From 69b27f0cd8ac4c43e21c1349dbf1bbf14a1fce1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Sun, 29 Sep 2024 18:07:54 +0200 Subject: [PATCH] cambiando presupuesto cliente --- ci4/app/Config/Routes.php | 14 +- .../Configuracion/Papelformato.php | 20 +- ci4/app/Language/es/Presupuestos.php | 5 +- .../Configuracion/PapelFormatoModel.php | 16 + .../presupuestos/cliente/_datosLibroItems.php | 94 -- .../cliente/_direccionesItems.php | 48 - .../cliente/_disenioLibroItems.php | 665 -------------- .../presupuestos/cliente/_resumenItems.php | 316 ------- .../presupuestos/cliente/_tipoLibroItems.php | 122 --- .../form/presupuestos/cliente/direcciones.js | 387 --------- .../form/presupuestos/cliente/disenioLibro.js | 789 ----------------- .../cliente/presupuestoCliente.js | 356 -------- .../form/presupuestos/cliente/previews.js | 819 ------------------ .../form/presupuestos/cliente/resumen.js | 311 ------- .../presupuestos/cliente/tipoLibroItems.js | 58 -- .../cliente/viewPresupuestoclienteForm.php | 302 +------ 16 files changed, 59 insertions(+), 4263 deletions(-) delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_datosLibroItems.php delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_direccionesItems.php delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_disenioLibroItems.php delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/direcciones.js delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/resumen.js delete mode 100644 ci4/app/Views/themes/vuexy/form/presupuestos/cliente/tipoLibroItems.js diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index f71ccec6..6c4d93ea 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -711,16 +711,22 @@ $routes->group( } ); -$routes->group( - 'buscadorpresupuestos', - ['namespace' => 'App\Controllers\Presupuestos'], - function ($routes) { +$routes->group('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { $routes->get('', 'Buscador::list', ['as' => 'buscadorPresupuestosList']); $routes->post('datatable', 'Buscador::datatable', ['as' => 'dataTableOfBuscador']); } ); $routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Buscador', 'except' => 'show,new,create,update']); + +$routes->group('papel-formato', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']); + } +); +$routes->resource('papel-formato', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelformato', 'except' => 'show,new,create,update']); + + + /* Rutas para mensajeria */ $routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], function ($routes) { diff --git a/ci4/app/Controllers/Configuracion/Papelformato.php b/ci4/app/Controllers/Configuracion/Papelformato.php index 4c55dff7..ee1a4dfc 100755 --- a/ci4/app/Controllers/Configuracion/Papelformato.php +++ b/ci4/app/Controllers/Configuracion/Papelformato.php @@ -244,23 +244,15 @@ class Papelformato extends \App\Controllers\BaseResourceController { public function menuItems() { if ($this->request->isAJAX()) { + $papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel'); $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; - $reqId = goSanitize($this->request->getPost('id'))[0]; - $reqText = goSanitize($this->request->getPost('text'))[0]; - $onlyActiveOnes = false; - $columns2select = [$reqId ?? 'id', $reqText ?? 'ancho']; - $onlyActiveOnes = false; - $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); - $nonItem = new \stdClass; - $nonItem->id = ''; - $nonItem->text = '- '.lang('Basic.global.None').' -'; - array_unshift($menu , $nonItem); - - $newTokenHash = csrf_hash(); - $csrfTokenName = csrf_token(); + $menu = $papelFormatoModel->getElementsForMenu2($searchStr); + if(empty(($searchStr))) + array_shift($menu); + $data = [ 'menu' => $menu, - $csrfTokenName => $newTokenHash + ]; return $this->respond($data); } else { diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 4904fd8d..d14be329 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -44,7 +44,10 @@ return [ 'titulo' => 'Título', 'paisId' => 'País', 'incRei' => 'Incidencia \ Reimpresión', - 'paginas' => 'Paginas', + 'paginas' => 'Páginas', + 'paginasNegro' => 'Páginas Negro', + 'paginasColor' => 'Páginas Color', + 'totalPaginas' => 'Total páginas', 'tirada' => 'Tirada', 'totalPedido' => 'Total Pedido', 'totalPresupuesto' => 'Total Presupuesto', diff --git a/ci4/app/Models/Configuracion/PapelFormatoModel.php b/ci4/app/Models/Configuracion/PapelFormatoModel.php index 6d682a71..d809fec6 100755 --- a/ci4/app/Models/Configuracion/PapelFormatoModel.php +++ b/ci4/app/Models/Configuracion/PapelFormatoModel.php @@ -93,4 +93,20 @@ class PapelFormatoModel extends \App\Models\BaseModel "t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS tamanio" )->where('is_deleted', 0)->orderBy('orden_select', 'asc')->get()->getResultObject(); } + + public function getElementsForMenu2($search = ""){ + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.id AS id, CONCAT(t1.ancho, ' x ', t1.alto) AS text" + )->where('is_deleted', 0)->orderBy('orden_select', 'asc'); + + return empty($search) + ? $builder->get()->getResultObject() + : $builder + ->groupStart() + ->like('t1.ancho', $search) + ->orLike('t1.alto', $search) + ->groupEnd()->get()->getResultObject(); + } } diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_datosLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_datosLibroItems.php deleted file mode 100644 index d0d58e27..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_datosLibroItems.php +++ /dev/null @@ -1,94 +0,0 @@ -
- - - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- - -
- - -
- - -
- -
- -
- - diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_direccionesItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_direccionesItems.php deleted file mode 100644 index eb4fe1d7..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_direccionesItems.php +++ /dev/null @@ -1,48 +0,0 @@ -
- -
-
- -
- -
- - -
-
- - -
-
- -
- -
-
-
-
- - -
-
-
- -
- -
-
- -section("additionalInlineJs") ?> - -window.direcciones = direcciones_envio) ?>; -window.direcciones_sel_tirada = selected_tirada) ?>; -window.routes_direcciones = { - direcciones: "", - getDatos: "", - nuevaDireccion: "", -} -endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_disenioLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_disenioLibroItems.php deleted file mode 100644 index 0516df66..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_disenioLibroItems.php +++ /dev/null @@ -1,665 +0,0 @@ -
- - - -
- -

Fresado

- -
-
- - -
-
- -
-
user()->inGroup('admin') || auth()->user()->inGroup('beta')) ?' style="display:none;"':''?>> - - -
- - -
- - -
-
- -
- -
-
> - -
-
-
-
> - -
-
- -
- -
-
-
Datos presupuesto
-
-
- -
- - - -
-
- - -
- -
- - -
- -
- - -
- -
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
papel_formato_personalizado == false ? '' : 'style="display: none"'; ?>> - - - -
- -
papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>> -
- - -
-
- -
papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>> -
- - -
-
- -
-
- papel_formato_personalizado == true ? 'checked' : ''; ?>> - -
-
- -
- -
-
-
Interior
-
-
- - - -
Color del interior
- -
- -
- -
-
- - color_impresion == 'negro' ? ' checked=""': ''); ?> > -
- -
-
Blanco y Negro Estándar
-
-
- - -
-
- - color_impresion == 'negroHq' ? ' checked=""': ''); ?> > -
- -
-
Blanco y Negro Premium
-
-
-
- - -
- -
-
- - color_impresion == 'color' ? ' checked=""': ''); ?> > -
- -
-
Color Estándar
-
-
- - -
-
- - color_impresion == 'colorHq' ? ' checked=""': ''); ?> > -
- -
-
Color Premium
-
-
-
-
- -
-
- - -
-
- -
Papel
-
- -
- - -
- -
- - -
- -
- - -
Opciones extra
- - - -
-
-
Cubierta
-
-
- - - -
Papel
-
- -
- - -
- -
- - -
- -
- -
- -
- - -
- -
- - -
Opciones extra
- -
- -
-
- solapas == true ? 'checked' : ''; ?>> - -
-
- -
solapas == true ? '' : 'style="display: none;"'; ?>> - - -
- -
- -
- -
- - -
- -
- - - -
-
-
Sobrecubierta
-
-
- - - -
-
-
- papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) : - echo 'checked'; - endif; ?> - > - -
-
-
- -
papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) : - echo ''; - else: - echo 'style="display: none;"'; - endif; ?> - > Papel
-
- -
- - -
- -
- - -
- -
- -
papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) : - echo ''; - else: - echo 'style="display: none;"'; - endif; ?> - > Opciones extra
- -
papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) : - echo ''; - else: - echo 'style="display: none;"'; - endif; ?> - > - -
- - -
- -
- -
papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) : - echo ''; - else: - echo 'style="display: none;"'; - endif; ?> - > - -
- - -
- -
- - - -
-
-
Guardas
-
-
- - - -
-
- - -
-
- -
-
- - -
-
- - - -
-
-
Servicios Extra
-
-
- -
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- - -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
- -
-
-
- -
-
-
- -
- - -
-
-
Otras opciones
-
-
- -
-
- - -
- -

Se verificará que el pedido cumpla con los requisitos establecidos en el Artículo 91 de la Ley 37/1992, sobre inserción de publicidad, antes de proceder con su producción, lo que garantiza la aplicación del IVA reducido del 4%.

-
- -
-
- - -section("additionalInlineJs") ?> - - -window.datosDisenioLibro = { - papel_interior: papel_interior ? $presupuestoEntity->papel_interior : 'null'; ?>, - gramaje_interior: gramaje_interior ? $presupuestoEntity->gramaje_interior : 'null'; ?>, - papel_cubierta: papel_cubierta ? $presupuestoEntity->papel_cubierta : 'null'; ?>, - gramaje_cubierta: gramaje_cubierta ? $presupuestoEntity->gramaje_cubierta : 'null'; ?>, - papel_sobrecubierta: papel_sobrecubierta ? $presupuestoEntity->papel_sobrecubierta : 'null'; ?>, - gramaje_sobrecubierta: gramaje_sobrecubierta ? $presupuestoEntity->gramaje_sobrecubierta : 'null'; ?>, -} -window.routes_disenio_libro = { - obtenerGramaje: "", - presupuestoCliente: "", -} -endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php deleted file mode 100644 index f9cf2d07..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php +++ /dev/null @@ -1,316 +0,0 @@ -
-
- estado_id==2): ?> -

PRESUPUESTO ACEPTADO

- lomo_cubierta ?>> -
- -

Resumen

-
-
Libro
-

resumen->titulo)?$presupuestoEntity->resumen->titulo:'') ?>

-

Tamaño: resumen->tamanio)?$presupuestoEntity->resumen->tamanio:'') ?>

-

Número de páginas: paginas ?>

-

Tirada: tirada ?>

-

Prototipo: prototipo?'SI':'NO') ?>

-

Ferro: ferro?'SI':'NO') ?>

- -
Interior
-

Impresion: - resumen->tipo_impresion)?$presupuestoEntity->resumen->tipo_impresion:'') ?> -

-

paginasColor==0?'style="display:none"':'')?>> - Páginas a color: paginasColor?>

-

Papel: - papel_interior_nombre)?$presupuestoEntity->papel_interior_nombre:'') ?> - gramaje_interior)?$presupuestoEntity->gramaje_interior:'') ?>gr/m²

- -
Cubierta
-

Papel: - papel_cubierta_nombre)?$presupuestoEntity->papel_cubierta_nombre:''); ?> - gramaje_cubierta)?$presupuestoEntity->gramaje_cubierta:''); ?>gr/m²

-

Impresión: paginas_cubierta==2?"1 cara":"2 caras");?>

- solapas_ancho>0 || $presupuestoEntity->estado_id==1): ?> -

Solapas: solapas_ancho;?>mm

- - acabado_cubierta_id>0 || $presupuestoEntity->estado_id==1): ?> -

Acabado: - acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) : - foreach ($datosPresupuesto->acabadosCubierta as $acabado) : - if ($acabado->id == $presupuestoEntity->acabado_cubierta_id): - echo $acabado->label; - endif; - endforeach; - endif; ?> -

- - - papel_sobrecubierta || $presupuestoEntity->estado_id==1): ?> -
Sobrecubierta
-

Papel: - papel_sobrecubierta_nombre)?$presupuestoEntity->papel_sobrecubierta_nombre:'') ?> - gramaje_sobrecubierta)?$presupuestoEntity->gramaje_sobrecubierta:'') ?>gr/m²

- solapas_ancho_sobrecubierta>0 || $presupuestoEntity->estado_id==1): ?> -

Ancho solapas: solapas_ancho_sobrecubierta;?>mm

- -

Acabado: - acabadosSobrecubierta) && is_array($datosPresupuesto->acabadosSobrecubierta) && !empty($datosPresupuesto->acabadosSobrecubierta)) : - foreach ($datosPresupuesto->acabadosSobrecubierta as $acabado) : - if ($acabado->id == $presupuestoEntity->acabado_sobrecubierta_id): - echo $acabado->label; - endif; - endforeach; - endif; ?> -

- - - papel_guardas || $presupuestoEntity->estado_id==1): ?> -
Guardas
-

Papel: - papel_guardas_nombre)?$presupuestoEntity->papel_guardas_nombre:''); ?> - 170gr/m²

-

Impresión: - paginas_guardas) || $presupuestoEntity->paginas_guardas==0): - echo "Sin impresion"; - elseif($presupuestoEntity->paginas_guardas==4): - echo "1 cara"; - else: - echo "2 caras"; - endif; ?>

- - - retractiladol || $presupuestoEntity->retractilado5 || $presupuestoEntity->faja_color || $presupuestoEntity->estado_id==1): ?> -
Extras
- - retractiladol): ?> -

Retractilado individual

- retractilado5): ?> -

Retractilado de 5

- faja_color): ?> -

Imprimir faja a color

- -
- -
- - estado_id==2): - $total = $presupuestoEntity->total_aceptado; - $iva = $presupuestoEntity->iva_reducido?1.04:1.21; - $total *= $iva; - $total_unidad = $presupuestoEntity->total_precio_unidad * $iva;; - echo '

Total: ' . round($total, 2) . '€

'; - echo '
' . round($total_unidad, 4) . '€/ud
' - ?> - -

Total: 100€

-
10.4€/ud
- -
-
-
- -
-
-
-
- estado_id==2): - echo '
'; - echo '

Direcciones de envío

'; - echo '
'; - if(isset($presupuestoEntity->direcciones_envio)): - foreach ($presupuestoEntity->direcciones_envio as $direccion): - echo '
'; - echo '
'; - echo ''; - echo '
'; - echo '
'; - endforeach; - endif; - echo '
'; - echo '
'; - endif; ?> - - estado_id==2): ?> -
-

Ficheros

-
-
-
- Arrastre aquí los ficheros o haga click -
-
- -
-
-
- -
- -
- - - - - -section("additionalInlineJs") ?> -window.estado = estado_id ?? 1?>; -window.tirada = selected_tirada ?? 0?>; -window.total = total_aceptado ?? 0?>; -window.total_unidad = total_precio_unidad ?? 0 ?>; -window.routes_resumen = { - guardarPresupuesto: "", - duplicarPresupuesto: "", -} - -estado_id===2): ?> - previewEsquemaCubierta(true); - - const previewTemplate = `
-
-
- -
-
-
-
-
-
-
-
-
-
-
`; - - Dropzone.autoDiscover = false; - - var dropzoneMulti = new Dropzone('#dropzone-multi', { - url: "", - addRemoveLinks: true, - previewTemplate: previewTemplate, - paramName: "file", - uploadMultiple: true, - parallelUploads: 4, // Ajusta este número al máximo número de archivos que esperas subir a la vez - maxFiles: 5, // Ajusta este número al máximo número de archivos que esperas subir a la vez - autoProcessQueue: true, - dictRemoveFile: "Eliminar", - acceptedFiles: 'image/*, application/pdf', - maxFilesize: 5e+7, // Bytes - init: function() { - thisDropzone = this; - $('#loader').show(); - - $.ajax({ - url: "", - type: 'POST', - data: { presupuesto_id: id ?> }, - - }).done(function(response) { - if(response == null || response == ""){ - return; - } - values = JSON.parse(response); - for(var i = 0; i < values.length; i++){ - var mockFile = { name: values[i].name, size: values[i].size, hash: values[i].hash}; - - thisDropzone.files.push(mockFile); // add to files array - thisDropzone.emit("addedfile", mockFile); - thisDropzone.emit("thumbnail", mockFile, window.location.host + "/sistema/intranet/presupuestos/"+values[i].hash); - thisDropzone.emit("complete", mockFile); - thisDropzone.options.success.call(thisDropzone, mockFile); - }; - }).always(function() { - $('#loader').hide(); - }); - - this.on("addedfile", function (file) { - if(file.hash){ - var viewButton = Dropzone.createElement("Ver"); - file.previewElement.appendChild(viewButton); - // Listen to the view button click event - viewButton.addEventListener("click", function (e) { - - window.open(window.location.protocol + "//" + window.location.host + "/sistema/intranet/presupuestos/"+file.hash, '_blank'); - }); - } - }); - } - }); - - $('#presupuesto-cliente-form').submit(function(e){ - e.preventDefault(); - var files = dropzoneMulti.files; - $('#loader').show(); - - var formData = new FormData(); - var oldFiles = []; - var counter = 0; - for (var i = 0; i < files.length; i++) { - - if(files[i].upload){ - var file = files[i]; - formData.append('file[' + counter + ']', file); - counter += 1; - } - else{ - oldFiles.push(files[i].name); - } - } - formData.append('oldFiles', JSON.stringify(oldFiles)); - - formData.append('presupuesto_id', id ?>); - - $.ajax({ - url: "", - type: 'POST', - data: formData, - processData: false, // Indicar a jQuery que no procese los datos - contentType: false // Indicar a jQuery que no establezca el tipo de contenido - }).done(function(response) { - // Aquí puedes manejar la respuesta del servidor - }).always(function() { - $('#loader').hide(); - }) - - return false; - }); - -endSection() ?> diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php deleted file mode 100644 index 54cf1280..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php +++ /dev/null @@ -1,122 +0,0 @@ -
-
- - lomo_cubierta ?>> - -
- -
-
-
- > - - tipo_libro == 'cosido' || $datosPresupuesto->tipo_libro == ''){ - echo 'checked=""'; - } - ?> - > -
-

Rústica cosido

-
-
- -
-
-
> - - tipo_libro)=='fresado'? 'checked=""':''); ?> > -
-

Rústica fresado

-
-
- -
-
-
> - - tipo_libro)=='grapado'? 'checked=""':''); ?> > -
-

Cosido con grapas

-
-
-
- -
-
-
-
> - - tipo_libro)=='espiral'? 'checked=""':''); ?> > -
-

Espiral

-
-
- -
-
-
> - - tipo_libro)=='wireo'? 'checked=""':''); ?> > -
-

Wire-o

-
-
- -
-
-
\ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/direcciones.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/direcciones.js deleted file mode 100644 index 5a264add..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/direcciones.js +++ /dev/null @@ -1,387 +0,0 @@ -function initDirecciones() { - data = { - id: $('#clienteId').val() - }, - data = Object.assign(data, window.token_ajax); - $('#errorDirecciones').hide(); - - $.ajax({ - url: window.routes_direcciones.direcciones, - type: 'POST', - data: data, - success: function(response) { - $("#direcciones").empty(); - $.each(response.menu, function(index, value) { - $("#direcciones").append(''); - }); - $("#direcciones").val(''); - }, - error: function() { - $("#direcciones").empty(); - }, - }); -} - -function initTiradasDirecciones() { - const _this = this - let sel_index = 1; - - $('#containerTiradasEnvios').empty(); - - for (i = 1; i <= 4; i++) { - let id = "tiradaPrecio" + i; - if ($('#' + id).length > 0) { - - let tirada_id = "ud_tiradaPrecio" + i; - let total_id = "tot_tiradaPrecio" + i; - let precio_u_id = "pu_tiradaPrecio" + i; - let peso = $('#' + id).attr('peso'); - - let html = ''; - html += '
'; - html += '
'; - html += ''; - html += '
'; - html += '
'; - - $('#containerTiradasEnvios').append(html); - - if(parseInt($('#' + tirada_id).text().split(' ')[0]) == window.direcciones_sel_tirada){ - sel_index = i; - } - - $('#' + id).hide(); - } - } - $(('#env_tiradaPrecio' + sel_index)).trigger('click'); - - cargarDirecciones(); - - const tiradasDireccionesList = [].slice.call(document.querySelectorAll('.custom-option-tiradasDirecciones .form-check-input')) - tiradasDireccionesList.map(function (customOptionEL) { - // Update custom options check on page load - _this.updateTiradasDireccionesCheck(customOptionEL) - - // Update custom options check on click - customOptionEL.addEventListener('click', e => { - _this.updateTiradasDireccionesCheck(customOptionEL) - }) - }) -} - -function cargarDirecciones(){ - $('#loader').show(); - $('#divDirecciones').empty(); - - if(window.direcciones == null){ - $('#loader').hide(); - return; - } - for(let i=0; i'; - html += '
'; - html += ''; - html += '
'; - html += ''; - - $('#divDirecciones').append(html); - $('#errorDirecciones').hide(); - $('#loader').hide(); - } -} - -function updateTiradasDireccionesCheck(el) { - if (el.checked) { - // If custom option element is radio, remove checked from the siblings (closest `.row`) - if (el.type === 'radio') { - const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tiradasDirecciones')) - customRadioOptionList.map(function (customRadioOptionEL) { - customRadioOptionEL.closest('.custom-option-tiradasDirecciones').classList.remove('checked') - let id_temp = customRadioOptionEL.id.split('-')[1]; - $('#' + id_temp).prop('checked', false); - }) - } - const element = el.closest('.custom-option-tiradasDirecciones'); - element.classList.add('checked'); - - let id = element.id.split('-')[1]; - $('#' + id).prop('checked', true); - - } else { - el.closest('.custom-option-tiradasDirecciones').classList.remove('checked') - } -} - - -function obtenerUnidadesEnvio(){ - - const elements = $('#divDirecciones').find('.row.mb-3'); - let total = 0; - - if(elements.length > 0) { - for (let index=0; index 0 ) { - - let unidades = $('#unidadesEnvio').val(); - if(unidades == '' || isNaN(unidades) || parseInt(unidades) <= 0){ - return false; - } - unidades = parseInt(unidades); - - const seleccion = $('.custom-option-tiradasDirecciones.checked'); - if(seleccion.length == 0) { - return false; - } - - const element_tirada =($(seleccion[0]).find('label input')[0]); - const number = element_tirada.id.match(/\d+$/); - if (number.length == 0) { - return false; - } - let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text()); - - let total = obtenerUnidadesEnvio(); - - if($('#prototipo').is(':checked')) { - tirada += 1; - } - - if(total + unidades <= tirada) { - - data = { - id: $('#direcciones').val(), - peso: $('#env_tiradaPrecio' + number[0]).attr('peso'), - unidades: unidades, - entregaPieCalle: $('#entregaPieCalle').is(':checked')?1:0, - }, - data = Object.assign(data, window.token_ajax) - - $('#loader').show(); - - $.ajax({ - url: window.routes_direcciones.getDatos, - type: 'POST', - data: data, - success: function(response) { - if(response.data.length > 0) { - let html = ''; - html += '
'; - html += '
'; - html += ''; - html += '
'; - html += '
'; - - $('#divDirecciones').append(html); - $('#errorDirecciones').hide(); - $('#loader').hide(); - } - }, - error: function() { - $("#direcciones").empty(); - $('#loader').hide(); - }, - }); - } - else{ - $('#errorDirecciones').text('El número de unidades supera la tirada seleccionada.'); - $('#errorDirecciones').show(); - } - } - return false; -}) - - - -$(document).on('click', '.eliminar-direccion', function(e) { - - $(this).closest('.row.mb-3').remove(); - - const seleccion = $('.custom-option-tiradasDirecciones.checked'); - if(seleccion.length == 0) { - return false; - } - - const element_tirada =($(seleccion[0]).find('label input')[0]); - const number = element_tirada.id.match(/\d+$/); - if (number.length == 0) { - return false; - } - - let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text()); - - const elements = $('#divDirecciones').find('.row.mb-3'); - - let total = 0; - if(elements.length > 0) { - for (let index=0; index' + value.text + ''); - }); - $("#direcciones").val(''); - $('#addressForm').modal('hide'); - }, - error: function() { - $('#addressForm').modal('hide'); - }, - }); - - } -} - -function validarEnvio(){ - - const seleccion = $('.custom-option-tiradasDirecciones.checked'); - if(seleccion.length == 0) { - return false; - } - - const element_tirada =($(seleccion[0]).find('label input')[0]); - - const number = element_tirada.id.match(/\d+$/); - if (number.length == 0) { - return false; - } - let tirada = parseInt($('#tiradaDireccionesValue' + number[0]).text()); - - let total = obtenerUnidadesEnvio(); - - if($('#prototipo').is(':checked')) { - tirada += 1; - } - - if(total != tirada){ - return false; - } - return true; -} - -function getDireccionesEnvio(){ - - const elements = $('#divDirecciones').find('.row.mb-3'); - - let direcciones = []; - - if(elements.length > 0) { - for (let index=0; index { - _this.updateTapaCheck(customOptionEL) - }) - }) -} - -function updateTapaCheck(el) { - if (el.checked) { - // If custom option element is radio, remove checked from the siblings (closest `.row`) - if (el.type === 'radio') { - const customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option-tapa')) - customRadioOptionList.map(function (customRadioOptionEL) { - customRadioOptionEL.closest('.custom-option-tapa').classList.remove('checked') - }) - } - el.closest('.custom-option-tapa').classList.add('checked') - if (el.closest('.custom-option-tapa').id == 'tapaBlandaInnerDiv') { - $('#tapaBlanda').prop('checked', true); - $('#tapaDura').prop('checked', false); - } - else { - $('#tapaBlanda').prop('checked', false); - $('#tapaDura').prop('checked', true); - } - } else { - el.closest('.custom-option-tapa').classList.remove('checked') - } -} - - -function initColorCheck() { - const _this = this - - const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-color .form-check-input')) - custopOptionList.map(function (customOptionEL) { - // Update custom options check on page load - _this.updateColorCheck(customOptionEL) - - // Update custom options check on click - customOptionEL.addEventListener('click', e => { - _this.updateColorCheck(customOptionEL) - }) - }) -} - -function updateColorCheck(el) { - if (el.checked) { - // If custom option element is radio, remove checked from the siblings (closest `.row`) - if (el.type === 'radio') { - const customRadioOptionList = [].slice.call(el.closest('.row-color').querySelectorAll('.custom-option-color')) - customRadioOptionList.map(function (customRadioOptionEL) { - customRadioOptionEL.closest('.custom-option-color').classList.remove('checked') - }) - } - el.closest('.custom-option-color').classList.add('checked') - if (el.closest('.custom-option-color').id == 'colorNegroDiv') { - $('#colorNegro').prop('checked', true); - $('#colorNegroHq').prop('checked', false); - $('#colorColor').prop('checked', false); - $('#colorColorHq').prop('checked', false); - } - else if (el.closest('.custom-option-color').id == 'colorNegroHqDiv') { - $('#colorNegro').prop('checked', false); - $('#colorNegroHq').prop('checked', true); - $('#colorColor').prop('checked', false); - $('#colorColorHq').prop('checked', false); - } - else if (el.closest('.custom-option-color').id == 'colorColorDiv') { - $('#colorNegro').prop('checked', false); - $('#colorNegroHq').prop('checked', false); - $('#colorColor').prop('checked', true); - $('#colorColorHq').prop('checked', false); - } - else { - $('#colorNegro').prop('checked', false); - $('#colorNegroHq').prop('checked', false); - $('#colorColor').prop('checked', false); - $('#colorColorHq').prop('checked', true); - } - - } else { - el.closest('.custom-option-color').classList.remove('checked') - } -} - - -$('#enableSobrecubierta').on('change', function () { - if ($(this).is(":checked")) { - $('.enable-sobrecubierta').show(); - } else { - $('#gramajeSobrecubierta').val('').trigger('change'); - $('#paperSobrecubierta').val('').trigger('change'); - $('#acabadosSobrecubierta').val('').trigger('change'); - $('#tamanioSolapasSobrecubierta').val(); - $('.enable-sobrecubierta').hide(); - - } -}); - - -function initDisenioLibro() { - initTapaCheck(); - initColorCheck(); - - $('.elementos-libro').trigger('change'); - $('.change-tipo-impresion').trigger('change'); - - $('#papelInterior').trigger('change'); - $('#papelInterior').val(window.datosDisenioLibro.papel_interior); - $('#gramajeInterior').append($(''); - - } -} - - -$('.calcular-presupuesto').on('change', function () { - - // se obtiene el id del elemento que ha disparado el evento - if($(this).hasClass('input-sobrecubierta')){ - if($('#papelSobrecubierta option:selected').val() == '' || $('#gramajeSobrecubierta option:selected').val() == ''){ - return; - } - } - calcularPresupuesto(); -}); - -function comprobarTiradasPOD(){ - const tiradas = getTiradas(); - - //Comprobar que todos los elementos del array tiradas estan por encima de 30 o por debajo - const tiradasPOD = tiradas.every(tirada => tirada <= 30); - const tiradasNoPOD = tiradas.every(tirada => tirada > 30); - if (tiradasPOD == !tiradasNoPOD) { - return true; - } - return false; -} - -$('#clienteId').on('select2:change', function () { - calcularPresupuesto(); -}); - - -async function calcularPresupuesto() { - - let isColor = false; - if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked')) - isColor = true; - let isHq = false; - if($('#colorNegroHqDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked')) - isHq = true; - - if(!comprobarTiradasPOD()){ - $('#errorTiradas').show(); - return; - } - $('#errorTiradas').hide(); - - // se obtiene la propiedad serv_id de los checkboxes seleccionados de la clase .servicio-extra - if (!checkValues()) { - return; - } - - let servicios = []; - $('.servicio-extra:checked').each(function () { - servicios.push($(this).attr('serv_id')); - }) - - let datos = { - 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: isColor ? 1 : 0, - isHq: isHq ? 1 : 0, - 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 es cosido, se añade el número de páginas del cuadernillo - if ($('#cosidoDiv').hasClass('checked')) { - datos.paginasCuadernillo = $('#paginasCuadernillo').val(); - } - // Si hay solapas de cubierta - if ($('#solapasCubierta').is(':checked')) { - datos.solapasCubierta = $('#anchoSolapasCubierta').val() - } - - - - // Si hay sobrecubierta - if ($('#enableSobrecubierta').is(':checked')) { - if($('#papelSobrecubierta option:selected').val()>0 && $('#gramajeSobrecubierta option:selected').val()>0){ - - datos.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 ($('#divGuardas').is(':visible')) { - datos.guardas = { - papel: $('#papelGuardas option:selected').val(), - papel_nombre: $('#papelGuardas option:selected').text().trim(), - gramaje: 170, - caras: $('#impresionGuardas option:selected').val() - } - } - - datos = Object.assign(datos, window.token_ajax) - - $('#divTiradasPrecio').empty(); - $('#loader').show(); - - $.ajax({ - url: window.routes_disenio_libro.presupuestoCliente, - type: 'POST', - data: datos, - success: function (response) { - error = false; - $('#errorGeneral').hide(); - try{ - - - if(response.errors.interior.length > 0){ - $('#errorInterior').show(); - error = true; - } - else - $('#errorInterior').hide(); - if(response.errors.cubierta.length > 0){ - $('#errorCubierta').show(); - error = true; - } - else - $('#errorCubierta').hide(); - - if(response.errors.sobrecubierta.length > 0){ - $('#errorSobrecubierta').show(); - error = true; - } - else - $('#errorSobrecubierta').hide(); - - - if(response.errors.guardas.length > 0){ - $('#errorGuardas').show(); - error = true; - } - else - $('#errorGuardas').hide(); - - if(response.errors.servicios.length > 0 || response.errors.serviciosDefecto.length > 0){ - error = true; - $('#errorGeneral').show(); - } - else{ - $('#errorGeneral').hide(); - } - } - catch(error){ - } - - //For debug only - //console.log(response); - - $('#loader').hide(); - - $('#divTiradasPrecio').empty(); - - if(!error){ - - $('#lomo_cubierta').val(response.info.lomo_cubierta); - - $('#precios').show(); - - if(response.tiradas){ - for (i = 0; i < response.tiradas.length; i++) { - const total = (parseFloat(response.precio_u[i]) * parseInt(response.tiradas[i])).toFixed(2) ; - const label = "tiradaPrecio" + parseInt(i+1); - - let html = ''; - - html += ''; - - $('#divTiradasPrecio').append(html); - } - } - - if($('#resumen-libro').hasClass('active')) { - initDirecciones(); - initTiradasDirecciones(); - generarResumen(); - previewEsquemaCubierta(true); - } - - } - }, - error: function (error) { - $('#loader').hide(); - $('#divTiradasPrecio').empty(); - } - }); -} \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js deleted file mode 100644 index 6c79f0ee..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js +++ /dev/null @@ -1,356 +0,0 @@ -/** - * Cliente presupuesto Wizard - */ - -'use strict'; - -(function () { - - - // Init custom option check - //window.Helpers.initCustomOptionCheck(); - // Vertical Wizard - // -------------------------------------------------------------------- - - const clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente'); - if (typeof clientePresupuestoWizard !== undefined && clientePresupuestoWizard !== null ) { - // Wizard form - const clientePresupuestoWizardForm = clientePresupuestoWizard.querySelector('#presupuesto-cliente-form'); - // Wizard steps - const clientePresupuestoWizardFormStep2 = clientePresupuestoWizardForm.querySelector('#tipo-libro'); - const clientePresupuestoWizardFormStep3 = clientePresupuestoWizardForm.querySelector('#disenio-libro'); - const clientePresupuestoWizardFormStep4 = clientePresupuestoWizardForm.querySelector('#direcciones-libro'); - const clientePresupuestoWizardFormStep5 = clientePresupuestoWizardForm.querySelector('#resumen-libro'); - // Wizard next prev button - const clientePresupuestoWizardNext = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-next')); - const clientePresupuestoWizardPrev = [].slice.call(clientePresupuestoWizardForm.querySelectorAll('.btn-prev')); - - let FormValidation2; - let FormValidation3; - let FormValidation4; - let FormValidation5; - - let validationStepper = new Stepper(clientePresupuestoWizard, { - linear: true - }); - - if(clientePresupuestoWizardFormStep2 != null) { - // select2 (clienteId) - const clienteId = $('#clienteId'); - - clienteId.on('change.select2', function () { - // Revalidate the clienteId field when an option is chosen - FormValidation2.revalidateField('clienteId'); - }); - - // Deal Details - FormValidation2 = FormValidation.formValidation(clientePresupuestoWizardFormStep2, { - fields: { - }, - plugins: { - trigger: new FormValidation.plugins.Trigger(), - bootstrap5: new FormValidation.plugins.Bootstrap5({ - // Use this for enabling/changing valid/invalid class - // eleInvalidClass: '', - eleValidClass: '', - rowSelector: '.col-sm-3' - }), - autoFocus: new FormValidation.plugins.AutoFocus(), - submitButton: new FormValidation.plugins.SubmitButton() - } - }).on('core.form.valid', function () { - // Jump to the next step when all fields in the current step are valid - validationStepper.next(); - }); - - - // Deal Usage - FormValidation3 = FormValidation.formValidation(clientePresupuestoWizardFormStep3, { - fields: { - titulo: { - validators: { - notEmpty: { - message: window.Presupuestos.validation.requerido_short - }, - } - }, - clienteId: { - validators: { - callback: { - message: window.Presupuestos.validation.cliente, - callback: function (input) { - // Get the selected options - const options = $("#clienteId").select2('data'); - const hasValidOption = options.some(option => parseInt(option.id) > 0); - return options !== null && options.length > 0 && hasValidOption; - }, - } - } - }, - tirada: { - validators: { - callback: { - message: window.Presupuestos.validation.integer_greatherThan_0, - callback: function (input) { - const value = $("#tirada").val(); - return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0; - }, - } - } - }, - paginas: { - validators: { - callback: { - message: window.Presupuestos.validation.integer_greatherThan_0, - callback: function (input) { - const value = $("#paginas").val(); - return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0; - }, - } - } - }, - paginasColor: { - validators: { - callback: { - message: window.Presupuestos.validation.integer_greatherThan_0, - callback: function (input) { - if ($('#pagColorDiv').is(':hidden')) - return true; - else { - const value = $("#paginasColor").val(); - return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0; - } - }, - } - } - }, - gramajeInterior: { - validators: { - callback: { - callback: function (input) { - const value = $("#tirada").val(); - if ($('#gramajeInterior option:selected').text().length == 0) { - if(value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0){ - return { - valid: false, - message: window.Presupuestos.validation.sin_gramaje, - } - } - return { - valid: value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0, - message: window.Presupuestos.validation.tirada_no_valida, - } - } - return true; - }, - }, - } - }, - gramajeCubierta: { - validators: { - callback: { - message: window.Presupuestos.validation.tirada_no_valida, - callback: function (input) { - const value = $("#tirada").val(); - if ($('#gramajeCubierta option:selected').text().length == 0) { - return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0; - } - return true; - }, - }, - callback: { - message: window.Presupuestos.validation.sin_gramaje, - callback: function (input) { - if ($('#gramajeCubierta option:selected').text().length == 0) { - return false; - } - return true; - }, - } - } - }, - gramajeSobrecubierta: { - validators: { - callback: { - message: window.Presupuestos.validation.tirada_no_valida, - callback: function (input) { - const value = $("#tirada").val(); - if ($('#gramajeSobrecubierta option:selected').text().length == 0) { - return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0; - } - return true; - }, - } - } - }, - }, - plugins: { - trigger: new FormValidation.plugins.Trigger(), - bootstrap5: new FormValidation.plugins.Bootstrap5({ - // Use this for enabling/changing valid/invalid class - // eleInvalidClass: '', - eleValidClass: '', - rowSelector: function (field, ele) { - // field is the field name - // ele is the field element - switch (field) { - case 'gramajeInterior': - case 'gramajeCubierta': - case 'gramajeSobrecubierta': - return '.col-sm-2'; - - case 'titulo': - return '.col-sm-12'; - - case 'clienteId': - return '.col-sm-6'; - - default: - return '.col-sm-3'; - } - } - }), - autoFocus: new FormValidation.plugins.AutoFocus(), - submitButton: new FormValidation.plugins.SubmitButton() - } - }).on('core.form.valid', function () { - if($('#tiradaPrecio1').length > 0) { - validationStepper.next(); - initDirecciones(); - initTiradasDirecciones(); - } - }); - - const tirada = $('#tirada'); - tirada.on('change', function () { - // Revalidate the clienteId field when an option is chosen - FormValidation2.revalidateField('gramajeInterior'); - FormValidation2.revalidateField('gramajeCubierta'); - FormValidation2.revalidateField('gramajeSobrecubierta'); - }); - - // Direcciones - FormValidation4 = FormValidation.formValidation(clientePresupuestoWizardFormStep4, { - fields: { - - }, - plugins: { - trigger: new FormValidation.plugins.Trigger(), - bootstrap5: new FormValidation.plugins.Bootstrap5({ - // Use this for enabling/changing valid/invalid class - // eleInvalidClass: '', - eleValidClass: '', - rowSelector: '.col-md-12' - }), - autoFocus: new FormValidation.plugins.AutoFocus(), - submitButton: new FormValidation.plugins.SubmitButton() - } - }).on('core.form.valid', function () { - if(validarEnvio()){ - generarResumen(); - validationStepper.next(); - } - else{ - let text = "El número de unidades enviadas no coincie con la tirada seleccionada."; - if($('#prototipo').is(':checked')) { - text += "
(Tenga en cuenta que se ha seleccionado la opción de prototipo)"; - } - $('#errorDirecciones').text(text); - $('#errorDirecciones').show(); - } - }); - } - // Deal Usage - FormValidation5 = FormValidation.formValidation(clientePresupuestoWizardFormStep5, { - fields: { - // * Validate the fields here based on your requirements - }, - plugins: { - trigger: new FormValidation.plugins.Trigger(), - bootstrap5: new FormValidation.plugins.Bootstrap5({ - // Use this for enabling/changing valid/invalid class - // eleInvalidClass: '', - eleValidClass: '', - rowSelector: '.col-md-12' - }), - autoFocus: new FormValidation.plugins.AutoFocus(), - submitButton: new FormValidation.plugins.SubmitButton() - } - }).on('core.form.valid', function () { - // You can submit the form - // clientePresupuestoWizardForm.submit() - // or send the form data to server via an Ajax request - // To make the demo simple, I just placed an alert - //alert('Submitted..!!'); - }); - - clientePresupuestoWizardNext.forEach(item => { - item.addEventListener('click', event => { - // When click the Next button, we will validate the current step - switch (validationStepper._currentIndex) { - case 0: - FormValidation2.validate(); - break; - - case 1: - FormValidation3.validate(); - break; - - case 2: - FormValidation4.validate(); - break; - - case 3: - FormValidation5.validate(); - break; - - default: - validationStepper.next(); - break; - } - }); - }); - - clientePresupuestoWizardPrev.forEach(item => { - item.addEventListener('click', event => { - switch (validationStepper._currentIndex) { - case 4: - validationStepper.previous(); - break; - - case 3: - validationStepper.previous(); - break; - - case 2: - for (let i = 0; i < 4; i++) { - let id = "tiradaPrecio" + i; - if ($('#' + id).length > 0) { - $('#' + id).show(); - } - } - validationStepper.previous(); - break; - - case 1: - validationStepper.previous(); - break; - - case 0: - window.location.href = document.location.origin + '/presupuestocliente/list'; - - default: - break; - } - }); - }); - - var url = $(location).attr('href'); // Obtener URL actual - if (url.includes('/edit/')) { // Comprobar si la URL contiene 'edit' - validationStepper.to(4); - } - - } -})(); - - diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js deleted file mode 100644 index ca350aa3..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js +++ /dev/null @@ -1,819 +0,0 @@ -// Global parameters -var pvObj; - -$('#toReview').on("click", function () { - previewEsquemaCubierta(true); -}); - -$(document).on('shown.bs.modal', function (e) { - previewEsquemaCubierta(false); -}) - - -function previewEsquemaCubierta(isThumbnail = false) { - - if($('#cosidoDiv').length){ - - if ($('#cosidoDiv').hasClass('checked') || $("#fresadoDiv").hasClass('checked')) { - //console.log("Cosido/Fresado"); - if ($("#tapaBlanda").is(":checked")) { - portadaTapaBlanda(isThumbnail); - } else if ($("#tapaDura").is(":checked")) { - portadaTapaDura(isThumbnail); - } - } else if ($('#espiralDiv').hasClass('checked') || $('#wireoDiv').hasClass('checked')) { - //console.log("Espiral/Wireo"); - if ($("#tapaBlanda").is(":checked")) { - portadaEspiral(isThumbnail, false); - } else if ($("#tapaDura").is(":checked")) { - portadaEspiral(isThumbnail, true); - } - } else if ($('#grapadoDiv').hasClass('checked')) { - portadaGrapado(isThumbnail); - } - } - else{ - let titulo = $('#tipoLibro').text().toLowerCase(); - if(titulo.includes("cosido") || titulo.includes("fresado")){ - if(titulo.includes("dura")) - portadaTapaDura(isThumbnail); - else{ - portadaTapaBlanda(isThumbnail); - } - } - else if (titulo.includes("espiral") || titulo.includes("wire-o")){ - if(titulo.includes("dura")) - portadaEspiral(isThumbnail, true); - else - portadaEspiral(isThumbnail, false); - } - else if (titulo.includes("grapado")){ - portadaGrapado(isThumbnail); - } - } - - -} - -function portadaTapaDura(isThumbnail = false) { - - // Variables locales - let altoLibro, anchoLibro, lomoLibro, anchoCubierta, altoSangrado, anchoSangrado; - let styleCotas = {size: 12, family: 'Public Sans'}; - let sangradoTexto = "Sangrado 20 mm"; - let sangradoValor = parseFloat(20); // mm - let anchoPliegue = parseFloat(7); // mm - let altoPliegue = parseFloat(7); // mm - let anchoCarton = parseFloat(7); // mm - - let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape'; - - // Get the preview Object parameters - getObjetoToPreview(); - - // Definicion de los parametros del Esquema de Cubierta (EC) - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 800; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = altoSangrado * 0.88; - anchoLibro = anchoSangrado * 0.39; - lomoLibro = anchoSangrado * 0.133; - anchoCubierta = (2 * anchoLibro) + lomoLibro; - - // Clear the canvas element - $(`#${divIdName}`).empty(); - // Get the element for placing the graphical elements - var divEC = document.getElementById(divIdName); - var previewEC = new Two({fitted: true}).appendTo(divEC); - - // Calculate the center of the canvas element - var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); - - var sangrado = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoSangrado, - altoSangrado - ); - sangrado.stroke = 'black'; - sangrado.dashes = [5, 5]; - sangrado.fill = '#FCEAF1'; - sangrado.linewidth = 1; - - var libro = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - ((2 * anchoLibro) + lomoLibro), - altoLibro); - libro.stroke = 'black'; - libro.linewidth = 1; - - var lomo = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - lomoLibro, - altoLibro); - lomo.stroke = 'black'; - lomo.fill = '#F4F8F2'; - lomo.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas: - var cotaAnchoCubierta = previewEC.makeDobleArrow( - origenEC.x - (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - origenEC.x + (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - 10); - cotaAnchoCubierta.linewidth = 2; - var cotaAltoCubierta = previewEC.makeDobleArrow( - origenEC.x + (anchoCubierta / 2) + 40, - origenEC.y + (altoSangrado / 2), - origenEC.x + (anchoCubierta / 2) + 40, - origenEC.y - (altoSangrado / 2), - 10); - cotaAltoCubierta.linewidth = 2; - var cotaAltoLibro = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y + (altoLibro / 2), - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y - (altoLibro / 2), - 10); - cotaAltoLibro.linewidth = 2; - var cotaLomo = previewEC.makeDobleArrow( - origenEC.x - (lomoLibro / 2), - origenEC.y + (altoLibro / 3), - origenEC.x + (lomoLibro / 2), - origenEC.y + (altoLibro / 3), - 10); - cotaLomo.linewidth = 2; - var cotaContraportada = previewEC.makeDobleArrow( - origenEC.x - (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - origenEC.x - (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - 10); - cotaContraportada.linewidth = 2; - var cotaPortada = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - origenEC.x + (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - 10); - cotaPortada.linewidth = 2; - - - // Textos: - // Titulos generales - let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'}; - previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2; - // Sangrados - let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - // Cotas - previewEC.makeText(pvObj.lomoLibro + anchoCarton + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.altoLibro + altoPliegue + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + altoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 55, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm", - origenEC.x, - origenEC.y + (altoLibro / 2) + 50, - styleCotas); - - } - - previewEC.update(); - -} - -function portadaTapaBlanda(isThumbnail = false) { - - // Variables locales - let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado; - let styleCotas = {size: 12, family: 'Public Sans'}; - let sangradoTexto = "Sangrado 5 mm"; - let sangradoValor = parseFloat(5); // mm - let offsetSolapaValor = parseFloat(0); // mm - - let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape'; - - // Get the preview Object parameters - getObjetoToPreview(); - - - // Definicion de los parametros del Esquema de Cubierta (EC) - if (pvObj.anchoSolapa == 0) { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 800; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - - altoLibro = altoSangrado * 0.97; - anchoLibro = anchoSangrado * 0.419; - anchoSolapa = 0; - lomoLibro = anchoSangrado * 0.133; - anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; - - } else { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = altoSangrado * 0.95; - anchoLibro = anchoSangrado * 0.28; - anchoSolapa = anchoSangrado * 0.163; - lomoLibro = anchoSangrado * 0.09; - anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; - offsetSolapaValor = parseFloat('3.0'); // mm - } - - // Clear the canvas element - $(`#${divIdName}`).empty(); - // Get the element for placing the graphical elements - var divEC = document.getElementById(divIdName); - var previewEC = new Two({fitted: true}).appendTo(divEC); - // Calculate the center of the canvas element - var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); - - var sangrado = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoSangrado, - altoSangrado - ); - sangrado.stroke = 'black'; - sangrado.dashes = [5, 5]; - sangrado.fill = '#FCEAF1'; - sangrado.linewidth = 1; - - if (pvObj.anchoSolapa != 0) { - var solapas = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoCubierta, - altoLibro); - solapas.stroke = 'black'; - solapas.linewidth = 1; - - // Cotas Solapas - if (!isThumbnail) { - var cotaSolapa2 = previewEC.makeDobleArrow( - origenEC.x - anchoCubierta / 2, - origenEC.y - (altoLibro / 3), - origenEC.x - anchoLibro - lomoLibro / 2, - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa2.linewidth = 2; - var cotaSolapa1 = previewEC.makeDobleArrow( - origenEC.x + anchoCubierta / 2, - origenEC.y - (altoLibro / 3), - origenEC.x + anchoLibro + lomoLibro / 2, - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa1.linewidth = 2; - - // Textos Solapas - let stylesSolapa = {size: 18, family: 'Public Sans'}; - previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); - previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); - // Textos Cotas Solapas - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - } - - } - - var libro = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - ((2 * anchoLibro) + lomoLibro), - altoLibro); - libro.stroke = 'black'; - libro.linewidth = 1; - - var lomo = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - lomoLibro, - altoLibro); - lomo.stroke = 'black'; - lomo.fill = '#F4F8F2'; - lomo.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas: - var cotaAnchoCubierta = previewEC.makeDobleArrow( - origenEC.x - (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - origenEC.x + (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - 10); - cotaAnchoCubierta.linewidth = 2; - var cotaAltoCubierta = previewEC.makeDobleArrow( - origenEC.x + (anchoCubierta / 2) + 35, - origenEC.y + (altoSangrado / 2), - origenEC.x + (anchoCubierta / 2) + 35, - origenEC.y - (altoSangrado / 2), - 10); - cotaAltoCubierta.linewidth = 2; - var cotaAltoLibro = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y + (altoLibro / 2), - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y - (altoLibro / 2), - 10); - cotaAltoLibro.linewidth = 2; - var cotaLomo = previewEC.makeDobleArrow( - origenEC.x - (lomoLibro / 2), - origenEC.y + (altoLibro / 3), - origenEC.x + (lomoLibro / 2), - origenEC.y + (altoLibro / 3), - 10); - cotaLomo.linewidth = 2; - var cotaContraportada = previewEC.makeDobleArrow( - origenEC.x - (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - origenEC.x - (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - 10); - cotaContraportada.linewidth = 2; - var cotaPortada = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - origenEC.x + (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - 10); - cotaPortada.linewidth = 2; - - - // Textos: - // Titulos generales - let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'}; - previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - let a = previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2; - // Sangrados - let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - // Cotas - previewEC.makeText(pvObj.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", - origenEC.x, - origenEC.y + (altoLibro / 2) + 50, - styleCotas); - - } - - previewEC.update(); - -} - -function portadaEspiral(isThumbnail = false, isTapaDura = false) { - - // Variables locales - let altoLibro, anchoLibro, anchoCalle, anchoCubierta, altoSangrado, anchoSangrado, anchoSolapa, offsetCubierta; - let styleCotas = {size: 12, family: 'Public Sans'}; - let sangradoTexto = (isTapaDura) ? "Sangrado 20 mm" : "Sangrado 5 mm"; - let sangradoValor = (isTapaDura) ? parseFloat(20) : parseFloat(5); // mm - - let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape'; - - // Get the preview Object parameters - getObjetoToPreview(); - - // Definicion de los parametros del Esquema de Cubierta (EC) - if ((pvObj.anchoSolapa !== 0) && (!isTapaDura)) { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = altoSangrado * 0.95; - anchoLibro = anchoSangrado * 0.28; - anchoCalle = anchoSangrado * 0.02; - anchoSolapa = anchoSangrado * 0.163; - sangrado = anchoSangrado * 0.03; - anchoCubierta = 2 * (anchoLibro + anchoSolapa + sangrado) + anchoCalle; - offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa / 2 + sangrado; - } else { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = (isTapaDura) ? altoSangrado * 0.88 : altoSangrado * 0.97; - anchoLibro = (isTapaDura) ? anchoSangrado * 0.39 : anchoSangrado * 0.419; - anchoCalle = anchoSangrado * 0.02; - anchoSolapa = 0; - anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + anchoCalle; - offsetCubierta = anchoLibro / 2 + anchoCalle / 2 + anchoSolapa + sangradoValor; - } - - // Clear the canvas element - $(`#${divIdName}`).empty(); - // Get the element for placing the graphical elements - var divEC = document.getElementById(divIdName); - var previewEC = new Two({fitted: true}).appendTo(divEC); - // Calculate the center of the canvas element - var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); - - var sangrado = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoSangrado, - altoSangrado - ); - sangrado.stroke = 'black'; - sangrado.dashes = [5, 5]; - sangrado.fill = '#FCEAF1'; - sangrado.linewidth = 1; - - if ((pvObj.anchoSolapa != 0) && (!isTapaDura)) { - var solapa1 = previewEC.makeRectangle( - origenEC.x + (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor), - origenEC.y, - anchoSolapa, - altoLibro); - solapa1.stroke = 'black'; - solapa1.linewidth = 1; - - var solapa2 = previewEC.makeRectangle( - origenEC.x - (anchoLibro + anchoCalle / 2 + anchoSolapa / 2 + sangradoValor), - origenEC.y, - anchoSolapa, - altoLibro); - solapa2.stroke = 'black'; - solapa2.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas - var cotaSolapa2 = previewEC.makeDobleArrow( - origenEC.x - (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa), - origenEC.y - (altoLibro / 3), - origenEC.x - (anchoLibro + sangradoValor + anchoCalle / 2), - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa2.linewidth = 2; - var cotaSolapa1 = previewEC.makeDobleArrow( - origenEC.x + (anchoCalle / 2 + sangradoValor + anchoLibro + anchoSolapa), - origenEC.y - (altoLibro / 3), - origenEC.x + (anchoLibro + sangradoValor + anchoCalle / 2), - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa1.linewidth = 2; - - // Textos Solapas - let stylesSolapa = {size: 18, family: 'Public Sans'}; - previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); - previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); - // Textos Cotas Solapas - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - } - - } - - var portada = previewEC.makeRectangle( - origenEC.x + (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), - origenEC.y, - anchoLibro, - altoLibro); - portada.stroke = 'black'; - portada.linewidth = 1; - - var contraportada = previewEC.makeRectangle( - origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), - origenEC.y, - anchoLibro, - altoLibro); - contraportada.stroke = 'black'; - contraportada.linewidth = 1; - - var calle = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoCalle, - altoSangrado); - calle.stroke = 'black'; - calle.dashes = [2, 5]; - calle.fill = '#F4F8F2'; - calle.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas: - var cotaAnchoCubierta = previewEC.makeDobleArrow( - origenEC.x - (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - origenEC.x + (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - 10); - cotaAnchoCubierta.linewidth = 2; - var cotaAltoCubierta = previewEC.makeDobleArrow( - origenEC.x + (anchoSangrado / 2) + 15, - origenEC.y + (altoSangrado / 2), - origenEC.x + (anchoSangrado / 2) + 15, - origenEC.y - (altoSangrado / 2), - 10); - cotaAltoCubierta.linewidth = 2; - var cotaAltoLibro = previewEC.makeDobleArrow( - origenEC.x + (anchoCalle / 2) + 35, - origenEC.y + (altoLibro / 2), - origenEC.x + (anchoCalle / 2) + 35, - origenEC.y - (altoLibro / 2), - 10); - cotaAltoLibro.linewidth = 2; - var cotaContraportada = previewEC.makeDobleArrow( - origenEC.x - (anchoCalle / 2 + anchoLibro + sangradoValor), - origenEC.y - (altoLibro / 3), - origenEC.x - ((anchoCalle / 2) + sangradoValor), - origenEC.y - (altoLibro / 3), - 10); - cotaContraportada.linewidth = 2; - var cotaPortada = previewEC.makeDobleArrow( - origenEC.x + ((anchoCalle / 2) + sangradoValor), - origenEC.y - (altoLibro / 3), - origenEC.x + (anchoCalle / 2 + anchoLibro + sangradoValor), - origenEC.y - (altoLibro / 3), - 10); - cotaPortada.linewidth = 2; - - - // Textos: - // Titulos generales - let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'}; - previewEC.makeText("Portada", - origenEC.x + anchoLibro / 2 + anchoCalle / 2 + sangradoValor + 15, - origenEC.y, - stylesEC - ); - previewEC.makeText("Contraportada", - origenEC.x - (anchoLibro / 2 + anchoCalle / 2 + sangradoValor), - origenEC.y, - stylesEC - ); - // Sangrados - let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; - previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x + (anchoSangrado / 2) - 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; - previewEC.makeText(sangradoTexto, origenEC.x - (anchoSangrado / 2) + 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; - // Cotas - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (offsetCubierta - anchoSolapa / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (anchoCalle / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", - origenEC.x + (anchoSangrado / 2) + 30, - origenEC.y, - styleCotas - ).rotation = -Math.PI / 2; - previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", - origenEC.x, - origenEC.y + (altoLibro / 2) + 50, - styleCotas); - } - - previewEC.update(); - -} - -function portadaGrapado(isThumbnail = false) { - - // Variables locales - let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado; - let styleCotas = {size: 12, family: 'Public Sans'}; - let sangradoTexto = "Sangrado 5 mm"; - let sangradoValor = parseFloat('5.0'); // mm - let offsetSolapaValor = parseFloat('0.0'); // mm - - let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape'; - - // Get the preview Object parameters - getObjetoToPreview(); - - // Definicion de los parametros del Esquema de Cubierta (EC) - if (pvObj.anchoSolapa == 0) { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = altoSangrado * 0.97; - anchoLibro = anchoSangrado * 0.48; - anchoSolapa = 0; - lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO - anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; - - } else { - if (isThumbnail) { - anchoSangrado = 350; // px - altoSangrado = (anchoSangrado * 0.647 > 300) ? 300 : anchoSangrado * 0.647; // px - } else { - anchoSangrado = 750; // px - altoSangrado = (anchoSangrado * 0.647 > 650) ? 650 : anchoSangrado * 0.647; // px - } - altoLibro = altoSangrado * 0.95; - anchoLibro = anchoSangrado * 0.3; - anchoSolapa = anchoSangrado * 0.18; - lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO - anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; - offsetSolapaValor = parseFloat('3.0'); // mm - } - - // Clear the canvas element - $(`#${divIdName}`).empty(); - // Get the element for placing the graphical elements - var divEC = document.getElementById(divIdName); - var previewEC = new Two({fitted: true}).appendTo(divEC); - // Calculate the center of the canvas element - var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2); - - var sangrado = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoSangrado, - altoSangrado - ); - sangrado.stroke = 'black'; - sangrado.dashes = [5, 5]; - sangrado.fill = '#FCEAF1'; - sangrado.linewidth = 1; - - if (pvObj.anchoSolapa != 0) { - var solapas = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - anchoCubierta, - altoLibro); - solapas.stroke = 'black'; - solapas.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas - var cotaSolapa2 = previewEC.makeDobleArrow( - origenEC.x - anchoCubierta / 2, - origenEC.y - (altoLibro / 3), - origenEC.x - anchoLibro - lomoLibro / 2, - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa2.linewidth = 2; - var cotaSolapa1 = previewEC.makeDobleArrow( - origenEC.x + anchoCubierta / 2, - origenEC.y - (altoLibro / 3), - origenEC.x + anchoLibro + lomoLibro / 2, - origenEC.y - (altoLibro / 3), - 10); - cotaSolapa1.linewidth = 2; - - // Textos Solapas - let stylesSolapa = {size: 18, family: 'Public Sans'}; - previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); - previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa); - // Textos Cotas Solapas - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); - } - - } - - var libro = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - ((2 * anchoLibro) + lomoLibro), - altoLibro); - libro.stroke = 'black'; - libro.linewidth = 1; - - var lomo = previewEC.makeRectangle( - origenEC.x, - origenEC.y, - lomoLibro, - altoLibro); - lomo.stroke = 'black'; - lomo.fill = '#F4F8F2'; - lomo.linewidth = 1; - - // Cotas y textos - if (!isThumbnail) { - // Cotas: - var cotaAnchoCubierta = previewEC.makeDobleArrow( - origenEC.x - (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - origenEC.x + (anchoSangrado / 2), - origenEC.y + (altoLibro / 2) + 35, - 10); - cotaAnchoCubierta.linewidth = 2; - var cotaAltoCubierta = previewEC.makeDobleArrow( - origenEC.x + (anchoCubierta / 2) + 35, - origenEC.y + (altoSangrado / 2), - origenEC.x + (anchoCubierta / 2) + 35, - origenEC.y - (altoSangrado / 2), - 10); - cotaAltoCubierta.linewidth = 2; - var cotaAltoLibro = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y + (altoLibro / 2), - origenEC.x + (lomoLibro / 2) + 35, - origenEC.y - (altoLibro / 2), - 10); - cotaAltoLibro.linewidth = 2; - var cotaContraportada = previewEC.makeDobleArrow( - origenEC.x - (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - origenEC.x - (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - 10); - cotaContraportada.linewidth = 2; - var cotaPortada = previewEC.makeDobleArrow( - origenEC.x + (lomoLibro / 2), - origenEC.y - (altoLibro / 3), - origenEC.x + (lomoLibro / 2 + anchoLibro), - origenEC.y - (altoLibro / 3), - 10); - cotaPortada.linewidth = 2; - - // Textos: - // Titulos generales - let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'}; - previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC); - // Sangrados - let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado); - previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2; - // Cotas - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); - previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; - previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", - origenEC.x, - origenEC.y + (altoLibro / 2) + 50, - styleCotas); - } - - previewEC.update(); - -} - - -function getObjetoToPreview() { - - if($('#cosidoDiv').length){ - pvObj = { - lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat(parseFloat($('#lomo_cubierta').val()).toFixed(2)), - anchoSolapa: $('#solapasCubierta').is(':checked') ? parseFloat($('#anchoSolapasCubierta').val()) : parseFloat('0.0'), - altoLibro: getDimensionLibro().alto, - anchoLibro: getDimensionLibro().ancho, - offsetSolapa: $('#solapasCubierta').is(':checked') ? parseFloat('3.0') : parseFloat('0.0') - }; - } else { - let tamanio = $('#resumenTamanio').text().split(' ')[1].split('x'); - let solapas = parseInt($('#resumenSolapasCubierta').length ? $('#resumenSolapasCubierta').text().split(' ')[1].replace("mm", '') : 0); - pvObj = { - lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat(parseFloat($('#lomo_cubierta').val()).toFixed(2)), - anchoSolapa: solapas, - altoLibro: parseInt(tamanio[1]), - anchoLibro: parseInt(tamanio[0]), - offsetSolapa: (solapas != 0) ? parseFloat('3.0') : parseFloat('0.0') - }; - } - //console.log($('#lomo_cubierta').val()); -} diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/resumen.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/resumen.js deleted file mode 100644 index 956eb8fa..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/resumen.js +++ /dev/null @@ -1,311 +0,0 @@ -function generarResumen(){ - $('#tipoLibro').text($('#tituloDisenioLibro').text() + ' tapa ' + (($('#tapaBlandaInnerDiv').hasClass('checked'))?'blanda':'dura')); - $('#resumenTamanio').text('Dimensiones: ' + getDimensionLibro().ancho + 'x' + getDimensionLibro().alto + 'mm'); - $('#resumenPaginas').text('Páginas: '+ $('#paginas').val() + ' páginas'); - - 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()); - } - } - $('#resumenTirada').text('Tirada: '+ tirada + ' unidades'); - - $('#resumenPrototipo').text('Prototipo: ' + (($('#prototipo').is(':checked'))?'Sí':'No')); - $('#resumenFerro').text('Ferro: ' + (($('#ferro').is(':checked'))?'Sí':'No')); - - $('#tipoImpresion').text('Impresión: ' + - ($('#colorNegroDiv').hasClass('checked')?'Negro estándar': - $('#colorNegroHqDiv').hasClass('checked')?'Negro premium': - $('#colorColorDiv').hasClass('checked')?'Color estándar':'Color premium')); - - if($('#colorNegroDiv').hasClass('checked') || $('#colorNegroHqDiv').hasClass('checked')){ - $('#pResumenPaginasColor').hide(); - } - else{ - $('#pResumenPaginasColor').show(); - $('#resumenPaginasColor').text($('#paginasColor').val()); - } - $('#resumenPapelInterior').text($('#papelInterior option:selected').text().trim() + ' ' + - $('#gramajeInterior option:selected').text() + 'gr/m²'); - - let papelCubierta = $('#papelCubierta option:selected').text().trim() + ' ' + - $('#gramajeCubierta option:selected').text(); - papelCubierta += 'gr/m²'; - $('#resumenPapelCubierta').text(papelCubierta); - $('#resumenCarasCubierta').text('Impresión: ' + $('#carasCubierta option:selected').text()) - $('#resumenAcabadoCubierta').text('Acabado: ' + $('#acabadosCubierta option:selected').text()) - if ($('#solapasCubierta').is(':checked')) { - $('#resumenSolapasCubierta').text('Solapas: ' + $('#anchoSolapasCubierta').val()) - } - else{ - $('#resumenSolapasCubierta').text('Solapas: No') - } - - if ($('#enableSobrecubierta').is(':checked')) { - $(".resumen-sobrecubierta").show(); - $('#resumenPapelCubierta').text($('#papelSobrecubierta option:selected').text().trim() + ' ' + - $('#gramajeSobrecubierta option:selected').text() + 'gr/m²'); - $('#resumenAcabadoSobrecubierta').text('Acabado: ' + $('#acabadosSobrecubierta option:selected').text()) - $('#resumenSolapasSobrecubierta').text('Solapas: ' + $('#anchoSolapasSobrecubierta').val()) - - } - else{ - $(".resumen-sobrecubierta").hide(); - } - - if ($('#divGuardas').css('display') != 'none') { - - $(".resumen-guardas").show(); - $('#resumenGuardasPapel').text($('#papelGuardas option:selected').text().trim() + ' ' + '170gr/m²'); - $('#resumenGuardasCaras').text('Impresión: ' + $('#impresionGuardas option:selected').text()) - } - else{ - $(".resumen-guardas").hide(); - } - - - if($('#retractilado').is(':checked') || $('#retractilado5').is(':checked') || $('#fajaColor').is(':checked')){ - - $('.resumen-extras').show(); - $('#retractilado').is(':checked')?$('#resumenRetractilado1').show():$('#resumenRetractilado1').hide(); - $('#retractilado5').is(':checked')?$('#resumenRetractilado5').show():$('#resumenRetractilado5').hide(); - $('#fajaColor').is(':checked')?$('#resumenFajaColor').show():$('#resumenFajaColor').hide(); - } - else{ - $('.resumen-extras').hide(); - } - - for (i = 1; i <= 4; i++) { - let id = "tiradaPrecio" + i; - if ($('#' + id).length > 0) { - - const envio = getTotalEnvio(); - - let tirada_id = "ud_tiradaPrecio" + i; - if(parseInt($('#' + tirada_id).text().replace(' ud.', '')) != tirada){ - continue; - } - - let total_id = "tot_tiradaPrecio" + i; - - let total = parseFloat($('#' + total_id).text().replace('€', '').replace('Total: ', '')) + envio; - let total_iva = 0.0; - if($('#ivaReducido').val() == '1'){ - total_iva = total * 1.04; - } - else{ - total_iva = total * 1.21; - } - const precio_u = total_iva/tirada; - $('#resumenTotalIVA').text('Total (I.V.A. ' + (($('#ivaReducido').val() == '1')?'4':'21') + '%): ' + total_iva.toFixed(2) + '€'); - $('#resumenPrecioU').text(precio_u.toFixed(4) + '€/ud'); - } - } - - -} - -function getTotalEnvio(){ - const elements = $('#divDirecciones').find('.row.mb-3'); - let total = 0.0; - - if(elements.length > 0) { - for (let index=0; index path !== ""); - let id=0; - if(paths.length > 0 && paths[paths.length - 2] == 'edit'){ - id=paths[paths.length - 1]; - } - datos = { - id: id, - } - datos = Object.assign(datos, window.token_ajax) - - $('#loader').show(); - - $.ajax({ - url: window.routes_resumen.duplicarPresupuesto, - type: 'POST', - data: datos, - success: function(response) { - - if(Object.keys(response).length > 0) { - if(response.success){ - $('#loader').hide(); - window.location.href = document.location.origin + '/presupuestos/presupuestocliente/edit/' + response.id; - } - } - $('#loader').hide(); - - }, - error: function() { - $('#loader').hide(); - }, - }); -}); - - -$('#btnBack').on('click', function() { - window.location.href = document.location.origin + '/presupuestocliente/list'; -}); - -function finalizarPresupuesto(confirmar){ - - let isColor = false; - if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked')) - isColor = true; - let isHq = false; - if($('#colorNegroDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked')) - isHq = true; - - const paths = window.location.pathname.split("/").filter(path => path !== ""); - let id=0; - if(paths.length > 0 && paths[paths.length - 2] == 'edit'){ - id=paths[paths.length - 1]; - } - - 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: isColor, - isHq: isHq, - 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 es cosido, se añade el número de páginas del cuadernillo - if ($('#cosidoDiv').hasClass('checked')) { - datos_libro.paginasCuadernillo = $('#paginasCuadernillo').val(); - } - - // Si hay solapas de cubierta - if ($('#solapasCubierta').is(':checked')) { - datos_libro.solapasCubierta = $('#anchoSolapasCubierta').val() - } - - // Si hay sobrecubierta - if ($('#enableSobrecubierta').is(':checked')) { - 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_libro.sobrecubierta.solapas = $('#anchoSolapasSobrecubierta').val() - } - } - - if ($('#divGuardas').css('display') != 'none') { - 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; - let peso_libro = 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()); - peso_libro = ($(seleccion[0])).find('label input').attr('peso'); - } - } - - - let direcciones = getDireccionesEnvio(); - datos = { - id: id, - datos_libro : datos_libro, - datos_cabecera: datos_cabecera, - direcciones: direcciones, - tirada: tirada, - peso: peso_libro, - iva_reducido: $('#ivaReducido').val()==1?1:0, - confirmar: confirmar?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(Object.keys(response).length > 0) { - if(response.status > 0){ - if(confirmar || window.location.href.includes("add")) - window.location.href = response.url + '/' + response.status; - } - - } - $('#loader').hide(); - - }, - error: function() { - $('#loader').hide(); - }, - }); -} \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/tipoLibroItems.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/tipoLibroItems.js deleted file mode 100644 index 11ee90da..00000000 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/tipoLibroItems.js +++ /dev/null @@ -1,58 +0,0 @@ -// Init custom option check -function initTipoLibroCheck() -{ - const _this = this - - const custopOptionList = [].slice.call(document.querySelectorAll('.custom-option-tipo .form-check-input')) - custopOptionList.map(function (customOptionEL) { - // Update custom options check on page load - _this.updateTipoLibroCheck(customOptionEL) - - // Update custom options check on click - customOptionEL.addEventListener('click', e => { - _this.updateTipoLibroCheck(customOptionEL) - }) - }) -} - -function updateTipoLibroCheck(el) -{ - if (el.checked) { - // If custom option element is radio, remove checked from the siblings (closest `.row`) - if (el.type === 'radio') { - const customRadioOptionList = [].slice.call(el.closest('.tipo_libro').querySelectorAll('.custom-option-tipo')) - customRadioOptionList.map(function (customRadioOptionEL) { - customRadioOptionEL.closest('.custom-option-tipo').classList.remove('checked') - }) - } - el.closest('.custom-option-tipo').classList.add('checked') - if(el.closest('.custom-option-tipo').id == 'grapadoDiv') { - $('#tapaDuraDiv').hide(); - $('#tapaBlanda').prop('checked', true); - } - else { - $('#tapaDuraDiv').show(); - } - if(el.closest('.custom-option-tipo').id == 'cosidoDiv') { - $('#div_pagCuadernillo').show(); - } - else { - $('#div_pagCuadernillo').hide(); - } - } else { - el.closest('.custom-option-tipo').classList.remove('checked') - } -} - -initTipoLibroCheck(); - - -function getUpdatePapelInterior() { - var impresionInterior = $('input[name="impresionInterior"]:checked').val(); - if(impresionInterior == 'color') { - $('#colorInteriorDiv').show(); - } - else { - $('#colorInteriorDiv').hide(); - } -} diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php index 8342e8a8..43aa68b5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -19,238 +19,35 @@
- estado_id == 1) : ?> - -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
- - - -
- -
+
+
+
+
+
-
-
+
+ - -
+ +
-
- - - -
- - -
-
-
- - -
-
- - - -
- - -
-
-
- - -
-
- - - -
- - -
-
-
- - -
-
- - - -
-
-
- estado_id == 1) : ?> - - -
-
- estado_id == 1) : ?> - - - - - - - id), - lang("Basic.global.Print"), - [ - "class" => "btn btn-dark float-start me-sm-3 ml-2", - "target" => "_blank" - ] - ); - } - ?> -
-
-
- -
- - - -
-
-
-
-
- - - -
-
- estado_id == 1) : ?> - - -
-
- estado_id == 1) : ?> - - - - - - - id), - lang("Basic.global.Print"), - [ - "class" => "btn btn-dark float-start me-sm-3 ml-2", - "target" => "_blank" - ] - ); - ?> -
-
- +
+
-
+ +
- - +
$presupuestoEntity->id]) ?> @@ -262,55 +59,13 @@ - - section("additionalInlineJs") ?> - - window.datosPresupuesto = ; - window.token_ajax= {: v}; - - estado_id == 1) : ?> - $('#clienteId').select2({ - allowClear: false, - ajax: { - url: '', - type: 'post', - dataType: 'json', - - data: function(params) { - return { - id: 'id', - text: 'nombre', - searchTerm: params.term, - : v - }; - }, - delay: 60, - processResults: function(response) { - yeniden(response.); - return { - results: response.menu - }; - }, - cache: true - } - }); - - initDisenioLibro(); - - - - - - - endSection() ?> - - section('css') ?> + endSection() ?> @@ -320,23 +75,12 @@ - - - - - - - - estado_id == 1) : ?> - - - - - - + + + endSection() ?> \ No newline at end of file