mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
comparador cubierta y sobrecubierta terminado
This commit is contained in:
@ -9,18 +9,18 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"plantilla-tarifa.edit",
|
"plantilla-tarifa.edit",
|
||||||
"plantilla-tarifa.delete",
|
"plantilla-tarifa.delete",
|
||||||
"plantilla-tarifa.menu",
|
"plantilla-tarifa.menu",
|
||||||
"perfil.create",
|
|
||||||
"perfil.edit",
|
|
||||||
"perfil.delete",
|
|
||||||
"perfil.menu",
|
|
||||||
"presupuesto.create",
|
"presupuesto.create",
|
||||||
"presupuesto.edit",
|
"presupuesto.edit",
|
||||||
"presupuesto.delete",
|
"presupuesto.delete",
|
||||||
"presupuesto.menu",
|
"presupuesto.menu",
|
||||||
"presupuesto-cliente.create",
|
"pedidos-activos.view",
|
||||||
"presupuesto-cliente.edit",
|
"pedidos-activos.menu",
|
||||||
"presupuesto-cliente.delete",
|
"pedidos-finalizados.view",
|
||||||
"presupuesto-cliente.menu",
|
"pedidos-finalizados.menu",
|
||||||
|
"pedidos-cancelados.view",
|
||||||
|
"pedidos-cancelados.menu",
|
||||||
|
"pedidos-todos.view",
|
||||||
|
"pedidos-todos.menu",
|
||||||
"tarifa-preimpresion.create",
|
"tarifa-preimpresion.create",
|
||||||
"tarifa-preimpresion.edit",
|
"tarifa-preimpresion.edit",
|
||||||
"tarifa-preimpresion.delete",
|
"tarifa-preimpresion.delete",
|
||||||
@ -41,10 +41,6 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"tarifa-envio.edit",
|
"tarifa-envio.edit",
|
||||||
"tarifa-envio.delete",
|
"tarifa-envio.delete",
|
||||||
"tarifa-envio.menu",
|
"tarifa-envio.menu",
|
||||||
"tarifa-extra.create",
|
|
||||||
"tarifa-extra.edit",
|
|
||||||
"tarifa-extra.delete",
|
|
||||||
"tarifa-extra.menu",
|
|
||||||
"proveedores.create",
|
"proveedores.create",
|
||||||
"proveedores.edit",
|
"proveedores.edit",
|
||||||
"proveedores.delete",
|
"proveedores.delete",
|
||||||
@ -61,10 +57,6 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"paises.edit",
|
"paises.edit",
|
||||||
"paises.delete",
|
"paises.delete",
|
||||||
"paises.menu",
|
"paises.menu",
|
||||||
"formas-pago.create",
|
|
||||||
"formas-pago.edit",
|
|
||||||
"formas-pago.delete",
|
|
||||||
"formas-pago.menu",
|
|
||||||
"maquinas.create",
|
"maquinas.create",
|
||||||
"maquinas.edit",
|
"maquinas.edit",
|
||||||
"maquinas.delete",
|
"maquinas.delete",
|
||||||
@ -89,36 +81,12 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"roles-permisos.edit",
|
"roles-permisos.edit",
|
||||||
"roles-permisos.delete",
|
"roles-permisos.delete",
|
||||||
"roles-permisos.menu",
|
"roles-permisos.menu",
|
||||||
"ubicaciones.create",
|
|
||||||
"ubicaciones.edit",
|
|
||||||
"ubicaciones.delete",
|
|
||||||
"ubicaciones.menu",
|
|
||||||
"series-facturas.create",
|
|
||||||
"series-facturas.edit",
|
|
||||||
"series-facturas.delete",
|
|
||||||
"series-facturas.menu",
|
|
||||||
],
|
],
|
||||||
"cliente-admin" => [
|
"cliente-admin" => [
|
||||||
"perfil.edit",
|
"pedidos-activos.view",
|
||||||
"perfil.menu",
|
"pedidos-activos.menu",
|
||||||
"direcciones.create",
|
|
||||||
"direcciones.edit",
|
|
||||||
"direcciones.delete",
|
|
||||||
"direcciones.menu",
|
|
||||||
"presupuesto-cliente.create",
|
|
||||||
"presupuesto-cliente.edit",
|
|
||||||
"presupuesto-cliente.delete",
|
|
||||||
"presupuesto-cliente.menu",
|
|
||||||
],
|
],
|
||||||
"cliente-editor" => [
|
"cliente-editor" => [
|
||||||
"perfil.create",
|
|
||||||
"perfil.edit",
|
|
||||||
"perfil.delete",
|
|
||||||
"perfil.menu",
|
|
||||||
"direcciones.create",
|
|
||||||
"direcciones.edit",
|
|
||||||
"direcciones.delete",
|
|
||||||
"direcciones.menu",
|
|
||||||
"presupuesto-cliente.create",
|
"presupuesto-cliente.create",
|
||||||
"presupuesto-cliente.edit",
|
"presupuesto-cliente.edit",
|
||||||
"presupuesto-cliente.delete",
|
"presupuesto-cliente.delete",
|
||||||
@ -129,8 +97,15 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"token.menu",
|
"token.menu",
|
||||||
],
|
],
|
||||||
"produccion" => [
|
"produccion" => [
|
||||||
"token.token",
|
"clientes.create",
|
||||||
"token.menu",
|
"clientes.edit",
|
||||||
|
"clientes.menu",
|
||||||
|
"direcciones.create",
|
||||||
|
"direcciones.edit",
|
||||||
|
"direcciones.menu",
|
||||||
|
"presupuesto.create",
|
||||||
|
"presupuesto.edit",
|
||||||
|
"presupuesto.menu",
|
||||||
],
|
],
|
||||||
"maquina" => [
|
"maquina" => [
|
||||||
"token.token",
|
"token.token",
|
||||||
@ -163,10 +138,6 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"plantilla-tarifa.edit",
|
"plantilla-tarifa.edit",
|
||||||
"plantilla-tarifa.delete",
|
"plantilla-tarifa.delete",
|
||||||
"plantilla-tarifa.menu",
|
"plantilla-tarifa.menu",
|
||||||
"perfil.create",
|
|
||||||
"perfil.edit",
|
|
||||||
"perfil.delete",
|
|
||||||
"perfil.menu",
|
|
||||||
"presupuesto.create",
|
"presupuesto.create",
|
||||||
"presupuesto.edit",
|
"presupuesto.edit",
|
||||||
"presupuesto.delete",
|
"presupuesto.delete",
|
||||||
@ -195,10 +166,6 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"tarifa-envio.edit",
|
"tarifa-envio.edit",
|
||||||
"tarifa-envio.delete",
|
"tarifa-envio.delete",
|
||||||
"tarifa-envio.menu",
|
"tarifa-envio.menu",
|
||||||
"tarifa-extra.create",
|
|
||||||
"tarifa-extra.edit",
|
|
||||||
"tarifa-extra.delete",
|
|
||||||
"tarifa-extra.menu",
|
|
||||||
"proveedores.create",
|
"proveedores.create",
|
||||||
"proveedores.edit",
|
"proveedores.edit",
|
||||||
"proveedores.delete",
|
"proveedores.delete",
|
||||||
@ -239,13 +206,5 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"roles-permisos.edit",
|
"roles-permisos.edit",
|
||||||
"roles-permisos.delete",
|
"roles-permisos.delete",
|
||||||
"roles-permisos.menu",
|
"roles-permisos.menu",
|
||||||
"ubicaciones.create",
|
|
||||||
"ubicaciones.edit",
|
|
||||||
"ubicaciones.delete",
|
|
||||||
"ubicaciones.menu",
|
|
||||||
"series-facturas.create",
|
|
||||||
"series-facturas.edit",
|
|
||||||
"series-facturas.delete",
|
|
||||||
"series-facturas.menu",
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -9,10 +9,6 @@ const SK_PERMISSIONS = [
|
|||||||
'plantilla-tarifa.edit' => 'Can edit',
|
'plantilla-tarifa.edit' => 'Can edit',
|
||||||
'plantilla-tarifa.delete' => 'Can delete',
|
'plantilla-tarifa.delete' => 'Can delete',
|
||||||
'plantilla-tarifa.menu' => 'Menu shall be visualize',
|
'plantilla-tarifa.menu' => 'Menu shall be visualize',
|
||||||
'perfil.create' => 'Can create',
|
|
||||||
'perfil.edit' => 'Can edit',
|
|
||||||
'perfil.delete' => 'Can delete',
|
|
||||||
'perfil.menu' => 'Menu shall be visualize',
|
|
||||||
'direcciones.create' => 'Can create',
|
'direcciones.create' => 'Can create',
|
||||||
'direcciones.edit' => 'Can edit',
|
'direcciones.edit' => 'Can edit',
|
||||||
'direcciones.delete' => 'Can delete',
|
'direcciones.delete' => 'Can delete',
|
||||||
@ -25,6 +21,14 @@ const SK_PERMISSIONS = [
|
|||||||
'presupuesto-cliente.edit' => 'Can edit',
|
'presupuesto-cliente.edit' => 'Can edit',
|
||||||
'presupuesto-cliente.delete' => 'Can delete',
|
'presupuesto-cliente.delete' => 'Can delete',
|
||||||
'presupuesto-cliente.menu' => 'Menu shall be visualize',
|
'presupuesto-cliente.menu' => 'Menu shall be visualize',
|
||||||
|
'pedidos-activos.view' => 'Can view',
|
||||||
|
'pedidos-activos.menu' => 'Menu shall be visualize',
|
||||||
|
'pedidos-finalizados.view' => 'Can view',
|
||||||
|
'pedidos-finalizados.menu' => 'Menu shall be visualize',
|
||||||
|
'pedidos-cancelados.view' => 'Can view',
|
||||||
|
'pedidos-cancelados.menu' => 'Menu shall be visualize',
|
||||||
|
'pedidos-todos.view' => 'Can view',
|
||||||
|
'pedidos-todos.menu' => 'Menu shall be visualize',
|
||||||
'tarifa-preimpresion.create' => 'Can create',
|
'tarifa-preimpresion.create' => 'Can create',
|
||||||
'tarifa-preimpresion.edit' => 'Can edit',
|
'tarifa-preimpresion.edit' => 'Can edit',
|
||||||
'tarifa-preimpresion.delete' => 'Can delete',
|
'tarifa-preimpresion.delete' => 'Can delete',
|
||||||
@ -45,10 +49,6 @@ const SK_PERMISSIONS = [
|
|||||||
'tarifa-envio.edit' => 'Can edit',
|
'tarifa-envio.edit' => 'Can edit',
|
||||||
'tarifa-envio.delete' => 'Can delete',
|
'tarifa-envio.delete' => 'Can delete',
|
||||||
'tarifa-envio.menu' => 'Menu shall be visualize',
|
'tarifa-envio.menu' => 'Menu shall be visualize',
|
||||||
'tarifa-extra.create' => 'Can create',
|
|
||||||
'tarifa-extra.edit' => 'Can edit',
|
|
||||||
'tarifa-extra.delete' => 'Can delete',
|
|
||||||
'tarifa-extra.menu' => 'Menu shall be visualize',
|
|
||||||
'proveedores.create' => 'Can create',
|
'proveedores.create' => 'Can create',
|
||||||
'proveedores.edit' => 'Can edit',
|
'proveedores.edit' => 'Can edit',
|
||||||
'proveedores.delete' => 'Can delete',
|
'proveedores.delete' => 'Can delete',
|
||||||
@ -65,10 +65,6 @@ const SK_PERMISSIONS = [
|
|||||||
'paises.edit' => 'Can edit',
|
'paises.edit' => 'Can edit',
|
||||||
'paises.delete' => 'Can delete',
|
'paises.delete' => 'Can delete',
|
||||||
'paises.menu' => 'Menu shall be visualize',
|
'paises.menu' => 'Menu shall be visualize',
|
||||||
'formas-pago.create' => 'Can create',
|
|
||||||
'formas-pago.edit' => 'Can edit',
|
|
||||||
'formas-pago.delete' => 'Can delete',
|
|
||||||
'formas-pago.menu' => 'Menu shall be visualize',
|
|
||||||
'maquinas.create' => 'Can create',
|
'maquinas.create' => 'Can create',
|
||||||
'maquinas.edit' => 'Can edit',
|
'maquinas.edit' => 'Can edit',
|
||||||
'maquinas.delete' => 'Can delete',
|
'maquinas.delete' => 'Can delete',
|
||||||
@ -93,12 +89,4 @@ const SK_PERMISSIONS = [
|
|||||||
'roles-permisos.edit' => 'Can edit',
|
'roles-permisos.edit' => 'Can edit',
|
||||||
'roles-permisos.delete' => 'Can delete',
|
'roles-permisos.delete' => 'Can delete',
|
||||||
'roles-permisos.menu' => 'Menu shall be visualize',
|
'roles-permisos.menu' => 'Menu shall be visualize',
|
||||||
'ubicaciones.create' => 'Can create',
|
|
||||||
'ubicaciones.edit' => 'Can edit',
|
|
||||||
'ubicaciones.delete' => 'Can delete',
|
|
||||||
'ubicaciones.menu' => 'Menu shall be visualize',
|
|
||||||
'series-facturas.create' => 'Can create',
|
|
||||||
'series-facturas.edit' => 'Can edit',
|
|
||||||
'series-facturas.delete' => 'Can delete',
|
|
||||||
'series-facturas.menu' => 'Menu shall be visualize',
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -660,7 +660,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
public function obtenerComparadorExteriores()
|
public function obtenerComparadorExteriores()
|
||||||
{
|
{
|
||||||
|
|
||||||
$resultado = [];
|
$lineasCubierta = null;
|
||||||
|
$lineasSobrecubierta = null;
|
||||||
|
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
|
|
||||||
$cubierta = $this->request->getPost('cubierta') ?? false;
|
$cubierta = $this->request->getPost('cubierta') ?? false;
|
||||||
@ -676,9 +678,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$datosPedido = $cubierta['datosPedido'];
|
$datosPedido = $cubierta['datosPedido'];
|
||||||
$papel_generico = $cubierta['papel_generico'];
|
$papel_generico = $cubierta['papel_generico'];
|
||||||
$gramaje = $cubierta['gramaje'];
|
$gramaje = $cubierta['gramaje'];
|
||||||
$paginas_color = $this->request->getPost('paginas_color') ?? 0;
|
$paginas_color = $cubierta['datosPedido']['paginas'] ?? 0;
|
||||||
$tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
|
$tipo_impresion_id = $cubierta['tipo_impresion_id'];
|
||||||
$uso = $this->request->getPost('uso');
|
$uso = $cubierta['uso'];
|
||||||
$lomoRedondo = $cubierta['lomoRedondo'] ?? false;
|
$lomoRedondo = $cubierta['lomoRedondo'] ?? false;
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
@ -693,8 +695,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
'uso' => $uso,
|
'uso' => $uso,
|
||||||
'lomoRedondo' => $lomoRedondo
|
'lomoRedondo' => $lomoRedondo
|
||||||
);
|
);
|
||||||
$lineas = PresupuestoClienteService::obtenerCubierta($data, true);
|
$lineasCubierta = PresupuestoClienteService::obtenerCubierta($data, true);
|
||||||
$resultado['cubierta'] = $lineas;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sobrecubierta) {
|
if ($sobrecubierta) {
|
||||||
@ -703,9 +704,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$datosPedido = $sobrecubierta['datosPedido'];
|
$datosPedido = $sobrecubierta['datosPedido'];
|
||||||
$papel_generico = $sobrecubierta['papel_generico'];
|
$papel_generico = $sobrecubierta['papel_generico'];
|
||||||
$gramaje = $sobrecubierta['gramaje'];
|
$gramaje = $sobrecubierta['gramaje'];
|
||||||
$paginas_color = $this->request->getPost('paginas_color') ?? 0;
|
$paginas_color = $sobrecubierta['datosPedido']['paginas'] ?? 0;
|
||||||
$tipo_impresion_id = $this->request->getPost('tipo_impresion_id');
|
$tipo_impresion_id = $sobrecubierta['tipo_impresion_id'];
|
||||||
$uso = $this->request->getPost('uso');
|
$uso = $sobrecubierta['uso'];
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'cliente_id' => $cliente_id,
|
'cliente_id' => $cliente_id,
|
||||||
@ -718,14 +719,16 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
'tipo_impresion_id' => $tipo_impresion_id,
|
'tipo_impresion_id' => $tipo_impresion_id,
|
||||||
'uso' => $uso
|
'uso' => $uso
|
||||||
);
|
);
|
||||||
$lineas = PresupuestoClienteService::obtenerSobrecubierta($data, true);
|
$lineasSobrecubierta = PresupuestoClienteService::obtenerSobrecubierta($data, true);
|
||||||
$resultado['sobrecubierta'] = $lineas;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(
|
return $this->respond(
|
||||||
[
|
[
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'data' => $resultado
|
'data' => (object) array(
|
||||||
|
'cubierta' => $lineasCubierta,
|
||||||
|
'sobrecubierta' => $lineasSobrecubierta
|
||||||
|
)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ return [
|
|||||||
'perfilSection' => 'Perfil',
|
'perfilSection' => 'Perfil',
|
||||||
'direccionesSection' => 'Direcciones',
|
'direccionesSection' => 'Direcciones',
|
||||||
'presupuestoSection' => 'Presupuestos',
|
'presupuestoSection' => 'Presupuestos',
|
||||||
'presupuestoClienteSection' => 'Presupuestos',
|
'presupuestoClienteSection' => 'Presupuestos cliente',
|
||||||
'pedidosActivosSection' => 'Activos',
|
'pedidosActivosSection' => 'Activos',
|
||||||
'pedidosFinalizadosSection' => 'Finalizados',
|
'pedidosFinalizadosSection' => 'Finalizados',
|
||||||
'pedidosCanceladosSection' => 'Cancelados',
|
'pedidosCanceladosSection' => 'Cancelados',
|
||||||
|
|||||||
@ -165,7 +165,7 @@ class PresupuestoClienteService extends BaseService
|
|||||||
$lineas_sobrecubierta = array_values(array_unique($lineas_sobrecubierta, SORT_REGULAR));
|
$lineas_sobrecubierta = array_values(array_unique($lineas_sobrecubierta, SORT_REGULAR));
|
||||||
|
|
||||||
return[
|
return[
|
||||||
'cubierta' => $lineas_sobrecubierta
|
'sobrecubierta' => $lineas_sobrecubierta
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -240,6 +240,7 @@ class Comparador {
|
|||||||
this.papelColor.onChange(() => this.gramajeColor.setVal(0))
|
this.papelColor.onChange(() => this.gramajeColor.setVal(0))
|
||||||
this.papelColorhq.onChange(() => this.gramajeColorhq.setVal(0))
|
this.papelColorhq.onChange(() => this.gramajeColorhq.setVal(0))
|
||||||
this.papelCubierta.onChange(() => this.gramajeCubierta.setVal(0))
|
this.papelCubierta.onChange(() => this.gramajeCubierta.setVal(0))
|
||||||
|
this.papelCubierta.onChange(() => this.gramajeSobrecubierta.setVal(0))
|
||||||
|
|
||||||
|
|
||||||
this.tipo_impresion.select2({
|
this.tipo_impresion.select2({
|
||||||
@ -841,7 +842,7 @@ class Comparador {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (uso = 'cubierta') {
|
else if (uso == 'cubierta') {
|
||||||
if (this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) {
|
if (this.papelCubierta.getVal() == 0 || this.papelCubierta.getVal() == null) {
|
||||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||||
return { error: true, data: {} };
|
return { error: true, data: {} };
|
||||||
@ -857,7 +858,7 @@ class Comparador {
|
|||||||
paginas = this.paginasCubierta.select2('data')[0].id
|
paginas = this.paginasCubierta.select2('data')[0].id
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (uso = 'sobrecubierta') {
|
else if (uso == 'sobrecubierta') {
|
||||||
if (this.papelSobrecubierta.getVal() == 0 || this.papelSobrecubierta.getVal() == null) {
|
if (this.papelSobrecubierta.getVal() == 0 || this.papelSobrecubierta.getVal() == null) {
|
||||||
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador');
|
||||||
return { error: true, data: {} };
|
return { error: true, data: {} };
|
||||||
@ -900,15 +901,47 @@ class Comparador {
|
|||||||
isHq: this.tipo_impresion.val().includes('hq'),
|
isHq: this.tipo_impresion.val().includes('hq'),
|
||||||
paginas_color: paginasColor
|
paginas_color: paginasColor
|
||||||
}
|
}
|
||||||
// TO-DO
|
|
||||||
if(uso == 'cubierta'){
|
if (uso == 'cubierta') {
|
||||||
|
datos.datosPedido.lomo = this.getLomoLineasPresupuesto('interior');
|
||||||
|
datos.datosPedido.solapas = $('#solapas').prop('checked') ? 1 : 0;
|
||||||
|
datos.datosPedido.solapas_ancho = $('#solapas').prop('checked') ? parseInt($('#solapas_ancho').val()) : 0;
|
||||||
|
// TO-DO
|
||||||
datos.lomoRedondo = false;
|
datos.lomoRedondo = false;
|
||||||
}
|
}
|
||||||
|
else if (uso == 'sobrecubierta') {
|
||||||
|
datos.datosPedido.lomo = this.getLomoLineasPresupuesto() + this.getLomoLineasPresupuesto('cubierta');
|
||||||
|
datos.datosPedido.solapas = $('#solapas_sobrecubierta').prop('checked') ? 1 : 0;
|
||||||
|
datos.datosPedido.solapas_ancho = $('#solapas_sobrecubierta').prop('checked') ? parseInt($('#solapas_ancho_sobrecubierta').val()) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return { error: false, data: datos };
|
return { error: false, data: datos };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLomoLineasPresupuesto(tipo_lomo='interior') {
|
||||||
|
|
||||||
|
let lomoTotal = 0
|
||||||
|
try {
|
||||||
|
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
|
var rowData = this.data();
|
||||||
|
if (tipo_lomo = 'interior') {
|
||||||
|
if (rowData.row_id != 'lp_cubierta' && rowData.tipo != 'lp_sobrecubierta')
|
||||||
|
lomoTotal += parseFloat(rowData.lomo);
|
||||||
|
}
|
||||||
|
else if (tipo_lomo == 'cubierta') {
|
||||||
|
if (rowData.row_id == 'lp_cubierta')
|
||||||
|
lomoTotal += parseFloat(rowData.lomo);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
lomoTotal = 0;
|
||||||
|
}
|
||||||
|
$('#lomo_cubierta').val(lomoTotal);
|
||||||
|
return lomoTotal;
|
||||||
|
}
|
||||||
|
|
||||||
obtenerComparadorInterior(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
obtenerComparadorInterior(event, actualizarLineaPlana = false, actualizarLineaRot = false) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1067,15 +1100,15 @@ class Comparador {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
datosComp.sobrecubierta = {};
|
datosComp.sobrecubierta = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
datosComp.sobrecubierta = {};
|
datosComp.sobrecubierta = {};
|
||||||
}
|
}
|
||||||
datosComp.cubierta.data[this.csrf_token] = this.csrf_hash;
|
datosComp.cubierta.data[this.csrf_token] = this.csrf_hash;
|
||||||
if(Object.keys(datosComp.sobrecubierta).length > 0){
|
if (Object.keys(datosComp.sobrecubierta).length > 0) {
|
||||||
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
|
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
|
||||||
}
|
}
|
||||||
new Ajax('/presupuestoadmin/comparadorexteriores',
|
new Ajax('/presupuestoadmin/comparadorexteriores',
|
||||||
@ -1085,22 +1118,23 @@ class Comparador {
|
|||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.data.cubierta.length > 0) {
|
if (response.data.cubierta && Object.keys(response.data.cubierta).length > 0) {
|
||||||
let sorted = response.data.cubierta.sort(
|
let sorted = Object.values(response.data.cubierta).sort(
|
||||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
sorted.forEach(function (linea) {
|
|
||||||
|
sorted[0].forEach(function (linea) {
|
||||||
if (typeof linea.error == "undefined")
|
if (typeof linea.error == "undefined")
|
||||||
self.tableCompCubierta.row
|
self.tableCompCubierta.row
|
||||||
add(self.getRowFromLinea('cubierta', linea))
|
.add(self.getRowFromLinea('cubierta', linea))
|
||||||
.draw()
|
.draw();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (response.data.sobrecubierta) {
|
if (response.data.sobrecubierta && Object.keys(response.data.sobrecubierta).length > 0) {
|
||||||
let sorted = response.data.sobrecubierta.sort(
|
let sorted = Object.values(response.data.sobrecubierta).sort(
|
||||||
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
(p1, p2) => ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) < (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ?
|
||||||
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
-1 : ((p1.fields.precio_pedido + p1.fields.precio_click_pedido) > (p2.fields.precio_pedido + p2.fields.precio_click_pedido)) ? 1 : 0);
|
||||||
sorted.forEach(function (linea) {
|
sorted[0].forEach(function (linea) {
|
||||||
if (typeof linea.error == "undefined")
|
if (typeof linea.error == "undefined")
|
||||||
self.tableCompCubierta.row
|
self.tableCompCubierta.row
|
||||||
.add(self.getRowFromLinea('sobrecubierta', linea))
|
.add(self.getRowFromLinea('sobrecubierta', linea))
|
||||||
@ -1141,8 +1175,8 @@ class Comparador {
|
|||||||
switch (tabla) {
|
switch (tabla) {
|
||||||
case 'cubierta':
|
case 'cubierta':
|
||||||
table = this.tableCompCubierta;
|
table = this.tableCompCubierta;
|
||||||
tipo1 = 'lp_cubierta';
|
tipo1 = 'cubierta';
|
||||||
tipo2 = 'lp_sobrecubierta';
|
tipo2 = 'sobrecubierta';
|
||||||
total_label = '#total_comp_cubierta';
|
total_label = '#total_comp_cubierta';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user