From e34403d3e4fef58fbf5216ccfedad7eae60cd23a Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 21:34:38 +0200 Subject: [PATCH] Add confirmation popup for declaration submission - Add confirmSubmission() JavaScript function with modal dialog - Include warning about irreversible accounting entry creation - Add French language strings for confirmation dialog - Ensure user gets proper confirmation before submission starts --- declarationtva_view.php | 58 ++++++++++++++++++++++++++++++++- langs/fr_FR/declarationtva.lang | 3 ++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/declarationtva_view.php b/declarationtva_view.php index 5b4eb2b..e44578a 100644 --- a/declarationtva_view.php +++ b/declarationtva_view.php @@ -446,7 +446,7 @@ if ($declarationtva->status == 'draft') { // Validation button with confirmation dialog print '' . $langs->trans("Validate") . ' '; } elseif ($declarationtva->status == 'validated') { - print '' . $langs->trans("Submit") . ' '; + print '' . $langs->trans("Submit") . ' '; // Add unvalidate button for testing print '' . $langs->trans("Unvalidate") . ' '; } @@ -621,6 +621,62 @@ function proceedValidation(declarationId) { window.location.href = "' . $_SERVER['PHP_SELF'] . '?id=" + declarationId + "&action=validate&token=' . newToken() . '"; } +function confirmSubmission(declarationId) { + // Create a proper Dolibarr-style modal dialog for submission + var dialog = document.createElement("div"); + dialog.id = "submissionModal"; + dialog.style.cssText = "position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 10000; display: flex; align-items: center; justify-content: center; font-family: Arial, sans-serif;"; + + var dialogContent = document.createElement("div"); + dialogContent.style.cssText = "background: white; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); max-width: 500px; width: 90%; max-height: 90%; overflow: hidden;"; + + // Header + var header = document.createElement("div"); + header.style.cssText = "background: #f8f9fa; padding: 20px; border-bottom: 1px solid #dee2e6; display: flex; align-items: center;"; + header.innerHTML = ` +
+

' . $langs->trans("ConfirmSubmission") . '

+
+ + `; + + // Body + var body = document.createElement("div"); + body.style.cssText = "padding: 20px;"; + body.innerHTML = ` +

' . $langs->trans("ConfirmSubmissionMessage") . '

+
+

' . $langs->trans("SubmissionWarning") . '

+
+ `; + + // Footer + var footer = document.createElement("div"); + footer.style.cssText = "background: #f8f9fa; padding: 15px 20px; border-top: 1px solid #dee2e6; display: flex; justify-content: flex-end; gap: 10px;"; + footer.innerHTML = ` + + + `; + + dialogContent.appendChild(header); + dialogContent.appendChild(body); + dialogContent.appendChild(footer); + dialog.appendChild(dialogContent); + document.body.appendChild(dialog); +} + +function closeSubmissionModal() { + var modal = document.getElementById("submissionModal"); + if (modal) { + modal.remove(); + } +} + +function proceedSubmission(declarationId) { + // Redirect to submission action + window.location.href = "' . $_SERVER['PHP_SELF'] . '?id=" + declarationId + "&action=submit&token=' . newToken() . '"; +} + function confirmUnvalidation(declarationId) { // Create a proper Dolibarr-style modal dialog for unvalidation var dialog = document.createElement("div"); diff --git a/langs/fr_FR/declarationtva.lang b/langs/fr_FR/declarationtva.lang index 77ea8ed..cadeb98 100644 --- a/langs/fr_FR/declarationtva.lang +++ b/langs/fr_FR/declarationtva.lang @@ -539,3 +539,6 @@ VATRefundThresholdConfigurationUpdateFailed = Erreur lors de la mise à jour de DeclarationSubmitted = Déclaration soumise avec succès ErrorSubmittingDeclaration = Erreur lors de la soumission de la déclaration Submit = Soumettre +ConfirmSubmission = Confirmer la soumission +ConfirmSubmissionMessage = Êtes-vous sûr de vouloir soumettre cette déclaration ? Cette action créera les écritures comptables et marquera la déclaration comme soumise. +SubmissionWarning = Attention : Cette action est irréversible. Les écritures comptables seront créées automatiquement.