mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en eventos datosLibro
This commit is contained in:
@ -20,7 +20,12 @@ class PresupuestoAdminEdit {
|
||||
this.cosido = $("#isCosido");
|
||||
|
||||
this.datosGenerales = new DatosGenerales(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosPresupuestoTip'));
|
||||
this.datosLibro = new DatosLibro(this.domItem.find('#accordionDatosLibroTip',
|
||||
{
|
||||
addService: this.addService,
|
||||
removeService: this.removeService,
|
||||
checkPaginasPresupuesto: this.checkPaginasPresupuesto,
|
||||
}));
|
||||
|
||||
this.calcularPresupuesto = false;
|
||||
}
|
||||
@ -33,6 +38,7 @@ class PresupuestoAdminEdit {
|
||||
});
|
||||
|
||||
this.datosGenerales.init();
|
||||
this.datosLibro.init();
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
@ -69,6 +75,7 @@ class PresupuestoAdminEdit {
|
||||
self.calcularPresupuesto = false;
|
||||
|
||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||
|
||||
/*self.direcciones.handleChangeCliente();
|
||||
|
||||
@ -103,6 +110,65 @@ class PresupuestoAdminEdit {
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
addService() {
|
||||
|
||||
}
|
||||
|
||||
removeService() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkPaginasPresupuesto() {
|
||||
|
||||
cantidad_total = 0
|
||||
|
||||
tableLineasPresupuesto.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||
cantidad_total += parseInt(rowData.paginas)
|
||||
})
|
||||
htmlString = ''
|
||||
|
||||
if (cantidad_total != parseInt($('#paginas').val())) {
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.errores.paginasLP +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
var ancho = 0;
|
||||
var alto = 0;
|
||||
|
||||
|
||||
if ($('#papelFormatoPersonalizado').is(':checked')) {
|
||||
ancho = parseFloat($('#papelFormatoAncho').val());
|
||||
alto = parseFloat($('#papelFormatoAlto').val());
|
||||
}
|
||||
else {
|
||||
ancho = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').getText().trim().split(" x ")[1]);
|
||||
}
|
||||
|
||||
return {
|
||||
ancho: ancho,
|
||||
alto: alto
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#checkChangesPresupuesto() {
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('change', function () {
|
||||
@ -150,7 +216,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Maquinas'] }, {},
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Presupuestos'] }, {},
|
||||
function (translations) {
|
||||
window.language = JSON.parse(translations);
|
||||
new PresupuestoAdminEdit().init();
|
||||
|
||||
Reference in New Issue
Block a user