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
This commit is contained in:
parent
abddcc1c30
commit
e34403d3e4
@ -446,7 +446,7 @@ if ($declarationtva->status == 'draft') {
|
||||
// Validation button with confirmation dialog
|
||||
print '<a href="#" onclick="confirmValidation(' . $id . '); return false;" class="butAction">' . $langs->trans("Validate") . '</a> ';
|
||||
} elseif ($declarationtva->status == 'validated') {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&action=submit" class="butAction">' . $langs->trans("Submit") . '</a> ';
|
||||
print '<a href="#" onclick="confirmSubmission(' . $id . '); return false;" class="butAction">' . $langs->trans("Submit") . '</a> ';
|
||||
// Add unvalidate button for testing
|
||||
print '<a href="#" onclick="confirmUnvalidation(' . $id . '); return false;" class="butAction" style="background-color: #dc3545;">' . $langs->trans("Unvalidate") . '</a> ';
|
||||
}
|
||||
@ -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 = `
|
||||
<div style="flex: 1;">
|
||||
<h3 style="margin: 0; color: #495057; font-size: 18px; font-weight: 600;">' . $langs->trans("ConfirmSubmission") . '</h3>
|
||||
</div>
|
||||
<button onclick="closeSubmissionModal()" style="background: none; border: none; font-size: 24px; color: #6c757d; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;">×</button>
|
||||
`;
|
||||
|
||||
// Body
|
||||
var body = document.createElement("div");
|
||||
body.style.cssText = "padding: 20px;";
|
||||
body.innerHTML = `
|
||||
<p style="margin: 0 0 15px 0; color: #495057; line-height: 1.5;">' . $langs->trans("ConfirmSubmissionMessage") . '</p>
|
||||
<div style="background: #fff3cd; border: 1px solid #ffeaa7; border-radius: 4px; padding: 12px; margin: 15px 0;">
|
||||
<p style="margin: 0; color: #856404; font-size: 14px;"><strong>' . $langs->trans("SubmissionWarning") . '</strong></p>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// 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 = `
|
||||
<button onclick="closeSubmissionModal()" style="background: #6c757d; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px;">' . $langs->trans("Cancel") . '</button>
|
||||
<button onclick="proceedSubmission(' . $id . ')" style="background: #28a745; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px;">' . $langs->trans("ConfirmSubmission") . '</button>
|
||||
`;
|
||||
|
||||
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");
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user