preparando el imprimir

This commit is contained in:
2025-10-12 21:42:04 +02:00
parent 6641c1f077
commit 26c2ca543a
41 changed files with 1325 additions and 208 deletions

View File

@ -1,10 +1,15 @@
<!-- templates/fragments/common.html -->
<div th:fragment="buttons(appMode)"
th:if="${appMode == 'add' or appMode == 'edit'}"
class="order-3 order-md-2 mx-md-auto d-flex">
<button id="btn-guardar" type="button"
<button th:if="${appMode == 'add' or appMode == 'edit'}" id="btn-guardar" type="button"
class="btn btn-success d-flex align-items-center guardar-presupuesto">
<i class="ri-save-3-line me-2"></i>
<span th:text="#{presupuesto.guardar}">Guardar</span>
</button>
<button id="btn-imprimir" type="button"
class="btn btn-primary d-flex align-items-center imprimir-presupuesto">
<i class="ri-printer-line me-2"></i>
<span th:text="#{app.imprimir}">Imprimir</span>
</button>
</div>

View File

@ -55,19 +55,15 @@
<div th:replace="~{imprimelibros/presupuestos/presupuestador-items/_buttons :: buttons(${appMode})}"></div>
<div th:unless="${#authorization.expression('isAuthenticated()')}">
<button id="btn-add-cart" type="button"
class="btn btn-secondary d-flex align-items-center order-2 order-md-3">
<i class="mdi mdi-login label-icon align-middle fs-16 me-2"></i>
<span th:text="#{presupuesto.resumen.inicie-sesion}">Inicie sesión para continuar</span>
</button>
</div>
<div th:if="${#authorization.expression('isAuthenticated()')}">
<button id="btn-add-cart" type="button"
class="btn btn-secondary d-flex align-items-center order-2 order-md-3">
<span th:text="#{presupuesto.resumen.agregar-cesta}">Agregar a la cesta</span>
<i class="ri-shopping-cart-2-line fs-16 ms-2"></i>
</button>
</div>
<button th:unless="${#authorization.expression('isAuthenticated()')}" id="btn-add-cart" type="button"
class="btn btn-secondary d-flex align-items-center order-2 order-md-3">
<i class="mdi mdi-login label-icon align-middle fs-16 me-2"></i>
<span th:text="#{presupuesto.resumen.inicie-sesion}">Inicie sesión para continuar</span>
</button>
<button th:if="${#authorization.expression('isAuthenticated()')}" id="btn-add-cart" type="button"
class="btn btn-secondary d-flex align-items-center order-2 order-md-3">
<span th:text="#{presupuesto.resumen.agregar-cesta}">Agregar a la cesta</span>
<i class="ri-shopping-cart-2-line fs-16 ms-2"></i>
</button>
</div>
</div>

View File

@ -15,6 +15,7 @@
<form action="#">
<input type="hidden" id="cliente_id" th:value="${cliente_id} ?: null" />
<input type="hidden" id="presupuesto_id" th:value="${presupuesto_id} ?: null" />
<div id="form-errors" class="alert alert-danger d-none" role="alert">
<i class="ri-error-warning-line label-icon"></i>

View File

@ -17,7 +17,7 @@
<div th:replace="~{imprimelibros/partials/topbar :: topbar}" />
<div th:replace="~{imprimelibros/partials/sidebar :: sidebar}"
th:unless="${#authorization.expression('isAuthenticated()') and (#authorization.expression('hasRole('SUPERADMIN', 'ADMIN')'))}" />
sec:authorize="isAuthenticated() and hasAnyRole('SUPERADMIN','ADMIN')">
<th:block layout:fragment="content">
<div th:if="${#authorization.expression('isAuthenticated()')}">

View File

@ -0,0 +1,68 @@
<div th:fragment="tabla-cliente-user">
<table id="presupuestos-clientes-user-datatable" class="table table-striped table-nowrap responsive w-100">
<thead>
<tr>
<th scope="col" th:text="#{presupuesto.tabla.id}">ID</th>
<th scope="col" th:text="#{presupuesto.tabla.titulo}">Título</th>
<th scope="col" th:text="#{presupuesto.tabla.encuadernacion}">Encuadernación</th>
<th scope="col" th:text="#{presupuesto.tabla.cubierta}">Cubierta</th>
<th scope="col" th:text="#{presupuesto.tabla.tipo-impresion}">Tipo de impresión</th>
<th scope="col" th:text="#{presupuesto.tabla.tirada}">Tirada</th>
<th scope="col" th:text="#{presupuesto.tabla.paginas}">Páginas</th>
<th scope="col" th:text="#{presupuesto.tabla.estado}">Estado</th>
<th scope="col" th:text="#{presupuesto.tabla.total-iva}">Total con IVA</th>
<th scope="col" th:text="#{presupuesto.tabla.updated-at}">Actualizado el</th>
<th scope="col" th:text="#{presupuesto.tabla.acciones}">Acciones</th>
</tr>
<tr>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="id" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="titulo" /></th>
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoEncuadernacion">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="fresado" th:text="#{presupuesto.fresado}">Fresado</option>
<option value="cosido" th:text="#{presupuesto.cosido}">Cosido</option>
<option value="espiral" th:text="#{presupuesto.espiral}">Espiral</option>
<option value="wireo" th:text="#{presupuesto.wireo}">Wireo</option>
<option value="grapado" th:text="#{presupuesto.grapado}">Grapado</option>
</select>
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoCubierta">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="tapaBlanda" th:text="#{presupuesto.tapa-blanda}">Tapa blanda</option>
<option value="tapaDura" th:text="#{presupuesto.tapa-dura}">Tapa dura</option>
<option value="tapaDuraLomoRedondo" th:text="#{presupuesto.tapa-dura-lomo-redondo}">Tapa dura
lomo redondo</option>
</select>
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoImpresion">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="negro" th:text="#{presupuesto.blanco-negro}">B/N</option>
<option value="negrohq" th:text="#{presupuesto.blanco-negro-premium}">B/N HQ</option>
<option value="color" th:text="#{presupuesto.color}">Color</option>
<option value="colorhq" th:text="#{presupuesto.color-premium}">Color HQ</option>
</select>
</th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="selectedTirada" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="paginas" />
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="estado">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="borrador" th:text="#{presupuesto.estado.borrador}">Borrador</option>
<option value="aceptado" th:text="#{presupuesto.estado.aceptado}">Aceptado</option>
<option value="modificado" th:text="#{presupuesto.estado.modificado}">Modificado</option>
</select>
</th>
<th></th> <!-- Total con IVA (sin filtro) -->
<th></th> <!-- Actualizado el (sin filtro) -->
<th></th> <!-- Acciones (sin filtro) -->
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

View File

@ -3,8 +3,8 @@
<thead>
<tr>
<th scope="col" th:text="#{presupuesto.tabla.id}">ID</th>
<th scope="col" th:text="#{presupuesto.tabla.titulo}">Título</th>
<th scope="col" th:text="#{presupuesto.tabla.cliente}">Cliente</th>
<th scope="col" th:text="#{presupuesto.tabla.titulo}">Título</th>
<th scope="col" th:text="#{presupuesto.tabla.encuadernacion}">Encuadernación</th>
<th scope="col" th:text="#{presupuesto.tabla.cubierta}">Cubierta</th>
<th scope="col" th:text="#{presupuesto.tabla.tipo-impresion}">Tipo de impresión</th>
@ -17,9 +17,8 @@
</tr>
<tr>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="id" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="user.fullName" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="titulo" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="user.fullName" />
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoEncuadernacion">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>

View File

@ -15,11 +15,13 @@
<div th:replace="~{imprimelibros/partials/topbar :: topbar}" />
<div th:replace="~{imprimelibros/partials/sidebar :: sidebar}"
th:unless="${#authorization.expression('isAuthenticated()') and (#authorization.expression('hasRole('SUPERADMIN', 'ADMIN')'))}" />
sec:authorize="isAuthenticated() and hasAnyRole('SUPERADMIN','ADMIN')">
<th:block layout:fragment="content">
<div th:if="${#authorization.expression('isAuthenticated()')}">
<input type="hidden" id="cliente_id" th:value="${#authentication.principal.id}" />
<div class="container-fluid">
<nav aria-label="breadcrumb">
@ -45,7 +47,8 @@
</button>
<ul class="nav nav-pills arrow-navtabs nav-secondary-outline bg-light mb-3" role="tablist">
<ul class="nav nav-pills arrow-navtabs nav-secondary-outline bg-light mb-3" role="tablist"
sec:authorize="isAuthenticated() and hasAnyRole('SUPERADMIN','ADMIN')">
<li class="nav-item" role="presentation">
<a class="nav-link active" data-bs-toggle="tab" href="#arrow-presupuestos-cliente" role="tab"
aria-selected="true">
@ -64,7 +67,7 @@
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content text-muted">
<div class="tab-content text-muted" sec:authorize="isAuthenticated() and hasAnyRole('SUPERADMIN','ADMIN')">
<div class="tab-pane active show" id="arrow-presupuestos-cliente" role="tabpanel">
<div
@ -79,6 +82,11 @@
</div>
</div>
<div th:if="${#authorization.expression('isAuthenticated() and hasRole(''USER'')')}"
th:insert="~{imprimelibros/presupuestos/presupuesto-list-items/tabla-cliente-user :: tabla-cliente-user}">
</div>
</div>
</div>
</th:block>
@ -100,7 +108,8 @@
<script th:src="@{/assets/libs/datatables/buttons.print.min.js}"></script>
<script th:src="@{/assets/libs/datatables/buttons.colVis.min.js}"></script>
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestos/list.js}"></script>
<script sec:authorize="isAuthenticated() and hasAnyRole('ADMIN', 'SUPERADMIN')" type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestos/list.js}"></script>
<script sec:authorize="isAuthenticated() and hasAnyRole('USER')" type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestos/list-user.js}"></script>
</th:block>
</body>