const fs = require('fs');
let js = fs.readFileSync('app_final.js', 'utf8');

js = js.replace(/closeModal\('client-abstract-modal'\);\s*await loadData\(\);\s*alert\('[^']+'\);/g, 
`closeModal('client-abstract-modal');
            await loadData();
            if (typeof window.renderClientAbstracts === 'function') {
                window.renderClientAbstracts();
            }
            alert('تم الحفظ بنجاح');`);

fs.writeFileSync('app_final.js', js, 'utf8');
