trabajando en el comparador de las guardas

This commit is contained in:
2024-02-08 20:14:45 +01:00
parent aa851469af
commit 733e1b6a26
7 changed files with 284 additions and 18 deletions

View File

@ -215,6 +215,44 @@
</div>
</div>
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
<div class="row">
<div class="col-md-12 col-lg-2 px-4">
<p><?= lang('PapelImpresion.guardas') ?></p>
</div>
<div class="col-md-12 col-lg-2 px-4">
<select id="compCarasGuardas" name="comp_paginas_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
<option value="0">
<p><?= lang('Presupuestos.sinImpresion') ?></p>
</option>
<option value="4">
<p><?= lang('Presupuestos.1cara') ?></p>
</option>
<option value="8">
<p><?= lang('Presupuestos.2caras') ?></p>
</option>
</select>
</div>
<div class="col-md-12 col-lg-6 px-4">
<select id="compPapelGuardas" name="comp_papel_guardas" class="form-control select2bs2 comp_guardas_items" style="width: 100%;">
<?php if (isset($papelGenericoGuardasList) && is_array($papelGenericoGuardasList) && !empty($papelGenericoGuardasList)) :
foreach ($papelGenericoGuardasList as $k => $v) : ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-md-12 col-lg-2 px-4">
<input readonly type="text" id="compGramajeGuardas" name="comp_gramaje_guardas" placeholder="0" maxLength="5" class="form-control comp_guardas_items" value='170'>
</div>
<div>
<hr class="my-1">
</div>
</div>
<?php endif; ?>
<!----------------------------------------------------------------------------->
<div class="divider divider-dark text-start mb-1 comp-color-selected">
@ -422,6 +460,66 @@
</div>
</div>
<!----------------------------------------------------------------------------->
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
<div class="accordion mt-3" id="accordionCompGuardas">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button id="accordion-button-int-guardas" type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionCompGuardasTip" aria-expanded="false" aria-controls="accordionCompGuardasTip">
<h6 id="title_guardas"><?= lang("Presupuestos.Guardas") ?></h6>
</button>
</h2>
<div id="accordionCompGuardasTip" class="accordion-collapse collapse" data-bs-parent="#accordionCompGuardasTip">
<div class="accordion-body">
<table id="tableCompGuardas" 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.Guardas") ?>:</td>
<td id="total_comp_guardas" class="dt-result dt-result-value" colspan="2"> 0.00 </td>
</tr>
</tfoot>
</table>
<div >
<button type="button" name="insertarGuardasBtn"
id="insertarGuardasBtn"
class="btn btn-primary float-end me-sm-3 me-1 mb-3 insertarLinea d-none">
<?= lang('Presupuestos.insertarLinea').' '.strtoupper(lang('Presupuestos.Guardas')) ?>
</button>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
</div> <!-- //.accordion-body -->
@ -580,11 +678,22 @@
allowClear: false,
});
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
$('#compCarasCubierta').select2({
allowClear: false,
minimumResultsForSearch: Infinity,
});
$('#compPapelGuardas').select2({
allowClear: false,
});
<?php endif; ?>
$('#compCarasGuardas').select2({
allowClear: false,
minimumResultsForSearch: Infinity,
});
updatePapelesComparador();
const paginasColor = document.getElementById('compCalPaginasColor');
if (paginasColor.value.length > 0) {
@ -827,6 +936,129 @@
]
});
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
var tableCompGuardas = new DataTable('#tableCompGuardas',{
scrollX: true,
searching: false,
paging: false,
info: false,
ordering: false,
responsive: true,
select: false,
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
columns: [
{ 'data': 'tipo',
'render': function ( data, type, row, meta ) {
return '<?= lang('Presupuestos.Guardas') ?>';
}
},
{ '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
},
]
});
function checkComparadorGuardas(actualizarLinea = false){
if ($('#compPapelGuardas').select2('data').length > 0 ){
const dimension = getDimensionLibro();
let datos = {
tipo_impresion_id: <?php echo $tipo_impresion_id ?>,
type: 'guardas',
paginas: 8,
paginas_impresion: parseInt($('#compCarasGuardas').select2('data')[0].id),
tirada: parseInt($('#tirada').val()),
merma: parseInt($('#mermacubierta').val()),
color: 1,
hq: 1,
ancho: dimension.ancho,
alto: dimension.alto,
papel_generico_id: $('#compPapelGuardas').select2('data')[0].id,
papel_generico: $('#compPapelGuardas').select2('data')[0].text.trim(),
gramaje: parseInt($('#compGramajeGuardas').val()),
cliente_id: $('#clienteId').find(":selected").val(),
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
$.ajax({
type: "POST",
url: "/cosidotapablanda/datatable",
data: datos,
success: function (data) {
clearGuardas();
if(data.lineas.length >0){
/*
fillCubierta(data);
selectCubiertaLineas();
$('#title_cubierta').html('<?= lang("Presupuestos.cubierta") ?>' + ' (' + tableCompCubierta.rows().count() + ')');
$('#insertarCubiertaBtn').removeClass('d-none')
if(actualizarLinea){
var rows = $("#tableCompCubierta").DataTable().rows( '.selected' ).data().toArray();
for(row of rows){
fill_lp_cubierta(row, true);
}
}
*/
}
else{
$('#title_guardas').html('<?= lang("Presupuestos.Guardas") ?>');
$('#insertarGuardasBtn').addClass('d-none')
$('#total_comp_guardas').html('0.00')
}
yeniden(data.<?= csrf_token() ?>);
return true;
},
error: function(e){
return false;
}
})
}
else{
clearGuardas();
}
}
$('.comp_guardas_items').on('change', function (e) {
checkComparadorGuardas(false,false);
});
<?php endif; ?>
async function getLineasIntPlana(is_color, is_hq, actualizarLinea){
@ -1049,6 +1281,8 @@
}
}
$('.comp_negro_items').on('change', function (e) {
checkComparadorInt(false,false);

View File

@ -328,6 +328,12 @@ function clearCubierta() {
}
function clearGuardas() {
$('#tableCompGuardas').DataTable().clear().draw();
$('#insertarGuardasBtn').css('display', 'none');
}
function clearIntRot() {
$('#errorComRot').html('');