trabajando en la vista de peiddos

This commit is contained in:
2025-11-17 22:52:35 +01:00
parent 6ff5250d1b
commit 997741c3c9
17 changed files with 4119 additions and 34 deletions

View File

@ -27,6 +27,7 @@ pdf.datos-maquetacion=Datos de maquetación:
pdf.datos-marcapaginas=Datos de marcapáginas:
pdf.incluye-envio=El presupuesto incluye el envío a una dirección de la península.
pdf.presupuesto-validez=Validez del presupuesto: 30 días desde la fecha de emisión.
pdf.politica-privacidad=Política de privacidad
pdf.politica-privacidad.responsable=Responsable: Impresión Imprime Libros - CIF: B04998886 - Teléfono de contacto: 910052574

View File

@ -0,0 +1,70 @@
import { normalizeNumericFilter } from '../utils.js';
$(() => {
const csrfToken = document.querySelector('meta[name="_csrf"]')?.getAttribute('content');
const csrfHeader = document.querySelector('meta[name="_csrf_header"]')?.getAttribute('content');
if (window.$ && csrfToken && csrfHeader) {
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader(csrfHeader, csrfToken);
}
});
}
const language = document.documentElement.lang || 'es-ES';
const tablePedidos = $('#pedidos-datatable').DataTable({
processing: true,
serverSide: true,
orderCellsTop: true,
pageLength: 50,
lengthMenu: [10, 25, 50, 100, 500],
order: [[5, 'desc']], // Ordena por fecha por defecto
language: { url: '/assets/libs/datatables/i18n/' + language + '.json' },
responsive: true,
dom: 'lBrtip',
buttons: {
dom: {
button: {
className: 'btn btn-sm btn-outline-primary me-1'
},
buttons: [
{ extend: 'copy' },
{ extend: 'csv' },
{ extend: 'excel' },
{ extend: 'pdf' },
{ extend: 'print' },
{ extend: 'colvis' }
],
}
},
ajax: {
url: '/pedidos/datatable',
method: 'GET',
},
order: [[0, 'desc']],
columns: [
{ data: 'id', name: 'id', orderable: true },
{ data: 'cliente', name: 'createdBy.fullName', orderable: true },
{ data: 'created_at', name: 'createdAt', orderable: true },
{ data: 'total', name: 'total', orderable: true },
{ data: 'estado', name: 'estado', orderable: true },
{ data: 'actions', name: 'actions', orderable: false, searchable: false }
],
});
tablePedidos.on("keyup change", ".input-filter", function () {
const colName = $(this).data("col");
const colIndex = tablePedidos.settings()[0].aoColumns.findIndex(c => c.name === colName);
if (colIndex >= 0) {
tablePedidos
.column(colIndex)
.search(normalizeNumericFilter(this.value))
.draw();
}
});
})

View File

@ -0,0 +1,4 @@
$(()=>{
$(document,'.btn-view').on('click', function () {
});
})

View File

@ -46,7 +46,6 @@ $(() => {
order: [[0, 'desc']],
columns: [
{ data: 'id', name: 'id', orderable: true },
{ data: 'cliente', name: 'createdBy.fullName', orderable: true },
{ data: 'created_at', name: 'createdAt', orderable: true },
{ data: 'total', name: 'total', orderable: true },
{ data: 'estado', name: 'estado', orderable: true },
@ -66,8 +65,4 @@ $(() => {
.draw();
}
});
$('.btn-view').on('click', function () {
});
})

View File

@ -1683,7 +1683,7 @@ export default class PresupuestoWizard {
const body = {
presupuesto: this.#getPresupuestoData(),
save: !this.opts.canSave,
save: this.opts.canSave,
mode: this.opts.mode,
servicios: servicios,
datosMaquetacion: this.formData.servicios.datosMaquetacion,

View File

@ -139,6 +139,7 @@
<div class="footer">
<div class="fw-bold fs-6 mb-1" th:text="#{pdf.incluye-envio}">El presupuesto incluye el envío a una dirección de la
península.</div>
<div class="fw-bold fs-6 mb-1" th:text="#{pdf.presupuesto-validez}">Validez del presupuesto: 30 días desde la fecha de emisión.</div>
<div class="privacy">
<div class="pv-title" th:text="#{pdf.politica-privacidad}">Política de privacidad</div>
<div class="pv-text" th:text="#{pdf.politica-privacidad.responsable}">Responsable: Impresión Imprime Libros -

View File

@ -0,0 +1,31 @@
<div th:fragment="pedido-linea (linea)">
<div class="row">
<div class="col-12">
<div class="card mb-3">
<div class="card-header">
<strong th:text="${linea.libro.titulo}">Título del libro</strong>
<span class="text-muted" th:text="' - ' + #{pedido.linea.cantidad} + ': ' + ${linea.cantidad}"> - Cantidad: 1</span>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-8">
<p>
<strong th:text="#{pedido.linea.precio-unitario} + ': '"></strong>
<span th:text="${#numbers.formatDecimal(linea.precioUnitario, 1, 'COMMA', 2, 'POINT')} + ' €'">10,00 €</span>
</p>
<p>
<strong th:text="#{pedido.linea.precio-total} + ': '"></strong>
<span th:text="${#numbers.formatDecimal(linea.precioTotal, 1, 'COMMA', 2, 'POINT')} + ' €'">10,00 €</span>
</p>
</div>
<div class="col-md-4 text-end">
<img th:if="${linea.libro.imagenPortadaUrl != null}" th:src="${linea.libro.imagenPortadaUrl}" alt="Portada del libro" class="img-fluid" style="max-height: 150px;" />
<div th:if="${linea.libro.imagenPortadaUrl == null}" class="text-muted" style="height: 150px; display: flex; align-items: center; justify-content: center; border: 1px dashed #ccc;">
<span th:text="#{pedido.linea.sin-imagen}">Sin imagen</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -32,30 +32,28 @@
<div class="container-fluid">
<table id="pagos-redsys-datatable" class="table table-striped table-nowrap responsive w-100">
<table id="pedidos-datatable" class="table table-striped table-nowrap responsive w-100">
<thead>
<tr>
<th scope="col" th:text="#{pedido.table.id}">Num. Pedido</th>
<th scope="col" th:text="#{pedido.table.cliente}">Cliente</th>
<th scope="col" th:text="#{pedido.table.fecha}">Fecha</th>
<th scope="col" th:text="#{pedido.table.importe}">Importe</th>
<th scope="col" th:text="#{pedido.table.estado}">Estado</th>
<th scope="col" th:text="#{pedido.table.acciones}">Acciones</th>
<th class="text-start" scope="col" th:text="#{pedido.table.id}">Num. Pedido</th>
<th class="text-start" scope="col" th:text="#{pedido.table.fecha}">Fecha</th>
<th class="text-start" scope="col" th:text="#{pedido.table.importe}">Importe</th>
<th class="text-start" scope="col" th:text="#{pedido.table.estado}">Estado</th>
<th class="text-start" scope="col" th:text="#{pedido.table.acciones}">Acciones</th>
</tr>
<tr>
<th><input type="text" class="form-control form-control-sm input-filter" /></th>
<th><input type="text" class="form-control form-control-sm input-filter" /></th>
<th><input type="text" class="form-control form-control-sm input-filter" data-col="id" /></th>
<th></th>
<th></th>
<th>
<select class="form-control form-control-sm select-filter">
<option value="" ></option>
<option value="aprobado" th:text="#{pedido.estado.aprobado}">Aprobado</option>
<option value="maquetacion" th:text="#{pedido.estado.maquetacion}">Maquetación</option>
<option value="haciendo_ferro" th:text="#{pedido.estado.haciendo_ferro}">Haciendo ferro</option>
<option value="produccion" th:text="#{pedido.estado.produccion}">Producción</option>
<option value="terminado" th:text="#{pedido.estado.terminado}">Terminado</option>
<option value="cancelado" th:text="#{pedido.estado.cancelado}">Cancelado</option>
<select class="form-select form-select-sm input-filter" data-col="estado">
<option value=""></option>
<option th:text="#{pedido.estado.aprobado}" value="aprobado"></option>
<option th:text="#{pedido.estado.maquetacion}" value="maquetacion"></option>
<option th:text="#{pedido.estado.haciendo_ferro}" value="haciendo_ferro"></option>
<option th:text="#{pedido.estado.produccion}" value="produccion"></option>
<option th:text="#{pedido.estado.terminado}" value="terminado"></option>
<option th:text="#{pedido.estado.cancelado}" value="cancelado"></option>
</select>
</th>
<th></th> <!-- Acciones (sin filtro) -->
@ -87,7 +85,7 @@
<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/pedidos/pedidos-common.js}"></script>
<script type="module" th:src="@{/assets/js/pages/imprimelibros/pedidos/pedidos.js}"></script>
</th:block>
</body>

View File

@ -87,8 +87,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/pedidos/pedidos.js}"></script>
<script type="module" th:src="@{/assets/js/pages/imprimelibros/pedidos/pedidos-common.js}"></script>
<script type="module" th:src="@{/assets/js/pages/imprimelibros/pedidos/pedidos-admin.js}"></script>
</th:block>
</body>

View File

@ -0,0 +1,65 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{imprimelibros/layout}">
<head>
<th:block layout:fragment="pagetitle" />
<th:block th:replace="~{imprimelibros/partials/head-css :: head-css}" />
<th:block layout:fragment="pagecss">
<link th:href="@{/assets/libs/datatables/dataTables.bootstrap5.min.css}" rel="stylesheet" />
</th:block>
</head>
<body>
<div th:replace="~{imprimelibros/partials/topbar :: topbar}" />
<div th:replace="~{imprimelibros/partials/sidebar :: sidebar}"
sec:authorize="isAuthenticated() and hasAnyRole('SUPERADMIN','ADMIN')">
<th:block layout:fragment="content">
<div th:if="${#authorization.expression('isAuthenticated()')}">
<div class="container-fluid">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><i class="ri-home-5-fill"></i></a></li>
<li class="breadcrumb-item active" aria-current="page" th:text="#{pedido.module-title}">
Pedidos</li>
</ol>
</nav>
</div>
<div class="container-fluid">
<th:block th:each="linea: ${pedidoLinea}">
<div th:insert="~{imprimelibros/pedidos/pedidos-linea :: pedido-linea (linea=${linea})}"></div>
</th:block>
</div>
</div>
</th:block>
<th:block th:replace="~{theme/partials/vendor-scripts :: scripts}" />
<th:block layout:fragment="pagejs">
<script th:inline="javascript">
window.languageBundle = /*[[${languageBundle}]]*/ {};
</script>
<script th:src="@{/assets/libs/datatables/datatables.min.js}"></script>
<script th:src="@{/assets/libs/datatables/dataTables.bootstrap5.min.js}"></script>
<!-- JS de Buttons y dependencias -->
<script th:src="@{/assets/libs/datatables/dataTables.buttons.min.js}"></script>
<script th:src="@{/assets/libs/jszip/jszip.min.js}"></script>
<script th:src="@{/assets/libs/pdfmake/pdfmake.min.js}"></script>
<script th:src="@{/assets/libs/pdfmake/vfs_fonts.min.js}"></script>
<script th:src="@{/assets/libs/datatables/buttons.html5.min.js}"></script>
<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/pedidos/pedidos-common.js}"></script>
<script type="module" th:src="@{/assets/js/pages/imprimelibros/pedidos/pedidos-admin.js}"></script>
</th:block>
</body>
</html>