calculado nueva tinta solo para color a espera de confirmar si es para negro tambien

This commit is contained in:
2024-02-05 22:51:51 +01:00
parent f84c652967
commit 8c25614b7c
13 changed files with 125 additions and 33 deletions

View File

@ -174,13 +174,9 @@
</div>
</div>
<?php if ($maquina->is_rotativa == false && $maquina->is_inkjet == false): ?>
<div class="row" id="datosRotativa" style="display:none">
<?php else: ?>
<div class="row" id="datosRotativa">
<?php endif; ?>
<div class="col-md-2">
<div class="row">
<div class="col-md-2 datosRotativa datosInkjet" style="display: none;">
<label for="precioTintaNegro" class="form-label">
<?= lang('Maquinas.precioTintaNegro') ?>
</label>
@ -188,7 +184,7 @@
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_tinta_negro', $maquina->precio_tinta_negro) ?>">
</div>
<div class="col-md-2">
<div class="col-md-2 datosRotativa datosInkjet" style="display: none;">
<label for="precioTintaColor" class="form-label">
<?= lang('Maquinas.precioTintaColor') ?>
</label>
@ -197,7 +193,16 @@
value="<?= old('precio_tinta_color', $maquina->precio_tinta_color) ?>">
</div>
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
<div class="col-md-2 datosInkjet" style="display: none;">
<label for="precioTintaCG" class="form-label">
<?= lang('Maquinas.precioTintaCG') ?>
</label>
<input type="number" id="precioTintaCG" name="precio_tinta_cg" placeholder="0.00"
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_tinta_cg', $maquina->precio_tinta_cg) ?>">
</div>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="velocidadCorte" class="form-label">
<?= lang('Maquinas.velocidadCorte') ?>
</label>
@ -205,7 +210,7 @@
step="0.01" class="form-control"
value="<?= old('velocidad_corte', $maquina->velocidad_corte) ?>">
</div>
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="precioHoraCorte" class="form-label">
<?= lang('Maquinas.precioHoraCorte') ?>
</label>
@ -213,7 +218,7 @@
maxLength="8" step="0.01" class="form-control"
value="<?= old('precio_hora_corte', $maquina->precio_hora_corte) ?>">
</div>
<div class="col-md-2" <?= ($maquina->is_rotativa == false)?' style="display:none"':""; ?>>
<div class="col-md-2 datosRotativa" style="display: none;">
<label for="metrosxminuto" class="form-label">
<?= lang('Maquinas.metrosxminuto') ?>
</label>

View File

@ -147,6 +147,20 @@
<?= $this->section("additionalInlineJs") ?>
<?php if($maquina->is_rotativa) { ?>
$(".datosInkjet").css('display', 'none');
$(".datosRotativa").css('display', 'inline');
<?php } ?>
<?php if($maquina->is_inkjet) { ?>
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'inline');
<?php } ?>
<?php if(!$maquina->is_inkjet && !$maquina->is_rotativa){ ?>
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'none');
<?php } ?>
const lastColNr2 = $('#tableOfPapelesImpresion').find("tr:first th").length - 1;
const actionBtns2 = function(data) {
return `
@ -173,13 +187,6 @@
isRotativa = watch(0);
$(document).ready(function () {
if($(this).is(':checked')){
$("#datosRotativa").show();
}
});
$('#isRotativa').on("click",function(el){
asyncConfirmDialog('<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
'<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>', yesCallback, noCallback);
@ -187,20 +194,19 @@
function yesCallback() {
if($('#isRotativa').is(':checked')){
isRotativa.watch = 1;
$("#datosRotativa").show();
$(".datosInkjet").css('display', 'none');
$('#isTinta').prop("checked", 0);
$(".datosRotativa").css('display', 'inline');
}else{
document.getElementById("precioTintaNegro").value = 0;
document.getElementById("precioTintaColor").value = 0;
document.getElementById("velocidadCorte").value = 0;
document.getElementById("precioHoraCorte").value = 0;
document.getElementById("metrosxminuto").value = 0;
$("#datosRotativa").hide();
isRotativa.watch = 0;
$(".datosRotativa").css('display', 'none');
}
theTable2.clearPipeline();
theTable2.draw();
//yeniden(response.<?= csrf_token() ?>); esto da error JJO?
updatePapeles()
}
function noCallback() {
@ -208,16 +214,38 @@
$('#isRotativa').prop("checked", !$('#isRotativa').prop("checked"));
}
$('#isRotativa').on('change', function(){
updatePapeles()
$('#isTinta').on('click', function(){
asyncConfirmDialog('<?= lang('MaquinasPapelImpresion.sureToChangeRotativaTitle') ?>',
'<?= lang('MaquinasPapelImpresion.sureToChangeRotativaText') ?>', yesCallbackInkjet, noCallbackInkjet);
})
$('#isTinta').on('change', function(){
function yesCallbackInkjet() {
if($('#isTinta').is(':checked')){
$(".datosRotativa").css('display', 'none');
$(".datosInkjet").css('display', 'inline');
$('#isRotativa').prop("checked", 0);
}else{
document.getElementById("precioTintaNegro").value = 0;
document.getElementById("precioTintaColor").value = 0;
document.getElementById("velocidadCorte").value = 0;
document.getElementById("precioHoraCorte").value = 0;
document.getElementById("metrosxminuto").value = 0;
$(".datosInkjet").css('display', 'inline');
}
updatePapeles()
})
}
function noCallbackInkjet() {
// Toggle behaviour
$('#isTinta').prop("checked", !$('#isTinta').prop("checked"));
}
function updatePapeles(){
yeniden(json.<?= csrf_token() ?>);
//yeniden(json.<?= csrf_token() ?>);
$.ajax({
url: '<?= route_to('updateMaquinaPapelOnTarifasChange') ?>',

View File

@ -79,6 +79,7 @@
<th><?= lang('ImpresionTipologias.cyan') ?></th>
<th><?= lang('ImpresionTipologias.magenta') ?></th>
<th><?= lang('ImpresionTipologias.amarillo') ?></th>
<th><?= lang('ImpresionTipologias.cg') ?></th>
<th><?= lang('ImpresionTipologias.gotaNegro') ?></th>
<th><?= lang('ImpresionTipologias.gotaColor') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
@ -449,6 +450,12 @@
type: "number"
}
},{
name: "cg",
attr: {
type: "number"
}
},
{
name: "gota_negro",
attr: {
type: "number"
@ -466,7 +473,6 @@
} );
// Definición de la tabla
theTable = $('#tableOfPapelimpresiontipologias').DataTable({
processing: true,
@ -507,11 +513,18 @@
{ 'data': 'cyan' },
{ 'data': 'magenta' },
{ 'data': 'amarillo' },
{ 'data': 'cg' },
{ 'data': 'gota_negro' },
{ 'data': 'gota_color' },
{ data: actionBtns,
className: 'row-edit dt-center'}
],
columnDefs: [
{
visible: false,
targets: [5]
}
],
buttons: [ {
className: 'btn btn-primary float-end me-sm-3 me-1',
extend: "createInline",
@ -520,7 +533,12 @@
submitTrigger: -1,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
}
} ]
} ],
initComplete: function () {
<?php if($papelImpresion->inkjet) { ?>
theTable.column(5).visible(true)
<?php } ?>
}
});