diff --git a/src/open_inwoner/js/components/cases/index.js b/src/open_inwoner/js/components/cases/index.js new file mode 100644 index 0000000000..967811e34d --- /dev/null +++ b/src/open_inwoner/js/components/cases/index.js @@ -0,0 +1,16 @@ +class DisableSubmitButton { + constructor(form) { + this.form = form + this.form.addEventListener('submit', this.disableButton.bind(this)) + } + + disableButton() { + const submitButton = this.form.querySelector('button[type="submit"]') + submitButton.setAttribute('disabled', 'true') + } +} + +const caseDocumentForms = document.querySelectorAll('#document-upload') +;[...caseDocumentForms].forEach( + (caseDocumentForm) => new DisableSubmitButton(caseDocumentForm) +) diff --git a/src/open_inwoner/js/components/index.js b/src/open_inwoner/js/components/index.js index fa7a189e71..833ac6a9cd 100644 --- a/src/open_inwoner/js/components/index.js +++ b/src/open_inwoner/js/components/index.js @@ -6,6 +6,7 @@ import './anchor-menu' import './autocomplete-search' import './autocomplete' import './autosumbit' +import './cases' import './confirmation' import './contacts' import './datepicker' diff --git a/src/open_inwoner/scss/components/Cases/Cases.scss b/src/open_inwoner/scss/components/Cases/Cases.scss index 33c707df16..08acb5d0ce 100644 --- a/src/open_inwoner/scss/components/Cases/Cases.scss +++ b/src/open_inwoner/scss/components/Cases/Cases.scss @@ -8,3 +8,10 @@ } } } + +#document-upload .button[type='submit']:disabled { + border-color: var(--color-gray) !important; + color: var(--color-gray-light); + pointer-events: none; + cursor: default; +}