mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en guardar presupuesto
This commit is contained in:
@ -544,6 +544,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
|||||||
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
|
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
|
||||||
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
|
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
|
||||||
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
||||||
|
$routes->post('guardarPresupuesto', 'Presupuestocliente::guardarPresupuesto', ['as' => 'guardarPresupuesto']);
|
||||||
});
|
});
|
||||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -412,6 +412,82 @@ class PresupuestoLineaModel extends \App\Models\BaseModel
|
|||||||
->update();
|
->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function insertLPFromBackend($presupuesto_id, $new_linea)
|
||||||
|
{
|
||||||
|
$rot_total_impresion = $new_linea['fields']['precio_click_pedido']??0.0 +
|
||||||
|
$new_linea['fields']['precio_tinta']??0.0+$new_linea['fields']['total_Corte']??0.0;
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'presupuesto_id' => $presupuesto_id,
|
||||||
|
"pliegos_precio" => $new_linea['fields']['precios_pliegos'],
|
||||||
|
"libro" => $new_linea['fields']['precio_libro'],
|
||||||
|
"total_papel_pedido" => round($new_linea['fields']['precio_pedido'], 2),
|
||||||
|
"margen_papel_pedido" => round($new_linea['fields']['margen_papel_pedido'], 2),
|
||||||
|
"mano" => $new_linea['fields']['mano'],
|
||||||
|
"precio_click" => round($new_linea['fields']['precio_click'], 6),
|
||||||
|
"precio_click_pedido" => round($new_linea['fields']['precio_click_pedido'], 2),
|
||||||
|
"margen_click_pedido" => round($new_linea['fields']['margen_click_pedido'], 2),
|
||||||
|
"tiempo_maquina" => strtotime($new_linea['fields']['tiempo_maquina']) - strtotime('TODAY'),
|
||||||
|
"tarifa_impresion_id" => $new_linea['fields']['tarifa_impresion_id'],
|
||||||
|
"rotativa_total_impresion" => $rot_total_impresion,
|
||||||
|
"rotativa_a_favor_fibra" => $new_linea['fields']['a_favor_fibra'] ?? 0,
|
||||||
|
"rotativa_mxm" => $new_linea['fields']['maquina_velocidad'] ?? 0,
|
||||||
|
"rotativa_resolucion" => $new_linea['fields']['resolucion'] ?? 0,
|
||||||
|
"rotativa_area_paginas" => $new_linea['fields']['superficie'] ?? 0,
|
||||||
|
"rotativa_num_gotas_negro" => $new_linea['fields']['num_gotas_negro'] ?? 0,
|
||||||
|
"rotativa_num_gotas_cyan" => $new_linea['fields']['num_gotas_cyan'] ?? 0,
|
||||||
|
"rotativa_num_gotas_magenta" => $new_linea['fields']['num_gotas_magenta'] ?? 0,
|
||||||
|
"rotativa_num_gotas_amarillo" => $new_linea['fields']['num_gotas_amarillo'] ?? 0,
|
||||||
|
"rotativa_num_gotas_cg" => $new_linea['fields']['num_gotas_cg'] ?? 0,
|
||||||
|
"rotativa_peso_gotas_negro" => $new_linea["fields"]["peso_gotas_negro"] ?? 0,
|
||||||
|
"rotativa_peso_gotas_cyan" => $new_linea['fields']['peso_gotas_cyan'] ?? 0,
|
||||||
|
"rotativa_peso_gotas_magenta" => $new_linea['fields']['peso_gotas_magenta'] ?? 0,
|
||||||
|
"rotativa_peso_gotas_amarillo" => $new_linea['fields']['peso_gotas_amarillo'] ?? 0,
|
||||||
|
"rotativa_peso_gotas_cg" => $new_linea['fields']['peso_gotas_cg'] ?? 0,
|
||||||
|
"rotativa_peso_gotas_negro_pedido" => $new_linea["fields"]["peso_gotas_negro_pedido"] ?? 0,
|
||||||
|
"rotativa_peso_gotas_cyan_pedido" => $new_linea["fields"]["peso_gotas_cyan_pedido"] ?? 0,
|
||||||
|
"rotativa_peso_gotas_magenta_pedido" => $new_linea["fields"]["peso_gotas_magenta_pedido"] ?? 0,
|
||||||
|
"rotativa_peso_gotas_amarillo_pedido" => $new_linea["fields"]["peso_gotas_amarillo_pedido"] ?? 0,
|
||||||
|
"rotativa_peso_gotas_cg_pedido" => $new_linea["fields"]["peso_gotas_cg_pedido"] ?? 0,
|
||||||
|
"rotativa_precio_pag_negro" => $new_linea['fields']['precio_pagina_negro'] ?? 0,
|
||||||
|
"rotativa_precio_pag_color" => $new_linea['fields']['precio_pagina_color'] ?? 0,
|
||||||
|
"rotativa_factor_altura" => $new_linea['fields']['factor_altura'] ?? 0,
|
||||||
|
"rotativa_factor_anchura" => $new_linea['fields']['factor_anchura'] ?? 0,
|
||||||
|
"rotativa_pag_por_pliego" => $new_linea['fields']['paginas_por_pliego'] ?? 0,
|
||||||
|
"rotativa_metros_libro" => $new_linea['fields']['metros_papel_libro'] ?? 0,
|
||||||
|
"rotativa_metros_total" => $new_linea['fields']['metros_papel_total'] ?? 0,
|
||||||
|
"rotativa_clicks_libro" => $new_linea['fields']['clicks_libro'] ?? 0,
|
||||||
|
"rotativa_clicks_total" => $new_linea['fields']['clicks_pedido'] ?? 0,
|
||||||
|
"rotativa_precio_tinta" => $new_linea['fields']['precio_tinta'] ?? 0,
|
||||||
|
"rotativa_velocidad_corte" => $new_linea['fields']['velocidad_corte'] ?? 0,
|
||||||
|
"rotativa_tiempo_corte" => $new_linea['fields']['tiempo_corte'] ?? 0,
|
||||||
|
"rotativa_precio_hora_corte" => $new_linea['fields']['precio_hora_corte'] ?? 0,
|
||||||
|
"rotativa_total_corte" => $new_linea['fields']['total_corte'] ?? 0,
|
||||||
|
"horas_maquina" => round($new_linea['fields']['horas_maquina'],4),
|
||||||
|
"precio_hora" => $new_linea['fields']['precio_hora'] ?? 0,
|
||||||
|
"precio_impresion" => $new_linea['fields']['precio_impresion_horas'] ?? 0,
|
||||||
|
"total_linea" => round($new_linea['fields']['total_impresion'], 2) ?? 0,
|
||||||
|
"margen_impresion" => $new_linea['fields']['margen_impresion_horas'] ?? 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
if(array_key_exists('datosTipologias', $new_linea['fields'])){
|
||||||
|
$data += [
|
||||||
|
"rotativa_negro" => $new_linea['fields']['datosTipologias']->negro ?? 0,
|
||||||
|
"rotativa_cyan" => $new_linea['fields']['datosTipologias']->cyan ?? 0,
|
||||||
|
"rotativa_magenta" => $new_linea['fields']['datosTipologias']->magenta ?? 0,
|
||||||
|
"rotativa_amarillo" => $new_linea['fields']['datosTipologias']->amarillo ?? 0,
|
||||||
|
"rotativa_cg" => $new_linea['fields']['datosTipologias']->cg ?? 0,
|
||||||
|
"rotativa_gota_negro" => $new_linea['fields']['datosTipologias']->gota_negro ?? 0,
|
||||||
|
"rotativa_gota_color" => $new_linea['fields']['datosTipologias']->gota_color
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->set($data)
|
||||||
|
->insert();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function deleteLineasPresupuesto($presupuesto_id)
|
public function deleteLineasPresupuesto($presupuesto_id)
|
||||||
{
|
{
|
||||||
$this->db
|
$this->db
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Models\Presupuestos;
|
namespace App\Models\Presupuestos;
|
||||||
|
|
||||||
|
use App\Models\Configuracion\TipoPresupuestoModel;
|
||||||
|
|
||||||
|
|
||||||
class PresupuestoModel extends \App\Models\BaseModel
|
class PresupuestoModel extends \App\Models\BaseModel
|
||||||
{
|
{
|
||||||
protected $table = "presupuestos";
|
protected $table = "presupuestos";
|
||||||
@ -262,10 +265,10 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
$builder->groupEnd();
|
$builder->groupEnd();
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeIsDuplicado($presupuesto_id){
|
public function removeIsDuplicado($presupuesto_id)
|
||||||
|
{
|
||||||
$this->db
|
$this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->where('id', $presupuesto_id)
|
->where('id', $presupuesto_id)
|
||||||
@ -307,4 +310,146 @@ class PresupuestoModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function insertarPresupuestoCliente($tirada, $data, $data_cabecera, $extra_info)
|
||||||
|
{
|
||||||
|
|
||||||
|
helper('date');
|
||||||
|
|
||||||
|
$model = model('App\Models\Configuracion\PapelFormatoModel');
|
||||||
|
$papel_formato_id = $model->where('ancho', $data['tamanio']['ancho'])->where('alto', $data['tamanio']['alto'])->first();
|
||||||
|
|
||||||
|
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($data['tipo_impresion_id']);
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
'cliente_id' => $data['clienteId'],
|
||||||
|
'tipo_impresion_id' => $data['tipo_impresion_id'],
|
||||||
|
'pais_id' => 1,
|
||||||
|
'retractilado' => in_array(3, $data['servicios']) ? 1 : 0,
|
||||||
|
'retractilado5' => in_array(5, $data['servicios']) ? 1 : 0,
|
||||||
|
'guardas' => in_array(62, $data['servicios']) ? 1 : 0,
|
||||||
|
'faja_color' => in_array(16, $data['servicios']) ? 1 : 0,
|
||||||
|
'ferro' => in_array(24, $data['servicios']) ? 1 : 0,
|
||||||
|
'prototipo' => in_array(9, $data['servicios']) ? 1 : 0,
|
||||||
|
'papel_formato_id' => is_null($papel_formato_id) ? 0: $papel_formato_id->id,
|
||||||
|
'papel_formato_personalizado' => !$papel_formato_id ? 1:0,
|
||||||
|
'papel_formato_ancho' => !$papel_formato_id ? $data['tamanio']['ancho']:null,
|
||||||
|
'papel_formato_alto' => !$papel_formato_id ? $data['tamanio']['alto']:null,
|
||||||
|
'titulo' => $data_cabecera['titulo'],
|
||||||
|
'referencia_cliente' => $data_cabecera['referenciaCliente'],
|
||||||
|
'paginas' => $data['interior']['paginas'],
|
||||||
|
'tirada' => $tirada,
|
||||||
|
'solapas' => $data['cubierta']['solapasCubierta']>0 ? 1 : 0,
|
||||||
|
'solapas_ancho' => $data['cubierta']['solapasCubierta']>0 ? $data['cubierta']['solapasCubierta'] : 0,
|
||||||
|
'solapas_sobrecubierta' => is_null($data['sobrecubierta']) ? 0 :1,
|
||||||
|
'solapas_ancho_sobrecubierta' => is_null($data['sobrecubierta']) ? 0 : $data['sobrecubierta']['solapas'],
|
||||||
|
'cosido' => $is_cosido,
|
||||||
|
'merma' => $extra_info['merma'],
|
||||||
|
'merma_cubierta' => $extra_info['merma'],
|
||||||
|
|
||||||
|
'lomo_cubierta' => $extra_info['lomo_cubierta'],
|
||||||
|
'lomo_sobrecubierta' => $extra_info['lomo_sobrecubierta'],
|
||||||
|
|
||||||
|
'comparador_json_data' => $this->generateJson($data),
|
||||||
|
|
||||||
|
'acabado_cubierta_id' => $data['acabadoCubierta'],
|
||||||
|
'acabado_sobrecubierta_id' => is_null($data['sobrecubierta']) ? 0 : $data['sobrecubierta']['acabado'],
|
||||||
|
|
||||||
|
'comp_tipo_impresion' => $data['isHq']? ($data['isColor']? 'colorhq':'negrohq'):($data['isColor']? 'color':'negro'),
|
||||||
|
|
||||||
|
'user_created_id' => $extra_info['user_id'],
|
||||||
|
'created_at' => date('Y-m-d H:i:s', now()),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s', now()),
|
||||||
|
|
||||||
|
'tirada_alternativa_json_data' => null,
|
||||||
|
|
||||||
|
'total_presupuesto' => 0,
|
||||||
|
'total_coste_papel' => 0,
|
||||||
|
'total_margen_papel' => 0,
|
||||||
|
'total_margenPercent_papel' => 0,
|
||||||
|
'total_coste_impresion' => 0,
|
||||||
|
'total_margen_impresion' => 0,
|
||||||
|
'total_margenPercent_impresion' => 0,
|
||||||
|
'total_coste_servicios' => 0,
|
||||||
|
'total_margen_servicios' => 0,
|
||||||
|
'total_margenPercent_servicios' => 0,
|
||||||
|
'total_coste_envios' => 0,
|
||||||
|
'total_margen_envios' => 0,
|
||||||
|
'total_costes' => 0,
|
||||||
|
'total_margenes' => 0,
|
||||||
|
'total_antes_descuento' => 0,
|
||||||
|
'total_descuento' => 0,
|
||||||
|
'total_descuentoPercent' => 0,
|
||||||
|
'total_precio_unidad' => 0,
|
||||||
|
|
||||||
|
'total_factor' => 0,
|
||||||
|
'total_factor_ponderado' => 0,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->db->table($this->table)->insert($fields);
|
||||||
|
return $this->db->insertID();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateJson($data)
|
||||||
|
{
|
||||||
|
$values = array();
|
||||||
|
if (is_array($data)) {
|
||||||
|
// -- INTERIOR --
|
||||||
|
// Si hay negro
|
||||||
|
if($data['interior']['paginas'] > $data['interior']['paginas_color']){
|
||||||
|
|
||||||
|
if($data['isHq'])
|
||||||
|
$key = 'bnhq';
|
||||||
|
else
|
||||||
|
$key = 'bn';
|
||||||
|
$values[$key] = array(
|
||||||
|
'paginas'=> intval($data['interior']['paginas'])-intval($data['interior']['paginas_color']),
|
||||||
|
'papel_id' => intval($data['interior']['papel_generico']['id']),
|
||||||
|
'gramaje' => intval($data['interior']['gramaje']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Si hay color
|
||||||
|
if($data['interior']['paginas_color']>0){
|
||||||
|
|
||||||
|
if($data['isHq'])
|
||||||
|
$key = 'colorhq';
|
||||||
|
else
|
||||||
|
$key = 'color';
|
||||||
|
$values[$key] = array(
|
||||||
|
'paginas'=> intval($data['interior']['paginas_color']),
|
||||||
|
'papel_id' => intval($data['interior']['papel_generico']['id']),
|
||||||
|
'gramaje' => intval($data['interior']['gramaje']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -- CUBIERTA --
|
||||||
|
$values['cubierta'] = array(
|
||||||
|
'papel_id' => intval($data['cubierta']['papel_generico_cubierta']['id']),
|
||||||
|
'gramaje' => intval($data['cubierta']['gramajeCubierta']),
|
||||||
|
'paginas' => intval($data['cubierta']['carasCubierta']),
|
||||||
|
);
|
||||||
|
|
||||||
|
// -- SOBRECUBIERTA --
|
||||||
|
if(!is_null($data['sobrecubierta'])){
|
||||||
|
$values['sobrecubierta'] = array(
|
||||||
|
'papel_id' => intval($data['sobrecubierta']['papel']),
|
||||||
|
'gramaje' => intval($data['sobrecubierta']['gramaje']),
|
||||||
|
'imprimir' => 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -- GUARDAS --
|
||||||
|
if($data['datos_guardas'] != 0){
|
||||||
|
$values['guardas'] = array(
|
||||||
|
'papel_id' => intval($data['datos_guardas']['papel']),
|
||||||
|
'gramaje' => intval($data['datos_guardas']['gramaje']),
|
||||||
|
'paginas' => intval($data['datos_guardas']['caras']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$json = json_encode($values);
|
||||||
|
return $json;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,8 +40,8 @@
|
|||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
window.routes_direcciones = {
|
window.routes_direcciones = {
|
||||||
direcciones: "<?= route_to('getDirecciones') ?>",
|
direcciones: "<?= route_to('getDirecciones') ?>",
|
||||||
getDatos: "<?= route_to('getDatosDireccion') ?>",
|
getDatos: "<?= route_to('getDatosDireccion') ?>",
|
||||||
nuevaDireccion: "<?= route_to('nuevaDireccion') ?>",
|
nuevaDireccion: "<?= route_to('nuevaDireccion') ?>",
|
||||||
}
|
}
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -47,3 +47,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
|
window.routes_resumen = {
|
||||||
|
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
|
||||||
|
}
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -192,8 +192,6 @@ $('#insertarDireccion').on('click', function() {
|
|||||||
$('#errorDirecciones').text('El número de unidades supera la tirada seleccionada.');
|
$('#errorDirecciones').text('El número de unidades supera la tirada seleccionada.');
|
||||||
$('#errorDirecciones').show();
|
$('#errorDirecciones').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
@ -311,4 +309,25 @@ function validarEnvio(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDireccionesEnvio(){
|
||||||
|
|
||||||
|
const elements = $('#divDirecciones').find('.row.mb-3');
|
||||||
|
|
||||||
|
let direcciones = [];
|
||||||
|
|
||||||
|
if(elements.length > 0) {
|
||||||
|
for (let index=0; index<elements.length; index++){
|
||||||
|
const unidades = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
|
||||||
|
const id = $(elements[index]).attr('id').replace('envioId', '');
|
||||||
|
const tipo = $(elements[index]).attr('t');
|
||||||
|
direcciones.push({
|
||||||
|
unidades: unidades,
|
||||||
|
id: id,
|
||||||
|
tipo: tipo,
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return direcciones;
|
||||||
}
|
}
|
||||||
@ -118,4 +118,108 @@ function getTotalEnvio(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#btnSave').on('click', function() {
|
||||||
|
|
||||||
|
let servicios = [];
|
||||||
|
$('.servicio-extra:checked').each(function () {
|
||||||
|
servicios.push($(this).attr('serv_id'));
|
||||||
|
})
|
||||||
|
|
||||||
|
let datos_libro = {
|
||||||
|
tamanio: getDimensionLibro(),
|
||||||
|
tirada: getTiradas(),
|
||||||
|
paginas: $('#paginas').val(),
|
||||||
|
paginasColor: $('#paginasColor').val(),
|
||||||
|
tipo: $('.custom-option-tipo.checked').attr('id').replace('Div', ''),
|
||||||
|
tapa: $('#tapaDura').is(':checked') ? 'dura' : 'blanda',
|
||||||
|
isColor: $('#colorNegroDiv').hasClass('checked') ? 0 : 1,
|
||||||
|
isHq: $('#calidadEstandarDiv').hasClass('checked') ? 0 : 1,
|
||||||
|
papelInterior: $('#papelInterior option:selected').val(),
|
||||||
|
papelInteriorNombre: $('#papelInterior option:selected').text().trim(),
|
||||||
|
gramajeInterior: $('#gramajeInterior option:selected').text(),
|
||||||
|
excluirRotativa: $('#excluirRotativa').is(':checked')? 1 : 0,
|
||||||
|
papelCubierta: $('#papelCubierta option:selected').val(),
|
||||||
|
papelCubiertaNombre: $('#papelCubierta option:selected').text().trim(),
|
||||||
|
gramajeCubierta: $('#gramajeCubierta option:selected').text(),
|
||||||
|
carasCubierta: $('#carasCubierta').val(),
|
||||||
|
acabadoCubierta: $('#acabadosCubierta').val(),
|
||||||
|
clienteId: $('#clienteId').val(),
|
||||||
|
servicios: servicios,
|
||||||
|
};
|
||||||
|
// Si hay solapas de cubierta
|
||||||
|
if ($('#solapasCubierta').is(':checked')) {
|
||||||
|
datos_libro.solapasCubierta = $('#anchoSolapasCubierta').val()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si hay sobrecubierta
|
||||||
|
if ($('.enable-sobrecubierta').is(':visible')) {
|
||||||
|
if($('#papelSobrecubierta option:selected').val()>0 && $('#gramajeSobrecubierta option:selected').val()>0){
|
||||||
|
|
||||||
|
datos_libro.sobrecubierta = {
|
||||||
|
papel: $('#papelSobrecubierta option:selected').val(),
|
||||||
|
papel_nombre: $('#papelSobrecubierta option:selected').text().trim(),
|
||||||
|
gramaje: $('#gramajeSobrecubierta option:selected').text(),
|
||||||
|
acabado: $('#acabadosSobrecubierta').val()
|
||||||
|
}
|
||||||
|
|
||||||
|
datos.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('.guardas').is(':visible')) {
|
||||||
|
datos_libro.guardas = {
|
||||||
|
papel: $('#papelGuardas option:selected').val(),
|
||||||
|
papel_nombre: $('#papelGuardas option:selected').text().trim(),
|
||||||
|
gramaje: 170,
|
||||||
|
caras: $('#impresionGuardas option:selected').val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let datos_cabecera = {
|
||||||
|
titulo: $('#titulo').val(),
|
||||||
|
referenciaCliente: $('#referenciaCliente').val(),
|
||||||
|
}
|
||||||
|
|
||||||
|
const seleccion = $('.custom-option-tiradasDirecciones.checked');
|
||||||
|
let tirada = 0;
|
||||||
|
if(seleccion.length != 0) {
|
||||||
|
|
||||||
|
const element_tirada =($(seleccion[0]).find('label input')[0]);
|
||||||
|
const number = element_tirada.id.match(/\d+$/);
|
||||||
|
if (number.length != 0) {
|
||||||
|
tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let direcciones = getDireccionesEnvio();
|
||||||
|
datos = {
|
||||||
|
datos_libro : datos_libro,
|
||||||
|
datos_cabecera: datos_cabecera,
|
||||||
|
direcciones: direcciones,
|
||||||
|
tirada: tirada,
|
||||||
|
iva_reducido: $('#ivaReducido').val()==1?1:0,
|
||||||
|
},
|
||||||
|
datos = Object.assign(datos, window.token_ajax)
|
||||||
|
|
||||||
|
$('#loader').show();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: window.routes_resumen.guardarPresupuesto,
|
||||||
|
type: 'POST',
|
||||||
|
data: datos,
|
||||||
|
success: function(response) {
|
||||||
|
if(response.length > 0) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$('#loader').hide();
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$('#loader').hide();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@ -151,7 +151,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 d-flex flex-row-reverse">
|
<div class="col-6 d-flex flex-row-reverse">
|
||||||
<button class="btn btn-primary btn-submit waves-effect waves-light ml-2">
|
<button id="btnSave" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
|
||||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
|
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
|
||||||
<i class="ti ti-arrow-right ti-xs"></i>
|
<i class="ti ti-arrow-right ti-xs"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -236,10 +236,10 @@ initDisenioLibro();
|
|||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
|
||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
|
||||||
|
<script src="<?= site_url('js_loader/presupuestoClienteResumen_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/presupuestoCliente_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestoCliente_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/presupuestoClienteTipoLibro_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestoClienteTipoLibro_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/presupuestoClienteDisenioLibro_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestoClienteDisenioLibro_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/presupuestoClienteDirecciones_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestoClienteDirecciones_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/presupuestoClienteResumen_js') ?>"></script>
|
|
||||||
<script src="<?= site_url('js_loader/presupuestoClientePreview_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestoClientePreview_js') ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
32485
xdebug.log
32485
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user