mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
cargando datos
This commit is contained in:
@ -578,6 +578,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
||||
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
|
||||
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
|
||||
$routes->post('guardar', 'Presupuestocliente::guardar', ['as' => 'guardar']);
|
||||
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
|
||||
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
||||
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
|
||||
});
|
||||
|
||||
@ -107,7 +107,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['formAction'] = 'add';
|
||||
|
||||
|
||||
$this->viewData['paisList'] = model('App\Models\Configuracion\PaisModel')->getAllForMenu('id, nombre', 'nombre', true);
|
||||
$this->viewData['clienteId'] = $clienteId;
|
||||
$this->viewData['POD'] = $POD;
|
||||
|
||||
@ -312,6 +312,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$guardas = $reqData['guardas'] ?? [];
|
||||
$faja = $reqData['faja'] ?? [];
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$excluirRotativa = intval($excluirRotativa);
|
||||
$ivaReducido = intval($reqData['ivaReducido']) ?? 0;
|
||||
|
||||
$direcciones = $reqData['direcciones'] ?? [];
|
||||
@ -331,7 +332,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$interior = [
|
||||
'papel_generico' => $papel,
|
||||
'gramaje' => $gramaje,
|
||||
'excluirRotativa' => $excluirRotativa == "false" ? false : true,
|
||||
'excluirRotativa' => $excluirRotativa,
|
||||
'paginas' => $paginas,
|
||||
'paginas_color' => $paginas_color,
|
||||
'papelInteriorDiferente' => $papelInteriorDiferente
|
||||
@ -421,7 +422,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
return $this->respond($return_data);
|
||||
} catch (Exception $e) {
|
||||
return $this->failServerError($e->getMessage() );
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -609,6 +610,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$guardas = $reqData['guardas'] ?? [];
|
||||
$faja = $reqData['faja'] ?? [];
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$excluirRotativa = intval($excluirRotativa);
|
||||
$ivaReducido = intval($reqData['ivaReducido']) ?? 0;
|
||||
|
||||
$direcciones = $reqData['direcciones'] ?? [];
|
||||
@ -628,7 +630,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$interior = [
|
||||
'papel_generico' => $papel,
|
||||
'gramaje' => $gramaje,
|
||||
'excluirRotativa' => $excluirRotativa == "false" ? false : true,
|
||||
'excluirRotativa' => $excluirRotativa,
|
||||
'paginas' => $paginas,
|
||||
'paginas_color' => $paginas_color,
|
||||
'papelInteriorDiferente' => $papelInteriorDiferente
|
||||
@ -778,19 +780,18 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$borrar_antes = true;
|
||||
}
|
||||
|
||||
if($datos_presupuesto['sobrecubierta']){
|
||||
if ($datos_presupuesto['sobrecubierta']) {
|
||||
$acabado_id = $this->obtenerTarifasAcabado(['plastificado' => $datos_presupuesto['sobrecubierta']['acabados']]);
|
||||
if(count($acabado_id)>0){
|
||||
if (count($acabado_id) > 0) {
|
||||
$datos_presupuesto['sobrecubierta']['acabados'] = $acabado_id[0];
|
||||
}
|
||||
}
|
||||
$acabado_id = $this->obtenerTarifasAcabado($datos_presupuesto['cubierta']['acabadosCubierta']);
|
||||
if(count($acabado_id)>0){
|
||||
if (count($acabado_id) > 0) {
|
||||
$datos_presupuesto['cubierta']['acabadosCubierta']['plastificado'] = $acabado_id[0];
|
||||
$datos_presupuesto['cubierta']['acabadosCubierta']['barniz'] = $acabado_id[1];
|
||||
$datos_presupuesto['cubierta']['acabadosCubierta']['estampado'] = $acabado_id[2];
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$datos_presupuesto['cubierta']['acabadosCubierta']['id'] = 0;
|
||||
}
|
||||
|
||||
@ -862,6 +863,145 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function cargar($id)
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$modelPapelGenerico = new PapelGenericoModel();
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$data = [];
|
||||
if ($presupuesto) {
|
||||
$data['datosGenerales']['titulo'] = $presupuesto->titulo;
|
||||
$data['datosGenerales']['autor'] = $presupuesto->autor;
|
||||
$data['datosGenerales']['isbn'] = $presupuesto->isbn;
|
||||
$data['datosGenerales']['coleccion'] = $presupuesto->coleccion;
|
||||
$data['datosGenerales']['referenciaCliente'] = $presupuesto->referencia_cliente;
|
||||
$data['datosGenerales']['paginas'] = $presupuesto->paginas;
|
||||
$data['datosGenerales']['posPaginasColor'] = $presupuesto->paginas_color;
|
||||
$data['datosGenerales']['paginasCuadernillo'] = $presupuesto->paginas_cuadernillo;
|
||||
$data['datosGenerales']['tirada'] = $presupuesto->tirada;
|
||||
$data['datosGenerales']['ivaReducido'] = $presupuesto->iva_reducido;
|
||||
$data['datosGenerales']['excluirRotativa'] = $presupuesto->excluir_rotativa;
|
||||
$data['datosGenerales']['clienteId'] = $presupuesto->cliente_id;
|
||||
$data['datosGenerales']['clienteNombre'] =
|
||||
model('App\Models\Clientes\ClienteModel')
|
||||
->find($presupuesto->cliente_id)->nombre;
|
||||
$data['datosGenerales']['papelFormatoId'] = $presupuesto->papel_formato_id;
|
||||
$data['datosGenerales']['papelFormatoPersonalizado'] = $presupuesto->papel_formato_personalizado;
|
||||
$data['datosGenerales']['papelInteriorDiferente'] = $presupuesto->papel_interior_diferente;
|
||||
|
||||
$data['tiradasPrecio'] = [
|
||||
(object) [
|
||||
'tirada' => $presupuesto->tirada,
|
||||
'precio' => $presupuesto->total_confirmado,
|
||||
'precio_u' => $presupuesto->total_precio_unidad,
|
||||
]
|
||||
];
|
||||
|
||||
$tiradas_alternativas = json_decode($presupuesto->tirada_alternativa_json_data);
|
||||
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
||||
$tirada = $tiradas_alternativas[$i];
|
||||
$data['datosGenerales']['tirada' . ($i + 2)] = $tirada->tirada;
|
||||
array_push($data['tiradasPrecio'], (object) [
|
||||
'tirada' => intval($tirada->tirada),
|
||||
'precio' => $tirada->total_pedido,
|
||||
'precio_u' => $tirada->precio_unidad,
|
||||
]);
|
||||
}
|
||||
usort($data['tiradasPrecio'], function ($a, $b) {
|
||||
return $a->tirada <=> $b->tirada;
|
||||
});
|
||||
|
||||
$modelLinea = new PresupuestoLineaModel();
|
||||
$lineas = $modelLinea->where('presupuesto_id', $id)->findAll();
|
||||
|
||||
[$data['datosGenerales']['paginasNegro'], $data['datosGenerales']['paginasColor']] =
|
||||
$this->getPaginas($lineas);
|
||||
|
||||
|
||||
return $this->respond([
|
||||
'status' => 1,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
;
|
||||
/*
|
||||
|
||||
if (this.datos.tipo == "cosido") {
|
||||
this.datos.paginasCuadernillo = this.datosGenerales.paginasCuadernillo.val();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//////////////////////////
|
||||
this.datos = {
|
||||
|
||||
|
||||
tamanio: this.datosGenerales.getDimensionLibro(),
|
||||
tirada: this.datosGenerales.getTiradas(),
|
||||
paginas: this.datosGenerales.paginas.val(),
|
||||
paginasColor: this.datosGenerales.paginasColor.val(),
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
|
||||
isColor: this.datosGenerales.getIsColor() ? 1 : 0,
|
||||
isHq: this.disenioInterior.getIsHq() ? 1 : 0,
|
||||
|
||||
interior: {
|
||||
papelInterior: this.disenioInterior.getPapel(),
|
||||
gramajeInterior: this.disenioInterior.getGramaje(),
|
||||
},
|
||||
|
||||
cubierta: {
|
||||
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||
papelCubierta: this.disenioCubierta.getPapel(),
|
||||
gramajeCubierta: this.disenioCubierta.getGramaje(),
|
||||
cabezada: this.disenioCubierta.getCabezada(),
|
||||
acabados: this.disenioCubierta.getAcabados(),
|
||||
carasImpresion: this.disenioCubierta.carasCubierta.val(),
|
||||
},
|
||||
|
||||
guardas: this.disenioCubierta.getGuardas(),
|
||||
sobrecubierta: this.disenioCubierta.getSobrecubierta(),
|
||||
faja: this.disenioCubierta.getFaja(),
|
||||
|
||||
|
||||
let solapasCubierta = this.disenioCubierta.getSolapasCubierta();
|
||||
if (solapasCubierta !== null && solapasCubierta !== undefined) {
|
||||
|
||||
if (solapasCubierta === false)
|
||||
this.datos.cubierta.solapas = 0;
|
||||
else {
|
||||
this.datos.cubierta.solapas = 1;
|
||||
this.datos.cubierta.tamanioSolapas = solapasCubierta;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.datos.cubierta.solapas = 0;
|
||||
}
|
||||
|
||||
if (this.direcciones.direcciones.length > 0) {
|
||||
this.datos.direcciones = [];
|
||||
for (let i = 0; i < this.direcciones.direcciones.length; i++) {
|
||||
this.datos.direcciones.push(this.direcciones.direcciones[i].getFormData());
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
////////////////////////////////////////////////////////*/
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_files()
|
||||
{
|
||||
|
||||
@ -1005,7 +1145,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$direccion['id'],
|
||||
$peso_libro,
|
||||
$direccion['unidades'],
|
||||
$direccion['entregaPalets'] == 'false' ? 0 : 1);
|
||||
$direccion['entregaPalets'] == 'false' ? 0 : 1
|
||||
);
|
||||
|
||||
if (count($data) > 0) {
|
||||
|
||||
@ -1367,7 +1508,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$acabadoCubierta = [];
|
||||
foreach ($tarifaAcabadoCubierta as $tarifa) {
|
||||
|
||||
if($tarifa == 0)
|
||||
if ($tarifa == 0)
|
||||
continue;
|
||||
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
$acabadoCubierta = $model->getPrecioTarifa($tarifa, $datosPedido->tirada, -1, $POD);
|
||||
@ -1630,11 +1771,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$return_data += [
|
||||
'errors' => $error,
|
||||
'total_lp' => $costeInterior + $coste_cubierta + $coste_sobrecubierta,
|
||||
'acabadoCubierta' => $acabadoCubierta,
|
||||
'acabadoSobrecubierta' => $acabadoSobrecubierta,
|
||||
'total_servicios_defecto' => $costeServiciosDefecto,
|
||||
'total_servicios_automaticos' => $coste_servicios,
|
||||
//'total_lp' => $costeInterior + $coste_cubierta + $coste_sobrecubierta,
|
||||
//'acabadoCubierta' => $acabadoCubierta,
|
||||
//'acabadoSobrecubierta' => $acabadoSobrecubierta,
|
||||
//'total_servicios_defecto' => $costeServiciosDefecto,
|
||||
//'total_servicios_automaticos' => $coste_servicios,
|
||||
'tiradas' => $tirada,
|
||||
'precio_u' => $precio_u,
|
||||
'peso' => $peso,
|
||||
@ -2082,12 +2223,39 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data = $model->where('code', $value)->first();
|
||||
$data = $data->id;
|
||||
array_push($tarifas, $data);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
array_push($tarifas, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return $tarifas;
|
||||
}
|
||||
|
||||
|
||||
private function getPaginas($lineas){
|
||||
|
||||
$paginasNegro = 0;
|
||||
$paginasColor = 0;
|
||||
|
||||
foreach ($lineas as $linea) {
|
||||
if (strpos($linea->tipo, "lp_bn") !== false || strpos($linea->tipo, "lp_color") !== false) {
|
||||
$paginasNegro = $linea->paginas;
|
||||
}
|
||||
|
||||
if (strpos($linea->tipo, "lp_color") !== false || strpos($linea->tipo, "lp_colorhq") !== false) {
|
||||
$paginasColor = $linea->paginas;
|
||||
}
|
||||
|
||||
if (strpos($linea->tipo, "lp_rot_bn") !== false) {
|
||||
$paginasNegro = $linea->paginas;
|
||||
}
|
||||
|
||||
if (strpos($linea->tipo, "lp_rot_color") !== false) {
|
||||
$paginasColor = $linea->rotativa_pag_color;
|
||||
$paginasNegro = $linea->paginas - $linea->rotativa_pag_color;
|
||||
}
|
||||
}
|
||||
|
||||
return [$paginasNegro, $paginasColor];
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,12 +27,13 @@ class PresupuestoClienteService extends BaseService
|
||||
if ($data['isColor']) {
|
||||
if ($data['datosPedido']->paginas == $data['paginas_color'])
|
||||
$total_plana += floatval($plana[1]['total_impresion']);
|
||||
|
||||
elseif (count($plana[0]) > 2 && count($plana[1]) > 2) {
|
||||
$total_plana = 0.0;
|
||||
foreach ($plana as $linea) {
|
||||
if (count($linea) > 0)
|
||||
$total_plana += floatval($linea['total_impresion']);
|
||||
elseif (count($plana) > 0) {
|
||||
if (count($plana[0]) > 2 && count($plana[1]) > 2) {
|
||||
$total_plana = 0.0;
|
||||
foreach ($plana as $linea) {
|
||||
if (count($linea) > 0)
|
||||
$total_plana += floatval($linea['total_impresion']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -46,7 +47,7 @@ class PresupuestoClienteService extends BaseService
|
||||
}
|
||||
|
||||
$total_rotativa = -1;
|
||||
if (!$data['excluirRotativa'] && count($rotativa) > 0 && $rotativa['num_formas']['posicion_formas'] != 'n/a') {
|
||||
if (!$data['excluirRotativa'] && count($rotativa) > 0 && $rotativa['num_formas']['posicion_formas'] != 'n/a') {
|
||||
$total_rotativa = floatval($rotativa['total_impresion']);
|
||||
}
|
||||
if ($total_plana < 0 && $total_rotativa < 0)
|
||||
@ -305,7 +306,7 @@ class PresupuestoClienteService extends BaseService
|
||||
$datosPedido->paginas = $paginas_color;
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
|
||||
if ($data['papelInteriorDiferente'] == true){
|
||||
if ($data['papelInteriorDiferente'] == true) {
|
||||
$papel_generico = $papel_generico_color;
|
||||
$gramaje = $gramaje_color;
|
||||
}
|
||||
@ -377,8 +378,7 @@ class PresupuestoClienteService extends BaseService
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (count($linea_negro_plana) > 0) {
|
||||
$linea_negro_plana = $linea_negro_plana[0]['fields'];
|
||||
$linea_negro_plana['tipo_linea'] = $isHq ? 'lp_bnhq' : 'lp_bn';
|
||||
|
||||
@ -21,10 +21,13 @@ if (session()->has('error')) {
|
||||
<div id="sk-alert">
|
||||
</div>
|
||||
|
||||
<div id="sk-alert-2">
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('globalJsFunctions') ?>
|
||||
|
||||
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert', fade = true){
|
||||
var htmlString = `
|
||||
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
@ -37,25 +40,39 @@ function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
if(containerId == 'sk-alert'){
|
||||
$(window).scrollTop(0);
|
||||
}
|
||||
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
if(fade){
|
||||
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#' + containerId).fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow");
|
||||
$('html, body').animate({ scrollTop: 0 }, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function popSuccessAlert(successMsg, containerId = 'sk-alert', fade = true){
|
||||
popAlert(successMsg, "alert-success", "ti-check", containerId, fade);
|
||||
}
|
||||
|
||||
function popWarningAlert(warningMsg, containerId = 'sk-alert', fade = true){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell", containerId, fade);
|
||||
}
|
||||
|
||||
function popErrorAlert(errorMsg, containerId = 'sk-alert', fade = true){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban", containerId, fade);
|
||||
}
|
||||
|
||||
function popAlert2Hide(containerId = 'sk-alert-2'){
|
||||
$('#' + containerId).hide().empty().fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#' + containerId).fadeOut("slow");
|
||||
}, 5000);
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function popSuccessAlert(successMsg, containerId = 'sk-alert'){
|
||||
popAlert(successMsg, "alert-success", "ti-check", containerId);
|
||||
}
|
||||
|
||||
function popWarningAlert(warningMsg, containerId = 'sk-alert'){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell", containerId);
|
||||
}
|
||||
|
||||
function popErrorAlert(errorMsg, containerId = 'sk-alert'){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban", containerId);
|
||||
}
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||
popSuccessAlert(`<?= $successMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
@ -206,7 +206,7 @@
|
||||
<label for="posPaginasColor" class="form-label">
|
||||
<?= lang('Presupuestos.posicionPagColor') ?>
|
||||
</label>
|
||||
<input class="form-control calcular-presupuesto" id="posPaginasColor" name="pos_paginas_color" value="">
|
||||
<input class="form-control" id="posPaginasColor" name="pos_paginas_color" value="">
|
||||
<div class="form-text">
|
||||
Intruzca la posición separada por comas. Ej: 3,5,7 ó 4-10,20,155
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div id="loader" class="loader" style="display: none;">
|
||||
<div id="loader" class="loader" data-backdrop="static" data-keyboard="false" style="display: none;">
|
||||
<div class="book">
|
||||
<div class="book__pg-shadow"></div>
|
||||
<div class="book__pg"></div>
|
||||
|
||||
@ -338,6 +338,53 @@ class DatosGenerales {
|
||||
});
|
||||
}
|
||||
|
||||
cargarDatos(datos) {
|
||||
|
||||
this.titulo.val(datos.titulo);
|
||||
this.autor.val(datos.autor);
|
||||
this.isbn.val(datos.isbn);
|
||||
this.coleccion.val(datos.coleccion);
|
||||
this.referenciaCliente.val(datos.referenciaCliente);
|
||||
|
||||
this.tirada1.val(parseInt(datos.tirada));
|
||||
if (datos.tirada2)
|
||||
this.tirada2.val(parseInt(datos.tirada2));
|
||||
if (datos.tirada3)
|
||||
this.tirada3.val(parseInt(datos.tirada3));
|
||||
if (datos.tirada4)
|
||||
this.tirada4.val(parseInt(datos.tirada4));
|
||||
|
||||
|
||||
this.paginas.val(parseInt(datos.paginas));
|
||||
this.paginasNegro.val(parseInt(datos.paginasNegro));
|
||||
this.paginasColor.val(parseInt(datos.paginasColor));
|
||||
|
||||
/*
|
||||
|
||||
this.papelFormatoId = this.domItem.find("#papelFormatoId");
|
||||
this.checkFormatoPersonalizado = this.domItem.find("#papelFormatoPersonalizado");
|
||||
this.formatoPersonalizado = this.domItem.find("#formatoPersonalizado");
|
||||
this.anchoPersonalizado = this.domItem.find("#papelFormatoAncho");
|
||||
this.altoPersonalizado = this.domItem.find("#papelFormatoAlto");
|
||||
|
||||
this.fresado = $(this.domItem.find("#fresado")[0]);
|
||||
this.cosido = $(this.domItem.find("#cosido")[0]);
|
||||
|
||||
this.tiposLibro = this.domItem.find(".tipo-libro");
|
||||
|
||||
|
||||
this.paginasCuadernillo = this.domItem.find("#paginasCuadernillo");
|
||||
this.pagColorConsecutivas = this.domItem.find("#pagColorConsecutivas");
|
||||
this.divPapelDiferente = this.domItem.find("#divPapelDiferente");
|
||||
this.papelDiferente = this.domItem.find("#papelDiferente");
|
||||
this.divPosPaginasColor = this.domItem.find("#divPosPaginasColor");
|
||||
this.posPaginasColor = this.domItem.find("#posPaginasColor");
|
||||
|
||||
this.ivaReducido = this.domItem.find("#ivaReducido");
|
||||
this.excluirRotativa = this.domItem.find("#excluirRotativa");
|
||||
this.prototipo = this.domItem.find("#prototipo");*/
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
let ancho = 0;
|
||||
|
||||
@ -68,12 +68,13 @@ class PresupuestoCliente {
|
||||
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
|
||||
this.RELLENAR_PRESUPUESTO(true);
|
||||
//this.RELLENAR_PRESUPUESTO(true);
|
||||
|
||||
if(window.location.href.includes("edit")){
|
||||
//load
|
||||
if (window.location.href.includes("edit")) {
|
||||
$(".calcular-presupuesto").off('change');
|
||||
this.#cargarPresupuesto();
|
||||
const successMessage = sessionStorage.getItem('message');
|
||||
if(successMessage){
|
||||
if (successMessage) {
|
||||
popSuccessAlert(successMessage);
|
||||
sessionStorage.removeItem('message');
|
||||
}
|
||||
@ -226,7 +227,7 @@ class PresupuestoCliente {
|
||||
try {
|
||||
$('#loader').show();
|
||||
|
||||
if(window.location.href.includes("edit")){
|
||||
if (window.location.href.includes("edit")) {
|
||||
this.datos["id"] = window.location.href.split("/").pop();
|
||||
}
|
||||
new Ajax('/presupuestocliente/guardar',
|
||||
@ -235,11 +236,11 @@ class PresupuestoCliente {
|
||||
(response) => {
|
||||
$('#loader').hide();
|
||||
console.log(response);
|
||||
if(this.datos["confirmar"] || window.location.href.includes("add")){
|
||||
if (this.datos["confirmar"] || window.location.href.includes("add")) {
|
||||
sessionStorage.setItem('message', response.message);
|
||||
window.location.href = response.url + '/' + response.status;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
popSuccessAlert(response.message);
|
||||
}
|
||||
},
|
||||
@ -257,7 +258,16 @@ class PresupuestoCliente {
|
||||
#procesarPresupuesto(response) {
|
||||
|
||||
$('#loader').hide();
|
||||
// checj if response.tiradas exists and is not empty
|
||||
|
||||
if (Object.values(response.errors).some((value) => value !== "")) {
|
||||
popErrorAlert("No se ha podido calcular el presupuesto para los datos proporcionados. Por favor, póngase en contacto con el departamento comercial."
|
||||
, "sk-alert-2", false);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
popAlert2Hide();
|
||||
}
|
||||
|
||||
if (response.tiradas && response.tiradas.length) {
|
||||
|
||||
this.divTiradasPrecios.empty();
|
||||
@ -397,6 +407,32 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
|
||||
#cargarPresupuesto() {
|
||||
|
||||
$('#loader').show();
|
||||
let id = window.location.href.split("/").pop()
|
||||
new Ajax('/presupuestocliente/cargar/' + id,
|
||||
{},
|
||||
{},
|
||||
(response) => {
|
||||
if (response.status === 1) {
|
||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
/*this.disenioInterior.cargarDatos(response);
|
||||
this.disenioCubierta.cargarDatos(response);
|
||||
this.direcciones.cargarDatos(response);
|
||||
*/
|
||||
}
|
||||
console.log(response);
|
||||
$('#loader').hide();
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
},
|
||||
() => {
|
||||
$('#loader').hide();
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
#isValidDataForm(value) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
|
||||
11277
xdebug.log
11277
xdebug.log
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user