feat: Enhance email functionality and PDF generation for Sales Orders

- Enabled SMTP debugging in PHPMailer for better error tracking.
- Added a "Test send email" link in the Inventory Detail View for quick email testing.
- Implemented automatic PDF generation and email sending upon Sales Order creation.
- Created a new action for sending Sales Order emails with attached PDFs.
- Added a new AJAX action for testing outgoing email server configurations.
- Updated outgoing server settings to use new SMTP credentials.
- Improved email templates for better user experience.
- Added test scripts for validating PDF generation and email sending.
This commit is contained in:
BACHIR SOULDI
2026-02-17 15:59:31 +01:00
parent 2794e62571
commit 2a647b138a
46 changed files with 25100 additions and 1296 deletions

View File

@@ -1932,11 +1932,33 @@ function box(data) {
success: function (data) {
//console.log(data);
let cleanData = data.trim();
data = data.replace('{', '{');
data = data.replace('{', '{');
console.log(data);
var dataResult = JSON.parse(data);
// Remove anything starting from the first <script> tag (and everything after)
const scriptIndex = cleanData.indexOf('<script>');
if (scriptIndex !== -1) {
cleanData = cleanData.substring(0, scriptIndex);
}
// Optional: remove BOM characters if present
cleanData = cleanData.replace(/^\uFEFF/, '');
// Now you can safely parse
let dataResult;
try {
dataResult = JSON.parse(cleanData);
console.log("✅ Parsed JSON:", dataResult);
} catch (e) {
console.error("❌ Invalid JSON:", cleanData);
console.error(e);
}
// var dataResult = JSON.parse(data);
box(dataResult);
@@ -2036,6 +2058,34 @@ $(document).ready(function() {
LoadALLDashBoard();
// const menuButton = document.querySelector('.app-navigator .app-icon');
// menuButton.addEventListener('click', toggleSidebar);
// function toggleSidebar() {
// console.log('clicked');
// const mainContainer = document.querySelector('.main-container');
// const sidebar = document.querySelector('.vertical-menu');
// const tabContainerD = document.querySelector('.tabContainer');
// const dashboard = document.querySelector('.dashboard');
// const isOpen = sidebar.classList.contains('open');
// if (isOpen) {
// sidebar.classList.remove('open');
// sidebar.style.width = '0px';
// if (mainContainer) mainContainer.style.marginLeft = '0px';
// if (tabContainerD) tabContainerD.style.marginLeft = '0px';
// if (dashboard) dashboard.style.marginLeft = '0px';
// } else {
// sidebar.classList.add('open');
// sidebar.style.width = '250px';
// if (mainContainer) mainContainer.style.marginLeft = '250px';
// if (tabContainerD) tabContainerD.style.marginLeft = '250px';
// if (dashboard) dashboard.style.marginLeft = '250px';
// }
// }
}
catch(err) {