diff --git a/app/controllers/account_configs_controller.rb b/app/controllers/account_configs_controller.rb index 82f90393..1130feef 100644 --- a/app/controllers/account_configs_controller.rb +++ b/app/controllers/account_configs_controller.rb @@ -8,6 +8,7 @@ class AccountConfigsController < ApplicationController AccountConfig::ALLOW_TYPED_SIGNATURE, AccountConfig::FORCE_MFA, AccountConfig::ALLOW_TO_RESUBMIT, + AccountConfig::ALLOW_TO_DECLINE_KEY, AccountConfig::FORM_PREFILL_SIGNATURE_KEY, AccountConfig::ESIGNING_PREFERENCE_KEY, AccountConfig::FORM_WITH_CONFETTI_KEY, diff --git a/app/models/account_config.rb b/app/models/account_config.rb index 29b90000..1e7e2d61 100644 --- a/app/models/account_config.rb +++ b/app/models/account_config.rb @@ -28,6 +28,7 @@ class AccountConfig < ApplicationRecord FORCE_MFA = 'force_mfa' ALLOW_TYPED_SIGNATURE = 'allow_typed_signature' ALLOW_TO_RESUBMIT = 'allow_to_resubmit' + ALLOW_TO_DECLINE_KEY = 'allow_to_decline' SUBMITTER_REMINDERS = 'submitter_reminders' FORM_COMPLETED_BUTTON_KEY = 'form_completed_button' FORM_COMPLETED_MESSAGE_KEY = 'form_completed_message' diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index 2ea9a167..b4b63db0 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -103,6 +103,18 @@ <% end %> <% end %> + <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::ALLOW_TO_DECLINE_KEY) %> + <% if can?(:manage, account_config) %> + <%= form_for account_config, url: account_configs_path, method: :post do |f| %> + <%= f.hidden_field :key %> +
+ + <%= t('allow_to_decline_documents') %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> +
+ <% end %> + <% end %> <% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FORM_PREFILL_SIGNATURE_KEY) %> <% if can?(:manage, account_config) %> <%= form_for account_config, url: account_configs_path, method: :post do |f| %> diff --git a/app/views/submit_form/show.html.erb b/app/views/submit_form/show.html.erb index e69c7445..4b072b29 100644 --- a/app/views/submit_form/show.html.erb +++ b/app/views/submit_form/show.html.erb @@ -15,11 +15,13 @@ <%= @submitter.submission.template.name %>
-
- <%= render 'shared/html_modal', title: t(:decline), btn_text: t(:decline), btn_class: 'btn btn-sm !px-5', button_id: 'decline_button' do %> - <%= render 'submit_form/decline_form', submitter: @submitter %> - <% end %> -
+ <% if @form_configs[:with_decline] %> +
+ <%= render 'shared/html_modal', title: t(:decline), btn_text: t(:decline), btn_class: 'btn btn-sm !px-5', button_id: 'decline_button' do %> + <%= render 'submit_form/decline_form', submitter: @submitter %> + <% end %> +
+ <% end %> <%= svg_icon('download', class: 'w-6 h-6 inline md:hidden') %> diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 1cf346cf..36a27291 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -134,6 +134,7 @@ en: &en require_signing_reason: Require signing reason allow_typed_text_signatures: Allow typed text signatures allow_to_resubmit_completed_forms: Allow to resubmit completed forms + allow_to_decline_documents: Allow to decline documents remember_and_pre_fill_signatures: Remember and pre-fill signatures require_authentication_for_file_download_links: Require authentication for file download links combine_completed_documents_and_audit_log: Combine completed documents and Audit Log @@ -770,6 +771,7 @@ es: &es require_signing_reason: Requerir motivo de firma allow_typed_text_signatures: Permitir firmas de texto mecanografiadas allow_to_resubmit_completed_forms: Permitir reenviar formularios completados + allow_to_decline_documents: Permitir rechazar documentos remember_and_pre_fill_signatures: Recordar y prellenar firmas require_authentication_for_file_download_links: Requerir autenticación para enlaces de descarga de archivos combine_completed_documents_and_audit_log: Combinar documentos completados y Registro de Auditoría @@ -1406,6 +1408,7 @@ it: &it require_signing_reason: Richiedere il motivo della firma allow_typed_text_signatures: Permettere firme con testo digitato allow_to_resubmit_completed_forms: Permettere di reinviare i moduli completati + allow_to_decline_documents: Permettere di rifiutare i documenti remember_and_pre_fill_signatures: Ricordare e precompilare le firme require_authentication_for_file_download_links: "Richiedere l'autenticazione per i link di download dei file" combine_completed_documents_and_audit_log: Combinare i documenti completati e il Registro di Audit @@ -2043,6 +2046,7 @@ fr: &fr require_signing_reason: Demander une raison pour la signature allow_typed_text_signatures: Autoriser les signatures en texte tapé allow_to_resubmit_completed_forms: Autoriser la resoumission des formulaires complétés + allow_to_decline_documents: Autoriser le refus des documents remember_and_pre_fill_signatures: Se souvenir et préremplir les signatures require_authentication_for_file_download_links: Exiger une authentification pour les liens de téléchargement des fichiers combine_completed_documents_and_audit_log: "Combiner les documents complétés et le journal d'audit" @@ -2679,6 +2683,7 @@ pt: &pt require_signing_reason: Requerer motivo para assinatura allow_typed_text_signatures: Permitir assinaturas digitadas allow_to_resubmit_completed_forms: Permitir reenviar formulários concluídos + allow_to_decline_documents: Permitir recusar documentos remember_and_pre_fill_signatures: Lembrar e preencher assinaturas automaticamente require_authentication_for_file_download_links: Requerer autenticação para links de download de arquivos combine_completed_documents_and_audit_log: Combinar documentos concluídos e log de auditoria @@ -3315,6 +3320,7 @@ de: &de require_signing_reason: Grund für die Signatur erforderlich allow_typed_text_signatures: Unterschriften mit getipptem Text zulassen allow_to_resubmit_completed_forms: Erneutes Einreichen abgeschlossener Formulare zulassen + allow_to_decline_documents: Erlauben, Dokumente abzulehnen remember_and_pre_fill_signatures: Signaturen merken und vorab ausfüllen require_authentication_for_file_download_links: Authentifizierung für Dateidownload-Links erforderlich combine_completed_documents_and_audit_log: Abgeschlossene Dokumente und Prüfprotokoll kombinieren diff --git a/lib/submitters/form_configs.rb b/lib/submitters/form_configs.rb index 6aba2594..2d1ec0ee 100644 --- a/lib/submitters/form_configs.rb +++ b/lib/submitters/form_configs.rb @@ -7,6 +7,7 @@ module Submitters AccountConfig::FORM_WITH_CONFETTI_KEY, AccountConfig::FORM_PREFILL_SIGNATURE_KEY, AccountConfig::WITH_SIGNATURE_ID, + AccountConfig::ALLOW_TO_DECLINE_KEY, AccountConfig::REQUIRE_SIGNING_REASON_KEY, AccountConfig::REUSE_SIGNATURE_KEY, AccountConfig::ALLOW_TYPED_SIGNATURE].freeze @@ -22,6 +23,7 @@ module Submitters with_confetti = find_safe_value(configs, AccountConfig::FORM_WITH_CONFETTI_KEY) != false prefill_signature = find_safe_value(configs, AccountConfig::FORM_PREFILL_SIGNATURE_KEY) != false reuse_signature = find_safe_value(configs, AccountConfig::REUSE_SIGNATURE_KEY) != false + with_decline = find_safe_value(configs, AccountConfig::ALLOW_TO_DECLINE_KEY) != false with_signature_id = find_safe_value(configs, AccountConfig::WITH_SIGNATURE_ID) == true require_signing_reason = find_safe_value(configs, AccountConfig::REQUIRE_SIGNING_REASON_KEY) == true @@ -30,6 +32,7 @@ module Submitters with_typed_signature:, with_confetti:, reuse_signature:, + with_decline:, completed_message:, require_signing_reason:, prefill_signature:,