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);
|
return $this->respond($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServiciosAcabados($datos_tarifas, $tirada, $POD){
|
public function getServiciosAcabados($datos_tarifas, $tirada, $POD)
|
||||||
|
{
|
||||||
|
|
||||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||||
$result = [];
|
$result = [];
|
||||||
@ -106,7 +107,7 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
public function cargar()
|
public function cargar()
|
||||||
{
|
{
|
||||||
if($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
$presupuesto_id = $this->request->getGet('presupuesto_id') ?? null;
|
$presupuesto_id = $this->request->getGet('presupuesto_id') ?? null;
|
||||||
|
|
||||||
$rows = $this->model->getResource($presupuesto_id)->get()->getResultObject();
|
$rows = $this->model->getResource($presupuesto_id)->get()->getResultObject();
|
||||||
@ -134,19 +135,30 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
|||||||
$proveedor_id = $reqData['proveedor_id'] ?? -1;
|
$proveedor_id = $reqData['proveedor_id'] ?? -1;
|
||||||
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
|
|
||||||
|
$isTarifa = $reqData['isTarifa'] ?? 0;
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$model = model('App\Models\Tarifas\Acabados\TarifasAcabadoServiciosAcabadoModel');
|
if ($isTarifa == 1) {
|
||||||
$tarifas = $model->getTarifasForServicio($tarifa_acabado_id);
|
$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
|
||||||
|
$values[0]->tarifa_id = $tarifa_acabado_id;
|
||||||
foreach ($tarifas as $tarifa) {
|
|
||||||
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $proveedor_id, $POD);
|
|
||||||
$values[0]->tarifa_id = $tarifa;
|
|
||||||
array_push($data, $values[0]);
|
array_push($data, $values[0]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
$model = model('App\Models\Tarifas\Acabados\TarifasAcabadoServiciosAcabadoModel');
|
||||||
|
$tarifas = $model->getTarifasForServicio($tarifa_acabado_id);
|
||||||
|
|
||||||
|
foreach ($tarifas as $tarifa) {
|
||||||
|
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $proveedor_id, $POD);
|
||||||
|
$values[0]->tarifa_id = $tarifa;
|
||||||
|
array_push($data, $values[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
|
//$values = $this->model->getPrecioTarifa($tarifa_acabado_id, $tirada, $proveedor_id, $POD);
|
||||||
|
|
||||||
@ -180,10 +192,9 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
|||||||
->where("servicios_acabado.deleted_at", null);
|
->where("servicios_acabado.deleted_at", null);
|
||||||
|
|
||||||
|
|
||||||
if($cubierta == 1){
|
if ($cubierta == 1) {
|
||||||
$query->where("servicios_acabado.acabado_cubierta", 1);
|
$query->where("servicios_acabado.acabado_cubierta", 1);
|
||||||
}
|
} else if ($sobrecubierta == 1) {
|
||||||
else if ($sobrecubierta == 1){
|
|
||||||
$query->where("servicios_acabado.acabado_sobrecubierta", 1);
|
$query->where("servicios_acabado.acabado_sobrecubierta", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@
|
|||||||
name: "precio_max",
|
name: "precio_max",
|
||||||
attr: {
|
attr: {
|
||||||
type: "text",
|
type: "text",
|
||||||
name : "tirada_min",
|
name : "precio_max",
|
||||||
class :"autonumeric"
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -139,14 +139,14 @@
|
|||||||
name: "precio_min",
|
name: "precio_min",
|
||||||
attr: {
|
attr: {
|
||||||
type: "text",
|
type: "text",
|
||||||
name : "tirada_min",
|
name : "precio_min",
|
||||||
class :"autonumeric"
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: "margen",
|
name: "margen",
|
||||||
attr: {
|
attr: {
|
||||||
type: "text",
|
type: "text",
|
||||||
name : "tirada_min",
|
name : "margen",
|
||||||
class :"autonumeric"
|
class :"autonumeric"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@ -242,6 +242,8 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
||||||
$(document).trigger('add-servicio-lineas', 'retractilado');
|
$(document).trigger('add-servicio-lineas', 'retractilado');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
||||||
break;
|
break;
|
||||||
case 'retractilado5':
|
case 'retractilado5':
|
||||||
if ($('#' + event.currentTarget.id).prop('checked')) {
|
if ($('#' + event.currentTarget.id).prop('checked')) {
|
||||||
@ -249,6 +251,8 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
$(document).trigger('remove-servicio-lineas', 'retractilado');
|
||||||
$(document).trigger('add-servicio-lineas', 'retractilado5');
|
$(document).trigger('add-servicio-lineas', 'retractilado5');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$(document).trigger('remove-servicio-lineas', 'retractilado5');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -127,12 +127,12 @@ class Servicios {
|
|||||||
else if (servicio == 'retractilado') {
|
else if (servicio == 'retractilado') {
|
||||||
const id = $('#retractilado').attr('service-id');
|
const id = $('#retractilado').attr('service-id');
|
||||||
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
||||||
this.serviciosAcabado.getPresupuestoAcabado(id);
|
this.serviciosAcabado.getPresupuestoAcabado(id, null, null, true);
|
||||||
}
|
}
|
||||||
else if (servicio == 'retractilado5') {
|
else if (servicio == 'retractilado5') {
|
||||||
const id = $('#retractilado5').attr('service-id');
|
const id = $('#retractilado5').attr('service-id');
|
||||||
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
if (!this.checkServiceInTable(this.serviciosAcabado.table, id))
|
||||||
this.serviciosAcabado.getPresupuestoAcabado(id);
|
this.serviciosAcabado.getPresupuestoAcabado(id, null, null,true);
|
||||||
}
|
}
|
||||||
else if (servicio == 'plegado_guardas') {
|
else if (servicio == 'plegado_guardas') {
|
||||||
const id = $('#plegado_guardas').attr('service-id');
|
const id = $('#plegado_guardas').attr('service-id');
|
||||||
@ -194,9 +194,10 @@ class Servicios {
|
|||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data.tarifa_id == id) {
|
if (data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.serviciosExtra.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.serviciosExtra.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'prototipo') {
|
else if (servicio == 'prototipo') {
|
||||||
const id = $('#prototipo').attr('service-id');
|
const id = $('#prototipo').attr('service-id');
|
||||||
@ -204,29 +205,32 @@ class Servicios {
|
|||||||
var data = this.data();
|
var data = this.data();
|
||||||
if (data.tarifa_id == id) {
|
if (data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.serviciosExtra.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.serviciosExtra.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'retractilado') {
|
else if (servicio == 'retractilado') {
|
||||||
const id = $('#retractilado').attr('service-id');
|
const id = $('#retractilado').attr('service-id');
|
||||||
this.serviciosAcabado.table.rows().every(function () {
|
for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
|
||||||
let data = this.data();
|
let data = this.serviciosAcabado.table.row(i).data();
|
||||||
if (data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.serviciosAcabado.table.row(i).remove();
|
||||||
|
this.serviciosAcabado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
this.serviciosAcabado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'retractilado5') {
|
else if (servicio == 'retractilado5') {
|
||||||
const id = $('#retractilado5').attr('service-id');
|
const id = $('#retractilado5').attr('service-id');
|
||||||
this.serviciosAcabado.table.rows().every(function () {
|
for(let i = this.serviciosAcabado.table.rows().count(); i >= 0; i--) {
|
||||||
let data = this.data();
|
let data = this.serviciosAcabado.table.row(i).data();
|
||||||
if (data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove().draw();
|
this.serviciosAcabado.table.row(i).remove();
|
||||||
|
this.serviciosAcabado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
this.serviciosAcabado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'plegado_guardas') {
|
else if (servicio == 'plegado_guardas') {
|
||||||
const id = $('#plegado_guardas').attr('service-id');
|
const id = $('#plegado_guardas').attr('service-id');
|
||||||
@ -234,9 +238,10 @@ class Servicios {
|
|||||||
var data = this.data();
|
var data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_cubierta') {
|
else if (servicio == 'solapas_cubierta') {
|
||||||
const id = $('#serv_solapas_cubierta').attr('service-id');
|
const id = $('#serv_solapas_cubierta').attr('service-id');
|
||||||
@ -244,9 +249,10 @@ class Servicios {
|
|||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data && parseInt(data.tarifa_id) == id) {
|
if (data && parseInt(data.tarifa_id) == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_sobrecubierta') {
|
else if (servicio == 'solapas_sobrecubierta') {
|
||||||
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
|
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
|
||||||
@ -254,9 +260,10 @@ class Servicios {
|
|||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_faja') {
|
else if (servicio == 'solapas_faja') {
|
||||||
const id = $('#solapas_faja').attr('service-id');
|
const id = $('#solapas_faja').attr('service-id');
|
||||||
@ -264,9 +271,10 @@ class Servicios {
|
|||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove().draw();
|
this.remove().draw();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_grandes_cubierta') {
|
else if (servicio == 'solapas_grandes_cubierta') {
|
||||||
const id = $('#solapas_grandes_cubierta').attr('service-id');
|
const id = $('#solapas_grandes_cubierta').attr('service-id');
|
||||||
@ -274,9 +282,10 @@ class Servicios {
|
|||||||
let data = this.data();
|
let data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_grandes_sobrecubierta') {
|
else if (servicio == 'solapas_grandes_sobrecubierta') {
|
||||||
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
|
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
|
||||||
@ -284,9 +293,10 @@ class Servicios {
|
|||||||
var data = this.data();
|
var data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'solapas_grandes_faja') {
|
else if (servicio == 'solapas_grandes_faja') {
|
||||||
const id = $('#solapas_grandes_faja').attr('service-id');
|
const id = $('#solapas_grandes_faja').attr('service-id');
|
||||||
@ -294,9 +304,10 @@ class Servicios {
|
|||||||
var data = this.data();
|
var data = this.data();
|
||||||
if (data && data.tarifa_id == id) {
|
if (data && data.tarifa_id == id) {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
this.ServiciosManipulado.table.draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.ServiciosManipulado.table.draw();
|
|
||||||
}
|
}
|
||||||
else if (servicio == 'acabadoCubierta') {
|
else if (servicio == 'acabadoCubierta') {
|
||||||
for (let i = 0; i < this.serviciosAcabado.table.rows().count(); i++) {
|
for (let i = 0; i < this.serviciosAcabado.table.rows().count(); i++) {
|
||||||
@ -563,7 +574,7 @@ class ServiciosAcabado {
|
|||||||
this.getPresupuestoAcabado(tarifa_id, uso, null);
|
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;
|
const self = this;
|
||||||
|
|
||||||
@ -573,6 +584,7 @@ class ServiciosAcabado {
|
|||||||
}
|
}
|
||||||
let datos = {
|
let datos = {
|
||||||
tirada: tirada,
|
tirada: tirada,
|
||||||
|
isTarifa: isTarifa ? 1 : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (updateSelect != null) {
|
if (updateSelect != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user