refactor: dividir módulo de instaladores en 2 módulos independientes (Catálogo de Instaladores CRUD y Tareas Activas)
This commit is contained in:
parent
a7aff82a81
commit
cb97d95cdf
63
public.php
63
public.php
@ -20,11 +20,20 @@ if (isset($_GET['action']) && $_GET['action'] === 'get_modules_list') {
|
|||||||
'key' => 'installers',
|
'key' => 'installers',
|
||||||
'title' => '🔧 Administrar Instaladores',
|
'title' => '🔧 Administrar Instaladores',
|
||||||
'sub' => 'SIIP WhatsApp Notifications',
|
'sub' => 'SIIP WhatsApp Notifications',
|
||||||
'description' => 'Gestiona los datos de los instaladores para el envío de notificaciones WhatsApp.',
|
'description' => 'Alta, edición y baja del catálogo de técnicos instaladores (CRUD).',
|
||||||
'image' => '?action=get_image&name=installers-management.png',
|
'image' => '?action=get_image&name=installers-management.png',
|
||||||
'tab' => 'installers',
|
'tab' => 'installers',
|
||||||
'plugin' => 'whatsapp'
|
'plugin' => 'whatsapp'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'key' => 'installer-jobs',
|
||||||
|
'title' => '📋 Tareas e Instalaciones Activas',
|
||||||
|
'sub' => 'SIIP WhatsApp Notifications',
|
||||||
|
'description' => 'Consulta de tareas en curso por técnico y reenvío de notificaciones WhatsApp.',
|
||||||
|
'image' => '?action=get_image&name=installers-management.png',
|
||||||
|
'tab' => 'installer-jobs',
|
||||||
|
'plugin' => 'whatsapp'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'key' => 'stripe',
|
'key' => 'stripe',
|
||||||
'title' => '💳 Pagos SPEI / Stripe',
|
'title' => '💳 Pagos SPEI / Stripe',
|
||||||
@ -1915,8 +1924,13 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
<div class="menu-container" id="mainDashboard">
|
<div class="menu-container" id="mainDashboard">
|
||||||
<div class="menu-item" onclick="showModule('installers')">
|
<div class="menu-item" onclick="showModule('installers')">
|
||||||
<img src="?action=image&file=instalador.png">
|
<img src="?action=image&file=instalador.png">
|
||||||
<h3>Administrar Instaladores y Servicios</h3>
|
<h3>Administrar Instaladores</h3>
|
||||||
<p>Administra los técnicos e instaladores registrados en el sistema y los servicios que realizan.</p>
|
<p>Administra los datos de contacto y registro de los instaladores técnicos (CRUD).</p>
|
||||||
|
</div>
|
||||||
|
<div class="menu-item" onclick="showModule('installer-jobs')">
|
||||||
|
<img src="?action=image&file=instalador.png">
|
||||||
|
<h3>Tareas e Instalaciones Activas</h3>
|
||||||
|
<p>Consulta las tareas en curso por técnico y reenvía notificaciones por WhatsApp.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-item" onclick="showModule('notifications')">
|
<div class="menu-item" onclick="showModule('notifications')">
|
||||||
<img src="?action=image&file=whatsapp-logo.png">
|
<img src="?action=image&file=whatsapp-logo.png">
|
||||||
@ -1942,6 +1956,9 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
<a href="#" class="tab active" data-tab="instaladores" onclick="switchTab('instaladores'); return false;">
|
<a href="#" class="tab active" data-tab="instaladores" onclick="switchTab('instaladores'); return false;">
|
||||||
<img src="?action=get_image&name=installers-management.png" style="width:24px;height:24px;vertical-align:middle;margin-right:8px;"> Administrar Instaladores
|
<img src="?action=get_image&name=installers-management.png" style="width:24px;height:24px;vertical-align:middle;margin-right:8px;"> Administrar Instaladores
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#" class="tab" data-tab="installer-jobs" onclick="switchTab('installer-jobs'); return false;">
|
||||||
|
<img src="?action=get_image&name=installers-management.png" style="width:24px;height:24px;vertical-align:middle;margin-right:8px;"> Tareas e Instalaciones Activas
|
||||||
|
</a>
|
||||||
<a href="#" class="tab" data-tab="notificaciones" onclick="switchTab('notificaciones'); return false;">
|
<a href="#" class="tab" data-tab="notificaciones" onclick="switchTab('notificaciones'); return false;">
|
||||||
<img src="?action=get_image&name=whatsapp-notification.png" style="width:24px;height:24px;vertical-align:middle;margin-right:8px;"> Reenviar Notificaciones de pago vía WhatsApp
|
<img src="?action=get_image&name=whatsapp-notification.png" style="width:24px;height:24px;vertical-align:middle;margin-right:8px;"> Reenviar Notificaciones de pago vía WhatsApp
|
||||||
</a>
|
</a>
|
||||||
@ -1953,18 +1970,16 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- MODULE 1: INSTALLERS -->
|
<!-- MODULE 1A: INSTALLERS CRUD -->
|
||||||
<section id="section-instaladores" class="section-view active">
|
<section id="section-instaladores" class="section-view active">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div style="margin-bottom: 2rem;">
|
<div style="margin-bottom: 2rem;">
|
||||||
<h2 style="margin: 0; display: flex; align-items: center; gap: 10px;">
|
<h2 style="margin: 0; display: flex; align-items: center; gap: 10px;">
|
||||||
<img src="?action=get_image&name=installers-management.png" style="width:64px;height:64px;"> Gestión de Instaladores
|
<img src="?action=get_image&name=installers-management.png" style="width:64px;height:64px;"> Gestión de Catálogo de Instaladores
|
||||||
</h2>
|
</h2>
|
||||||
<p style="color: var(--text-muted); margin: 5px 0 0 0;">👷 Administra tu equipo de técnicos y asigna instalaciones de manera eficiente</p>
|
<p style="color: var(--text-muted); margin: 5px 0 0 0;">👷 Administra tu equipo de técnicos instaladores y sus números de contacto</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- CONFIG CONTAINER -->
|
|
||||||
<!-- CONFIG CONTAINER -->
|
|
||||||
<div style="display: flex; justify-content: flex-end; margin-bottom: 2rem;">
|
<div style="display: flex; justify-content: flex-end; margin-bottom: 2rem;">
|
||||||
<button class="btn btn-primary" onclick="openInstallerModal()" style="height: 42px;">
|
<button class="btn btn-primary" onclick="openInstallerModal()" style="height: 42px;">
|
||||||
+ Nuevo Instalador
|
+ Nuevo Instalador
|
||||||
@ -1990,24 +2005,33 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
<p>No se encontraron instaladores</p>
|
<p>No se encontraron instaladores</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<!-- JOBS ACTIVOS DEL INSTALADOR -->
|
<!-- MODULE 1B: INSTALLER JOBS -->
|
||||||
<div class="card" style="margin-top: 2rem;">
|
<section id="section-installer-jobs" class="section-view">
|
||||||
|
<div class="card">
|
||||||
<div style="margin-bottom: 1.5rem;">
|
<div style="margin-bottom: 1.5rem;">
|
||||||
<h2 id="jobsSectionTitle" style="margin: 0; display: flex; align-items: center; gap: 10px;">
|
<h2 style="margin: 0; display: flex; align-items: center; gap: 10px;">
|
||||||
📋 Tareas Activas del Instalador
|
📋 Tareas e Instalaciones Activas por Técnico
|
||||||
</h2>
|
</h2>
|
||||||
<p style="color: var(--text-muted); margin: 5px 0 0 0;">Selecciona un instalador con el botón 📋 para ver sus tareas "En curso" y reenviar notificaciones</p>
|
<p style="color: var(--text-muted); margin: 5px 0 0 0;">Selecciona un técnico instalador para consultar sus tareas "En curso" y reenviar notificaciones por WhatsApp</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 1.5rem; max-width: 420px;">
|
||||||
|
<label for="installerJobsSelect" style="display: block; font-weight: 600; margin-bottom: 6px;">👷 Seleccionar Instalador:</label>
|
||||||
|
<select id="installerJobsSelect" onchange="onInstallerSelectChange(this.value)" style="width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); font-size: 0.95rem;">
|
||||||
|
<option value="">-- Selecciona un instalador --</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="jobsEmptyState" class="placeholder-state">
|
<div id="jobsEmptyState" class="placeholder-state">
|
||||||
<span class="placeholder-icon">👷</span>
|
<span class="placeholder-icon">👷</span>
|
||||||
<p>Selecciona un instalador para ver sus tareas activas</p>
|
<p>Selecciona un instalador arriba para ver sus tareas activas</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="jobsLoading" style="display: none; text-align: center; padding: 2rem; color: var(--text-muted);">
|
<div id="jobsLoading" style="display: none; text-align: center; padding: 2rem; color: var(--text-muted);">
|
||||||
<div class="loader" style="margin: 0 auto 1rem;"></div>
|
<div class="loader" style="margin: 0 auto 1rem;"></div>
|
||||||
<p>Cargando tareas...</p>
|
<p>Cargando tareas del instalador...</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="jobsTableWrapper" style="display: none; overflow-x: auto;">
|
<div id="jobsTableWrapper" style="display: none; overflow-x: auto;">
|
||||||
@ -2245,6 +2269,8 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
const moduleMap = {
|
const moduleMap = {
|
||||||
// Spanish IDs
|
// Spanish IDs
|
||||||
'instaladores': 'instaladores',
|
'instaladores': 'instaladores',
|
||||||
|
'installer-jobs': 'installer-jobs',
|
||||||
|
'tareas-instalador': 'installer-jobs',
|
||||||
'notificaciones': 'notificaciones',
|
'notificaciones': 'notificaciones',
|
||||||
'stripe': 'pagos-spei',
|
'stripe': 'pagos-spei',
|
||||||
'oxxo': 'pagos-oxxo',
|
'oxxo': 'pagos-oxxo',
|
||||||
@ -2594,15 +2620,16 @@ $installersData = json_decode($config['installersDataWhatsApp'] ?? '{"instalador
|
|||||||
function renderTable() {
|
function renderTable() {
|
||||||
const tbody = document.querySelector('#installersTable tbody');
|
const tbody = document.querySelector('#installersTable tbody');
|
||||||
tbody.innerHTML = store.installers.map((inst, i) => `<tr>
|
tbody.innerHTML = store.installers.map((inst, i) => `<tr>
|
||||||
<td>#${inst.id}</td>
|
<td>${inst.id}</td>
|
||||||
<td>${inst.nombre}</td>
|
<td><strong>${inst.nombre}</strong></td>
|
||||||
<td>${inst.whatsapp}</td>
|
<td>${inst.whatsapp}</td>
|
||||||
<td>
|
<td>
|
||||||
<span style="cursor:pointer; font-size:1.3em; margin-right:8px;" onclick="loadInstallerJobs('${inst.id}', '${inst.nombre}')" title="Ver tareas activas">📋</span>
|
<span style="cursor:pointer; font-size:1.3em; margin-right:8px;" onclick="openInstallerJobsFromCrud('${inst.id}', '${inst.nombre}')" title="Ver tareas activas">📋</span>
|
||||||
<img src="?action=image&file=edit.webp" class="icon-action" onclick="editInstaller(${i})" title="Editar">
|
<img src="?action=image&file=edit.webp" class="icon-action" onclick="editInstaller(${i})" title="Editar">
|
||||||
<img src="?action=image&file=delete.webp" class="icon-action" style="margin-left:10px" onclick="deleteInstaller(${i})" title="Borrar">
|
<img src="?action=image&file=delete.webp" class="icon-action" style="margin-left:10px" onclick="deleteInstaller(${i})" title="Borrar">
|
||||||
</td>
|
</td>
|
||||||
</tr>`).join('');
|
</tr>`).join('');
|
||||||
|
populateInstallerJobsSelect();
|
||||||
}
|
}
|
||||||
renderTable();
|
renderTable();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user