mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Realizadas todas la modificaciones solicitadas por @jm
This commit is contained in:
@ -116,7 +116,7 @@
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="alto" class="form-label">
|
||||
<label id="labelAlto" for="alto" class="form-label">
|
||||
<?= lang('PapelImpresion.alto') ?>*
|
||||
</label>
|
||||
<input type="number" id="alto" name="alto" required maxLength="8" step="0.01" class="form-control" value="<?= old('alto', $papelImpresion->alto) ?>">
|
||||
@ -139,10 +139,10 @@
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="precioPliego" class="form-label">
|
||||
<label id="labelPrecioPliego" for="precioPliego" class="form-label">
|
||||
<?= lang('PapelImpresion.precioPliego') ?>
|
||||
</label>
|
||||
<input readonly style="background-color:#d6d6d6; id="precioPliego" name="precio_pliego" required maxLength="31" class="form-control" value="<?= old('precio_pliego', $papelImpresion->precio_pliego) ?>">
|
||||
<input readonly style="background-color:#d6d6d6;" id="precioPliego" name="precio_pliego" required maxLength="31" class="form-control" value="<?= old('precio_pliego', $papelImpresion->precio_pliego) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
|
||||
@ -124,6 +124,38 @@
|
||||
id = -1;
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '#rotativa', function(e) {
|
||||
updateForRotativa();
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
updateForRotativa();
|
||||
});
|
||||
|
||||
function updateForRotativa(){
|
||||
let label = document.getElementById('labelAlto');
|
||||
let field = document.getElementById('alto');
|
||||
let labelPrecio = document.getElementById('labelPrecioPliego');
|
||||
if($("#rotativa").is(":checked")) {
|
||||
labelPrecio.innerHTML = '<?= lang('PapelImpresion.precioMetro') ?>';
|
||||
label.innerHTML = '<?= lang('PapelImpresion.alto') ?>';
|
||||
field.readOnly = true;
|
||||
field.style.backgroundColor = "#d6d6d6";
|
||||
field.value = '0';
|
||||
updateValue();
|
||||
}
|
||||
else{
|
||||
labelPrecio.innerHTML = '<?= lang('PapelImpresion.precioPliego') ?>';
|
||||
label.innerHTML = '<?= lang('PapelImpresion.alto') ?>*';
|
||||
field.readOnly = false;
|
||||
field.style.backgroundColor = "white";
|
||||
updateValue();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const lastColNr = $('#tableOfPapelimpresiontipologias').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
@ -465,7 +497,9 @@
|
||||
});
|
||||
|
||||
$("#alto").on('input', function () {
|
||||
updateValue();
|
||||
if(!$('#rotativa').is(':checked')){
|
||||
updateValue();
|
||||
}
|
||||
});
|
||||
|
||||
$("#gramaje").on('input', function () {
|
||||
@ -477,12 +511,18 @@
|
||||
});
|
||||
|
||||
function updateValue() {
|
||||
let value = parseFloat($("#gramaje").val()) * parseFloat($("#ancho").val())*parseFloat($("#alto").val())/1E6;
|
||||
let value;
|
||||
if($("#rotativa").is(":checked")) {
|
||||
value = parseFloat($("#gramaje").val()) * parseFloat($("#ancho").val())*1000/1E6;
|
||||
}
|
||||
else{
|
||||
value = parseFloat($("#gramaje").val()) * parseFloat($("#ancho").val())*parseFloat($("#alto").val())/1E6;
|
||||
}
|
||||
value = value.toFixed(2);
|
||||
$('#pesoPorPliego').val(value);
|
||||
let value2 = parseFloat($("#precioTonelada").val()) *value/1E6;
|
||||
value2 = value2.toFixed(6);
|
||||
$('#preciopliego').val(value2);
|
||||
$('#precioPliego').val(value2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user