2021-09-07 10:37:42 +02:00
|
|
|
- has_edit_action = !dossier.read_only?
|
2019-03-26 17:55:40 +01:00
|
|
|
- has_delete_action = dossier.can_be_deleted_by_user?
|
2023-04-21 12:18:27 +02:00
|
|
|
- has_new_dossier_action = dossier.procedure.accepts_new_dossiers? || dossier.procedure.replaced_by_procedure?
|
2021-09-07 10:37:42 +02:00
|
|
|
- has_transfer_action = dossier.user == current_user
|
2021-12-07 15:38:37 +01:00
|
|
|
- has_actions = has_edit_action || has_delete_action || has_new_dossier_action || has_transfer_action
|
2019-03-26 17:55:40 +01:00
|
|
|
|
2023-01-06 14:26:59 +01:00
|
|
|
|
|
|
|
|
2019-03-26 17:55:40 +01:00
|
|
|
- if has_actions
|
2023-06-26 18:27:40 +02:00
|
|
|
- if has_edit_action
|
|
|
|
- if dossier.brouillon?
|
2024-07-24 12:33:01 +02:00
|
|
|
= link_to t('views.users.dossiers.dossier_action.edit_draft'), (url_for_dossier(dossier)), class: 'fr-btn fr-btn--sm fr-mr-1w fr-icon-draft-line fr-btn--icon-left'
|
2023-06-26 18:27:40 +02:00
|
|
|
|
|
|
|
- else
|
2024-07-24 12:33:01 +02:00
|
|
|
= link_to t('views.users.dossiers.dossier_action.edit_dossier'), modifier_dossier_path(dossier), class: 'fr-btn fr-btn--sm fr-mr-1w fr-icon-draft-line fr-btn--icon-left'
|
2021-11-24 10:35:34 +01:00
|
|
|
|
2024-07-24 12:33:01 +02:00
|
|
|
- if has_new_dossier_action
|
|
|
|
= link_to (commencer_url(dossier.procedure.path)), class: 'fr-btn fr-btn--sm fr-btn--tertiary fr-mr-1w fr-icon-file-fill fr-btn--icon-left' do
|
|
|
|
= t('views.users.dossiers.dossier_action.start_other_dossier')
|
2024-07-19 10:02:02 +02:00
|
|
|
|
2023-06-27 15:24:21 +02:00
|
|
|
= render Dropdown::MenuComponent.new(wrapper: :div, wrapper_options: {class: 'invite-user-actions'}, menu_options: {id: dom_id(dossier, :actions_menu)}, button_options: {class: 'fr-btn--sm fr-btn--tertiary'}) do |menu|
|
2023-06-26 18:27:40 +02:00
|
|
|
- menu.with_button_inner_html do
|
|
|
|
- if has_edit_action
|
|
|
|
= t('views.users.dossiers.dossier_action.other_actions')
|
2023-01-06 14:26:59 +01:00
|
|
|
- else
|
2023-06-26 18:27:40 +02:00
|
|
|
= t('views.users.dossiers.dossier_action.actions')
|
2023-01-06 14:26:59 +01:00
|
|
|
|
|
|
|
- if has_transfer_action
|
|
|
|
- menu.with_item do
|
|
|
|
= link_to(transferer_dossier_path(dossier), role: 'menuitem') do
|
2023-11-27 13:56:13 +01:00
|
|
|
= dsfr_icon('fr-icon-user-add-fill', :sm)
|
2023-01-06 14:26:59 +01:00
|
|
|
.dropdown-description
|
|
|
|
= t('views.users.dossiers.dossier_action.transfer_dossier')
|
|
|
|
|
|
|
|
- if has_new_dossier_action
|
|
|
|
- menu.with_item do
|
|
|
|
= link_to(clone_dossier_path(dossier), method: :post, role: 'menuitem') do
|
2023-11-27 14:51:39 +01:00
|
|
|
= dsfr_icon('fr-icon-file-copy-line', :sm)
|
2023-01-06 14:26:59 +01:00
|
|
|
.dropdown-description
|
|
|
|
= t('views.users.dossiers.dossier_action.clone')
|
|
|
|
|
|
|
|
- if has_delete_action
|
|
|
|
- menu.with_item(class: 'danger') do
|
2024-01-29 10:57:45 +01:00
|
|
|
- confirm = dossier.transfer.present? ? t("views.users.dossiers.dossier_action.delete_dossier_with_transfer_confirm", email: dossier.transfer.email) : t("views.users.dossiers.dossier_action.delete_dossier_confirm")
|
2024-01-24 15:22:29 +01:00
|
|
|
= link_to(dossier_path(dossier), role: 'menuitem', method: :delete, data: { disable: true, confirm: }) do
|
2023-11-27 17:06:29 +01:00
|
|
|
= dsfr_icon('fr-icon-delete-fill', :sm)
|
2023-01-06 14:26:59 +01:00
|
|
|
.dropdown-description
|
|
|
|
= t('views.users.dossiers.dossier_action.delete_dossier')
|