mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
solucionado problema con los checks de retractilado
This commit is contained in:
@ -86,7 +86,8 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function getServiciosAcabados($datos_tarifas, $tirada, $POD){
|
||||
public function getServiciosAcabados($datos_tarifas, $tirada, $POD)
|
||||
{
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$result = [];
|
||||
@ -134,11 +135,21 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
||||
$proveedor_id = $reqData['proveedor_id'] ?? -1;
|
||||
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
|
||||
$isTarifa = $reqData['isTarifa'] ?? 0;
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($isTarifa == 1) {
|
||||
$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
|
||||
$values[0]->tarifa_id = $tarifa_acabado_id;
|
||||
array_push($data, $values[0]);
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
$model = model('App\Models\Tarifas\Acabados\TarifasAcabadoServiciosAcabadoModel');
|
||||
$tarifas = $model->getTarifasForServicio($tarifa_acabado_id);
|
||||
|
||||
@ -147,6 +158,7 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
||||
$values[0]->tarifa_id = $tarifa;
|
||||
array_push($data, $values[0]);
|
||||
}
|
||||
}
|
||||
|
||||
//$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
|
||||
|
||||
@ -182,8 +194,7 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($cubierta == 1) {
|
||||
$query->where("servicios_acabado.acabado_cubierta", 1);
|
||||
}
|
||||
else if ($sobrecubierta == 1){
|
||||
} else if ($sobrecubierta == 1) {
|
||||
$query->where("servicios_acabado.acabado_sobrecubierta", 1);
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
name: "precio_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_min",
|
||||
name : "precio_max",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
@ -139,14 +139,14 @@
|
||||
name: "precio_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_min",
|
||||
name : "precio_min",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "margen",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_min",
|
||||
name : "margen",
|
||||
class :"autonumeric"
|
||||
}
|
||||
}, {
|
||||
|
||||
@ -242,6 +242,8 @@ class DatosLibro {
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
||||
$(document).trigger('add-servicio-lineas', 'retractilado');
|
||||
}
|
||||
else
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
||||
break;
|
||||
case 'retractilado5':
|
||||
if ($('#' + event.currentTarget.id).prop('checked')) {
|
||||
@ -249,6 +251,8 @@ class DatosLibro {
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
||||
$(document).trigger('add-servicio-lineas', 'retractilado5');
|
||||
}
|
||||
else
|
||||
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -127,12 +127,12 @@ class Servicios {
|
||||
else if (servicio == 'retractilado') {
|
||||
const id = $('#retractilado').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
||||
this.serviciosAcabado.getPresupuestoAcabado(id);
|
||||
this.serviciosAcabado.getPresupuestoAcabado(id, null, null, true);
|
||||
}
|
||||
else if (servicio == 'retractilado5') {
|
||||
const id = $('#retractilado5').attr('service-id');
|
||||
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
||||
this.serviciosAcabado.getPresupuestoAcabado(id);
|
||||
this.serviciosAcabado.getPresupuestoAcabado(id, null, null,true);
|
||||
}
|
||||
else if (servicio == 'plegado_guardas') {
|
||||
const id = $('#plegado_guardas').attr('service-id');
|
||||
@ -194,9 +194,10 @@ class Servicios {
|
||||
let data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.serviciosExtra.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.serviciosExtra.table.draw();
|
||||
}
|
||||
else if (servicio == 'prototipo') {
|
||||
const id = $('#prototipo').attr('service-id');
|
||||
@ -204,29 +205,32 @@ class Servicios {
|
||||
var data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.serviciosExtra.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.serviciosExtra.table.draw();
|
||||
}
|
||||
else if (servicio == 'retractilado') {
|
||||
const id = $('#retractilado').attr('service-id');
|
||||
this.serviciosAcabado.table.rows().every(function () {
|
||||
let data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove();
|
||||
}
|
||||
});
|
||||
for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
|
||||
let data = this.serviciosAcabado.table.row(i).data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.serviciosAcabado.table.row(i).remove();
|
||||
this.serviciosAcabado.table.draw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (servicio == 'retractilado5') {
|
||||
const id = $('#retractilado5').attr('service-id');
|
||||
this.serviciosAcabado.table.rows().every(function () {
|
||||
let data = this.data();
|
||||
if (data.tarifa_id == id) {
|
||||
this.remove().draw();
|
||||
}
|
||||
});
|
||||
for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
|
||||
let data = this.serviciosAcabado.table.row(i).data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.serviciosAcabado.table.row(i).remove();
|
||||
this.serviciosAcabado.table.draw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (servicio == 'plegado_guardas') {
|
||||
const id = $('#plegado_guardas').attr('service-id');
|
||||
@ -234,9 +238,10 @@ class Servicios {
|
||||
var data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_cubierta') {
|
||||
const id = $('#serv_solapas_cubierta').attr('service-id');
|
||||
@ -244,9 +249,10 @@ class Servicios {
|
||||
let data = this.data();
|
||||
if (data && parseInt(data.tarifa_id) == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_sobrecubierta') {
|
||||
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
|
||||
@ -254,9 +260,10 @@ class Servicios {
|
||||
let data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_faja') {
|
||||
const id = $('#solapas_faja').attr('service-id');
|
||||
@ -264,9 +271,10 @@ class Servicios {
|
||||
let data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove().draw();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_cubierta') {
|
||||
const id = $('#solapas_grandes_cubierta').attr('service-id');
|
||||
@ -274,9 +282,10 @@ class Servicios {
|
||||
let data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_sobrecubierta') {
|
||||
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
|
||||
@ -284,9 +293,10 @@ class Servicios {
|
||||
var data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_faja') {
|
||||
const id = $('#solapas_grandes_faja').attr('service-id');
|
||||
@ -294,9 +304,10 @@ class Servicios {
|
||||
var data = this.data();
|
||||
if (data && data.tarifa_id == id) {
|
||||
this.remove();
|
||||
this.ServiciosManipulado.table.draw();
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.ServiciosManipulado.table.draw();
|
||||
}
|
||||
else if (servicio == 'acabadoCubierta') {
|
||||
for (let i = 0; i < this.serviciosAcabado.table.rows().count(); i++) {
|
||||
@ -563,7 +574,7 @@ class ServiciosAcabado {
|
||||
this.getPresupuestoAcabado(tarifa_id, uso, null);
|
||||
}
|
||||
|
||||
getPresupuestoAcabado(tarifa_id = -1, uso = null, updateSelect = null) {
|
||||
getPresupuestoAcabado(tarifa_id = -1, uso = null, updateSelect = null, isTarifa = false) {
|
||||
|
||||
const self = this;
|
||||
|
||||
@ -573,6 +584,7 @@ class ServiciosAcabado {
|
||||
}
|
||||
let datos = {
|
||||
tirada: tirada,
|
||||
isTarifa: isTarifa ? 1 : 0
|
||||
};
|
||||
|
||||
if (updateSelect != null) {
|
||||
|
||||
Reference in New Issue
Block a user