mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en eventos de lineas
This commit is contained in:
@ -166,6 +166,7 @@ return [
|
|||||||
'solapasSobrecubierta' => 'Solapas sobrecub.',
|
'solapasSobrecubierta' => 'Solapas sobrecub.',
|
||||||
'solapasAnchoCubierta' => 'Ancho solapas cub.',
|
'solapasAnchoCubierta' => 'Ancho solapas cub.',
|
||||||
'solapasAnchoSobrecubierta' => 'Ancho solapas sobrecub.',
|
'solapasAnchoSobrecubierta' => 'Ancho solapas sobrecub.',
|
||||||
|
|
||||||
'sinImpresion' => 'Sin impresion',
|
'sinImpresion' => 'Sin impresion',
|
||||||
'unaCara' => '1 cara',
|
'unaCara' => '1 cara',
|
||||||
'dosCaras' => '2 caras',
|
'dosCaras' => '2 caras',
|
||||||
@ -387,7 +388,8 @@ return [
|
|||||||
'noInterior' => 'No se hay resultados para el interior',
|
'noInterior' => 'No se hay resultados para el interior',
|
||||||
'noCubiertaSobrecubierta' => 'No se hay resultados para cubierta/sobrecubierta',
|
'noCubiertaSobrecubierta' => 'No se hay resultados para cubierta/sobrecubierta',
|
||||||
'errorPresupuesto' => 'Se ha producido un error al calcular el presupuesto. Póngase en contacto con el administrador',
|
'errorPresupuesto' => 'Se ha producido un error al calcular el presupuesto. Póngase en contacto con el administrador',
|
||||||
'error_sobrecubierta_sin_solapas' => 'Debe seleccionar "sobrecubierta" en los datos del libro para introducir el ancho de solapa'
|
'error_sobrecubierta_sin_solapas' => 'Debe seleccionar "sobrecubierta" en los datos del libro para introducir el ancho de solapa',
|
||||||
|
'error_faja_sin_solapas' => 'Debe seleccionar "faja" en los datos del libro para introducir el ancho de solapa'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -162,6 +162,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Fila 3 -->
|
||||||
|
<div class="row mt-2 container-faja">
|
||||||
|
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<div class="mb-1">
|
||||||
|
<div class="form-check form-switch mb-2">
|
||||||
|
<input class="form-check-input" type="checkbox" id="faja" name="faja" tabindex="6"
|
||||||
|
value="1">
|
||||||
|
<label class="form-check-label" for="faja"><?= lang('Presupuestos.faja') ?></label>
|
||||||
|
</div>
|
||||||
|
</div><!--//.mb-3 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<div class="mb-1 faja-div d-none" id="div_faja_alto">
|
||||||
|
<label for="faja_alto" class="form-label">
|
||||||
|
<?= lang('Presupuestos.altoFaja') ?>*
|
||||||
|
</label>
|
||||||
|
<input type="number" id="faja_alto" name="faja_alto" placeholder="0" maxLength="8"
|
||||||
|
step="1" class="form-control" value="50">
|
||||||
|
<div class="form-text">
|
||||||
|
Entre 50 y 120 mm
|
||||||
|
</div>
|
||||||
|
</div><!--//.mb-1 -->
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<div class="mb-1 faja-div d-none" id="div_faja_solapas_ancho">
|
||||||
|
<label for="faja_solapas_ancho" class="form-label">
|
||||||
|
<?= lang('Presupuestos.tamanioSolapasFaja') ?>*
|
||||||
|
</label>
|
||||||
|
<input type="number" id="faja_solapas_ancho" name="faja_solapas_ancho" placeholder="0"
|
||||||
|
maxLength="8" step="1" class="form-control" value="60">
|
||||||
|
<div class="form-text">
|
||||||
|
Entre 60 y 120 mm
|
||||||
|
</div>
|
||||||
|
</div><!--//.mb-1 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!----------------------------------------------------------------------------->
|
<!----------------------------------------------------------------------------->
|
||||||
|
|||||||
@ -222,46 +222,46 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3): ?>
|
<?php if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3): ?>
|
||||||
<div class="col-md-12 col-lg-2 px-4">
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12 col-lg-2 px-4">
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
<label id="label_compLomoRedondo" for="compLomoRedondo" class="form-label">
|
<label id="label_compLomoRedondo" for="compLomoRedondo" class="form-label">
|
||||||
<?= lang('Presupuestos.lomoRedondo') ?>*
|
<?= lang('Presupuestos.lomoRedondo') ?>*
|
||||||
</label>
|
</label>
|
||||||
<select id="compLomoRedondo" name="lomo_redondo"
|
<select id="compLomoRedondo" name="lomo_redondo"
|
||||||
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
|
class="form-control select2bs2 comp_cubierta_items" style="width: 100%;">
|
||||||
<option value="0">
|
<option value="0">
|
||||||
<p>
|
<p>
|
||||||
<?= lang('Presupuestos.no') ?>
|
<?= lang('Presupuestos.no') ?>
|
||||||
</p>
|
</p>
|
||||||
</option>
|
</option>
|
||||||
<option value="1">
|
<option value="1">
|
||||||
<p>
|
<p>
|
||||||
<?= lang('Presupuestos.si') ?>
|
<?= lang('Presupuestos.si') ?>
|
||||||
</p>
|
</p>
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 col-lg-2 px-4">
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
<label for="cabezada" class="form-label">
|
<label for="cabezada" class="form-label">
|
||||||
<?= lang('Presupuestos.cabezada') ?>
|
<?= lang('Presupuestos.cabezada') ?>
|
||||||
</label>
|
</label>
|
||||||
<select class="form-select select2bs2" id="cabezada" name="cabezada">
|
<select class="form-select select2bs2" id="cabezada" name="cabezada">
|
||||||
<option value="WHI">
|
<option value="WHI">
|
||||||
<?= lang('Presupuestos.blanca') ?>
|
<?= lang('Presupuestos.blanca') ?>
|
||||||
</option>
|
</option>
|
||||||
<option value="GRE">
|
<option value="GRE">
|
||||||
<?= lang('Presupuestos.verde') ?>
|
<?= lang('Presupuestos.verde') ?>
|
||||||
</option>
|
</option>
|
||||||
<option value="BLUE">
|
<option value="BLUE">
|
||||||
<?= lang('Presupuestos.azul') ?>
|
<?= lang('Presupuestos.azul') ?>
|
||||||
</option>
|
</option>
|
||||||
<option value="REDYEL">
|
<option value="REDYEL">
|
||||||
<?= lang('Presupuestos.rojaAmarilla') ?>
|
<?= lang('Presupuestos.rojaAmarilla') ?>
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div>
|
<div>
|
||||||
<hr class="my-1">
|
<hr class="my-1">
|
||||||
@ -345,13 +345,49 @@
|
|||||||
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<hr class="my-1">
|
<hr class="my-1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<p>
|
||||||
|
<?= lang('Presupuestos.faja') ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<select id="compFaja" name="comp_faja" class="form-control select2bs2 comp_faja_items"
|
||||||
|
style="width: 100%;">
|
||||||
|
<option value="0">
|
||||||
|
<p>
|
||||||
|
<?= lang('Presupuestos.no') ?>
|
||||||
|
</p>
|
||||||
|
</option>
|
||||||
|
<option value="1">
|
||||||
|
<p>
|
||||||
|
<?= lang('Presupuestos.si') ?>
|
||||||
|
</p>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-6 px-4">
|
||||||
|
<select disabled id="compPapelFaja" name="comp_papel_faja"
|
||||||
|
class="form-control select2bs2 comp_faja_items" style="width: 100%;">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
|
<select disabled id="compGramajeFaja" name="comp_gramaje_faja"
|
||||||
|
class="form-control select2bs2 comp_faja_items" style="width: 100%;">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hr class="my-1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!----------------------------------------------------------------------------->
|
<!----------------------------------------------------------------------------->
|
||||||
|
|
||||||
<div class="divider divider-dark text-start mb-1 pos-paginas-color">
|
<div class="divider divider-dark text-start mb-1 pos-paginas-color">
|
||||||
@ -799,6 +835,102 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="accordion mt-3" id="accordionCompFaja">
|
||||||
|
<div class="card accordion-item active">
|
||||||
|
<h2 class="accordion-header" id="headingThree">
|
||||||
|
<button id="accordion-button-faja" type="button" class="accordion-button"
|
||||||
|
data-bs-toggle="collapse" data-bs-target="#accordionCompFajaTip"
|
||||||
|
aria-expanded="false" aria-controls="accordionFajaTip">
|
||||||
|
<h6 id="title_faja">
|
||||||
|
<?= lang("Presupuestos.faja") ?>
|
||||||
|
</h6>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div id="accordionCompFajaTip" class="accordion-collapse collapse"
|
||||||
|
data-bs-parent="#accordionCompFaja">
|
||||||
|
<div class="accordion-body">
|
||||||
|
|
||||||
|
<table id="tableCompFaja" class="comparator-table table dt-responsive dataTable"
|
||||||
|
style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.tipo') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.paginas') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.papel') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.gramaje') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.marca') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.maquina') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.numeroPliegos') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px">
|
||||||
|
<?= lang('Presupuestos.pliegosPedido') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px">
|
||||||
|
<?= lang('Presupuestos.precioPliego') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.libro') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px">
|
||||||
|
<?= lang('Presupuestos.totalPapelPedido') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.lomo') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.peso') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px">
|
||||||
|
<?= lang('Presupuestos.horas') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em; max-width:80px">
|
||||||
|
<?= lang('Presupuestos.precioImpresion') ?>
|
||||||
|
</th>
|
||||||
|
<th style="padding-right: 0.75em;">
|
||||||
|
<?= lang('Presupuestos.total') ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td class="dt-result dt-result-text" colspan="14">
|
||||||
|
<?= lang('Presupuestos.total') ?>
|
||||||
|
<?= lang("Presupuestos.faja") ?>:
|
||||||
|
</td>
|
||||||
|
<td id="total_comp_faja" class="dt-result dt-result-value" colspan="2">
|
||||||
|
0.00 </td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="button" name="insertarFajaBtn" id="insertarFajaBtn"
|
||||||
|
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
|
||||||
|
<?= lang('Presupuestos.insertarLinea') . ' ' . strtoupper(lang('Presupuestos.faja')) ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@
|
|||||||
<?php if ($presupuestoEntity->estado_id == 2): ?>
|
<?php if ($presupuestoEntity->estado_id == 2): ?>
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
<div class="mb-1">
|
<div class="mb-1">
|
||||||
<label for="paginas" class="form-label">
|
<label for="totalAceptado" class="form-label">
|
||||||
<?= lang('Presupuestos.totalAceptado') ?>
|
<?= lang('Presupuestos.totalAceptado') ?>
|
||||||
</label>
|
</label>
|
||||||
<input disabled type="text" id="totalAceptado" name="totalAceptado" class="form-control" value="" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
<input disabled type="text" id="totalAceptado" name="totalAceptado" class="form-control" value="" <?php echo ($tipo_impresion_id == 21)?' max=80':'' ?>>
|
||||||
|
|||||||
@ -50,6 +50,7 @@ class PresupuestoAdminAdd {
|
|||||||
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
|
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
|
||||||
$('.solapas-cubierta-div').addClass('d-none');
|
$('.solapas-cubierta-div').addClass('d-none');
|
||||||
$('.solapas-sobrecubierta-div').addClass('d-none');
|
$('.solapas-sobrecubierta-div').addClass('d-none');
|
||||||
|
$('.container-faja').addClass('d-none');
|
||||||
|
|
||||||
this.cliente.init();
|
this.cliente.init();
|
||||||
this.pais.init();
|
this.pais.init();
|
||||||
|
|||||||
@ -55,6 +55,9 @@ class PresupuestoAdminEdit {
|
|||||||
this.guardar = $('#saveForm');
|
this.guardar = $('#saveForm');
|
||||||
|
|
||||||
this.calcularPresupuesto = false;
|
this.calcularPresupuesto = false;
|
||||||
|
this.cargandoPresupuesto = false;
|
||||||
|
|
||||||
|
|
||||||
this.configUploadDropzone = {
|
this.configUploadDropzone = {
|
||||||
domElement: '#dropzone-presupuesto-admin-files',
|
domElement: '#dropzone-presupuesto-admin-files',
|
||||||
nameId: "presupuesto_id",
|
nameId: "presupuesto_id",
|
||||||
@ -130,10 +133,6 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
$('#lomo_cubierta').on('change', this.datosLibro.changeAnchoSolapasCubierta);
|
$('#lomo_cubierta').on('change', this.datosLibro.changeAnchoSolapasCubierta);
|
||||||
$('#lomo_sobrecubierta').on('change', this.datosLibro.changeAnchoSolapasSobrecubierta);
|
$('#lomo_sobrecubierta').on('change', this.datosLibro.changeAnchoSolapasSobrecubierta);
|
||||||
if ($(this.configUploadDropzone.domElement).length > 0) {
|
|
||||||
this.fileUploadDropzone.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,6 +281,8 @@ class PresupuestoAdminEdit {
|
|||||||
update_resumen = true,
|
update_resumen = true,
|
||||||
update_tiradas_alternativas = true
|
update_tiradas_alternativas = true
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
const waitForEvent = (eventName) => {
|
const waitForEvent = (eventName) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$(document).one(eventName, () => {
|
$(document).one(eventName, () => {
|
||||||
@ -290,30 +291,32 @@ class PresupuestoAdminEdit {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ejecutar los pasos de forma secuencial si están habilitados
|
if (self.cargandoPresupuesto == false) {
|
||||||
if (update_lineas) {
|
// Ejecutar los pasos de forma secuencial si están habilitados
|
||||||
$(document).trigger('update-lineas-presupuesto');
|
if (update_lineas) {
|
||||||
await waitForEvent('update-lineas-presupuesto-completed');
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
}
|
await waitForEvent('update-lineas-presupuesto-completed');
|
||||||
|
}
|
||||||
|
|
||||||
if (update_servicios) {
|
if (update_servicios) {
|
||||||
$(document).trigger('update-servicios');
|
$(document).trigger('update-servicios');
|
||||||
await waitForEvent('update-servicios-completed');
|
await waitForEvent('update-servicios-completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_envios) {
|
if (update_envios) {
|
||||||
$(document).trigger('update-envios');
|
$(document).trigger('update-envios');
|
||||||
await waitForEvent('update-envios-completed');
|
await waitForEvent('update-envios-completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_resumen) {
|
if (update_resumen) {
|
||||||
$(document).trigger('update-totales');
|
$(document).trigger('update-totales');
|
||||||
await waitForEvent('update-totales-completed');
|
await waitForEvent('update-totales-completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_tiradas_alternativas) {
|
if (update_tiradas_alternativas) {
|
||||||
$(document).trigger('update-tiradas-alternativas');
|
$(document).trigger('update-tiradas-alternativas');
|
||||||
await waitForEvent('update-tiradas-alternativas-completed');
|
await waitForEvent('update-tiradas-alternativas-completed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,6 +324,7 @@ class PresupuestoAdminEdit {
|
|||||||
#cargarPresupuesto() {
|
#cargarPresupuesto() {
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
this.cargandoPresupuesto = true;
|
||||||
|
|
||||||
$('#loader').modal('show');
|
$('#loader').modal('show');
|
||||||
let id = window.location.href.split("/").pop()
|
let id = window.location.href.split("/").pop()
|
||||||
@ -338,15 +342,18 @@ class PresupuestoAdminEdit {
|
|||||||
self.POD.val(response.data.POD);
|
self.POD.val(response.data.POD);
|
||||||
|
|
||||||
self.calcularPresupuesto = false;
|
self.calcularPresupuesto = false;
|
||||||
|
self.comparador.cargando = true;
|
||||||
|
|
||||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||||
self.comparador.cargarDatos(response.data.comparador);
|
|
||||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||||
|
|
||||||
self.servicios.cargar(response.data.servicios);
|
self.servicios.cargar(response.data.servicios);
|
||||||
self.envios.cargar(response.data.direcciones);
|
self.envios.cargar(response.data.direcciones);
|
||||||
|
|
||||||
|
self.comparador.cargarDatos(response.data.comparador);
|
||||||
|
|
||||||
$('#comentariosCliente').val(response.data.comentarios_cliente);
|
$('#comentariosCliente').val(response.data.comentarios_cliente);
|
||||||
$('#comentariosSafekat').val(response.data.comentarios_safekat);
|
$('#comentariosSafekat').val(response.data.comentarios_safekat);
|
||||||
$('#comentariosPdf').val(response.data.comentarios_presupuesto);
|
$('#comentariosPdf').val(response.data.comentarios_presupuesto);
|
||||||
@ -363,8 +370,10 @@ class PresupuestoAdminEdit {
|
|||||||
if (response.data.state != 2) {
|
if (response.data.state != 2) {
|
||||||
|
|
||||||
self.calcularPresupuesto = true;
|
self.calcularPresupuesto = true;
|
||||||
|
self.cargandoPresupuesto = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
this.calcularSolapas();
|
this.calcularSolapas();
|
||||||
@ -380,6 +389,7 @@ class PresupuestoAdminEdit {
|
|||||||
() => {
|
() => {
|
||||||
$('#loader').modal('hide');
|
$('#loader').modal('hide');
|
||||||
this.calcularPresupuesto = true;
|
this.calcularPresupuesto = true;
|
||||||
|
self.cargandoPresupuesto = false;
|
||||||
}
|
}
|
||||||
).get();
|
).get();
|
||||||
}
|
}
|
||||||
@ -389,12 +399,12 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
let cantidad_total = 0;
|
let cantidad_total = 0;
|
||||||
|
|
||||||
this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
var rowData = this.data();
|
var rowData = this.data();
|
||||||
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
||||||
cantidad_total += parseInt(rowData.paginas)
|
cantidad_total += parseInt(rowData.paginas)
|
||||||
})
|
})
|
||||||
htmlString = ''
|
let htmlString = ''
|
||||||
|
|
||||||
if (cantidad_total != parseInt($('#paginas').val())) {
|
if (cantidad_total != parseInt($('#paginas').val())) {
|
||||||
htmlString = `
|
htmlString = `
|
||||||
@ -430,7 +440,7 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
calcularSolapas() {
|
calcularSolapas() {
|
||||||
|
|
||||||
let anchoTotal = 2*this.getDimensionLibro().ancho;
|
let anchoTotal = 2 * this.getDimensionLibro().ancho;
|
||||||
let maxSolapas = 120;
|
let maxSolapas = 120;
|
||||||
|
|
||||||
let mano = 0;
|
let mano = 0;
|
||||||
@ -443,29 +453,28 @@ class PresupuestoAdminEdit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mano > 0) {
|
if (mano > 0) {
|
||||||
anchoTotal += 6 + 5; // dobleces + sangre
|
anchoTotal += 6 + 5; // dobleces + sangre
|
||||||
maxSolapas = Math.min(Math.floor((865-anchoTotal)/2), 0.75*this.getDimensionLibro().ancho);
|
maxSolapas = Math.min(Math.floor((865 - anchoTotal) / 2), 0.75 * this.getDimensionLibro().ancho);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
maxSolapas = 0.75*this.getDimensionLibro().ancho;
|
maxSolapas = 0.75 * this.getDimensionLibro().ancho;
|
||||||
}
|
}
|
||||||
if($('#solapas_ancho').length>0 && $('#solapas_ancho').attr('max') != maxSolapas){
|
if ($('#solapas_ancho').length > 0 && $('#solapas_ancho').attr('max') != maxSolapas) {
|
||||||
$('#solapas_ancho').attr('max', maxSolapas);
|
$('#solapas_ancho').attr('max', maxSolapas);
|
||||||
$('#solapas_ancho').trigger('change');
|
$('#solapas_ancho').trigger('change');
|
||||||
$('#solapas_ancho').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
$('#solapas_ancho').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||||
}
|
}
|
||||||
if($('#solapas_ancho_sobrecubierta').length>0 && $('#solapas_ancho_sobrecubierta').attr('max') != maxSolapas){
|
if ($('#solapas_ancho_sobrecubierta').length > 0 && $('#solapas_ancho_sobrecubierta').attr('max') != maxSolapas) {
|
||||||
$('#solapas_ancho_sobrecubierta').attr('max', maxSolapas);
|
$('#solapas_ancho_sobrecubierta').attr('max', maxSolapas);
|
||||||
$('#solapas_ancho_sobrecubierta').trigger('change');
|
$('#solapas_ancho_sobrecubierta').trigger('change');
|
||||||
$('#solapas_ancho_sobrecubierta').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
$('#solapas_ancho_sobrecubierta').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||||
}
|
}
|
||||||
if($('#solapas_ancho_faja').length>0 && $('#solapas_ancho_faja').attr('max') != maxSolapas){
|
if ($('#solapas_ancho_faja').length > 0 && $('#solapas_ancho_faja').attr('max') != maxSolapas) {
|
||||||
$('#solapas_ancho_faja').attr('max', maxSolapas);
|
$('#solapas_ancho_faja').attr('max', maxSolapas);
|
||||||
$('#solapas_ancho_faja').trigger('change');
|
$('#solapas_ancho_faja').trigger('change');
|
||||||
$('#solapas_ancho_faja').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
$('#solapas_ancho_faja').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||||
}
|
}
|
||||||
console.log('maxSolapas', maxSolapas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDimensionLibro() {
|
getDimensionLibro() {
|
||||||
|
|||||||
@ -220,6 +220,35 @@ class Comparador {
|
|||||||
this.btnInsertarGuardas = $('#insertarGuardasBtn');
|
this.btnInsertarGuardas = $('#insertarGuardasBtn');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.faja = $('#compFaja');
|
||||||
|
this.papelFaja = new ClassSelect($('#compPapelFaja'),
|
||||||
|
'/presupuestoadmin/papelgenerico', 'Seleccione papel', false,
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
tipo_impresion: this.tipo_impresion_id,
|
||||||
|
tirada: () => $('#tirada').val(),
|
||||||
|
ancho: () => this.getDimensionLibro().ancho,
|
||||||
|
alto: () => $('faja_alto').val(),
|
||||||
|
sopalas: () => $('#faja_solapas_ancho').val(),
|
||||||
|
lomo: () => $('#lomo_sobrecubierta').val(),
|
||||||
|
tipo: 'colorhq',
|
||||||
|
uso: 'sobrecubierta',
|
||||||
|
});
|
||||||
|
this.gramajeFaja = new ClassSelect($('#compGramajeFaja'),
|
||||||
|
'/presupuestoadmin/papelgramaje', 'Seleccione gramaje', false,
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
papel_generico: () => this.papelFaja.getVal(),
|
||||||
|
tipo_impresion: this.tipo_impresion_id,
|
||||||
|
tirada: () => $('#tirada').val(),
|
||||||
|
ancho: () => this.getDimensionLibro().ancho,
|
||||||
|
alto: () => $('faja_alto').val(),
|
||||||
|
sopalas: () => $('#faja_solapas_ancho').val(),
|
||||||
|
lomo: () => $('#lomo_sobrecubierta').val(),
|
||||||
|
tipo: 'colorhq',
|
||||||
|
uso: 'sobrecubierta',
|
||||||
|
});
|
||||||
|
|
||||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3) {
|
||||||
this.lomoRedondo = $('#compLomoRedondo');
|
this.lomoRedondo = $('#compLomoRedondo');
|
||||||
this.cabezada = $('#cabezada');
|
this.cabezada = $('#cabezada');
|
||||||
@ -232,9 +261,11 @@ class Comparador {
|
|||||||
this.tableCompGuardas = null;
|
this.tableCompGuardas = null;
|
||||||
this.tableCompIntPlana = null;
|
this.tableCompIntPlana = null;
|
||||||
this.tableCompIntRotativa = null;
|
this.tableCompIntRotativa = null;
|
||||||
|
this.tableCompFaja = null;
|
||||||
this.btnInsertarPlana = $('#insertarPlanaBtn');
|
this.btnInsertarPlana = $('#insertarPlanaBtn');
|
||||||
this.btnInsertarRotativa = $('#insertarRotativaBtn');
|
this.btnInsertarRotativa = $('#insertarRotativaBtn');
|
||||||
this.btnInsertarCubierta = $('#insertarCubiertaBtn');
|
this.btnInsertarCubierta = $('#insertarCubiertaBtn');
|
||||||
|
this.btnInsertarFaja = $('#insertarFajaBtn');
|
||||||
|
|
||||||
this.cargando = false;
|
this.cargando = false;
|
||||||
this.comparadorPlanaRunning = false;
|
this.comparadorPlanaRunning = false;
|
||||||
@ -292,6 +323,14 @@ class Comparador {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.faja.select2({
|
||||||
|
allowClear: false,
|
||||||
|
minimumResultsForSearch: Infinity,
|
||||||
|
});
|
||||||
|
this.papelFaja.init();
|
||||||
|
this.gramajeFaja.init();
|
||||||
|
this.papelFaja.onChange(() => self.gramajeFaja.empty());
|
||||||
|
|
||||||
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
||||||
|
|
||||||
this.sobrecubierta.select2({
|
this.sobrecubierta.select2({
|
||||||
@ -323,6 +362,28 @@ class Comparador {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.faja.on('change', () => {
|
||||||
|
if (this.faja.select2('data')[0].id == 1) {
|
||||||
|
if ($('#faja').prop('checked') == false) {
|
||||||
|
this.faja.val(0);
|
||||||
|
popErrorAlert(window.language.Presupuestos.errores.error_faja_sin_solapas, 'divAlarmasComparador');
|
||||||
|
}
|
||||||
|
$('#faja').prop('checked', true);
|
||||||
|
$('.faja-div').removeClass('d-none');
|
||||||
|
$('#faja_solapas_ancho').val(60);
|
||||||
|
$('#faja_alto').val(50);
|
||||||
|
$('#compPapelFaja').prop('disabled', false);
|
||||||
|
$('#compGramajeFaja').prop('disabled', false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.papelFaja.setVal(0);
|
||||||
|
this.gramajeFaja.setVal(0);
|
||||||
|
$('#compPapelFaja').prop('disabled', true);
|
||||||
|
$('#compGramajeFaja').prop('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||||
this.papelGuardas.init();
|
this.papelGuardas.init();
|
||||||
this.gramajeGuardas.init();
|
this.gramajeGuardas.init();
|
||||||
@ -360,6 +421,9 @@ class Comparador {
|
|||||||
else if (e.target.id.includes("guardas")) {
|
else if (e.target.id.includes("guardas")) {
|
||||||
$("#tableCompGuardas").DataTable().columns.adjust();
|
$("#tableCompGuardas").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
|
else if (e.target.id.includes("faja")) {
|
||||||
|
$("#tableCompFaja").DataTable().columns.adjust();
|
||||||
|
}
|
||||||
else if (e.target.id.includes("LineasPresupuesto")) {
|
else if (e.target.id.includes("LineasPresupuesto")) {
|
||||||
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
$("#tableLineasPresupuesto").DataTable().columns.adjust();
|
||||||
}
|
}
|
||||||
@ -378,6 +442,8 @@ class Comparador {
|
|||||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||||
$('.comp_guardas_items').on('change', this.obtenerComparadorGuardas.bind(this));
|
$('.comp_guardas_items').on('change', this.obtenerComparadorGuardas.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('.comp_faja_items').on('change', this.obtenerComparadorFaja.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
#changePaginasComparador(element) {
|
#changePaginasComparador(element) {
|
||||||
@ -477,22 +543,25 @@ class Comparador {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cargando = false;
|
this.cargando = false;
|
||||||
if (this.paginasNegro.val() > 0) {
|
|
||||||
this.paginasNegro.trigger('change');
|
if (this.paginasColor.val() > 0) {
|
||||||
}
|
|
||||||
else if (this.paginasNegrohq.val() > 0) {
|
|
||||||
this.paginasNegrohq.trigger('change');
|
|
||||||
}
|
|
||||||
else if (this.paginasColor.val() > 0) {
|
|
||||||
this.paginasColor.trigger('change');
|
this.paginasColor.trigger('change');
|
||||||
}
|
}
|
||||||
else if (this.paginasColorhq.val() > 0) {
|
else if (this.paginasColorhq.val() > 0) {
|
||||||
this.paginasColorhq.trigger('change');
|
this.paginasColorhq.trigger('change');
|
||||||
}
|
}
|
||||||
|
else if (this.paginasNegro.val() > 0) {
|
||||||
|
this.paginasNegro.trigger('change');
|
||||||
|
}
|
||||||
|
else if (this.paginasNegrohq.val() > 0) {
|
||||||
|
this.paginasNegrohq.trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
this.paginasCubierta.trigger('change');
|
this.paginasCubierta.trigger('change');
|
||||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||||
this.carasGuardas.trigger('change');
|
this.carasGuardas.trigger('change');
|
||||||
}
|
}
|
||||||
|
this.faja.trigger('change');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,6 +742,57 @@ class Comparador {
|
|||||||
"order": [[0, 'asc'], [15, 'asc']]
|
"order": [[0, 'asc'], [15, 'asc']]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.tableCompFaja = new DataTable('#tableCompFaja', {
|
||||||
|
scrollX: true,
|
||||||
|
searching: false,
|
||||||
|
paging: false,
|
||||||
|
info: false,
|
||||||
|
ordering: true,
|
||||||
|
responsive: true,
|
||||||
|
select: false,
|
||||||
|
language: {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
'data': 'tipo',
|
||||||
|
'render': function (data, type, row, meta) {
|
||||||
|
if (data == 'faja')
|
||||||
|
return window.language.Presupuestos.faja;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ 'data': 'paginas' },
|
||||||
|
{ 'data': 'papel' },
|
||||||
|
{ 'data': 'gramaje' },
|
||||||
|
{ 'data': 'marca' },
|
||||||
|
{ 'data': 'maquina' },
|
||||||
|
{ 'data': 'numeroPliegos' },
|
||||||
|
{ 'data': 'pliegosPedido' },
|
||||||
|
{ 'data': 'precioPliego' },
|
||||||
|
{ 'data': 'libro' },
|
||||||
|
{ 'data': 'totalPapelPedido' },
|
||||||
|
{ 'data': 'lomo' },
|
||||||
|
{ 'data': 'peso' },
|
||||||
|
{ 'data': 'horasMaquina' },
|
||||||
|
{ 'data': 'precioImpresion' },
|
||||||
|
{ 'data': 'total' },
|
||||||
|
{ 'data': 'maquinaId' },
|
||||||
|
{ 'data': 'maquinaVelocidad' },
|
||||||
|
{ 'data': 'tiempoMaquina' },
|
||||||
|
{ 'data': 'papelGenericoId' },
|
||||||
|
{ 'data': 'papelImpresionId' },
|
||||||
|
{ 'data': 'tarifa_impresion_id' }
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
target: [16, 17, 18, 19, 20, 21],
|
||||||
|
visible: false,
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"order": [[15, 'asc']]
|
||||||
|
});
|
||||||
|
|
||||||
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
if (this.tipo_impresion_id == 1 || this.tipo_impresion_id == 3 || this.tipo_impresion_id == 5 || this.tipo_impresion_id == 7) {
|
||||||
this.tableCompGuardas = new DataTable('#tableCompGuardas', {
|
this.tableCompGuardas = new DataTable('#tableCompGuardas', {
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
@ -1019,6 +1139,23 @@ class Comparador {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (uso == 'faja') {
|
||||||
|
if (this.papelFaja.getVal() == 0 || this.papelFaja.getVal() == null) {
|
||||||
|
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||||
|
return { error: true, data: {} };
|
||||||
|
}
|
||||||
|
if (this.gramajeFaja.getVal() == 0 || this.gramajeFaja.getVal() == null) {
|
||||||
|
popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador');
|
||||||
|
return { error: true, data: {} };
|
||||||
|
}
|
||||||
|
|
||||||
|
papel_generico = { id: this.papelFaja.getVal(), nombre: this.papelFaja.getText() };
|
||||||
|
gramaje = this.gramajeFaja.getVal();
|
||||||
|
paginas = 4;
|
||||||
|
alto = $('#faja_alto').val();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
else if (uso == 'guardas') {
|
else if (uso == 'guardas') {
|
||||||
if (this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) {
|
if (this.papelGuardas.getVal() == 0 || this.papelGuardas.getVal() == null) {
|
||||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||||
@ -1053,7 +1190,7 @@ class Comparador {
|
|||||||
|
|
||||||
let datos = {
|
let datos = {
|
||||||
datosPedido: datosPedido,
|
datosPedido: datosPedido,
|
||||||
uso: uso,
|
uso: uso == 'faja' ? 'sobrecubierta' : uso,
|
||||||
tipo_impresion_id: this.tipo_impresion_id,
|
tipo_impresion_id: this.tipo_impresion_id,
|
||||||
cliente_id: $('#clienteId').select2('data')[0].id,
|
cliente_id: $('#clienteId').select2('data')[0].id,
|
||||||
papel_generico: papel_generico,
|
papel_generico: papel_generico,
|
||||||
@ -1076,6 +1213,13 @@ class Comparador {
|
|||||||
datos.datosPedido.solapas = $('#solapas_sobrecubierta').prop('checked') ? 1 : 0;
|
datos.datosPedido.solapas = $('#solapas_sobrecubierta').prop('checked') ? 1 : 0;
|
||||||
datos.datosPedido.solapas_ancho = $('#solapas_sobrecubierta').prop('checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
datos.datosPedido.solapas_ancho = $('#solapas_sobrecubierta').prop('checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (uso == 'faja') {
|
||||||
|
datos.datosPedido.lomo = $("#lomo_sobrecubierta").val();
|
||||||
|
datos.datosPedido.solapas = 1;
|
||||||
|
datos.datosPedido.solapas_ancho = parseInt($('#faja_solapas_ancho').val());
|
||||||
|
}
|
||||||
|
|
||||||
else if (uso == 'guardas') {
|
else if (uso == 'guardas') {
|
||||||
datos.datosPedido.isCosido = 1;
|
datos.datosPedido.isCosido = 1;
|
||||||
datos.datosPedido.isHq = 1;
|
datos.datosPedido.isHq = 1;
|
||||||
@ -1273,7 +1417,7 @@ class Comparador {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
if (this.tipo_impresion_id != 5 && this.tipo_impresion_id != 6 && this.tipo_impresion_id != 7 && this.tipo_impresion_id != 8 && this.tipo_impresion_id != 21) {
|
||||||
if (this.sobrecubierta.select2('data')[0].id == 1) {
|
if (this.sobrecubierta.val() == 1) {
|
||||||
datosComp.sobrecubierta = this.getDataForComp('sobrecubierta');
|
datosComp.sobrecubierta = this.getDataForComp('sobrecubierta');
|
||||||
if (datosComp.sobrecubierta.error) {
|
if (datosComp.sobrecubierta.error) {
|
||||||
return;
|
return;
|
||||||
@ -1297,6 +1441,7 @@ class Comparador {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
(response) => {
|
(response) => {
|
||||||
|
this.tableCompCubierta.clear().draw();
|
||||||
if (response.data.cubierta && Object.keys(response.data.cubierta).length > 0) {
|
if (response.data.cubierta && Object.keys(response.data.cubierta).length > 0) {
|
||||||
let sorted = Object.values(response.data.cubierta).sort(
|
let sorted = Object.values(response.data.cubierta).sort(
|
||||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
@ -1342,6 +1487,67 @@ class Comparador {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
obtenerComparadorFaja(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
if (this.cargando) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tableCompFaja.clear().draw();
|
||||||
|
this.btnInsertarFaja.addClass('d-none');
|
||||||
|
$('#title_faja').html(window.language.Presupuestos.faja);
|
||||||
|
|
||||||
|
let datosComp = {};
|
||||||
|
datosComp.sobrecubierta = this.getDataForComp('faja');
|
||||||
|
|
||||||
|
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
|
||||||
|
|
||||||
|
new Ajax('/presupuestoadmin/comparadorexteriores',
|
||||||
|
{
|
||||||
|
sobrecubierta: datosComp.sobrecubierta.data
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
(response) => {
|
||||||
|
|
||||||
|
if (response.data.sobrecubierta && Object.keys(response.data.sobrecubierta).length > 0) {
|
||||||
|
let sorted = Object.values(response.data.sobrecubierta).sort(
|
||||||
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
|
sorted[0].forEach(function (linea) {
|
||||||
|
if (typeof linea.error == "undefined")
|
||||||
|
self.tableCompFaja.row
|
||||||
|
.add(self.getRowFromLinea('faja', linea))
|
||||||
|
.draw()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
self.selectLineas('faja');
|
||||||
|
if (self.tableCompFaja.rows().count() > 0) {
|
||||||
|
$('#title_faja').html(window.language.Presupuestos.faja +
|
||||||
|
(' (' + self.tableCompFaja.rows().count() + ')'));
|
||||||
|
self.btnInsertarFaja.removeClass('d-none');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#title_faja').html(window.language.Presupuestos.faja);
|
||||||
|
self.btnInsertarFaja.addClass('d-none');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
).post();
|
||||||
|
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obtenerComparadorGuardas(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
obtenerComparadorGuardas(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1425,6 +1631,12 @@ class Comparador {
|
|||||||
total_label = '#total_comp_cubierta';
|
total_label = '#total_comp_cubierta';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'faja':
|
||||||
|
table = this.tableCompFaja;
|
||||||
|
tipo1 = 'faja';
|
||||||
|
total_label = '#total_comp_faja';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'rotativa':
|
case 'rotativa':
|
||||||
table = this.tableCompIntRotativa;
|
table = this.tableCompIntRotativa;
|
||||||
tipo1 = 'rotativa';
|
tipo1 = 'rotativa';
|
||||||
|
|||||||
@ -55,6 +55,11 @@ class DatosLibro {
|
|||||||
this.ferroDigital = this.domItem.find('#ferroDigital');
|
this.ferroDigital = this.domItem.find('#ferroDigital');
|
||||||
this.marcapaginas = this.domItem.find('#marcapaginas');
|
this.marcapaginas = this.domItem.find('#marcapaginas');
|
||||||
|
|
||||||
|
this.faja = this.domItem.find('#faja');
|
||||||
|
this.fajaAlto = this.domItem.find('#faja_alto');
|
||||||
|
this.fajaSolapasAncho = this.domItem.find('#faja_solapas_ancho');
|
||||||
|
this.div_faja = this.domItem.find('.faja-div');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -96,12 +101,27 @@ class DatosLibro {
|
|||||||
this.paginas.on('change', this.changePaginas.bind(this));
|
this.paginas.on('change', this.changePaginas.bind(this));
|
||||||
this.tirada.on('change', this.changeTirada.bind(this));
|
this.tirada.on('change', this.changeTirada.bind(this));
|
||||||
|
|
||||||
this.anchoSolapasCubierta.on('focusout', this.checkSolapasMax.bind(this));
|
this.anchoSolapasCubierta.on('focusout', this.checkSolapaAncho.bind(this));
|
||||||
this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapasMax.bind(this));
|
this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapaAncho.bind(this));
|
||||||
|
|
||||||
|
this.faja.on('change', this.changeFaja.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSolapasMax(event) {
|
changeFaja() {
|
||||||
|
|
||||||
|
if (this.faja.prop('checked')) {
|
||||||
|
this.div_faja.removeClass('d-none');
|
||||||
|
$('#compFaja').val(1).trigger('change');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.div_faja.addClass('d-none');
|
||||||
|
$('#compFaja').val(0).trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkSolapaAncho(event) {
|
||||||
|
|
||||||
const el = event.target;
|
const el = event.target;
|
||||||
if (el.value != "") {
|
if (el.value != "") {
|
||||||
if (parseInt(el.value) < parseInt(el.min)) {
|
if (parseInt(el.value) < parseInt(el.min)) {
|
||||||
@ -116,15 +136,6 @@ class DatosLibro {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeFajaColor() {
|
|
||||||
|
|
||||||
if (this.imprimirFajaColor.prop('checked')) {
|
|
||||||
$(document).trigger('add-servicio-lineas', 'facaColor');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(document).trigger('remove-servicio-lineas', 'fajaColor');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
changeFerro() {
|
changeFerro() {
|
||||||
|
|
||||||
@ -243,7 +254,7 @@ class DatosLibro {
|
|||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
// para que se actualice el comparador
|
// para que se actualice el comparador
|
||||||
this.updateComparador();
|
$('#compCarasCubierta').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
changeAnchoSolapasCubierta() {
|
changeAnchoSolapasCubierta() {
|
||||||
@ -256,7 +267,7 @@ class DatosLibro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// para que se actualice el comparador
|
// para que se actualice el comparador
|
||||||
this.updateComparador();
|
$('#compCarasCubierta').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -287,8 +298,7 @@ class DatosLibro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// para que se actualice el comparador
|
// para que se actualice el comparador
|
||||||
this.updateComparador();
|
$('#compSobrecubierta').trigger('change');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSolapasGrandes(elemento) {
|
checkSolapasGrandes(elemento) {
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class LineasPresupuesto {
|
|||||||
|
|
||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
const data = self.table.row(row).data()
|
const data = self.table.row(row).data()
|
||||||
if(data.row_id == 'lp_guardas'){
|
if (data.row_id == 'lp_guardas') {
|
||||||
$(document).trigger('remove-servicio-lineas', 'plegado_guardas');
|
$(document).trigger('remove-servicio-lineas', 'plegado_guardas');
|
||||||
}
|
}
|
||||||
self.table.row(row)
|
self.table.row(row)
|
||||||
@ -152,6 +152,9 @@ class LineasPresupuesto {
|
|||||||
else if (row.row_id.includes('_guardas')) {
|
else if (row.row_id.includes('_guardas')) {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
else if (row.row_id.includes('_faja')) {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -163,7 +166,7 @@ class LineasPresupuesto {
|
|||||||
{
|
{
|
||||||
data: 'paginas',
|
data: 'paginas',
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
if (row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas")
|
if (row.row_id != "lp_cubierta" && row.row_id != "lp_sobrecubierta" && row.row_id != "lp_guardas" && row.row_id != "lp_faja")
|
||||||
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
return '<td class="lp-td"><input id="' + row.row_id + '_paginas" name="' + row.row_id + '_paginas" class="lp-cell lp-input paginas-lp" type="text" value="' + data + '"></td>';
|
||||||
else if (row.row_id == "lp_cubierta") {
|
else if (row.row_id == "lp_cubierta") {
|
||||||
let select = '<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
let select = '<select id="lp_cubierta_paginas" name="comp_paginas_cubierta" class="form-control form-select-sm lp-cell lp-select" style="min-width:50px;">'
|
||||||
@ -615,13 +618,13 @@ class LineasPresupuesto {
|
|||||||
data.push(linea_data)
|
data.push(linea_data)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var datos = {
|
var datos = {
|
||||||
tipo: 'lineasPresupuesto',
|
tipo: 'lineasPresupuesto',
|
||||||
datos: data,
|
datos: data,
|
||||||
presupuesto_id: presupuesto_id,
|
presupuesto_id: presupuesto_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
await $.ajax({
|
await $.ajax({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
url: '/presupuestoadmin/datatable_2',
|
url: '/presupuestoadmin/datatable_2',
|
||||||
@ -666,7 +669,7 @@ class LineasPresupuesto {
|
|||||||
|
|
||||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
let rowData = this.data();
|
let rowData = this.data();
|
||||||
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas')
|
if (rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta' && rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_faja')
|
||||||
cantidad_total += parseInt(rowData.paginas)
|
cantidad_total += parseInt(rowData.paginas)
|
||||||
})
|
})
|
||||||
let htmlString = ''
|
let htmlString = ''
|
||||||
@ -917,6 +920,8 @@ class LineasPresupuesto {
|
|||||||
icon = '/themes/vuexy/img/safekat/presupuestos/icon_cubierta.png';
|
icon = '/themes/vuexy/img/safekat/presupuestos/icon_cubierta.png';
|
||||||
else if (rowId == 'lp_sobrecubierta')
|
else if (rowId == 'lp_sobrecubierta')
|
||||||
icon = '/themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png';
|
icon = '/themes/vuexy/img/safekat/presupuestos/icon_sobrecubierta.png';
|
||||||
|
else if (rowId == 'lp_faja')
|
||||||
|
icon = '/themes/vuexy/img/safekat/presupuestos/icon_faja.png';
|
||||||
else if (rowId == 'lp_guardas')
|
else if (rowId == 'lp_guardas')
|
||||||
icon = '/themes/vuexy/img/safekat/presupuestos/icon_guardas.png';
|
icon = '/themes/vuexy/img/safekat/presupuestos/icon_guardas.png';
|
||||||
else if (rowId == 'lp_rot_bn')
|
else if (rowId == 'lp_rot_bn')
|
||||||
@ -1100,11 +1105,22 @@ class LineasPresupuesto {
|
|||||||
'</div>' +
|
'</div>' +
|
||||||
'</td>'
|
'</td>'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
value += '</tr>'
|
value += '</tr>'
|
||||||
|
|
||||||
|
if (d.row_id == "lp_faja") {
|
||||||
|
value += '<tr>' +
|
||||||
|
'<td></td>' +
|
||||||
|
'<td></td>' +
|
||||||
|
'<td colspan="10">' +
|
||||||
|
'<div class="row flex-grow-1 d-flex align-items-end">' +
|
||||||
|
'<div class="col-md-12 col-lg-1">' +
|
||||||
|
window.language.Presupuestos.papelFormatoAlto + ' ' + window.language.Presupuestos.faja +
|
||||||
|
'<input id="' + d.row_id + '_altoFaja" name="' + d.row_id + '_altoFaja" class="lp-input lp-cell ' + d.row_class + '-input" type="text" value="' + d.alto_faja + '">' +
|
||||||
|
'</div>' +
|
||||||
|
'</td>' +
|
||||||
|
'</tr>'
|
||||||
|
}
|
||||||
|
|
||||||
if (d.maquinaTipo == 'inkjet') {
|
if (d.maquinaTipo == 'inkjet') {
|
||||||
value +=
|
value +=
|
||||||
'<tr>' +
|
'<tr>' +
|
||||||
@ -1389,6 +1405,22 @@ class LineasPresupuesto {
|
|||||||
const self = this;
|
const self = this;
|
||||||
const dimension = this.getDimensionLibro();
|
const dimension = this.getDimensionLibro();
|
||||||
|
|
||||||
|
if (linea == 'lp_faja') {
|
||||||
|
if (Object.keys(input_data).length == 0) {
|
||||||
|
let altoSelected = parseInt($('#' + linea + '_altoFaja').val());
|
||||||
|
if(altoSelected == 0 || isNaN(altoSelected) || altoSelected == '' || altoSelected < 50){
|
||||||
|
altoSelected = 50;
|
||||||
|
}
|
||||||
|
else if(altoSelected > dimension.alto){
|
||||||
|
altoSelected = dimension.alto;
|
||||||
|
}
|
||||||
|
dimension.alto = altoSelected;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dimension.alto = parseInt($('#faja_alto').val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const dataFromComparador = fromComparador;
|
const dataFromComparador = fromComparador;
|
||||||
|
|
||||||
if (Object.keys(input_data).length == 0) {
|
if (Object.keys(input_data).length == 0) {
|
||||||
@ -1406,7 +1438,7 @@ class LineasPresupuesto {
|
|||||||
if (linea == 'lp_cubierta') {
|
if (linea == 'lp_cubierta') {
|
||||||
input_data.paginas = parseInt($('#lp_cubierta_paginas option:selected').val());
|
input_data.paginas = parseInt($('#lp_cubierta_paginas option:selected').val());
|
||||||
}
|
}
|
||||||
else if (linea == 'lp_sobrecubierta') {
|
else if (linea == 'lp_sobrecubierta' || linea == 'lp_faja') {
|
||||||
input_data.paginas = 4;
|
input_data.paginas = 4;
|
||||||
}
|
}
|
||||||
else if (linea == 'lp_guardas') {
|
else if (linea == 'lp_guardas') {
|
||||||
@ -1433,6 +1465,7 @@ class LineasPresupuesto {
|
|||||||
uso = 'cubierta';
|
uso = 'cubierta';
|
||||||
break;
|
break;
|
||||||
case 'lp_sobrecubierta':
|
case 'lp_sobrecubierta':
|
||||||
|
case 'lp_faja':
|
||||||
uso = 'sobrecubierta';
|
uso = 'sobrecubierta';
|
||||||
break;
|
break;
|
||||||
case 'lp_guardas':
|
case 'lp_guardas':
|
||||||
@ -1453,7 +1486,6 @@ class LineasPresupuesto {
|
|||||||
hq = 0;
|
hq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var datos = {
|
var datos = {
|
||||||
tipo_impresion_id: $('#tipo_impresion_id').val(),
|
tipo_impresion_id: $('#tipo_impresion_id').val(),
|
||||||
type: uso,
|
type: uso,
|
||||||
@ -1496,6 +1528,11 @@ class LineasPresupuesto {
|
|||||||
datos.solapas_ancho = $('#solapas_sobrecubierta').is(':checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
datos.solapas_ancho = $('#solapas_sobrecubierta').is(':checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
||||||
datos.lomo = $('#lomo_sobrecubierta').val();
|
datos.lomo = $('#lomo_sobrecubierta').val();
|
||||||
}
|
}
|
||||||
|
else if (linea == 'lp_faja') {
|
||||||
|
datos.solapas = 1;
|
||||||
|
datos.solapas_ancho = parseInt($('#faja_solapas_ancho').val());
|
||||||
|
datos.lomo = $('#lomo_sobrecubierta').val();
|
||||||
|
}
|
||||||
else if (linea == 'lp_guardas') {
|
else if (linea == 'lp_guardas') {
|
||||||
datos.paginas_impresion = input_data.paginas_impresion;
|
datos.paginas_impresion = input_data.paginas_impresion;
|
||||||
}
|
}
|
||||||
@ -1503,7 +1540,7 @@ class LineasPresupuesto {
|
|||||||
|
|
||||||
// Si es inkjet, existe este check
|
// Si es inkjet, existe este check
|
||||||
if ($('#' + linea + '_aFavorFibra').length) {
|
if ($('#' + linea + '_aFavorFibra').length) {
|
||||||
datos.a_favor_fibra = $('#' + linea + '_aFavorFibra').prop('checked') ? 1: 0;
|
datos.a_favor_fibra = $('#' + linea + '_aFavorFibra').prop('checked') ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatedTipologias && $('#' + linea + '_gotaNegro').length) {
|
if (updatedTipologias && $('#' + linea + '_gotaNegro').length) {
|
||||||
@ -1549,6 +1586,9 @@ class LineasPresupuesto {
|
|||||||
response.lineas[$i].fields.check_papel_total = 1;
|
response.lineas[$i].fields.check_papel_total = 1;
|
||||||
response.lineas[$i].fields.check_impresion_total = 1;
|
response.lineas[$i].fields.check_impresion_total = 1;
|
||||||
}
|
}
|
||||||
|
if (linea == 'lp_faja') {
|
||||||
|
response.lineas[$i].fields.alto_faja = dimension.alto;
|
||||||
|
}
|
||||||
self.rellenarDatosLinea(linea, response.lineas[$i].fields);
|
self.rellenarDatosLinea(linea, response.lineas[$i].fields);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1583,7 +1623,7 @@ class LineasPresupuesto {
|
|||||||
papel_impresion_id: row.papelImpresionId,
|
papel_impresion_id: row.papelImpresionId,
|
||||||
maquina_id: row.maquinaId,
|
maquina_id: row.maquinaId,
|
||||||
}
|
}
|
||||||
if(linea.includes('guardas')) {
|
if (linea.includes('guardas')) {
|
||||||
input_data.paginas_impresion = parseInt($('#compCarasGuardas').select2('data')[0].id);
|
input_data.paginas_impresion = parseInt($('#compCarasGuardas').select2('data')[0].id);
|
||||||
}
|
}
|
||||||
this.obtenerLinea(linea, fromComparator, false, input_data)
|
this.obtenerLinea(linea, fromComparator, false, input_data)
|
||||||
@ -1602,7 +1642,13 @@ class LineasPresupuesto {
|
|||||||
this.table.row.add(data).draw()
|
this.table.row.add(data).draw()
|
||||||
currentRow = this.table.row('#' + linea);
|
currentRow = this.table.row('#' + linea);
|
||||||
}
|
}
|
||||||
currentRow.child(this.formatRow(currentRow.data())).show();
|
|
||||||
|
let datosLinea = currentRow.data();
|
||||||
|
if(linea == 'lp_faja') {
|
||||||
|
datosLinea.alto_faja = row.alto_faja;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentRow.child(this.formatRow(datosLinea)).show();
|
||||||
|
|
||||||
this.#addEventosLineas(linea, data.maquinaTipo == 'inkjet' ? true : false);
|
this.#addEventosLineas(linea, data.maquinaTipo == 'inkjet' ? true : false);
|
||||||
|
|
||||||
@ -1615,16 +1661,16 @@ class LineasPresupuesto {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).trigger('update-presupuesto', {
|
$(document).trigger('update-presupuesto', {
|
||||||
update_lineas : false,
|
update_lineas: false,
|
||||||
update_servicios : true,
|
update_servicios: true,
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Si existe cubierta, hay que actualizar con el valor del lomo
|
// Si existe cubierta, hay que actualizar con el valor del lomo
|
||||||
if (linea != 'lp_cubierta' && linea != 'lp_sobrecubierta' && this.table.row('#lp_cubierta').length > 0) {
|
if (linea != 'lp_cubierta' && linea != 'lp_sobrecubierta' && linea != 'lp_faja' && this.table.row('#lp_cubierta').length > 0) {
|
||||||
this.obtenerLinea('lp_cubierta', false, false);
|
this.obtenerLinea('lp_cubierta', false, false);
|
||||||
}
|
}
|
||||||
if (mostrar_calculos) {
|
if (mostrar_calculos) {
|
||||||
@ -1666,6 +1712,7 @@ class LineasPresupuesto {
|
|||||||
uso = 'cubierta';
|
uso = 'cubierta';
|
||||||
break;
|
break;
|
||||||
case 'lp_sobrecubierta':
|
case 'lp_sobrecubierta':
|
||||||
|
case 'lp_faja':
|
||||||
uso = 'sobrecubierta';
|
uso = 'sobrecubierta';
|
||||||
break;
|
break;
|
||||||
case 'lp_guardas':
|
case 'lp_guardas':
|
||||||
@ -1765,6 +1812,12 @@ class LineasPresupuesto {
|
|||||||
$('#' + tipoLinea + '_defecto').on("click", () => { this.lp_por_defecto(tipoLinea); });
|
$('#' + tipoLinea + '_defecto').on("click", () => { this.lp_por_defecto(tipoLinea); });
|
||||||
$('#' + tipoLinea + '_aFavorFibra').on("change", () => { this.change_aFavorFibra(tipoLinea); });
|
$('#' + tipoLinea + '_aFavorFibra').on("change", () => { this.change_aFavorFibra(tipoLinea); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tipoLinea == 'lp_faja') {
|
||||||
|
$('#' + tipoLinea + '_altoFaja').on("change", function (event) {
|
||||||
|
self.obtenerLinea(tipoLinea, false, false, {}, event); // Pasamos explícitamente 'tipoLinea'
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1922,19 +1975,36 @@ class LineasPresupuesto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.table.draw();
|
self.table.draw();
|
||||||
|
|
||||||
var rows = $("#tableCompGuardas").DataTable().rows('.selected').data().toArray();
|
var rows = $("#tableCompGuardas").DataTable().rows('.selected').data().toArray();
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
this.rellenarDatosLinea('lp_guardas', row, true);
|
this.rellenarDatosLinea('lp_guardas', row, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).trigger('add-servicio-lineas', 'plegado_guardas');
|
$(document).trigger('add-servicio-lineas', 'plegado_guardas');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (e.target.id.includes("Faja")) {
|
||||||
|
|
||||||
|
for (let i = self.table.rows().data().length - 1; i >= 0; i--) {
|
||||||
|
let row = self.table.row(i).data(); // Obtener datos de la fila actual
|
||||||
|
|
||||||
|
if (row.row_id.includes('lp_faja')) {
|
||||||
|
self.table.row(i).remove(); // Eliminar fila
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.table.draw();
|
||||||
|
|
||||||
|
var rows = $("#tableCompFaja").DataTable().rows('.selected').data().toArray();
|
||||||
|
for (const row of rows) {
|
||||||
|
this.rellenarDatosLinea('lp_faja', row, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).trigger('update-presupuesto', {
|
$(document).trigger('update-presupuesto', {
|
||||||
update_lineas : false,
|
update_lineas: false,
|
||||||
update_servicios : true,
|
update_servicios: true,
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class TiradasAlernativas {
|
|||||||
const self = this;
|
const self = this;
|
||||||
const id = window.location.href.split('/').pop();
|
const id = window.location.href.split('/').pop();
|
||||||
|
|
||||||
const tirada = tiradaExterna === null ? parseInt(this.tirada.val()) : tiradaExterna;
|
const tirada = tiradaExterna === null || isNaN(tiradaExterna) ? parseInt(this.tirada.val()) : tiradaExterna;
|
||||||
const tirada_ejemplo = parseInt($('#tirada').val());
|
const tirada_ejemplo = parseInt($('#tirada').val());
|
||||||
const POD = parseInt($('#POD').val());
|
const POD = parseInt($('#POD').val());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user