mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en presupuesto admin
This commit is contained in:
@ -39,7 +39,6 @@
|
|||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.costePrecio') ?></th>
|
||||||
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
<th class="lp-header"><?= lang('Tarifaacabado.margen') ?></th>
|
||||||
<th class="lp-header">Pallets?</th>
|
<th class="lp-header">Pallets?</th>
|
||||||
<th class="lp-header">Ferro o Prototipo?</th>
|
|
||||||
<th style="min-width:120px !important;" class="lp-header"><?= lang('Basic.global.Action') ?></th>
|
<th style="min-width:120px !important;" class="lp-header"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@ -9,14 +9,6 @@
|
|||||||
|
|
||||||
<div id='error-tarifa'></div>
|
<div id='error-tarifa'></div>
|
||||||
|
|
||||||
<div class="mb-3" id="direccionFerroProto">
|
|
||||||
<label for="dirFerroProto" class="form-label">
|
|
||||||
Dirección Ferro o Prototipo
|
|
||||||
</label>
|
|
||||||
<input type="checkbox" id="dirFerroProto" class="form-check-input">
|
|
||||||
|
|
||||||
</div><!--//.mb-3 -->
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="add_clientedAdd" class="form-label">
|
<label for="add_clientedAdd" class="form-label">
|
||||||
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*
|
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*
|
||||||
|
|||||||
@ -228,6 +228,7 @@
|
|||||||
<!------------------------------------------->
|
<!------------------------------------------->
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
|
|
||||||
$(document).keypress(function(e) {
|
$(document).keypress(function(e) {
|
||||||
var key = e.which;
|
var key = e.which;
|
||||||
if (key == 13) // the enter key code
|
if (key == 13) // the enter key code
|
||||||
|
|||||||
@ -404,7 +404,9 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||||
response.data.total_aceptado_revisado : response.data.resumen.total_aceptado;
|
response.data.total_aceptado_revisado : response.data.resumen.total_aceptado;
|
||||||
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
if((!isNaN(totalAceptadoRevisado) && totalAceptadoRevisado !== null) || totalAceptadoRevisado === 0) {
|
||||||
|
AutoNumeric.getAutoNumericElement($('#total_aceptado_revisado')[0]).set(totalAceptadoRevisado);
|
||||||
|
}
|
||||||
|
|
||||||
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
$('#aprobado_by_at').html(response.data.aprobado_by_at);
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,8 @@ class DatosLibro {
|
|||||||
this.div_faja = this.domItem.find('.faja-div');
|
this.div_faja = this.domItem.find('.faja-div');
|
||||||
|
|
||||||
this.cargando = cargando;
|
this.cargando = cargando;
|
||||||
|
|
||||||
|
this._bloqueoCambioFaja = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -186,6 +188,8 @@ class DatosLibro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeFaja() {
|
changeFaja() {
|
||||||
|
if (this._bloqueoCambioFaja) return;
|
||||||
|
this._bloqueoCambioFaja = true;
|
||||||
|
|
||||||
if (this.faja.prop('checked')) {
|
if (this.faja.prop('checked')) {
|
||||||
this.div_faja.removeClass('d-none');
|
this.div_faja.removeClass('d-none');
|
||||||
@ -210,6 +214,7 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this._bloqueoCambioFaja = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMinMaxInput(event) {
|
checkMinMaxInput(event) {
|
||||||
|
|||||||
@ -71,7 +71,6 @@ class Envios {
|
|||||||
},
|
},
|
||||||
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
||||||
{ 'data': 'entregaPieCalle' },
|
{ 'data': 'entregaPieCalle' },
|
||||||
{ 'data': 'is_ferro_prototipo' },
|
|
||||||
{
|
{
|
||||||
data: function (row, type, set, meta) {
|
data: function (row, type, set, meta) {
|
||||||
return `
|
return `
|
||||||
@ -98,7 +97,7 @@ class Envios {
|
|||||||
|
|
||||||
drawCallback: function (settings) {
|
drawCallback: function (settings) {
|
||||||
|
|
||||||
const boolCols = [15, 16];
|
const boolCols = [15];
|
||||||
for (let coln of boolCols) {
|
for (let coln of boolCols) {
|
||||||
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
||||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||||
@ -165,19 +164,7 @@ class Envios {
|
|||||||
$('#add_telefono').val(data.telefono)
|
$('#add_telefono').val(data.telefono)
|
||||||
$('#add_cantidad').val(data.cantidad)
|
$('#add_cantidad').val(data.cantidad)
|
||||||
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle == 1 ? true : false)
|
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle == 1 ? true : false)
|
||||||
$('#dirFerroProto').prop('checked', data.is_ferro_prototipo == 1 ? true : false)
|
|
||||||
|
|
||||||
if (data.is_ferro_prototipo == 1) {
|
|
||||||
$('#add_cantidad').val(1);
|
|
||||||
$('#add_cantidad').attr('disabled', true);
|
|
||||||
$('#dirFerroProto').prop('disabled', true);
|
|
||||||
$('#direccionFerroProto').removeClass('d-none');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#add_cantidad').attr('disabled', false);
|
|
||||||
$('#dirFerroProto').prop('disabled', false);
|
|
||||||
$('#direccionFerroProto').addClass('d-none');
|
|
||||||
}
|
|
||||||
|
|
||||||
self.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
|
self.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
|
||||||
self.direccionesClienteForm.init();
|
self.direccionesClienteForm.init();
|
||||||
@ -243,33 +230,14 @@ class Envios {
|
|||||||
})
|
})
|
||||||
|
|
||||||
let cantidad_total = 0;
|
let cantidad_total = 0;
|
||||||
let hasFerroPrototipo = false;
|
|
||||||
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data.is_ferro_prototipo == 0)
|
cantidad_total += parseInt(data.cantidad);
|
||||||
cantidad_total += parseInt(data.cantidad);
|
|
||||||
else
|
|
||||||
hasFerroPrototipo = true;
|
|
||||||
});
|
});
|
||||||
const restante = parseInt($('#tirada').val()) - cantidad_total;
|
const restante = parseInt($('#tirada').val()) - cantidad_total;
|
||||||
$('#add_cantidad').attr('max-value', restante);
|
$('#add_cantidad').attr('max-value', restante);
|
||||||
$('#add_cantidad').val(restante > 0 ? restante : 0);
|
$('#add_cantidad').val(restante > 0 ? restante : 0);
|
||||||
|
|
||||||
if (hasFerroPrototipo) {
|
|
||||||
$('#dirFerroProto').prop('checked', false);
|
|
||||||
$('#direccionFerroProto').addClass('d-none');
|
|
||||||
$('#add_cantidad').attr('disabled', false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (restante == 0) {
|
|
||||||
$('#direccionFerroProto').removeClass('d-none');
|
|
||||||
$('#dirFerroProto').prop('checked', true);
|
|
||||||
$('#dirFerroProto').prop('disabled', true);
|
|
||||||
$('#add_cantidad').attr('disabled', true);
|
|
||||||
$('#add_cantidad').val(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
newAddDialog.modal('show');
|
newAddDialog.modal('show');
|
||||||
}
|
}
|
||||||
@ -316,7 +284,6 @@ class Envios {
|
|||||||
proveedor: data.proveedor,
|
proveedor: data.proveedor,
|
||||||
proveedor_id: data.proveedor_id,
|
proveedor_id: data.proveedor_id,
|
||||||
entregaPieCalle: data.entregaPieCalle,
|
entregaPieCalle: data.entregaPieCalle,
|
||||||
is_ferro_prototipo: data.is_ferro_prototipo,
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -421,7 +388,6 @@ class Envios {
|
|||||||
'precio': datos_tarifa.precio.toFixed(2),
|
'precio': datos_tarifa.precio.toFixed(2),
|
||||||
'margen': datos_tarifa.margen,
|
'margen': datos_tarifa.margen,
|
||||||
'entregaPieCalle': rowData.entregaPieCalle,
|
'entregaPieCalle': rowData.entregaPieCalle,
|
||||||
'is_ferro_prototipo': rowData.is_ferro_prototipo,
|
|
||||||
'actionBtns_direcciones': self.actionBtns_direcciones,
|
'actionBtns_direcciones': self.actionBtns_direcciones,
|
||||||
})
|
})
|
||||||
.draw();
|
.draw();
|
||||||
@ -611,7 +577,6 @@ class Envios {
|
|||||||
'precio': tarifa_final.precio,
|
'precio': tarifa_final.precio,
|
||||||
'margen': tarifa_final.margen,
|
'margen': tarifa_final.margen,
|
||||||
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
|
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
|
||||||
'is_ferro_prototipo': $('#dirFerroProto').is(":checked") ? 1 : 0,
|
|
||||||
'actionBtns_direcciones': `
|
'actionBtns_direcciones': `
|
||||||
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-envio mx-2"></i></a></span>
|
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-envio mx-2"></i></a></span>
|
||||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
|
||||||
@ -719,12 +684,8 @@ class Envios {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cantidad_total = 0
|
let cantidad_total = 0
|
||||||
let hasFerroPrototipo = false
|
|
||||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
if (this.data().is_ferro_prototipo == 0)
|
cantidad_total += parseInt(this.data().cantidad);
|
||||||
cantidad_total += parseInt(this.data().cantidad);
|
|
||||||
else
|
|
||||||
hasFerroPrototipo = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const tirada = parseInt($('#tirada').val());
|
const tirada = parseInt($('#tirada').val());
|
||||||
@ -745,11 +706,6 @@ class Envios {
|
|||||||
this.insertarEnvio.removeClass('d-none');
|
this.insertarEnvio.removeClass('d-none');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($('#ferro').is(':checked') || $('#prototipo').is(':checked')) && !hasFerroPrototipo)
|
|
||||||
this.insertarEnvio.removeClass('d-none');
|
|
||||||
else
|
|
||||||
this.insertarEnvio.addClass('d-none');
|
|
||||||
$('#alert-envios').html(htmlString);
|
$('#alert-envios').html(htmlString);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user