diff --git a/public.php b/public.php
index 218288aa..0d110a66 100755
--- a/public.php
+++ b/public.php
@@ -2638,6 +2638,69 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
}
renderTable();
+ function escapeHtml(str) {
+ if (!str) return '';
+ return String(str)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
+ }
+
+ function populateInstallerJobsSelect() {
+ const select = document.getElementById('installerJobsSelect');
+ if (!select) return;
+
+ let installerList = Array.isArray(store.installers) ? [...store.installers] : [];
+ const installerIds = installerList.map(i => String(i.id));
+
+ if (Array.isArray(store.admins)) {
+ store.admins.forEach(admin => {
+ if (!installerIds.includes(String(admin.id))) {
+ installerList.push({
+ id: admin.id,
+ nombre: admin.nombre,
+ whatsapp: ''
+ });
+ }
+ });
+ }
+
+ const currentVal = select.value;
+ select.innerHTML = '' +
+ installerList.map(inst => {
+ const phoneInfo = inst.whatsapp ? ` (${inst.whatsapp})` : '';
+ return ``;
+ }).join('');
+
+ if (currentVal) select.value = currentVal;
+ }
+
+ window.onInstallerSelectChange = function(installerId) {
+ if (!installerId) {
+ document.getElementById('jobsEmptyState').style.display = 'block';
+ document.getElementById('jobsLoading').style.display = 'none';
+ document.getElementById('jobsTableWrapper').style.display = 'none';
+ document.getElementById('jobsNoResults').style.display = 'none';
+ return;
+ }
+ let installer = (store.installers || []).find(i => String(i.id) === String(installerId));
+ if (!installer && Array.isArray(store.admins)) {
+ const adminObj = store.admins.find(a => String(a.id) === String(installerId));
+ if (adminObj) installer = { id: adminObj.id, nombre: adminObj.nombre };
+ }
+ const installerName = installer ? installer.nombre : `ID ${installerId}`;
+ loadInstallerJobs(installerId, installerName);
+ };
+
+ window.openInstallerJobsFromCrud = function(installerId, installerName) {
+ switchTab('installer-jobs');
+ const select = document.getElementById('installerJobsSelect');
+ if (select) select.value = installerId;
+ loadInstallerJobs(installerId, installerName);
+ };
+
window.editInstaller = function(index) {
const installer = store.installers[index];