mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en direcciones!
This commit is contained in:
@ -663,21 +663,25 @@ $routes->group('serviciosacabados', ['namespace' => 'App\Controllers\Presupuesto
|
|||||||
$routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']);
|
$routes->post('menuitems', 'Presupuestoacabados::menuItems', ['as' => 'menuItemsOfPresupuestoAcabados']);
|
||||||
$routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']);
|
$routes->post('edit/(:num)', 'Presupuestoacabados::edit/$1', ['as' => 'updatePresupuestoacabados']);
|
||||||
$routes->get('cargar', 'Presupuestoacabados::cargar');
|
$routes->get('cargar', 'Presupuestoacabados::cargar');
|
||||||
|
$routes->post('update/(:num)', 'Presupuestoacabados::update/$1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
$routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
$routes->post('datatable', 'Presupuestoencuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
|
$routes->post('datatable', 'Presupuestoencuadernaciones::datatable', ['as' => 'dataTableOfPresupuestoEncuadernaciones']);
|
||||||
$routes->post('getvalues', 'Presupuestoencuadernaciones::getRowValues');
|
$routes->post('getvalues', 'Presupuestoencuadernaciones::getRowValues');
|
||||||
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
||||||
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
||||||
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
||||||
|
$routes->post('update/(:num)', 'Presupuestoencuadernaciones::update/$1');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
$routes->post('getvalues', 'Presupuestomanipulados::getRowValues');
|
$routes->post('getvalues', 'Presupuestomanipulados::getRowValues');
|
||||||
$routes->post('datatable', 'Presupuestomanipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
|
$routes->post('datatable', 'Presupuestomanipulados::datatable', ['as' => 'dataTableOfPresupuestoManipulados']);
|
||||||
$routes->post('edit/(:num)', 'Presupuestomanipulados::edit/$1', ['as' => 'updatePresupuestomanipulados']);
|
$routes->post('edit/(:num)', 'Presupuestomanipulados::edit/$1', ['as' => 'updatePresupuestomanipulados']);
|
||||||
|
$routes->post('update/(:num)', 'Presupuestomanipulados::update/$1');
|
||||||
|
$routes->get('serviciosolapas', 'Presupuestomanipulados::getServicioSolapas');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
$routes->group('serviciospreimpresiones', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
|
|||||||
@ -69,23 +69,26 @@ class Presupuestoacabados extends \App\Controllers\BaseResourceController
|
|||||||
return;
|
return;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$postData = $this->request->getJSON();
|
$postData = $this->request->getPost();
|
||||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
$datos_tarifas = $postData['datos'] ?? [];
|
||||||
$tirada = $postData->tirada ?? 0;
|
$tirada = $postData['tirada'] ?? 0;
|
||||||
$POD = $postData->POD ?? 0;
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
if (count($tarifas) > 0) {
|
if (count($datos_tarifas) > 0) {
|
||||||
foreach ($tarifas as $tarifa) {
|
foreach ($datos_tarifas as $tarifa) {
|
||||||
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $POD);
|
$proveedor = $tarifa['proveedor_id'] == '' ? -1 : $tarifa['proveedor_id'];
|
||||||
array_push($result, $values);
|
$values = $this->model->getPrecioTarifa($tarifa['tarifa_id'], $tirada, $proveedor, $POD);
|
||||||
|
$values[0]->cubierta = $tarifa['cubierta'] ?? 0;
|
||||||
|
$values[0]->sobrecubierta = $tarifa['sobrecubierta'] ?? 0;
|
||||||
|
array_push($result, $values[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
$data = [
|
$data = [
|
||||||
'lines' => $result,
|
'lineas' => $result,
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -510,6 +510,13 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$data['servicios'] = $this->getLineasServicios($presupuesto)[1];
|
$data['servicios'] = $this->getLineasServicios($presupuesto)[1];
|
||||||
|
|
||||||
|
if (intval($presupuesto->envios_recoge_cliente) == 1) {
|
||||||
|
$data['direcciones']['entrega_taller'] = 1;
|
||||||
|
} else {
|
||||||
|
$data['direcciones']['entrega_taller'] = 0;
|
||||||
|
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
||||||
@ -1422,4 +1429,17 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
return PresupuestoService::checkLineasEnvios($direccionesEnvio);
|
return PresupuestoService::checkLineasEnvios($direccionesEnvio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function obtenerDireccionesEnvio($id, $cliente_id)
|
||||||
|
{
|
||||||
|
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||||
|
$model_direcciones = model('App\Models\Clientes\ClienteDireccionesModel');
|
||||||
|
$direcciones = $model
|
||||||
|
->join('lg_proveedores', 'presupuesto_direcciones.proveedor_id = lg_proveedores.id')
|
||||||
|
->join('lg_paises', 'presupuesto_direcciones.pais_id = lg_paises.id')
|
||||||
|
->select('presupuesto_direcciones.*, lg_proveedores.nombre AS proveedor, lg_paises.nombre AS pais')
|
||||||
|
->where('presupuesto_id', $id)->findAll();
|
||||||
|
|
||||||
|
return $direcciones;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -345,6 +345,53 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$lomo += floatval($linea['mano']);
|
$lomo += floatval($linea['mano']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Guardas
|
||||||
|
$guardas = $reqData['guardas'] ?? [];
|
||||||
|
if ($guardas != "false" && $guardas != null) {
|
||||||
|
$datos_guardas = [
|
||||||
|
'papel' => $modelPapelGenerico->getIdFromCode($guardas['papel']),
|
||||||
|
'gramaje' => intval($guardas['gramaje']),
|
||||||
|
'caras' => intval($guardas['caras']),
|
||||||
|
];
|
||||||
|
} else
|
||||||
|
$datos_guardas = false;
|
||||||
|
$guardas = [];
|
||||||
|
$peso_guardas = 0.0;
|
||||||
|
$coste_guardas = 0.0;
|
||||||
|
if ($datos_guardas != 0) {
|
||||||
|
if (count($datos_guardas) != 0 && $datos_guardas) {
|
||||||
|
|
||||||
|
$guardas = $datos_guardas;
|
||||||
|
$input_data['papel_generico'] = $datos_guardas['papel'] ?? 0;
|
||||||
|
$input_data['gramaje'] = $datos_guardas['gramaje'] ?? 0;
|
||||||
|
$input_data['datosPedido']->paginas = 8;
|
||||||
|
$input_data['paginas_color'] = 8;
|
||||||
|
$input_data['datosPedido']->paginas_impresion = $datos_guardas['caras'] ?? 0;
|
||||||
|
$input_data['datosPedido']->solapas_ancho = 0;
|
||||||
|
$input_data['datosPedido']->solapas = 0;
|
||||||
|
$input_data['isColor'] = 1;
|
||||||
|
$input_data['isHq'] = 1;
|
||||||
|
$input_data['uso'] = 'guardas';
|
||||||
|
|
||||||
|
// Para el caso de Fresado y Cosido tapa dura, las guardas son un diptico
|
||||||
|
// y hay que imprimirlas como "cosido" (dos hojas pegadas). En el caso de espiral
|
||||||
|
// o wire-o tapa dura, las guardas se imprimen como hojas sueltas
|
||||||
|
if ($tipo_impresion_id == 1 || $tipo_impresion_id == 3) {
|
||||||
|
$input_data['datosPedido']->isCosido = true;
|
||||||
|
} else if ($tipo_impresion_id == 5 || $tipo_impresion_id == 7) {
|
||||||
|
$input_data['datosPedido']->isCosido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$guardas = PresupuestoClienteService::obtenerGuardas($input_data);
|
||||||
|
|
||||||
|
foreach ($guardas as $linea) {
|
||||||
|
if (count($linea) > 0) {
|
||||||
|
$lomo += floatval($linea['mano']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$lomo = round($lomo, 2);
|
$lomo = round($lomo, 2);
|
||||||
$errors = [
|
$errors = [
|
||||||
'status' => 0,
|
'status' => 0,
|
||||||
@ -659,7 +706,21 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
if ($interior == null) {
|
if ($interior == null) {
|
||||||
return $this->failServerError('Error al calcular el interior');
|
return $this->failServerError('Error al calcular el interior');
|
||||||
}
|
}
|
||||||
$anchoTotal = $interior[0]['mano'];
|
|
||||||
|
$anchoTotal = 0;
|
||||||
|
if(count($interior) == 2) {
|
||||||
|
|
||||||
|
if(count($interior[0]) > 0)
|
||||||
|
$anchoTotal += $interior[0]['mano'];
|
||||||
|
if(count($interior[1]) > 0)
|
||||||
|
$anchoTotal += $interior[1]['mano'];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(count($interior) > 0)
|
||||||
|
$anchoTotal += $interior['mano'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// le añadimos 2*ancho libro
|
// le añadimos 2*ancho libro
|
||||||
$anchoTotal += 2 * $datosPedido->ancho;
|
$anchoTotal += 2 * $datosPedido->ancho;
|
||||||
// le añadimos los dobleces de las solapas
|
// le añadimos los dobleces de las solapas
|
||||||
|
|||||||
@ -69,30 +69,30 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
|
|||||||
return;
|
return;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$postData = $this->request->getJSON();
|
$postData = $this->request->getPost();
|
||||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
$datos_tarifas = $postData['datos'] ?? [];
|
||||||
$tirada = $postData->tirada ?? 0;
|
$tirada = $postData['tirada'] ?? 0;
|
||||||
$paginas = $postData->paginas ?? 0;
|
$paginas = $postData['paginas'] ?? 0;
|
||||||
$POD = $postData->POD ?? 0;
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
$ancho = $postData->ancho ?? 0;
|
$ancho = $postData['ancho'] ?? 0;
|
||||||
$alto = $postData->alto ?? 0;
|
$alto = $postData['alto'] ?? 0;
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
if (count($tarifas) > 0) {
|
if (count($datos_tarifas) > 0) {
|
||||||
foreach ($tarifas as $tarifa) {
|
foreach ($datos_tarifas as $tarifa) {
|
||||||
if ($tarifaModel->isTarifaPorHoras($tarifa)) {
|
if ($tarifaModel->isTarifaPorHoras($tarifa['tarifa_id'])) {
|
||||||
$values = $this->model->getPrecioTarifaHoras($tarifa, $paginas, $tirada, -1, $POD);
|
$values = $this->model->getPrecioTarifaHoras($tarifa['tarifa_id'], $paginas, $tirada, -1, $POD);
|
||||||
} else {
|
} else {
|
||||||
$values = $this->model->getPrecioTarifa($tarifa, $paginas, $tirada, $ancho, $alto, -1, $POD);
|
$values = $this->model->getPrecioTarifa($tarifa['tarifa_id'], $paginas, $tirada, $ancho, $alto, -1, $POD);
|
||||||
}
|
}
|
||||||
array_push($result, $values);
|
array_push($result, $values[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
$data = [
|
$data = [
|
||||||
'lines' => $result,
|
'lineas' => $result,
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,27 @@ class Presupuestomanipulados extends \App\Controllers\BaseResourceController
|
|||||||
return $this->respond($data);
|
return $this->respond($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getServicioSolapas(){
|
||||||
|
|
||||||
|
if($this->request->isAJAX()){
|
||||||
|
|
||||||
|
$servicio = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('servicio_solapas')->value;
|
||||||
|
|
||||||
|
$newTokenHash = csrf_hash();
|
||||||
|
$csrfTokenName = csrf_token();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'service' => $servicio,
|
||||||
|
$csrfTokenName => $newTokenHash
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function update($requestedId = null)
|
public function update($requestedId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -70,23 +91,23 @@ class Presupuestomanipulados extends \App\Controllers\BaseResourceController
|
|||||||
return;
|
return;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$postData = $this->request->getJSON();
|
$postData = $this->request->getPost();
|
||||||
$tarifas = array_column($postData->datos, 'tarifa_id');
|
$tarifas = $postData['datos'] ?? [];
|
||||||
$tirada = $postData->tirada ?? 0;
|
$tirada = $postData['tirada'] ?? 0;
|
||||||
$POD = $postData->POD ?? 0;
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
if(count($tarifas)>0){
|
if(count($tarifas)>0){
|
||||||
foreach ($tarifas as $tarifa){
|
foreach ($tarifas as $tarifa){
|
||||||
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $POD);
|
$values = $this->model->getPrecioTarifa($tarifa, $tirada, $POD);
|
||||||
array_push($result, $values);
|
array_push($result, $values[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$newTokenHash = csrf_hash();
|
$newTokenHash = csrf_hash();
|
||||||
$csrfTokenName = csrf_token();
|
$csrfTokenName = csrf_token();
|
||||||
$data = [
|
$data = [
|
||||||
'lines' => $result,
|
'lineas' => $result,
|
||||||
$csrfTokenName => $newTokenHash
|
$csrfTokenName => $newTokenHash
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
const actionBtns_direcciones = function(data) {
|
/*
|
||||||
return `
|
|
||||||
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-add mx-2" data-id="${data.id}"></i></a></span>
|
|
||||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas delete-add-row mx-2"></i></a>
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Funcion para obtener el peso total del libro
|
// Funcion para obtener el peso total del libro
|
||||||
function get_peso_libro(){
|
function get_peso_libro(){
|
||||||
@ -203,7 +198,7 @@ $('#insertar_direccion').on('click', function(){
|
|||||||
$newAddDialog.modal('show')
|
$newAddDialog.modal('show')
|
||||||
})
|
})
|
||||||
|
|
||||||
const lastColNr_direcciones = $('#tableOfDireccionesEnvio').find("tr:first th").length - 1;
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.delete-add-row', function(e) {
|
$(document).on('click', '.delete-add-row', function(e) {
|
||||||
@ -280,67 +275,6 @@ $('#recoger_en_taller').change(function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
let tableEnvios = $('#tableOfDireccionesEnvio').DataTable( {
|
|
||||||
draw:5,
|
|
||||||
serverSide: false,
|
|
||||||
processing: true,
|
|
||||||
autoWidth: true,
|
|
||||||
responsive: true,
|
|
||||||
order: [[ 0, "asc" ]],
|
|
||||||
pageLength: 20,
|
|
||||||
lengthChange: false,
|
|
||||||
searching: false,
|
|
||||||
paging: false,
|
|
||||||
info: false,
|
|
||||||
scrollX: true,
|
|
||||||
|
|
||||||
columns: [
|
|
||||||
{ 'data': 'tarifa_id' },
|
|
||||||
{ 'data': 'cantidad' },
|
|
||||||
{ 'data': 'peso' },
|
|
||||||
{ 'data': 'att' },
|
|
||||||
{ 'data': 'email' },
|
|
||||||
{ 'data': 'direccion' },
|
|
||||||
{ 'data': 'cp' },
|
|
||||||
{ 'data': 'municipio' },
|
|
||||||
{ 'data': 'paisId' ,
|
|
||||||
render: function(data, type, row, meta) {
|
|
||||||
var pais = window.paisList.find(element => element.id == data);
|
|
||||||
return pais['nombre'];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'data': 'telefono' },
|
|
||||||
{ 'data': 'proveedor'},
|
|
||||||
{ 'data': 'proveedor_id'},
|
|
||||||
{ 'data': 'precio' },
|
|
||||||
{ 'data': 'margen' },
|
|
||||||
{ 'data': 'entregaPieCalle' },
|
|
||||||
{
|
|
||||||
data: actionBtns_direcciones,
|
|
||||||
className: 'row-edit dt-center'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
columnDefs: [
|
|
||||||
{
|
|
||||||
orderable: false,
|
|
||||||
searchable: false,
|
|
||||||
targets: [lastColNr_direcciones]
|
|
||||||
},
|
|
||||||
{"orderData": [ 0], "targets": 0 },
|
|
||||||
|
|
||||||
],
|
|
||||||
columnDefs: [
|
|
||||||
{
|
|
||||||
target: [0,11,13,14],
|
|
||||||
visible: false,
|
|
||||||
searchable: false
|
|
||||||
},
|
|
||||||
],
|
|
||||||
language: {
|
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
|
||||||
},
|
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -421,3 +355,4 @@ function load_datos_envios(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable px-2 update-resumen-presupuesto" style="width: 95%;">
|
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable px-2 update-resumen-presupuesto" style="width: 95%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="lp-header">Tarifa_id</th>
|
<th class="lp-header">TARIFA ID</th>
|
||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.cantidad') ?></th>
|
||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.peso') ?></th>
|
||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.att') ?></th>
|
||||||
@ -27,8 +27,8 @@
|
|||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.proveedor') ?></th>
|
||||||
<th>Proveedor_id</th>
|
<th>Proveedor_id</th>
|
||||||
<th class="lp-header"><?= lang('PresupuestosDirecciones.precio') ?></th>
|
<th class="lp-header"><?= lang('PresupuestosDirecciones.precio') ?></th>
|
||||||
<th>Margen</th>
|
<th><?= lang('Tarifaacabado.margen') ?></th>
|
||||||
<th>Entrega a pie</th>
|
<th>Pallets?</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>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@ import Comparador from './sections/comparador.js';
|
|||||||
import LineasPresupuesto from './sections/lineasPresupuesto.js';
|
import LineasPresupuesto from './sections/lineasPresupuesto.js';
|
||||||
import PreviewFormasAdmin from './sections/previewFormasAdmin.js';
|
import PreviewFormasAdmin from './sections/previewFormasAdmin.js';
|
||||||
import Servicios from './sections/servicios.js';
|
import Servicios from './sections/servicios.js';
|
||||||
|
import Envios from './sections/envios.js';
|
||||||
|
|
||||||
class PresupuestoAdminEdit {
|
class PresupuestoAdminEdit {
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
this.previewFormasAdmin = null;
|
this.previewFormasAdmin = null;
|
||||||
this.servicios = new Servicios();
|
this.servicios = new Servicios();
|
||||||
|
this.envios = new Envios();
|
||||||
this.calcularPresupuesto = false;
|
this.calcularPresupuesto = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +69,7 @@ class PresupuestoAdminEdit {
|
|||||||
this.datosLibro.init();
|
this.datosLibro.init();
|
||||||
this.comparador.init();
|
this.comparador.init();
|
||||||
this.lineasPresupuesto.init();
|
this.lineasPresupuesto.init();
|
||||||
|
this.envios.init();
|
||||||
|
|
||||||
this.previewFormasAdmin = new PreviewFormasAdmin(tipoLibro, this.tipoTapa,
|
this.previewFormasAdmin = new PreviewFormasAdmin(tipoLibro, this.tipoTapa,
|
||||||
{
|
{
|
||||||
@ -124,6 +127,7 @@ class PresupuestoAdminEdit {
|
|||||||
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
self.lineasPresupuesto.cargarDatos(response.data.lineasPresupuesto);
|
||||||
|
|
||||||
self.servicios.cargar(response.data.servicios);
|
self.servicios.cargar(response.data.servicios);
|
||||||
|
self.envios.cargar(response.data.direcciones);
|
||||||
/*self.direcciones.handleChangeCliente();
|
/*self.direcciones.handleChangeCliente();
|
||||||
|
|
||||||
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
|
||||||
|
|||||||
@ -66,8 +66,8 @@ class DatosLibro {
|
|||||||
this.acabadoSobrecubierta.init();
|
this.acabadoSobrecubierta.init();
|
||||||
|
|
||||||
this.acabadoCubierta.item.on('select2:select', function () {
|
this.acabadoCubierta.item.on('select2:select', function () {
|
||||||
|
|
||||||
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
$(document).trigger('add-servicio-lineas', 'acabadoCubierta');
|
||||||
});
|
});
|
||||||
this.acabadoSobrecubierta.item.on('select2:select', function () {
|
this.acabadoSobrecubierta.item.on('select2:select', function () {
|
||||||
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
|
$(document).trigger('add-servicio-lineas', 'acabadoSobrecubierta');
|
||||||
@ -96,9 +96,10 @@ class DatosLibro {
|
|||||||
|
|
||||||
$('.formato-libro').on('change', function () {
|
$('.formato-libro').on('change', function () {
|
||||||
$(document).trigger('update-lineas-presupuesto');
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
|
$(document).trigger('update-servicios');
|
||||||
|
|
||||||
/* TO-DO
|
/* TO-DO
|
||||||
updatePresupuesto({
|
updatePresupuesto({
|
||||||
update_servicios: true,
|
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
@ -116,7 +117,7 @@ class DatosLibro {
|
|||||||
$(document).trigger('remove-servicio-lineas', 'fajaColor');
|
$(document).trigger('remove-servicio-lineas', 'fajaColor');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeFerro() {
|
changeFerro() {
|
||||||
|
|
||||||
if (this.ferro.prop('checked')) {
|
if (this.ferro.prop('checked')) {
|
||||||
@ -130,7 +131,7 @@ class DatosLibro {
|
|||||||
changePrototipo() {
|
changePrototipo() {
|
||||||
|
|
||||||
if (this.prototipo.prop('checked')) {
|
if (this.prototipo.prop('checked')) {
|
||||||
|
|
||||||
$(document).trigger('add-servicio-lineas', 'prototipo');
|
$(document).trigger('add-servicio-lineas', 'prototipo');
|
||||||
this.ferro.prop('checked', true).trigger('change');
|
this.ferro.prop('checked', true).trigger('change');
|
||||||
}
|
}
|
||||||
@ -183,33 +184,32 @@ class DatosLibro {
|
|||||||
this.checkPaginasPresupuesto();
|
this.checkPaginasPresupuesto();
|
||||||
|
|
||||||
$(document).trigger('update-lineas-presupuesto');
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
|
$(document).trigger('update-servicios');
|
||||||
// TO-DO
|
// TO-DO
|
||||||
/*updatePresupuesto({
|
/*updatePresupuesto({
|
||||||
update_servicios: true,
|
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
})*/
|
})*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
changeTipoTamanio(){
|
changeTipoTamanio() {
|
||||||
|
|
||||||
if(this.tamanioPersonalizado.prop('checked')){
|
if (this.tamanioPersonalizado.prop('checked')) {
|
||||||
$('.tamanio-personalizado').removeClass('d-none');
|
$('.tamanio-personalizado').removeClass('d-none');
|
||||||
$('.tamanio-estandar').addClass('d-none');
|
$('.tamanio-estandar').addClass('d-none');
|
||||||
this.tamanio.setVal('');
|
this.tamanio.setVal('');
|
||||||
$("#label_papelFormatoId").text(
|
$("#label_papelFormatoId").text(
|
||||||
window.language.Presupuestos.papelFormatoId + " (" +
|
window.language.Presupuestos.papelFormatoId + " (" +
|
||||||
window.language.Presupuestos.papelFormatoAncho + " x " + window.language.Presupuestos.papelFormatoAncho + ")*");
|
window.language.Presupuestos.papelFormatoAncho + " x " + window.language.Presupuestos.papelFormatoAncho + ")*");
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.anchoPersonalizado.val("");
|
this.anchoPersonalizado.val("");
|
||||||
this.altoPersonalizado.val("");
|
this.altoPersonalizado.val("");
|
||||||
$('.tamanio-personalizado').addClass('d-none');
|
$('.tamanio-personalizado').addClass('d-none');
|
||||||
$('.tamanio-estandar').removeClass('d-none');
|
$('.tamanio-estandar').removeClass('d-none');
|
||||||
$("#label_papelFormatoId").text(
|
$("#label_papelFormatoId").text(
|
||||||
window.language.Presupuestos.papelFormatoId + '*');
|
window.language.Presupuestos.papelFormatoId + '*');
|
||||||
}
|
}
|
||||||
$(document).trigger('update-lineas-presupuesto');
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
@ -218,59 +218,67 @@ class DatosLibro {
|
|||||||
|
|
||||||
changeSolapasCubierta() {
|
changeSolapasCubierta() {
|
||||||
|
|
||||||
if (this.solapasCubierta.prop('checked')) {
|
setTimeout(() => {
|
||||||
$('#div_solapas_ancho').removeClass('d-none');
|
if (this.solapasCubierta.prop('checked')) {
|
||||||
}
|
$('#div_solapas_ancho').removeClass('d-none');
|
||||||
else {
|
$(document).trigger('add-servicio-lineas', 'solapas');
|
||||||
$('#div_solapas_ancho').divSolapasCubierta.addClass('d-none');
|
}
|
||||||
this.anchoSolapasCubierta.val(0);
|
else {
|
||||||
}
|
$('#div_solapas_ancho').addClass('d-none');
|
||||||
$('#serv_default').trigger('click');
|
this.anchoSolapasCubierta.val(60);
|
||||||
|
$(document).trigger('remove-servicio-lineas', 'solapas');
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
$(document).trigger('update-servicios');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
changeSolapasSobrecubierta() {
|
changeSolapasSobrecubierta() {
|
||||||
|
|
||||||
if (this.solapasSobrecubierta.prop('checked')) {
|
if (this.solapasSobrecubierta.prop('checked')) {
|
||||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||||
|
$(document).trigger('remove-servicio-lineas', 'solapas');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.divSolapasSobrecubierta.addClass('d-none');
|
this.divSolapasSobrecubierta.addClass('d-none');
|
||||||
this.anchoSolapasSobrecubierta.val(0);
|
this.anchoSolapasSobrecubierta.val(60);
|
||||||
|
$(document).trigger('add-servicio-lineas', 'solapas');
|
||||||
}
|
}
|
||||||
$('#serv_default').trigger('click');
|
$(document).trigger('update-servicios');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changePaginas() {
|
changePaginas() {
|
||||||
|
|
||||||
if($('#tipo_impresion_id').val() == 21){
|
if ($('#tipo_impresion_id').val() == 21) {
|
||||||
if(parseInt($('#paginas').val()) > 80){
|
if (parseInt($('#paginas').val()) > 80) {
|
||||||
$('#paginas').val(80)
|
$('#paginas').val(80)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window.location.href.includes('edit')){
|
if (window.location.href.includes('edit')) {
|
||||||
|
|
||||||
this.checkPaginasPresupuesto();
|
this.checkPaginasPresupuesto();
|
||||||
|
|
||||||
// Si es negro o color
|
// Si es negro o color
|
||||||
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
if ($('#tipoImpresion').select2('data')[0].id == 'negro' ||
|
||||||
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
$('#tipoImpresion').select2('data')[0].id == 'color') {
|
||||||
$('#compPaginasNegro').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColor').val()));
|
$('#compPaginasNegro').val(parseInt($('#paginas').val()) - parseInt($('#compPaginasColor').val()));
|
||||||
$('#compPaginasNegro').trigger('change')
|
$('#compPaginasNegro').trigger('change')
|
||||||
}
|
}
|
||||||
// Si es negrohq o colorhq
|
// Si es negrohq o colorhq
|
||||||
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
if ($('#tipoImpresion').select2('data')[0].id == 'negrohq' ||
|
||||||
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
$('#tipoImpresion').select2('data')[0].id == 'colorhq') {
|
||||||
$('#compPaginasNegrohq').val(parseInt($('#paginas').val())-parseInt($('#compPaginasColorhq').val()));
|
$('#compPaginasNegrohq').val(parseInt($('#paginas').val()) - parseInt($('#compPaginasColorhq').val()));
|
||||||
$('#compPaginasNegrohq').trigger('change');
|
$('#compPaginasNegrohq').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
|
$(document).trigger('update-servicios');
|
||||||
|
|
||||||
// TO-DO
|
// TO-DO
|
||||||
/*
|
/*
|
||||||
updatePresupuesto({
|
updatePresupuesto({
|
||||||
update_lineas: true,
|
|
||||||
update_servicios: true,
|
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
@ -278,16 +286,16 @@ class DatosLibro {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
changeTirada(update_tiradas_alternativas = true) {
|
changeTirada(update_tiradas_alternativas = true) {
|
||||||
|
|
||||||
this.calcular_mermas()
|
this.calcular_mermas()
|
||||||
|
|
||||||
const url2 = window.location.href;
|
const url2 = window.location.href;
|
||||||
const url_parts2 = url2.split('/');
|
const url_parts2 = url2.split('/');
|
||||||
|
|
||||||
if(url_parts2[url_parts2.length-2] == 'edit'){
|
if (url_parts2[url_parts2.length - 2] == 'edit') {
|
||||||
$(document).trigger('update-lineas-presupuesto');
|
$(document).trigger('update-lineas-presupuesto');
|
||||||
//update_servicios(false)
|
//update_servicios(false)
|
||||||
//updateLineasPresupuesto()
|
//updateLineasPresupuesto()
|
||||||
@ -314,35 +322,35 @@ class DatosLibro {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calcular_mermas(){
|
calcular_mermas() {
|
||||||
|
|
||||||
const tirada = parseInt($('#tirada').val());
|
const tirada = parseInt($('#tirada').val());
|
||||||
const POD = parseInt($('#POD').val());
|
const POD = parseInt($('#POD').val());
|
||||||
let merma = 0;
|
let merma = 0;
|
||||||
let htmlString = '';
|
let htmlString = '';
|
||||||
|
|
||||||
if(tirada> POD){
|
if (tirada > POD) {
|
||||||
merma = tirada*0.1<=POD ? tirada*0.1 : POD;
|
merma = tirada * 0.1 <= POD ? tirada * 0.1 : POD;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
let merma_lineas = []
|
let merma_lineas = []
|
||||||
$('#tableLineasPresupuesto').DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) {
|
$('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
var rowData = this.data();
|
var rowData = this.data();
|
||||||
if(rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta'){
|
if (rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta') {
|
||||||
const formas_linea = parseInt($('#isCosido').val())==0?parseInt(rowData.formas):parseInt(rowData.formas)/2
|
const formas_linea = parseInt($('#isCosido').val()) == 0 ? parseInt(rowData.formas) : parseInt(rowData.formas) / 2
|
||||||
if(formas_linea > tirada)
|
if (formas_linea > tirada)
|
||||||
merma_lineas.push(formas_linea-tirada)
|
merma_lineas.push(formas_linea - tirada)
|
||||||
else
|
else
|
||||||
merma_lineas.push(tirada%formas_linea)
|
merma_lineas.push(tirada % formas_linea)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
if(merma_lineas.length>0)
|
if (merma_lineas.length > 0)
|
||||||
merma = Math.max(...merma_lineas)
|
merma = Math.max(...merma_lineas)
|
||||||
else{
|
else {
|
||||||
htmlString = `
|
htmlString = `
|
||||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||||
@ -350,16 +358,16 @@ class DatosLibro {
|
|||||||
</span>
|
</span>
|
||||||
<div class="d-flex flex-column ps-1">
|
<div class="d-flex flex-column ps-1">
|
||||||
<h5 class="alert-heading mb-2">` +
|
<h5 class="alert-heading mb-2">` +
|
||||||
window.language.Presupuestos.validation.no_lp_for_merma +
|
window.language.Presupuestos.validation.no_lp_for_merma +
|
||||||
`</h5>
|
`</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
merma = 0
|
merma = 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$('#mermacubierta').val(parseInt(merma))
|
$('#mermacubierta').val(parseInt(merma))
|
||||||
$('#merma').val(parseInt(merma))
|
$('#merma').val(parseInt(merma))
|
||||||
@ -392,15 +400,15 @@ class DatosLibro {
|
|||||||
$('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 7) {
|
$('#tipo_impresion_id').val() == 5 || $('#tipo_impresion_id').val() == 7) {
|
||||||
$(".solapas-cubierta-div").addClass('d-none');
|
$(".solapas-cubierta-div").addClass('d-none');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if (datos.solapasCubierta) {
|
if (datos.solapasCubierta) {
|
||||||
this.solapasCubierta.prop('checked', true);
|
this.solapasCubierta.prop('checked', true);
|
||||||
this.anchoSolapasCubierta.val(datos.solapasCubiertaAncho);
|
this.anchoSolapasCubierta.val(datos.solapasCubiertaAncho);
|
||||||
this.divSolapasSobrecubierta.removeClass('d-none');
|
this.divSolapasSobrecubierta.removeClass('d-none');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.solapasCubierta.prop('checked', false);
|
this.solapasCubierta.prop('checked', false);
|
||||||
this.anchoSolapasCubierta.val(0);
|
this.anchoSolapasCubierta.val(60);
|
||||||
this.divSolapasSobrecubierta.addClass('d-none');
|
this.divSolapasSobrecubierta.addClass('d-none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,12 +417,12 @@ class DatosLibro {
|
|||||||
this.anchoSolapasSobrecubierta.val(datos.solapasSobrecubiertaAncho);
|
this.anchoSolapasSobrecubierta.val(datos.solapasSobrecubiertaAncho);
|
||||||
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
$('#div_solapas_ancho_sobrecubierta').removeClass('d-none');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
this.solapasSobrecubierta.prop('checked', false);
|
this.solapasSobrecubierta.prop('checked', false);
|
||||||
this.anchoSolapasSobrecubierta.val(60);
|
this.anchoSolapasSobrecubierta.val(60);
|
||||||
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
|
$('#div_solapas_ancho_sobrecubierta').addClass('d-none');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text);
|
this.acabadoCubierta.setOption(datos.acabadoCubierta.id, datos.acabadoCubierta.text);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,125 @@
|
|||||||
|
import Ajax from "../../../components/ajax.js";
|
||||||
|
import { getToken } from "../../../common/common.js";
|
||||||
|
|
||||||
|
class Envios {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
this.csrf_token = getToken();
|
||||||
|
this.csrf_hash = $('#mainContainer').find('input[name="' + this.csrf_token + '"]').val();
|
||||||
|
|
||||||
|
this.recogerTaller = $('#recoger_en_taller');
|
||||||
|
|
||||||
|
this.table = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
this.table = $('#tableOfDireccionesEnvio').DataTable({
|
||||||
|
draw: 5,
|
||||||
|
serverSide: false,
|
||||||
|
processing: true,
|
||||||
|
autoWidth: true,
|
||||||
|
responsive: true,
|
||||||
|
order: [[0, "asc"]],
|
||||||
|
pageLength: 20,
|
||||||
|
lengthChange: false,
|
||||||
|
searching: false,
|
||||||
|
paging: false,
|
||||||
|
info: false,
|
||||||
|
scrollX: true,
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{ 'data': 'tarifa_id' },
|
||||||
|
{ 'data': 'cantidad' },
|
||||||
|
{ 'data': 'peso' },
|
||||||
|
{ 'data': 'att' },
|
||||||
|
{ 'data': 'email' },
|
||||||
|
{ 'data': 'direccion' },
|
||||||
|
{ 'data': 'cp' },
|
||||||
|
{ 'data': 'municipio' },
|
||||||
|
{ 'data': 'pais' },
|
||||||
|
{ 'data': 'telefono' },
|
||||||
|
{ 'data': 'proveedor' },
|
||||||
|
{ 'data': 'proveedor_id' },
|
||||||
|
{ 'data': 'precio' },
|
||||||
|
{ 'data': 'margen' },
|
||||||
|
{ 'data': 'entregaPieCalle' },
|
||||||
|
{
|
||||||
|
data: function (row, type, set, meta) {
|
||||||
|
return `
|
||||||
|
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-add mx-2" data-id="${row.id}"></i></a></span>
|
||||||
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas delete-add-row mx-2"></i></a>
|
||||||
|
`;
|
||||||
|
},
|
||||||
|
className: 'row-edit dt-center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
targets: [$('#tableOfDireccionesEnvio').find("tr:first th").length - 1]
|
||||||
|
},
|
||||||
|
{ "orderData": [0], "targets": 0 },
|
||||||
|
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
target: [11],
|
||||||
|
visible: false,
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
},
|
||||||
|
|
||||||
|
drawCallback: function (settings) {
|
||||||
|
self.check_unidades_enviadas();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cargar(datos) {
|
||||||
|
if (datos.entrega_taller) {
|
||||||
|
this.recogerTaller.prop('checked', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.table.rows.add(datos).draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
check_unidades_enviadas() {
|
||||||
|
|
||||||
|
var cantidad_total = 0
|
||||||
|
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||||
|
cantidad_total += parseInt(this.data().cantidad)
|
||||||
|
});
|
||||||
|
|
||||||
|
const tirada = parseInt($('#tirada').val());
|
||||||
|
let htmlString = '';
|
||||||
|
if (cantidad_total < tirada && this.recogerTaller.prop('checked') === false) {
|
||||||
|
htmlString = `
|
||||||
|
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||||
|
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||||
|
<i class="ti ti-bell ti-sm"></i>
|
||||||
|
</span>
|
||||||
|
<div class="d-flex flex-column ps-1">
|
||||||
|
<h5 class="alert-heading mb-2">` +
|
||||||
|
window.language.Presupuestos.validation.ejemplares_envio +
|
||||||
|
`</h5>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
$('#alert-envios').html(htmlString);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('#alert-envios').html(htmlString);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Envios;
|
||||||
@ -37,7 +37,6 @@ class LineasPresupuesto {
|
|||||||
|
|
||||||
// TO-DO
|
// TO-DO
|
||||||
/*updatePresupuesto({
|
/*updatePresupuesto({
|
||||||
update_servicios: true,
|
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
@ -1605,8 +1604,6 @@ class LineasPresupuesto {
|
|||||||
calcular_mermas()
|
calcular_mermas()
|
||||||
|
|
||||||
updatePresupuesto({
|
updatePresupuesto({
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: true,
|
|
||||||
update_envios: true,
|
update_envios: true,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
@ -1923,10 +1920,10 @@ class LineasPresupuesto {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TO-DO
|
/* TO-DO
|
||||||
updatePresupuesto({
|
updatePresupuesto({
|
||||||
update_lineas: false,
|
|
||||||
update_servicios: true,
|
|
||||||
update_envios: false,
|
update_envios: false,
|
||||||
update_resumen: true,
|
update_resumen: true,
|
||||||
update_tiradas_alternativas: true
|
update_tiradas_alternativas: true
|
||||||
|
|||||||
@ -53,9 +53,9 @@ class Servicios {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$(document).on('add-servicio-lineas', this.addServicio.bind(this));
|
$(document).on('add-servicio-lineas', this.addServicio.bind(this));
|
||||||
$(document).on('remove-servicio-lineas', this.addServicio.bind(this));
|
$(document).on('remove-servicio-lineas', this.removeServicio.bind(this));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('change', '.update-totales-servicios', function () {
|
$(document).on('change', '.update-totales-servicios', function () {
|
||||||
|
|
||||||
@ -71,6 +71,7 @@ class Servicios {
|
|||||||
showBreadCrumbSaveButton(true);
|
showBreadCrumbSaveButton(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('update-servicios', this.updateServicios.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
cargar(datos) {
|
cargar(datos) {
|
||||||
@ -96,13 +97,25 @@ class Servicios {
|
|||||||
else if (servicio == 'acabadoSobrecubierta') {
|
else if (servicio == 'acabadoSobrecubierta') {
|
||||||
this.serviciosAcabado.updateAcabadosExteriores(0, 1);
|
this.serviciosAcabado.updateAcabadosExteriores(0, 1);
|
||||||
}
|
}
|
||||||
|
else if (servicio == 'solapas') {
|
||||||
|
this.ServiciosManipulado.addSolapas();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeServicio(servicio) {
|
removeServicio(event, servicio) {
|
||||||
|
if (servicio == 'solapas') {
|
||||||
|
this.ServiciosManipulado.removeSolapas();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateServicios() {
|
||||||
|
|
||||||
|
this.serviciosAcabado.updateServicios();
|
||||||
|
this.ServiciosEncuadernacion.updateServicios();
|
||||||
|
this.ServiciosManipulado.updateServicios();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServiciosAcabado {
|
class ServiciosAcabado {
|
||||||
@ -231,6 +244,11 @@ class ServiciosAcabado {
|
|||||||
|
|
||||||
self.check_serv_acabado_error();
|
self.check_serv_acabado_error();
|
||||||
}
|
}
|
||||||
|
/* TO-DO
|
||||||
|
updatePresupuesto({
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -253,6 +271,45 @@ class ServiciosAcabado {
|
|||||||
}); */
|
}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateServicios() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
const id = window.location.href.split('/').pop();
|
||||||
|
const tarifa_ids = this.table.rows().data().toArray().map(row => row.tarifa_id);
|
||||||
|
const proveedor_ids = this.table.rows().data().toArray().map(row => row.proveedor_id);
|
||||||
|
const cubiertas = this.table.rows().data().toArray().map(row => row.cubierta);
|
||||||
|
const sobrecubiertas = this.table.rows().data().toArray().map(row => row.sobrecubierta);
|
||||||
|
// emparejar los tarifa_ids con los proveedor_ids
|
||||||
|
let tarifa_data = [];
|
||||||
|
for (let i = 0; i < tarifa_ids.length; i++) {
|
||||||
|
tarifa_data.push({ tarifa_id: tarifa_ids[i], proveedor_id: proveedor_ids[i], cubierta: cubiertas[i], sobrecubierta: sobrecubiertas[i] });
|
||||||
|
}
|
||||||
|
|
||||||
|
let tirada = 0;
|
||||||
|
if (parseInt($('#tirada').val()) > 0) {
|
||||||
|
tirada = parseInt($('#tirada').val())
|
||||||
|
}
|
||||||
|
if (tarifa_ids.length > 0 && tirada > 0) {
|
||||||
|
const data = {
|
||||||
|
datos: tarifa_data,
|
||||||
|
tirada: tirada
|
||||||
|
};
|
||||||
|
new Ajax('/serviciosacabados/update/' + id, data, {},
|
||||||
|
function (response) {
|
||||||
|
if (response.lineas) {
|
||||||
|
self.table.clear().draw();
|
||||||
|
self.table.rows.add(response.lineas).draw();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
).post();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
updateAcabadosExteriores(cubierta, sobrecubierta) {
|
updateAcabadosExteriores(cubierta, sobrecubierta) {
|
||||||
|
|
||||||
this.table.rows().every(function () {
|
this.table.rows().every(function () {
|
||||||
@ -461,6 +518,11 @@ class ServiciosPreimpresion {
|
|||||||
drawCallback: function (settings) {
|
drawCallback: function (settings) {
|
||||||
|
|
||||||
self.check_serv_preimpresion_error();
|
self.check_serv_preimpresion_error();
|
||||||
|
/* TO-DO
|
||||||
|
updatePresupuesto({
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -750,6 +812,12 @@ class ServiciosEncuadernacion {
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.check_serv_enc_error();
|
self.check_serv_enc_error();
|
||||||
|
|
||||||
|
/* TO-DO
|
||||||
|
updatePresupuesto({
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -772,6 +840,52 @@ class ServiciosEncuadernacion {
|
|||||||
}); */
|
}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateServicios() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
const id = window.location.href.split('/').pop();
|
||||||
|
const tarifa_ids = this.table.rows().data().toArray().map(row => row.tarifa_id);
|
||||||
|
const proveedor_ids = this.table.rows().data().toArray().map(row => row.proveedor_id);
|
||||||
|
const cuadernillos = this.table.rows().data().toArray().map(row => row.paginas_por_cuadernillo);
|
||||||
|
|
||||||
|
let tarifa_data = [];
|
||||||
|
for (let i = 0; i < tarifa_ids.length; i++) {
|
||||||
|
tarifa_data.push({ tarifa_id: tarifa_ids[i], proveedor_id: proveedor_ids[i], paginas_por_cuadernillo: cuadernillos[i] });
|
||||||
|
}
|
||||||
|
|
||||||
|
let tirada = 0;
|
||||||
|
if (parseInt($('#tirada').val()) > 0) {
|
||||||
|
tirada = parseInt($('#tirada').val())
|
||||||
|
}
|
||||||
|
let paginas = 0;
|
||||||
|
if (parseInt($('#paginas').val()) > 0) {
|
||||||
|
paginas = parseInt($('#paginas').val())
|
||||||
|
}
|
||||||
|
|
||||||
|
const dimension = self.getDimensionLibro();
|
||||||
|
if (tarifa_ids.length > 0 && tirada > 0) {
|
||||||
|
const data = {
|
||||||
|
datos: tarifa_data,
|
||||||
|
tirada: tirada,
|
||||||
|
paginas: paginas,
|
||||||
|
ancho: dimension.ancho,
|
||||||
|
alto: dimension.alto,
|
||||||
|
};
|
||||||
|
new Ajax('/serviciosencuadernaciones/update/' + id, data, {},
|
||||||
|
function (response) {
|
||||||
|
if (response.lineas) {
|
||||||
|
self.table.clear().draw();
|
||||||
|
self.table.rows.add(response.lineas).draw();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
).post();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cargarServiciosEncuadernacion(datos) {
|
cargarServiciosEncuadernacion(datos) {
|
||||||
|
|
||||||
this.table.rows.add(datos).draw();
|
this.table.rows.add(datos).draw();
|
||||||
@ -779,8 +893,6 @@ class ServiciosEncuadernacion {
|
|||||||
|
|
||||||
async getServiciosDefecto() {
|
async getServiciosDefecto() {
|
||||||
|
|
||||||
this.table.clear().draw();
|
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
let tirada = 0;
|
let tirada = 0;
|
||||||
@ -806,6 +918,7 @@ class ServiciosEncuadernacion {
|
|||||||
new Ajax('/serviciosencuadernaciones/datatable', datos, {},
|
new Ajax('/serviciosencuadernaciones/datatable', datos, {},
|
||||||
function (response) {
|
function (response) {
|
||||||
if (response.values) {
|
if (response.values) {
|
||||||
|
self.table.clear().draw();
|
||||||
self.table.rows.add(response.values).draw();
|
self.table.rows.add(response.values).draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1041,6 +1154,12 @@ class ServiciosManipulado {
|
|||||||
drawCallback: function (settings) {
|
drawCallback: function (settings) {
|
||||||
|
|
||||||
self.check_serv_manipulado_error();
|
self.check_serv_manipulado_error();
|
||||||
|
|
||||||
|
/* TO-DO
|
||||||
|
updatePresupuesto({
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1072,8 +1191,6 @@ class ServiciosManipulado {
|
|||||||
|
|
||||||
async getServiciosDefecto() {
|
async getServiciosDefecto() {
|
||||||
|
|
||||||
this.table.clear().draw();
|
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
let tirada = 0;
|
let tirada = 0;
|
||||||
@ -1091,6 +1208,7 @@ class ServiciosManipulado {
|
|||||||
new Ajax('/serviciosmanipulados/datatable', datos, {},
|
new Ajax('/serviciosmanipulados/datatable', datos, {},
|
||||||
function (response) {
|
function (response) {
|
||||||
if (response.values) {
|
if (response.values) {
|
||||||
|
self.table.clear().draw();
|
||||||
self.table.rows.add(response.values).draw();
|
self.table.rows.add(response.values).draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1104,6 +1222,86 @@ class ServiciosManipulado {
|
|||||||
showBreadCrumbSaveButton(true);
|
showBreadCrumbSaveButton(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addSolapas() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
new Ajax('/serviciosmanipulados/serviciosolapas', {}, {},
|
||||||
|
function (response) {
|
||||||
|
if (response.service) {
|
||||||
|
|
||||||
|
const tarifa_id = response.service;
|
||||||
|
var rows = self.table.rows().data().toArray();
|
||||||
|
var found = rows.some(row => row.tarifa_id === tarifa_id);
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
self.getPresupuestoManipulado(tarifa_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
removeSolapas() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
new Ajax('/serviciosmanipulados/serviciosolapas', {}, {},
|
||||||
|
function (response) {
|
||||||
|
if (response.service) {
|
||||||
|
|
||||||
|
const tarifa_id = response.service;
|
||||||
|
var rows = self.table.rows().data().toArray();
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
if (rows[i]['tarifa_id'] == tarifa_id) {
|
||||||
|
self.table.row(i).remove().draw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateServicios() {
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
|
const id = window.location.href.split('/').pop();
|
||||||
|
const tarifa_ids = this.table.rows().data().toArray().map(row => row.tarifa_id);
|
||||||
|
|
||||||
|
let tirada = 0;
|
||||||
|
if (parseInt($('#tirada').val()) > 0) {
|
||||||
|
tirada = parseInt($('#tirada').val())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tarifa_ids.length > 0) {
|
||||||
|
const data = {
|
||||||
|
datos: tarifa_ids,
|
||||||
|
solapas: $('#solapas').is(':checked') ? 1 : 0,
|
||||||
|
tirada: tirada
|
||||||
|
};
|
||||||
|
new Ajax('/serviciosmanipulados/update/' + id, data, {},
|
||||||
|
function (response) {
|
||||||
|
if (response.lineas) {
|
||||||
|
self.table.clear().draw();
|
||||||
|
self.table.rows.add(response.lineas).draw();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
).post();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
getPresupuestoManipulado(tarifa_id = -1) {
|
getPresupuestoManipulado(tarifa_id = -1) {
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
@ -1238,6 +1436,12 @@ class ServiciosExtra {
|
|||||||
drawCallback: function (settings) {
|
drawCallback: function (settings) {
|
||||||
|
|
||||||
self.check_serv_extra_error();
|
self.check_serv_extra_error();
|
||||||
|
|
||||||
|
/* TO-DO
|
||||||
|
updatePresupuesto({
|
||||||
|
update_resumen: true,
|
||||||
|
update_tiradas_alternativas: true})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -677,6 +677,8 @@ class PresupuestoCliente {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.datos.guardas = this.disenioCubierta.getGuardas();
|
||||||
|
|
||||||
if (calcularSolapas) {
|
if (calcularSolapas) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -700,7 +702,7 @@ class PresupuestoCliente {
|
|||||||
carasImpresion: this.disenioCubierta.carasCubierta.val(),
|
carasImpresion: this.disenioCubierta.carasCubierta.val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.datos.guardas = this.disenioCubierta.getGuardas();
|
|
||||||
this.datos.sobrecubierta = this.disenioCubierta.getSobrecubierta();
|
this.datos.sobrecubierta = this.disenioCubierta.getSobrecubierta();
|
||||||
this.datos.faja = this.disenioCubierta.getFaja();
|
this.datos.faja = this.disenioCubierta.getFaja();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user