2025-03-03 17:50:11 -03:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block title %}Esquemas - ARCH{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="container my-5">
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
|
|
<h1>Esquemas de Proyecto</h1>
|
|
|
|
{% if current_user.has_permission(9000) %}
|
|
|
|
<a href="{{ url_for('schemas.create') }}" class="btn btn-primary">
|
|
|
|
<i class="fas fa-plus"></i> Nuevo Esquema
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
{% if schemas %}
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-striped table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Código</th>
|
|
|
|
<th>Descripción</th>
|
|
|
|
<th>Tipos de documentos</th>
|
|
|
|
<th>Fecha de creación</th>
|
|
|
|
<th>Acciones</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for schema_id, schema in schemas.items() %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ schema.codigo }}</td>
|
|
|
|
<td>{{ schema.descripcion }}</td>
|
|
|
|
<td>{{ schema.documentos|length }}</td>
|
|
|
|
<td>{{ schema.fecha_creacion|default('-') }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="btn-group btn-group-sm" role="group">
|
|
|
|
<a href="{{ url_for('schemas.view', schema_id=schema_id) }}"
|
|
|
|
class="btn btn-outline-primary" title="Ver detalles">
|
|
|
|
<i class="fas fa-eye"></i>
|
|
|
|
</a>
|
|
|
|
{% if current_user.has_permission(9000) %}
|
|
|
|
<a href="{{ url_for('schemas.edit', schema_id=schema_id) }}"
|
|
|
|
class="btn btn-outline-secondary" title="Editar">
|
|
|
|
<i class="fas fa-edit"></i>
|
|
|
|
</a>
|
|
|
|
<button type="button" class="btn btn-outline-danger"
|
|
|
|
onclick="confirmDeleteSchema('{{ schema_id }}', '{{ schema.descripcion }}')"
|
|
|
|
title="Eliminar">
|
|
|
|
<i class="fas fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="alert alert-info mb-0">
|
|
|
|
No hay esquemas definidos. {% if current_user.has_permission(9000) %}
|
|
|
|
<a href="{{ url_for('schemas.create') }}">Crear el primer esquema</a>.
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if current_user.has_permission(9000) %}
|
|
|
|
<!-- Modal de confirmación para eliminar esquema -->
|
|
|
|
<div class="modal fade" id="deleteSchemaModal" tabindex="-1" aria-labelledby="deleteSchemaModalLabel" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h5 class="modal-title" id="deleteSchemaModalLabel">Confirmar Eliminación</h5>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p>¿Está seguro que desea eliminar el esquema <strong id="schemaDescription"></strong>?</p>
|
|
|
|
<p class="text-danger">Esta acción no se puede deshacer y podría afectar a proyectos existentes.</p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
|
|
|
<form id="deleteSchemaForm" method="POST" action="">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<button type="submit" class="btn btn-danger">Eliminar</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function confirmDeleteSchema(schemaId, schemaDesc) {
|
|
|
|
document.getElementById('schemaDescription').textContent = schemaDesc;
|
|
|
|
document.getElementById('deleteSchemaForm').action = "{{ url_for('schemas.delete', schema_id='') }}" + schemaId;
|
|
|
|
|
|
|
|
var deleteModal = new bootstrap.Modal(document.getElementById('deleteSchemaModal'));
|
|
|
|
deleteModal.show();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|