mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'add/solapas_maximas_admin' into 'main'
Add/solapas maximas admin See merge request jjimenez/safekat!501
This commit is contained in:
@ -694,7 +694,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$excluirRotativa = intval($excluirRotativa);
|
||||
|
||||
$tipo = $reqData['tipo'];
|
||||
$tipo = $reqData['tipo'] ??'cosido';
|
||||
$tipoCubierta = 'blanda'; // solapas sólo tapa blanda y sobre cubierta
|
||||
|
||||
$isColor = intval($reqData['isColor']) ?? 0;
|
||||
|
||||
@ -107,7 +107,18 @@
|
||||
for="solapas"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||
</div>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mb-1 solapas-cubierta-div d-none" id="div_solapas_ancho">
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="0"
|
||||
maxLength="8" step="1" class="form-control solapas_cubierta" value="">
|
||||
<div class="form-text">
|
||||
Entre 60 y 120 mm
|
||||
</div>
|
||||
</div><!--//.mb-1 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -122,6 +133,19 @@
|
||||
</div>
|
||||
</div><!--//.mb-3 -->
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mb-1 solapas-sobrecubierta-div d-none" id="div_solapas_ancho_sobrecubierta">
|
||||
<label for="solapas_ancho_sobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho_sobrecubierta" name="solapas_ancho_sobrecubierta"
|
||||
placeholder="60" min="60" maxLength="8" step="1"
|
||||
class="form-control solapas_sobrecubierta" value="">
|
||||
<div class="form-text">
|
||||
Entre 60 y 120 mm
|
||||
</div>
|
||||
</div><!--//.mb-1 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-6 px-4">
|
||||
@ -138,32 +162,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Fila 3 -->
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-1 solapas-cubierta-div d-none" id="div_solapas_ancho">
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoCubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho" name="solapas_ancho" placeholder="0" maxLength="8"
|
||||
step="1" class="form-control solapas_cubierta" value="">
|
||||
</div><!--//.mb-1 -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-1 solapas-sobrecubierta-div d-none" id="div_solapas_ancho_sobrecubierta">
|
||||
<label for="solapas_ancho_sobrecubierta" class="form-label">
|
||||
<?= lang('Presupuestos.solapasAnchoSobrecubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="solapas_ancho_sobrecubierta" name="solapas_ancho_sobrecubierta"
|
||||
placeholder="60" min="60" maxLength="8" step="1"
|
||||
class="form-control solapas_sobrecubierta" value="">
|
||||
</div><!--//.mb-1 -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
|
||||
@ -258,8 +258,7 @@
|
||||
paging: true,
|
||||
info: false,
|
||||
stateSave: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l>
|
||||
<t><"mt-4 mb-3"p>',
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('tarifaAcabadoLineasDT') ?>',
|
||||
data: {
|
||||
|
||||
@ -173,8 +173,7 @@
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l>
|
||||
<t><"mt-4 mb-3"p>',
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfTarifaManipuladoLineas') ?>',
|
||||
data: {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/datatables") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section("content") ?>
|
||||
@ -26,25 +27,6 @@
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
<?php if(str_contains($formAction, 'edit')): ?>
|
||||
|
||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||
<div class="card accordion-item active">
|
||||
<h2 class="accordion-header" id="headingTwo">
|
||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||
<h3>Tarifa máquinas</h3>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||
<div class="accordion-body">
|
||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifapreimpresionEntity?->id]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- //.accordion -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/preimpresion/index.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -367,6 +367,8 @@ class PresupuestoAdminEdit {
|
||||
|
||||
}, 0);
|
||||
|
||||
this.calcularSolapas();
|
||||
|
||||
// Funciones para detectar cambios en el formulario
|
||||
this.#checkChangesPresupuesto();
|
||||
$('#bc-save').on("click", function () {
|
||||
@ -387,15 +389,13 @@ class PresupuestoAdminEdit {
|
||||
|
||||
let cantidad_total = 0;
|
||||
|
||||
// TO-DO
|
||||
/*
|
||||
tableLineasPresupuesto.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
this.lineasPresupuesto.table.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">
|
||||
@ -408,8 +408,64 @@ class PresupuestoAdminEdit {
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)*/
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
|
||||
getPaginasColor() {
|
||||
|
||||
let paginasColor = 0;
|
||||
this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
if (rowData.row_id === 'lp_color' || rowData.row_id === 'lp_colorhq') {
|
||||
return parseInt(rowData.paginas);
|
||||
}
|
||||
if (rowData.row_id === 'lp_rot_color') {
|
||||
return parseInt(rowData.numPagColor);
|
||||
}
|
||||
});
|
||||
return paginasColor;
|
||||
}
|
||||
|
||||
calcularSolapas() {
|
||||
|
||||
let anchoTotal = 2*this.getDimensionLibro().ancho;
|
||||
let maxSolapas = 120;
|
||||
|
||||
let mano = 0;
|
||||
this.lineasPresupuesto.table.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' || rowData.row_id === 'lp_faja'
|
||||
) {
|
||||
mano += parseInt(rowData.mano);
|
||||
}
|
||||
});
|
||||
|
||||
if (mano > 0) {
|
||||
anchoTotal += 6 + 5; // dobleces + sangre
|
||||
maxSolapas = Math.min(Math.floor((865-anchoTotal)/2), 0.75*this.getDimensionLibro().ancho);
|
||||
}
|
||||
else{
|
||||
maxSolapas = 0.75*this.getDimensionLibro().ancho;
|
||||
}
|
||||
if($('#solapas_ancho').length>0 && $('#solapas_ancho').attr('max') != maxSolapas){
|
||||
$('#solapas_ancho').attr('max', maxSolapas);
|
||||
$('#solapas_ancho').trigger('change');
|
||||
$('#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){
|
||||
$('#solapas_ancho_sobrecubierta').attr('max', maxSolapas);
|
||||
$('#solapas_ancho_sobrecubierta').trigger('change');
|
||||
$('#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){
|
||||
$('#solapas_ancho_faja').attr('max', maxSolapas);
|
||||
$('#solapas_ancho_faja').trigger('change');
|
||||
$('#solapas_ancho_faja').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||
}
|
||||
console.log('maxSolapas', maxSolapas);
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
@ -95,6 +95,24 @@ class DatosLibro {
|
||||
|
||||
this.paginas.on('change', this.changePaginas.bind(this));
|
||||
this.tirada.on('change', this.changeTirada.bind(this));
|
||||
|
||||
this.anchoSolapasCubierta.on('focusout', this.checkSolapasMax.bind(this));
|
||||
this.anchoSolapasSobrecubierta.on('focusout', this.checkSolapasMax.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
checkSolapasMax(event) {
|
||||
const el = event.target;
|
||||
if (el.value != "") {
|
||||
if (parseInt(el.value) < parseInt(el.min)) {
|
||||
el.value = el.min;
|
||||
}
|
||||
if (parseInt(el.value) > parseInt(el.max)) {
|
||||
el.value = el.max;
|
||||
}
|
||||
}
|
||||
else{
|
||||
el.value = el.min;
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,8 +190,8 @@ class DatosLibro {
|
||||
this.checkPaginasPresupuesto();
|
||||
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas : true,
|
||||
update_servicios : true,
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
@ -199,10 +217,10 @@ class DatosLibro {
|
||||
$("#label_papelFormatoId").text(
|
||||
window.language.Presupuestos.papelFormatoId + '*');
|
||||
}
|
||||
|
||||
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas : true,
|
||||
update_servicios : false,
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
@ -225,20 +243,20 @@ class DatosLibro {
|
||||
}, 100);
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('paginas').trigger('change');
|
||||
this.updateComparador();
|
||||
}
|
||||
|
||||
changeAnchoSolapasCubierta(){
|
||||
changeAnchoSolapasCubierta() {
|
||||
|
||||
if(this.checkSolapasGrandes('cubierta')){
|
||||
if (this.checkSolapasGrandes('cubierta')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_cubierta');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_cubierta');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('paginas').trigger('change');
|
||||
this.updateComparador();
|
||||
}
|
||||
|
||||
|
||||
@ -259,39 +277,39 @@ class DatosLibro {
|
||||
}
|
||||
|
||||
|
||||
changeAnchoSolapasSobrecubierta(){
|
||||
changeAnchoSolapasSobrecubierta() {
|
||||
|
||||
if(this.checkSolapasGrandes('cubierta')){
|
||||
if (this.checkSolapasGrandes('cubierta')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
$('paginas').trigger('change');
|
||||
this.updateComparador();
|
||||
|
||||
}
|
||||
|
||||
checkSolapasGrandes(elemento) {
|
||||
|
||||
|
||||
const ancho_libro = 2 * this.getDimensionLibro().ancho;
|
||||
let ancho_solapas = 0.0;
|
||||
let lomo = 0.0;
|
||||
if(elemento == 'cubierta'){
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho').val());
|
||||
lomo = parseFloat($('lomo_cubierta').val());
|
||||
if (elemento == 'cubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho').val());
|
||||
lomo = parseFloat($('lomo_cubierta').val());
|
||||
}
|
||||
else if (elemento == 'sobrecubierta'){
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('lomo_sobrecubierta').val());
|
||||
else if (elemento == 'sobrecubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('lomo_sobrecubierta').val());
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
|
||||
if (ancho_libro + ancho_solapas + lomo > 630)
|
||||
if (ancho_libro + ancho_solapas + lomo > 630)
|
||||
return true;
|
||||
else
|
||||
else
|
||||
return false
|
||||
}
|
||||
|
||||
@ -320,35 +338,54 @@ class DatosLibro {
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas : true,
|
||||
update_servicios : true,
|
||||
update_lineas: true,
|
||||
update_servicios: true,
|
||||
update_envios: true,
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
updateComparador() {
|
||||
|
||||
if ($("#compPaginasNegro").hasClass('d-none')) {
|
||||
$('#compPaginasNegrohq').trigger('change');
|
||||
}
|
||||
else {
|
||||
$('#compPaginasNegro').trigger('change');
|
||||
}
|
||||
$('#compCarasCubierta').trigger('change');
|
||||
|
||||
if ($('#compSobrecubierta').length) {
|
||||
$('#compSobrecubierta').trigger('change');
|
||||
}
|
||||
if ($('#compCarasGuardas').length) {
|
||||
$('#compCarasGuardas').trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
changeTirada(update_tiradas_alternativas = true) {
|
||||
|
||||
this.calcular_mermas()
|
||||
this.calcular_mermas();
|
||||
|
||||
this.updateComparador();
|
||||
|
||||
const url2 = window.location.href;
|
||||
const url_parts2 = url2.split('/');
|
||||
|
||||
if (url_parts2[url_parts2.length - 2] == 'edit') {
|
||||
$(document).trigger('update-presupuesto', {
|
||||
update_lineas : true,
|
||||
update_servicios : false,
|
||||
update_lineas: true,
|
||||
update_servicios: false,
|
||||
update_envios: false,
|
||||
update_resumen: false,
|
||||
update_tiradas_alternativas: false
|
||||
});
|
||||
|
||||
|
||||
$(document).trigger('ckeck-lineas-envios');
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ class Envios {
|
||||
|
||||
$("#costeEnvios").text(total.toFixed(2) + "€" || "0€");
|
||||
|
||||
self.check_unidades_enviadas();
|
||||
self.check_unidades_enviadas(null, self.recogerTaller.prop('checked'));
|
||||
}
|
||||
|
||||
});
|
||||
@ -169,11 +169,10 @@ class Envios {
|
||||
self.modalYesNo.init();
|
||||
self.modalYesNo.show(() => {
|
||||
self.table.clear().draw();
|
||||
self.check_unidades_enviadas();
|
||||
self.check_unidades_enviadas(null, true);
|
||||
self.recogerTaller.prop('checked', true);
|
||||
self.modalYesNo.hide();
|
||||
self.insertarEnvio.addClass('d-none');
|
||||
|
||||
self.modalYesNo.hide();
|
||||
});
|
||||
}
|
||||
else {
|
||||
@ -641,7 +640,11 @@ class Envios {
|
||||
}
|
||||
}
|
||||
|
||||
check_unidades_enviadas() {
|
||||
check_unidades_enviadas(event, recogerTaller = null) {
|
||||
|
||||
if(recogerTaller === null) {
|
||||
recogerTaller = this.recogerTaller.prop('checked');
|
||||
}
|
||||
|
||||
let cantidad_total = 0
|
||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
@ -650,7 +653,7 @@ class Envios {
|
||||
|
||||
const tirada = parseInt($('#tirada').val());
|
||||
let htmlString = '';
|
||||
if (cantidad_total < tirada && this.recogerTaller.prop('checked') === false) {
|
||||
if (cantidad_total < tirada && recogerTaller === false) {
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
|
||||
@ -320,7 +320,9 @@ class ServiciosAcabado {
|
||||
},
|
||||
{
|
||||
data: 'precio_total', render: function (data, type, row) {
|
||||
const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
let total = 0;
|
||||
if(data !==undefined)
|
||||
total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
return `
|
||||
<input class="update-totales-servicios form-control" id="precio_acabado_${row.tarifa_id}" value="${total}"></input>`;
|
||||
}
|
||||
@ -644,9 +646,11 @@ class ServiciosPreimpresion {
|
||||
{
|
||||
data: 'precio', render: function (data, type, row) {
|
||||
|
||||
const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
let total = 0;
|
||||
if(data !==undefined)
|
||||
total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
return `
|
||||
<input class="update-totales-servicios form-control" id="precio_preimpresion_${row.tarifa_id}" value="${total}"></input>`;
|
||||
<input class="update-totales-servicios totales-preimpresion form-control" id="precio_preimpresion_${row.tarifa_id}" value="${total}"></input>`;
|
||||
|
||||
}
|
||||
},
|
||||
@ -675,6 +679,22 @@ class ServiciosPreimpresion {
|
||||
|
||||
});
|
||||
|
||||
$('#tableOfServiciosPreimpresion tbody').on('change', '.totales-preimpresion', function () {
|
||||
|
||||
let input = $(this);
|
||||
let tarifa_id = input.attr('id').replace('precio_preimpresion_', '');
|
||||
let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
|
||||
|
||||
let table = $('#tableOfServiciosPreimpresion').DataTable();
|
||||
let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
|
||||
|
||||
if (row) {
|
||||
row.precio = newValue;
|
||||
table.row($(this).closest('tr')).data(row).draw(false);
|
||||
self.check_serv_preimpresion_error();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.btn-delete-servpreimpresion', function () {
|
||||
const rowId = $(this).closest('td').parent()[0].sectionRowIndex;
|
||||
@ -743,7 +763,7 @@ class ServiciosPreimpresion {
|
||||
|
||||
const rows = this.table.rows().data().toArray();
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i]['precio_total'] == 0) {
|
||||
if (rows[i]['precio'] == 0) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
@ -860,7 +880,9 @@ class ServiciosEncuadernacion {
|
||||
},
|
||||
{
|
||||
data: 'precio_total', render: function (data, type, row) {
|
||||
const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
let total = 0;
|
||||
if(data !==undefined)
|
||||
total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
return `
|
||||
<input class="update-totales-servicios form-control" id="precio_enc_${row.tarifa_id}" value="${total}"></input>`;
|
||||
}
|
||||
@ -1287,9 +1309,13 @@ class ServiciosManipulado {
|
||||
},
|
||||
{
|
||||
data: 'precio_total', render: function (data, type, row) {
|
||||
const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
let total = 0;
|
||||
if(data !==undefined)
|
||||
total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
else
|
||||
data = 0;
|
||||
return `
|
||||
<input class="update-totales-servicios form-control" id="precio_manipulado_${row.tarifa_id}" value="${total}"></input>`;
|
||||
<input class="update-totales-servicios totales-manipulado form-control" id="precio_manipulado_${row.tarifa_id}" value="${total}"></input>`;
|
||||
}
|
||||
},
|
||||
{ data: 'margen' },
|
||||
@ -1315,6 +1341,21 @@ class ServiciosManipulado {
|
||||
}
|
||||
});
|
||||
|
||||
$('#tableOfServiciosManipulado tbody').on('change', '.totales-manipulado', function () {
|
||||
let input = $(this);
|
||||
let tarifa_id = input.attr('id').replace('precio_manipulado_', '');
|
||||
let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
|
||||
|
||||
let table = $('#tableOfServiciosManipulado').DataTable();
|
||||
let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
|
||||
|
||||
if (row) {
|
||||
row.precio_total = newValue;
|
||||
table.row($(this).closest('tr')).data(row).draw(false);
|
||||
self.check_serv_manipulado_error();
|
||||
}
|
||||
});
|
||||
|
||||
this.addServicio.on('click', this.addServicioManipulado.bind(this));
|
||||
|
||||
$(document).on('click', '.btn-delete-servmanipulado', function () {
|
||||
@ -1534,9 +1575,11 @@ class ServiciosExtra {
|
||||
{
|
||||
data: 'precio', render: function (data, type, row) {
|
||||
|
||||
const total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
let total = 0;
|
||||
if(data !==undefined)
|
||||
total = parseFloat(data).toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
||||
return `
|
||||
<input class="update-totales-servicios form-control" id="precio_extra_${row.tarifa_id}" value="${total}"></input>`;
|
||||
<input class="update-totales-servicios totales-extra form-control" id="precio_extra_${row.tarifa_id}" value="${total}"></input>`;
|
||||
|
||||
}
|
||||
},
|
||||
@ -1563,6 +1606,22 @@ class ServiciosExtra {
|
||||
}
|
||||
});
|
||||
|
||||
$('#tableOfServiciosExtra tbody').on('change', '.totales-extra', function () {
|
||||
|
||||
let input = $(this);
|
||||
let tarifa_id = input.attr('id').replace('precio_extra_', '');
|
||||
let newValue = parseFloat(input.val().replace(/\./g, '').replace(',', '.')) || 0;
|
||||
|
||||
let table = $('#tableOfServiciosExtra').DataTable();
|
||||
let row = table.rows().data().toArray().find(r => r.tarifa_id == tarifa_id);
|
||||
|
||||
if (row) {
|
||||
row.precio = newValue;
|
||||
table.row($(this).closest('tr')).data(row).draw(false);
|
||||
self.check_serv_extra_error();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-delete-servextra', function () {
|
||||
const rowId = $(this).closest('td').parent()[0].sectionRowIndex;
|
||||
self.table.row(rowId).remove().draw();
|
||||
@ -1644,7 +1703,7 @@ class ServiciosExtra {
|
||||
|
||||
const rows = this.table.rows().data().toArray();
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i]['precio_total'] == 0) {
|
||||
if (rows[i]['precio'] == 0) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ class PresupuestoCliente {
|
||||
{},
|
||||
(response) => {
|
||||
if (response === null || response === undefined || response === "") {
|
||||
console.log("Error en el calculo máximo de solapas.");
|
||||
console.error("Error en el calculo máximo de solapas.");
|
||||
return;
|
||||
}
|
||||
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
|
||||
|
||||
Reference in New Issue
Block a user