add cancel button and delete pj button in batch context
This commit is contained in:
parent
dc46430c40
commit
92bc95014a
4 changed files with 19 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
- if opt[:operation] == 'accepter'
|
- if opt[:operation] == 'accepter'
|
||||||
.dropdown{ data: { controller: 'menu-button', popover: 'true', operation: opt[:operation] } }
|
.dropdown{ data: { controller: 'menu-button', popover: 'true', operation: opt[:operation] }, id: 'dropdown_batch' }
|
||||||
-# Dropdown button title
|
-# Dropdown button title
|
||||||
%button{ disabled: true, class: ['fr-btn fr-btn--sm fr-btn--icon-left fr-ml-1w', icons[opt[:operation].to_sym]], disabled: true, name: "#{form.object_name}[operation]" , data: { menu_button_target: 'button' } }
|
%button{ disabled: true, class: ['fr-btn fr-btn--sm fr-btn--icon-left fr-ml-1w', icons[opt[:operation].to_sym]], disabled: true, name: "#{form.object_name}[operation]" , data: { menu_button_target: 'button' } }
|
||||||
= opt[:label]
|
= opt[:label]
|
||||||
|
@ -17,12 +17,15 @@
|
||||||
.motivation.accept
|
.motivation.accept
|
||||||
= form.text_area :motivation, class: 'fr-input'
|
= form.text_area :motivation, class: 'fr-input'
|
||||||
#justificatif_motivation_suggest_accept.optional-justificatif
|
#justificatif_motivation_suggest_accept.optional-justificatif
|
||||||
%button.button{ type: 'button', onclick: "DS.showImportJustificatif('accept');" } Ajouter un justificatif (optionnel)
|
%button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-attachment-line.fr-ml-0{ type: 'button', onclick: "DS.showImportJustificatif('accept');" } Ajouter un justificatif (optionnel)
|
||||||
#justificatif_motivation_import_accept.hidden
|
#justificatif_motivation_import_accept.hidden
|
||||||
= form.file_field :justificatif_motivation, direct_upload: true
|
= form.file_field :justificatif_motivation, direct_upload: true, id: "dossier_justificatif_motivation_accept", onchange: "DS.showDeleteJustificatif('accept');"
|
||||||
|
|
||||||
|
.hidden{ id: "delete_motivation_import_accept" }
|
||||||
|
%button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-delete-line.fr-ml-0.fr-mt-1w.js_delete_motivation{ type: 'button', onclick: "DS.deleteJustificatif('accept');"} Supprimer le justificatif
|
||||||
|
|
||||||
= form.button "Valider la décision", class: ['fr-btn fr-mt-2w'], disabled: true, name: "#{form.object_name}[operation]", value: opt[:operation]
|
= button_tag "Annuler", type: :reset, class: 'fr-btn fr-btn--sm fr-btn--secondary', onclick: 'DS.motivationCancelBatch();'
|
||||||
|
= form.button "Valider la décision", class: ['fr-btn fr-btn--sm fr-mt-2w'], disabled: true, name: "#{form.object_name}[operation]", value: opt[:operation]
|
||||||
|
|
||||||
- else
|
- else
|
||||||
= form.button opt[:label], class: ['fr-btn fr-btn--sm fr-btn--icon-left fr-ml-1w', icons[opt[:operation].to_sym]], disabled: true, name: "#{form.object_name}[operation]", value: opt[:operation], data: { operation: opt[:operation] }
|
= form.button opt[:label], class: ['fr-btn fr-btn--sm fr-btn--icon-left fr-ml-1w', icons[opt[:operation].to_sym]], disabled: true, name: "#{form.object_name}[operation]", value: opt[:operation], data: { operation: opt[:operation] }
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
motivationCancel,
|
motivationCancel,
|
||||||
showImportJustificatif,
|
showImportJustificatif,
|
||||||
showDeleteJustificatif,
|
showDeleteJustificatif,
|
||||||
|
motivationCancelBatch,
|
||||||
deleteJustificatif
|
deleteJustificatif
|
||||||
} from '../new_design/instruction-button';
|
} from '../new_design/instruction-button';
|
||||||
import { showFusion, showNewAccount } from '../new_design/fc-fusion';
|
import { showFusion, showNewAccount } from '../new_design/fc-fusion';
|
||||||
|
@ -34,6 +35,7 @@ const DS = {
|
||||||
motivationCancel,
|
motivationCancel,
|
||||||
showImportJustificatif,
|
showImportJustificatif,
|
||||||
showDeleteJustificatif,
|
showDeleteJustificatif,
|
||||||
|
motivationCancelBatch,
|
||||||
deleteJustificatif,
|
deleteJustificatif,
|
||||||
showFusion,
|
showFusion,
|
||||||
showNewAccount
|
showNewAccount
|
||||||
|
|
|
@ -17,6 +17,13 @@ export function motivationCancel() {
|
||||||
.forEach((el) => hide(el.parentElement));
|
.forEach((el) => hide(el.parentElement));
|
||||||
|
|
||||||
show(document.querySelector('.dropdown-items'));
|
show(document.querySelector('.dropdown-items'));
|
||||||
|
|
||||||
|
document.querySelectorAll('.js_delete_motivation').forEach(hide);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function motivationCancelBatch() {
|
||||||
|
document.querySelector('#dropdown_batch' ).classList.remove("open");;
|
||||||
|
hide(document.querySelector('.js_delete_motivation'));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showDeleteJustificatif(name) {
|
export function showDeleteJustificatif(name) {
|
||||||
|
|
|
@ -28,12 +28,11 @@
|
||||||
- else
|
- else
|
||||||
= text_area :dossier, :motivation, class: 'fr-input', placeholder: placeholder, required: true
|
= text_area :dossier, :motivation, class: 'fr-input', placeholder: placeholder, required: true
|
||||||
.optional-justificatif{ id: "justificatif_motivation_suggest_#{popup_class}", onclick: "DS.showImportJustificatif('#{popup_class}');" }
|
.optional-justificatif{ id: "justificatif_motivation_suggest_#{popup_class}", onclick: "DS.showImportJustificatif('#{popup_class}');" }
|
||||||
.fr-btn.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-attachment-line.fr-ml-0 Ajouter un justificatif (optionnel)
|
%button.fr-btn.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-attachment-line.fr-ml-0{ type: 'button', onclick: "DS.showImportJustificatif('accept');" } Ajouter un justificatif (optionnel)
|
||||||
.hidden{ id: "justificatif_motivation_import_#{popup_class}" }
|
.hidden{ id: "justificatif_motivation_import_#{popup_class}" }
|
||||||
= file_field :dossier, :justificatif_motivation, direct_upload: true, id: "dossier_justificatif_motivation_#{popup_class}",onchange: "DS.showDeleteJustificatif('#{popup_class}');"
|
= file_field :dossier, :justificatif_motivation, direct_upload: true, id: "dossier_justificatif_motivation_#{popup_class}",onchange: "DS.showDeleteJustificatif('#{popup_class}');"
|
||||||
|
|
||||||
.hidden{ id: "delete_motivation_import_#{popup_class}" }
|
.hidden{ id: "delete_motivation_import_#{popup_class}" }
|
||||||
.fr-btn.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-delete-line.fr-ml-0{ onclick: "DS.deleteJustificatif('#{popup_class}');"} Supprimer le justificatif
|
%button.fr-btn.fr-btn--tertiary-no-outline.fr-btn--icon-left.fr-icon-delete-line.fr-ml-0.fr-mt-1w.js_delete_motivation{ type: 'button', onclick: "DS.deleteJustificatif('#{popup_class}');"} Supprimer le justificatif
|
||||||
.text-right.fr-mt-2w
|
.fr-mt-2w
|
||||||
= button_tag "Annuler", type: :reset, class: 'fr-btn fr-btn--secondary', onclick: 'DS.motivationCancel();'
|
= button_tag "Annuler", type: :reset, class: 'fr-btn fr-btn--secondary', onclick: 'DS.motivationCancel();'
|
||||||
= button_tag 'Valider la décision', name: :process_action, value: process_action, class: 'fr-btn fr-mr-0', title: title
|
= button_tag 'Valider la décision', name: :process_action, value: process_action, class: 'fr-btn fr-mr-0', title: title
|
||||||
|
|
Loading…
Reference in a new issue