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:
@ -404,7 +404,9 @@ class PresupuestoAdminEdit {
|
||||
|
||||
const totalAceptadoRevisado = response.data.total_aceptado_revisado != null ?
|
||||
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);
|
||||
|
||||
|
||||
@ -73,6 +73,8 @@ class DatosLibro {
|
||||
this.div_faja = this.domItem.find('.faja-div');
|
||||
|
||||
this.cargando = cargando;
|
||||
|
||||
this._bloqueoCambioFaja = false;
|
||||
}
|
||||
|
||||
init() {
|
||||
@ -186,6 +188,8 @@ class DatosLibro {
|
||||
}
|
||||
|
||||
changeFaja() {
|
||||
if (this._bloqueoCambioFaja) return;
|
||||
this._bloqueoCambioFaja = true;
|
||||
|
||||
if (this.faja.prop('checked')) {
|
||||
this.div_faja.removeClass('d-none');
|
||||
@ -210,6 +214,7 @@ class DatosLibro {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
|
||||
}
|
||||
this._bloqueoCambioFaja = false;
|
||||
}
|
||||
|
||||
checkMinMaxInput(event) {
|
||||
|
||||
@ -71,7 +71,6 @@ class Envios {
|
||||
},
|
||||
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
|
||||
{ 'data': 'entregaPieCalle' },
|
||||
{ 'data': 'is_ferro_prototipo' },
|
||||
{
|
||||
data: function (row, type, set, meta) {
|
||||
return `
|
||||
@ -98,7 +97,7 @@ class Envios {
|
||||
|
||||
drawCallback: function (settings) {
|
||||
|
||||
const boolCols = [15, 16];
|
||||
const boolCols = [15];
|
||||
for (let coln of boolCols) {
|
||||
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
@ -165,19 +164,7 @@ class Envios {
|
||||
$('#add_telefono').val(data.telefono)
|
||||
$('#add_cantidad').val(data.cantidad)
|
||||
$('#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.init();
|
||||
@ -243,34 +230,15 @@ class Envios {
|
||||
})
|
||||
|
||||
let cantidad_total = 0;
|
||||
let hasFerroPrototipo = false;
|
||||
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
let data = this.data();
|
||||
if (data.is_ferro_prototipo == 0)
|
||||
cantidad_total += parseInt(data.cantidad);
|
||||
else
|
||||
hasFerroPrototipo = true;
|
||||
let data = this.data();
|
||||
cantidad_total += parseInt(data.cantidad);
|
||||
});
|
||||
const restante = parseInt($('#tirada').val()) - cantidad_total;
|
||||
$('#add_cantidad').attr('max-value', restante);
|
||||
$('#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');
|
||||
}
|
||||
|
||||
@ -316,7 +284,6 @@ class Envios {
|
||||
proveedor: data.proveedor,
|
||||
proveedor_id: data.proveedor_id,
|
||||
entregaPieCalle: data.entregaPieCalle,
|
||||
is_ferro_prototipo: data.is_ferro_prototipo,
|
||||
})
|
||||
});
|
||||
|
||||
@ -421,7 +388,6 @@ class Envios {
|
||||
'precio': datos_tarifa.precio.toFixed(2),
|
||||
'margen': datos_tarifa.margen,
|
||||
'entregaPieCalle': rowData.entregaPieCalle,
|
||||
'is_ferro_prototipo': rowData.is_ferro_prototipo,
|
||||
'actionBtns_direcciones': self.actionBtns_direcciones,
|
||||
})
|
||||
.draw();
|
||||
@ -611,7 +577,6 @@ class Envios {
|
||||
'precio': tarifa_final.precio,
|
||||
'margen': tarifa_final.margen,
|
||||
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
|
||||
'is_ferro_prototipo': $('#dirFerroProto').is(":checked") ? 1 : 0,
|
||||
'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>
|
||||
<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 hasFerroPrototipo = false
|
||||
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
if (this.data().is_ferro_prototipo == 0)
|
||||
cantidad_total += parseInt(this.data().cantidad);
|
||||
else
|
||||
hasFerroPrototipo = true;
|
||||
cantidad_total += parseInt(this.data().cantidad);
|
||||
});
|
||||
|
||||
const tirada = parseInt($('#tirada').val());
|
||||
@ -745,11 +706,6 @@ class Envios {
|
||||
this.insertarEnvio.removeClass('d-none');
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user