134 lines
5.8 KiB
HTML
134 lines
5.8 KiB
HTML
{% extends "macros/base.html" %}
|
|
{% from 'macros/modals.html' import confirm_modal, edit_worker_modal, add_worker_modal %}
|
|
{% from "macros/ui.html" import flashed_messages %}
|
|
|
|
{% block title %}Gestión de Trabajadores{% endblock %}
|
|
|
|
{% block content %}
|
|
{{ flashed_messages() }}
|
|
|
|
{{ edit_worker_modal(modulos, bancos) }}
|
|
{{ add_worker_modal(modulos, bancos) }}
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h2 class="mb-0">Gestión de Trabajadores</h2>
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addWorkerModal">
|
|
<i class="bi bi-plus-lg"></i> Agregar Trabajador
|
|
</button>
|
|
</div>
|
|
|
|
<div class="card mb-4 shadow-sm border-0">
|
|
<div class="card-body bg-body-tertiary rounded">
|
|
<div class="row g-3">
|
|
<div class="col-md-5">
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="bi bi-search"></i></span>
|
|
<input type="text" class="form-control" id="searchWorker" placeholder="Buscar por Nombre o RUT...">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<select class="form-select" id="filterModule">
|
|
<option value="all">Todos los Módulos</option>
|
|
{% for mod in modulos %}
|
|
<option value="{{ mod[0] }}">{{ mod[2] }} - {{ mod[1] }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<select class="form-select" id="filterType">
|
|
<option value="all">Todas las Jornadas</option>
|
|
<option value="Full Time">Full Time</option>
|
|
<option value="Part Time">Part Time</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-body p-0">
|
|
<table class="table table-striped table-hover mb-0">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>RUT</th>
|
|
<th>Nombre</th>
|
|
<th>Teléfono</th>
|
|
<th>Módulo</th>
|
|
<th>Tipo</th>
|
|
<th>Banco</th>
|
|
<th>N° Cuenta</th>
|
|
<th>RUT Cuenta</th>
|
|
<th>Tipo Cuenta</th>
|
|
<th class="text-end">Acciones</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for worker in workers %}
|
|
<tr class="worker-row" data-modulo="{{ worker[5] }}" data-tipo="{{ worker[6] }}">
|
|
<td class="align-middle">{{ worker[1] }}</td>
|
|
<td class="align-middle">{{ worker[2] }}</td>
|
|
<td class="align-middle">{{ worker[3] }}</td>
|
|
<td class="align-middle"><span class="badge bg-info text-dark">{{ worker[4] }}</span></td>
|
|
<td class="align-middle">
|
|
<span class="badge {% if worker[6] == 'Full Time' %}bg-success{% else %}bg-secondary{% endif %}">
|
|
{{ worker[6] }}
|
|
</span>
|
|
</td>
|
|
<td class="align-middle">{{ worker[7] or '-' }}</td>
|
|
<td class="align-middle">{{ worker[8] or '-' }}</td>
|
|
<td class="align-middle">{{ worker[10] or '-' }}</td>
|
|
<td class="align-middle">{{ worker[9] or '-' }}</td>
|
|
<td class="text-end">
|
|
<button type="button"
|
|
class="btn btn-primary btn-sm btn-edit-sm"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#editWorkerModal"
|
|
data-id="{{ worker[0] }}"
|
|
data-rut="{{ worker[1] }}"
|
|
data-name="{{ worker[2] }}"
|
|
data-phone="{{ worker[3] }}"
|
|
data-modulo="{{ worker[5] }}"
|
|
data-tipo="{{ worker[6] }}"
|
|
data-nombre-banco="{{ worker[7] }}"
|
|
data-numero-cuenta="{{ worker[8] }}"
|
|
data-tipo-cuenta="{{ worker[9] }}"
|
|
data-rut-banco="{{ worker[10] }}">
|
|
<i class="bi bi-pencil"></i>
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-danger btn-sm btn-del-sm" data-bs-toggle="modal" data-bs-target="#delWorker{{ worker[0] }}">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
|
|
{{ confirm_modal(
|
|
id='delWorker' ~ worker[0],
|
|
title='Eliminar Trabajador',
|
|
message='¿Eliminar a ' ~ worker[2] ~ '?',
|
|
action_url=url_for('admin.delete_worker', id=worker[0]),
|
|
btn_class='btn-danger'
|
|
) }}
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="10" class="text-center py-3 text-muted">No hay trabajadores registrados.</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
{{ confirm_modal(
|
|
id='confirmResetPass',
|
|
title='Restablecer Contraseña',
|
|
message='¿Estás seguro de generar una nueva contraseña? La anterior dejará de funcionar inmediatamente.',
|
|
action_url='#',
|
|
btn_class='btn-warning',
|
|
btn_text='Generar Nueva Clave'
|
|
) }}
|
|
{% endblock %}
|
|
{% block scripts %}
|
|
<script src="{{ url_for('static', filename='js/admin_workers.js') }}"></script>
|
|
{% endblock %}
|