Merge branch 'feat/add-chat-presupuesto-cliente' into 'main'

Feat/add chat presupuesto cliente

See merge request jjimenez/safekat!352
This commit is contained in:
Alvaro
2024-10-23 05:17:38 +00:00
147 changed files with 9810 additions and 5667 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
ci4/.env
.vscode/
xdebug.log
xdebug.log
xdebug.*

View File

@ -1,92 +0,0 @@
# safekat
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://git.imnavajas.es/jjimenez/safekat.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://git.imnavajas.es/jjimenez/safekat/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

View File

@ -1,133 +0,0 @@
Quitar Oauth
---------------------------------------------
Quitar packete con composer que se usa en la Oauth
composer remove hybridauth/hybridauth
Tablas en la BBDD.
wg_user_oauth
wg_settings_oauth
Se hace migración (hay que añadir el controlador Migrate a whiteListController)
Modelos
UserOauthModel.php
SettingsOauthModel.php
Controllers
Oauth.php
Realizar busqueda de UserOauthModel que está en varios Controllers
Buscar la variable que crea en cada controlador y ver para que la usa
Igual que la acción anterior pero con SettingsOauthModel
Está en el controlador Settings.php. Buscar la variable que crea y borrarla
Eliminar Views\themes\backend\focus2\form\settings\oauth.php
En Views\themes\backend\focus2\main\menu.
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
En Views\themes\frontend\tivo\main\menu.php
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
En en controlador Settings.php
Quitar las funciones oauth() y oauth_store()
En los idiomas quitar la key dashboard_chart_auth
En la vista quitar la carta de Solcial autenthification
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<h4 class="card-title"><?=lang("App.dashboard_chart_auth")?></h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12" id="ct-icon-chart"></div>
</div>
<div class="row">
<div class="col-lg-12"><div class="ct-pie-chart"></div></div>
</div>
</div>
</div>
</div>
Quitar los SMS
--------------------------------------------
Quitar packete con composer que se usa en la Oauth
twilio/sdk
Dentro de Controllers\Integration.php
Eliminar sendSMS (public y private)
Se hace migración de la BBDD
Del controlador Cron.php se elimina
la accion // Cron Notification SMS
la función test()
Del controlador Ajax.php
linea 368, quitar is_send_sms de la lista
linea 399, eliminar "is_send_sms"=>$record['is_send_sms'],
Del controlador Login.php eliminar
//Notification SMS User Welcome
//SMS Account Confirmation
Dentro de //Notification New Register, las dos líneas is_send_sms y send_sms_notification
linea 455 if($settings['send_sms_register']??false){ quitar if completo
Del controlador Notification.php
linea 117 , 148, 150
Del controlador Settings.php
linea 106, 109
De los idiomas, quitar los registros
settings_field_send_sms_register
notification_field_send_sms
Del modelo NotificationModel.php
Quitar los fields is_send_sms y send_sms_notification
Del modelo SettingsModel.php
Quitar los fields send_sms_register y send_sms_welcome
sms_gateway, sms_account_id, ,sms_auth_token, sms_info_add, sms_confirmation
De la vista Views\themes\backend\focus2\form\notification\form quitar
<div class="col-md-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.notification_field_send_sms")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_notification" name="send_sms_notification" class="custom-control-input" <?= $obj['send_sms_notification']??false ? 'checked' : ''?>>
<label for="send_sms_notification" class="custom-control-label"><?=lang("App.notification_field_send_label")?></label>
</div>
</div>
</div>
De la vista Views\themes\backend\focus2\form\notification\index.php quitar de la linea 129 { data: 'is_send_sms' },
De la vista Views\themes\backend\focus2\form\settings\index.php quitar los siguientes bloques
<div class="col-lg-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.settings_field_send_welcome_message_sms")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_welcome" name="send_sms_welcome" class="custom-control-input" <?= $obj['send_sms_welcome']??false ? 'checked' : ''?>>
<label for="send_sms_welcome" class="custom-control-label"><?=lang("App.global_activate")?></label>
</div>
</div>
</div>
y
<div class="col-lg-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.settings_field_send_sms_register")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_register" name="send_sms_register" class="custom-control-input" <?= $obj['send_sms_register']??false ? 'checked' : ''?>>
<label for="send_sms_register" class="custom-control-label"><?=lang("App.global_activate")?></label>
</div>
</div>
</div>
En el controlador Ajax.php quitar if($records[$key]['sms_confirmed'] == 1)
En el controlador Login.php quitar
bloque // Check sms confirmed
if($confirmation['type'] == 'sms')
En el controlador Settings.php quitar
linea 104
case 'sms;
En el controlador User.php quitar linea 217 y 236
Del modelo UserModel.php quitar el campo sms_confirmed
En los idiomas buscar la key sms
En la vista Views\themes\backend\focus2\form\notification\index.php quitar linea 49
En la vista Views\themes\backend\focus2\form\settings\index.php quitar
linea 37
bloque en linea 298
linea 355
bloque en linea 679
linea 1033
En la vista Views\themes\backend\focus2\form\settings\template.php
bloque linea 87 hasta 131
En la vista Views\themes\backend\focus2\form\user\form.php
bloque linea 104 hasta 113
linea 210
Renombrar tablas a auth_ en lugar de wg_
-------------------------------------------------
La tabla wg_migrations hay que modificarla a mano.
En .env quitar el prefijo: database.default.DBPrefix =
En todos los modelos añadir auth_ al principio del nombre de la tabla

View File

@ -1,6 +1,7 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
@ -8,6 +9,7 @@ use CodeIgniter\Router\RouteCollection;
//service('auth')->routes($routes, ['except' => ['login', 'register']]);
service('auth')->routes($routes);
//WEB ROUTER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('/', 'Home::index', ['as' => 'home']);
@ -50,7 +52,6 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
});
});
});
/* Rutas para configuraciones */
@ -64,7 +65,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
});
/* Series Factura */
@ -85,14 +85,20 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
});
$routes->group("variables",["namespace" => 'App\Controllers\Configuracion'],function($routes){
$routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
});
$routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
$routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
$routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
});
});
@ -370,8 +376,8 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'clienteDelete']);
$routes->post('datatable', 'Cliente::datatable', ['as' => 'clienteDT']);
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
});
});
@ -407,6 +413,10 @@ $routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], f
$routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
$routes->get('', 'Clientedirecciones::index', ['as' => 'clientedireccionesIndex']);
$routes->get('get/(:num)', 'Clientedirecciones::get/$1', ['as' => 'get']);
$routes->get('getDireccionPresupuesto/(:num)', 'Clientedirecciones::getDireccionPresupuesto/$1', ['as' => 'getDireccionPresupuesto']);
$routes->post('add', 'Clientedirecciones::add', ['as' => 'newClientedirecciones']);
$routes->get('getSelect2', 'Clientedirecciones::getSelect2', ['as' => 'listaClientedirecciones']);
});
@ -562,7 +572,7 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->post('datatable', 'Presupuestocliente::datatable', ['as' => 'datatableOfPresupuestos']);
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
@ -571,10 +581,11 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
$routes->post('guardarPresupuesto', 'Presupuestocliente::guardarPresupuesto', ['as' => 'guardarPresupuesto']);
$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']);
});
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
@ -589,7 +600,6 @@ $routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Pre
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
});
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
@ -615,13 +625,13 @@ $routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presup
$routes->group('presupuestotiradasalternativas', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'Presupuestotiradasalternativas::datatable', ['as' => 'dataTableOfPresupuestoTiradasAlternativas']);
$routes->post('datatable_2', 'Presupuestotiradasalternativas::datatable_2', ['as' => 'getTiradaData']);
});
});
$routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ($routes) {
$routes->get('list', 'Pedido::todos', ['as' => 'listaPresupuestos']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->post('datatable', 'Pedido::datatable', ['as' => 'dataTableOfPedidos']);
$routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']);
$routes->post('add', 'Pedido::add', ['as' => 'crearPedido']);
@ -629,9 +639,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1',['as' => 'getXMLPedido']);
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
});
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
@ -728,6 +736,19 @@ $routes->group(
);
$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->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
}
);
$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) {
@ -740,9 +761,7 @@ $routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], functi
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
});
});
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
@ -766,14 +785,9 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
$routes->post('hebra/pedido', 'ChatController::store_hebra_pedido', ['as' => 'storeHebraPedido']);
$routes->post('hebra/factura', 'ChatController::store_hebra_factura', ['as' => 'storeHebraFactura']);
$routes->post('hebra/(:num)', 'ChatController::update_hebra/$1', ['as' => 'updateHebra']);
$routes->get('hebra/presupuesto/(:num)',"ChatController::get_hebra_presupuesto/$1",["as" => "getHebraPresupuesto"]);
$routes->get('hebra/pedido/(:num)',"ChatController::get_hebra_pedido/$1",["as" => "getHebraPedido"]);
$routes->get('hebra/factura/(:num)',"ChatController::get_hebra_factura/$1",["as" => "getHebraFactura"]);
$routes->get('hebra/presupuesto/(:num)', "ChatController::get_hebra_presupuesto/$1", ["as" => "getHebraPresupuesto"]);
$routes->get('hebra/pedido/(:num)', "ChatController::get_hebra_pedido/$1", ["as" => "getHebraPedido"]);
$routes->get('hebra/factura/(:num)', "ChatController::get_hebra_factura/$1", ["as" => "getHebraFactura"]);
});
@ -789,6 +803,15 @@ $routes->group('api', ['filter' => 'jwt'], static function ($routes) {
// ...
});
/*
* --------------------------------------------------------------------
* Translation
* --------------------------------------------------------------------
*/
$routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) {
$routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']);
});
$routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']);
/*
@ -806,4 +829,4 @@ $routes->group('api', ['filter' => 'jwt'], static function ($routes) {
*/
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
}

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Clientes;
<?php
namespace App\Controllers\Clientes;
@ -152,7 +154,7 @@ class Cliente extends \App\Controllers\BaseResourceController
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
@ -310,10 +312,9 @@ class Cliente extends \App\Controllers\BaseResourceController
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
$onlyActiveOnes = false;
try{
try {
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
}
catch(Exception $e){
} catch (Exception $e) {
$menu = [];
}
@ -330,6 +331,28 @@ class Cliente extends \App\Controllers\BaseResourceController
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$query = $this->model->builder()->select(
[
"id",
"nombre as name"
]
)->where("deleted_at", null);
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("clientes.nombre", $this->request->getGet("q"))
->groupEnd();
}
return $this->response->setJSON($query->get()->getResultObject());
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getPaisListItems($selId = null)
{
$paisModel = model('App\Models\Configuracion\PaisModel');
@ -423,24 +446,23 @@ class Cliente extends \App\Controllers\BaseResourceController
}
protected function getPrecioTemplate($cliente_id){
protected function getPrecioTemplate($cliente_id)
{
$modelPreciosCliente = model('App\Models\Clientes\ClientePreciosModel');
$plantilla_id = $modelPreciosCliente->get_plantilla_precios($cliente_id);
if (is_null($plantilla_id)){
if (is_null($plantilla_id)) {
return null;
}
$modelPlantillaPreciosCliente = model('App\Models\Clientes\ClientePlantillaPreciosModel');
$plantilla = $modelPlantillaPreciosCliente->where("id", $plantilla_id)->where("is_deleted", 0)->first();
if ($plantilla == false){
if ($plantilla == false) {
return null;
}
else{
} else {
return (object)array(
"value" => $plantilla_id,
"label" => $plantilla->nombre
);
}
}
}

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Clientes;
<?php
namespace App\Controllers\Clientes;
use App\Models\Collection;
@ -38,7 +40,7 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
// Breadcrumbs (IMN)
$this->viewData['breadcrumb'] = [
['title' => lang("Clientes.direccionesEnvio"), 'route' => "javascript:void(0);", 'active' => false],
];
$this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null);
@ -71,21 +73,22 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
return view(static::$viewPath . 'viewClienteDireccionesList', $viewData);
}
public function add(){
public function add()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cliente_id = $reqData['cliente_id'] ?? -1;
$att = $reqData['att'] ?? "";
$email = $reqData['email'] ?? "";
$direccion = $reqData['direccion'] ?? "";
$pais_id = $reqData['paisId'] ?? -1;
$pais_id = $reqData['pais_id'] ?? -1;
$provincia = $reqData['provincia'] ?? "";
$municipio = $reqData['municipio'] ?? "";
$cp = $reqData['cp'] ?? "";
$telefono = $reqData['telefono'] ?? "";
$alias = $reqData['alias'] ?? "";
$data = [
"cliente_id" => $cliente_id,
"att" => $att,
@ -99,15 +102,11 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
"alias" => $alias,
];
$response = $this->model->insert($data);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data_ret = [
'data' => $response,
$csrfTokenName => $newTokenHash
];
return $this->respond($data_ret);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
@ -117,14 +116,14 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
public function menuItems()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cliente_id = $reqData['cliente_id'] ?? -1;
$clienteDireccionesModel = model('App\Models\Clientes\ClienteDireccionesModel');
$menu = $clienteDireccionesModel->getMenuDirecciones($cliente_id);
//$menu = $this->model->getMenuItems($cliente_id);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
@ -138,6 +137,34 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$cliente_id = $this->request->getGet('cliente_id');
$query = $this->model->builder()->select(
[
"id",
"alias as name"
]
)
->where("cliente_id", $cliente_id)
->orderBy("alias", "asc");
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("clientes.nombre", $this->request->getGet("q"))
->groupEnd();
}
return $this->response->setJSON($query->get()->getResultObject());
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable()
{
if ($this->request->isAJAX()) {
@ -145,7 +172,7 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$tipo = $reqData['tipo'] ?? null;
if(is_null($tipo)){
if (is_null($tipo)) {
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
@ -160,22 +187,21 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$id_C = $reqData['cliente_id'] ?? -1;
$resourceData = $this->model->getResource($search, $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource("", $id_C)->countAllResults()
));
}
else{
} else {
$id = $reqData['id'] ?? -1;
$resourceData = $this->model->getDireccion($id);
return $this->respond($resourceData);
}
@ -184,6 +210,44 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
}
}
public function get($id)
{
try {
$resourceData = $this->model->getDireccion($id);
$response = (object)[
'error' => false,
'data' => $resourceData
];
return $this->respond($response);
} catch (\Exception $e) {
$response = (object)[
'error' => true,
'message' => $e->getMessage()
];
return $this->fail($response);
}
}
public function getDireccionPresupuesto($id)
{
try {
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
$resourceData = $model->getDireccion($id);
$response = (object)[
'error' => false,
'data' => $resourceData
];
return $this->respond($response);
} catch (\Exception $e) {
$response = (object)[
'error' => true,
'message' => $e->getMessage()
];
return $this->fail($response);
}
}
public function datatable_editor()
{
if ($this->request->isAJAX()) {
@ -194,72 +258,116 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$response = Editor::inst($db, 'cliente_direcciones')
->fields(
Field::inst('att')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('alias')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('email')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('direccion')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 255 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(255),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('municipio')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('cp')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 20 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(20),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('telefono')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 40 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(40),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('provincia')
->validator( function ( $val, $data, $field, $host ) {
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
if (strlen( $val ) > 100)
return lang('ClienteDirecciones.validation.max_length');
else if (strlen( $val ) == 0)
lang('ClienteDirecciones.validation.required');
else
return true;
->validator(
function ($val, $data, $field, $host) {
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
if (strlen($val) > 100)
return lang('ClienteDirecciones.validation.max_length');
else if (strlen($val) == 0)
lang('ClienteDirecciones.validation.required');
else
return true;
}
return true;
}
return true;
}
),
),
Field::inst('pais_id')->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))),
'message' => lang('ClienteDirecciones.validation.required')
)),
Field::inst('cliente_id'),
)
->debug(true)
->process($_POST)
->data();
@ -270,7 +378,6 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseResourceController;
use App\Models\Collection;
use App\Models\Presupuestos\ErrorPresupuesto as ErrorPresupuestoModel;
use CodeIgniter\HTTP\Response;
use Hermawan\DataTables\DataTable;
class ConfigErrores extends BaseResourceController
{
protected ErrorPresupuestoModel $errorPresupuestoModel;
protected $format = 'json';
protected array $viewData = [];
protected static $viewPath = 'themes/vuexy/form/configuracion/error_presupuesto/';
protected static $controllerSlug = "errores-presupuesto";
protected $indexRoute = 'viewErrorPresupuestoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->errorPresupuestoModel = model(ErrorPresupuestoModel::class);
}
public function index()
{
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true]
];
return view(static::$viewPath . $this->indexRoute, $this->viewData);
}
public function viewForm(int $error_presupuesto_id)
{
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_error_presupuesto"), 'route' => site_url('configuracion/errores-presupuesto'), 'active' => true]
];
$this->viewData["error_presupuesto_id"] = $error_presupuesto_id;
$this->errorPresupuestoModel->update($error_presupuesto_id, [
"last_user_id" => auth()->user()->id,
"visto" => true,
]);
return view(static::$viewPath . 'viewErrorPresupuestoForm', $this->viewData);
}
public function store()
{
$data = [];
$variableCreated = $this->errorPresupuestoModel->store($data);
return $this->response->setJSON($variableCreated);
}
public function get_error_presupuesto(int $error_presupuesto_id)
{
$data = $this->errorPresupuestoModel->getErrorPresupuestoForm($error_presupuesto_id);
if(isset($data[0])){
return $this->response->setJSON(["data" => $data[0]]);
}else{
return $this->response->setJSON(["data" => []]);
}
}
public function update_error_presupuesto(int $error_presupuesto_id)
{
$bodyData = $this->request->getPost();
$this->errorPresupuestoModel->updateComment($error_presupuesto_id, $bodyData["comments"]);
return $this->response->setJSON(["message" => "Comentario actualizado", "status" => true]);
}
public function datatable()
{
$query = $this->errorPresupuestoModel->getQueryDatatable();
return DataTable::of($query)
->add("action", fn($q) => $q->id)
->toJson(true);
}
}

View File

@ -33,7 +33,6 @@ class ConfigVariables extends BaseResourceController
parent::initController($request, $response, $logger);
$this->configVariableModel = model(ConfigVariableModel::class);
}
@ -48,45 +47,46 @@ class ConfigVariables extends BaseResourceController
return view(static::$viewPath . $this->indexRoute, $viewData);
}
public function store(){
public function store()
{
$data = [];
$variableCreated = $this->configVariableModel->store($data);
return $this->response->setJSON($variableCreated);
}
public function get(int $config_variable_id){
public function get(int $config_variable_id)
{
$data = $this->configVariableModel->find($config_variable_id);
return $this->response->setJSON($data);
}
public function updateVariable(int $config_variable_id){
public function updateVariable(int $config_variable_id)
{
$reqData = [];
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$status = $this->configVariableModel->update($config_variable_id,$reqData);
$status = $this->configVariableModel->update($config_variable_id, $reqData);
return $this->response->setJSON([
"message" => "Variable actualizada correctamente",
"status" => $status
]);
}
else {
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function deleteVariable(int $config_variable_id): Response
{
return $this->response->setJSON([]);
}
public function datatable(){
public function datatable()
{
$query = $this->configVariableModel->builder()->select([
"id",
"name",
"value",
"description"])->orderBy("name","asc");
"description"
])->orderBy("name", "asc");
return DataTable::of($query)
->add("action",fn($q) => $q->id)
->toJson(true);
->add("action", fn($q) => $q->id)
->toJson(true);
}
}

View File

@ -244,23 +244,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
public function menuItems() {
if ($this->request->isAJAX()) {
$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();
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$searchStr = goSanitize($this->request->getPfgost('searchTerm'))[0];
$menu = $papelFormatoModel->getElementsForMenu2($searchStr);
if(empty(($searchStr)))
array_shift($menu);
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
@ -268,4 +260,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
}
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$data = $this->model->getElementsForMenu2($this->request->getGet("q"));
return $this->response->setJSON($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -15,4 +15,15 @@ class Language extends BaseController
$url = previous_url();
return redirect()->to($url);
}
// Function to get the translation of the language file from a AJAX request
public function getTranslation()
{
$translationFile = $this->request->getPost('translationFile');
$locale = $this->request->getPost('locale');
$path = "Language/{$locale}/$translationFile.php";
$lang = require APPPATH.$path;
return json_encode($lang);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,10 @@ class TarifaAcabados extends BaseResourceController
$this->viewData = ['usingServerSideDataTable' => true];
// Breadcrumbs
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_tarifas"), 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_tarifaacabado"), 'route' => site_url('tarifas/tarifaacabado'), 'active' => true]
['title' => lang("App.menu_tarifaacabado"), 'route' => site_url('tarifas/acabados'), 'active' => true]
];
parent::initController($request, $response, $logger);
@ -133,6 +133,8 @@ class TarifaAcabados extends BaseResourceController
endif; // ($requestMethod === 'post')
$this->viewData['proveedores'] = $this->getProveedores();
$this->viewData['tarifaacabadoEntity'] = isset($sanitizedData) ? new TarifaAcabadoEntity($sanitizedData) : new TarifaAcabadoEntity();
$this->viewData['formAction'] = route_to('tarifaAcabadoAdd');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaacabado.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');

View File

@ -64,7 +64,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"created_at" => null,
"updated_at" => null,
"comp_tipo_impresion" => null,
"comp_pos_paginas_color" => null,
"pos_paginas_color" => null,
"total_coste_papel" => null,
"total_margen_papel" => null,
"total_margenPercent_papel" => null,
@ -90,6 +90,11 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"acabado_cubierta_id" => null,
"acabado_sobrecubierta_id" => null,
"is_duplicado" => false,
'paginas_color_consecutivas' => null,
'papel_interior_diferente' => null,
'paginasCuadernillo' => null,
'lomo_redondo' => null,
'cabezada' => null,
];
protected $casts = [
"cliente_id" => "int",
@ -155,5 +160,9 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"acabado_cubierta_id" => "int",
"acabado_sobrecubierta_id" => "int",
"is_duplicado" => "boolean",
'paginas_color_consecutivas' => "boolean",
'papel_interior_diferente' => "boolean",
'paginasCuadernillo' => "int",
'lomo_redondo' => "boolean",
];
}

View File

@ -8,6 +8,8 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"comment" => null,
"precio_min" => 0,
"importe_fijo" => 0,
"mostrar_en_presupuesto" => 1,
@ -22,6 +24,8 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"precio_min" => "float",
"comment" => "string",
"code" => "string",
"importe_fijo" => "float",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

@ -9,6 +9,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"mostrar_en_presupuesto" => 1,
"tipo_encuadernacion" => 0,
"servicio_encuadernacion" => 0,
@ -22,6 +23,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"mostrar_en_presupuesto" => "int",
"code" => "string",
"tipo_encuadernacion" => "int",
"servicio_encuadernacion" => "int",
"por_horas" => "int",

View File

@ -9,6 +9,8 @@ class TarifaEnvioEntity extends \CodeIgniter\Entity\Entity
"id" => null,
"pais_id" => null,
"nombre" => null,
"code" => null,
"comment" => null,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
@ -17,6 +19,8 @@ class TarifaEnvioEntity extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"pais_id" => "?int",
"code" => "string",
"comment" => "string",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",

View File

@ -9,6 +9,8 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"comment" => null,
"precio_min" => 0,
"importe_fijo" => 0,
"mostrar_en_presupuesto" => 1,
@ -22,6 +24,8 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
protected $casts = [
"precio_min" => "float",
"importe_fijo" => "float",
"code" => "string",
"comment" => "string",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

@ -8,6 +8,8 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"comment" => null,
"precio" => null,
"margen" => 0,
"mostrar_en_presupuesto" => 1,
@ -20,6 +22,8 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
];
protected $casts = [
"precio" => "float",
"code" => "string",
"comment" => "string",
"margen" => "float",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",

View File

@ -8,6 +8,8 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"comment" => null,
"precio" => null,
"margen" => 0,
"mostrar_en_presupuesto" => 1,
@ -21,6 +23,8 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
protected $casts = [
"precio" => "float",
"margen" => "float",
"code" => "string",
"comment" => "string",
"mostrar_en_presupuesto" => "int",
"user_created_id" => "int",
"user_update_id" => "int",

View File

@ -31,12 +31,12 @@ return [
'presupuestoEstadoAceptado' => 'Acepted',
'incidencia' => 'Incident',
'reimpresion' => 'Reprint',
'reimpresion' => 'Free of charge',
'autor' => 'Author',
'coleccion' => 'Collection',
'numeroEdicion' => 'Edition number',
'isbn' => 'ISBN',
'referenciaCliente' => 'Customer reference',
'formatoLibro' => "Book format",
'papelFormatoId' => "Size",
'papelFormatoPersonalizado' => 'Custom size',
'papelFormatoAncho' => 'Width',

View File

@ -10,6 +10,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Finishing Rates',
'nombre' => 'Name',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precioMax' => 'Price Max',
'precioMin' => 'Price Min',
'precioMin' => 'Min Price',

View File

@ -26,8 +26,12 @@ return [
"global_inactive" => "Inactivo",
"global_copy" => "Dupdo",
"global_print" => "Impresión",
"global_print2" => "Imprimir",
"global_confirm" => "Confirmar",
"global_excel" => "Excel",
"global_pdf" => "PDF",
"global_prev" => "Anterior",
"global_next" => "Siguiente",
// LOGIN - Index
"login_title" => "Iniciar sesión en su cuenta",
@ -680,6 +684,7 @@ return [
"menu_configuration" => "Configuración",
"menu_variables" => "Variables sistema",
"menu_error_presupuesto" => "Errores presupuesto",
"menu_calendario" => "Calendario",
"menu_paises" => "Paises",
"menu_correo" => "Correo",

View File

@ -2,6 +2,7 @@
return [
"chat" => "Mensajería",
"messages" => "Mensajes",
"modal" => [
"new_hebra" => "Nueva hebra",
"title" => "Título",

View File

@ -0,0 +1,21 @@
<?php
return [
"cardTitle" => "Errores presupuesto",
"datatable" =>
[
"columns" => [
"usuario" => "Usuario presupuesto",
"last_user_id" => "Último accesso",
"visto" => "Visto",
"created_at" => "Creado"
]
],
"form" =>
[
"name" => "Nombre",
"value" => "Valor",
"description" => "Descripción",
]
];

View File

@ -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',
@ -79,6 +82,8 @@ return [
'tipoImpresion' => 'Tipo de impresión',
'papelesComparadorCosidoTapaBlanda' => 'Papeles interior y cubierta',
'posicionPagColor' => 'Posición páginas a color',
'papelDiferente' => 'Papel color y negro diferente',
'paginasColorConsecutivas' => 'Páginas color consecutivas',
'colorPageInstructions' => 'Introduzca la posición de las páginas a color dentro del libro. Ej: 3,5,7 ó 4-10,20,155',
'numeroPaginas' => 'Nº Páginas',
'papel' => 'Papel',
@ -87,7 +92,43 @@ return [
'retractilado' => 'Retractilado individual',
'retractilado5' => 'Retractilado de 5',
'Guardas' => 'Guardas',
'papelGuardas' => 'Papel de guardas',
'offsetBlancoGuardas' => 'Offset blanco 170 gr',
'offsetAhuesadoGuardas' => 'Offset ahuesado 170 gr',
'guardasImpresas' => "Guardas impresas",
'imprimir_guardas' => 'Imprimir guardas',
'cabezada' => 'Cabezada',
'blanca' => 'Blanca',
'verde' => 'Verde',
'azul' => 'Azul',
'rojaAmarilla' => 'Roja-Amarilla',
'plastificado' => 'Plastificado',
'brillo' => 'Brillo',
'mate' => 'Mate',
'antirrayado' => 'Anti-rayado',
'rugoso' => 'Sandy (rugoso)',
'sinPlastificar' => 'Sin plastificar',
'barniz' => 'Barniz UVI',
'relieve2D' => 'Relieve 2D',
'relieve3D' => 'Relieve 3D',
'barnizDescription' => 'Barnizado selectivo en zonas de la cubierta',
'estampado' => 'Estampado',
'oro' => 'Oro',
'plata' => 'Plata',
'cobre' => 'Cobre',
'bronce' => 'Bronce',
'retractiladoTitle' => 'Retractilado',
'papelSobrecubierta' => 'Papel sobrecubierta',
'tamanioSolapasSobrecubierta' => 'Tamaño solapas sobrecubierta',
'plastificadoSobrecubierta' => 'Plastificado sobrecubierta',
'faja' => 'Faja',
'altoFaja' => 'Alto faja',
'papelFaja' => 'Papel faja',
'tamanioSolapasFaja' => 'Tamaño solapas faja',
'plastificadoFaja' => 'Plastificado faja',
'estucadoMate170gr' => 'Estucado mate 170 gr',
'estucadoMate200gr' => 'Estucado mate 200 gr',
'fajaColor' => 'Imprimir faja a color',
'compInteriorPlana' => 'Interior en plana',
'compInteriorRotativa' => 'Interior en rotativa',
@ -212,6 +253,11 @@ return [
'totalAceptado' => 'Total aceptado',
// Placeholders
'formatoLibro' => "Formato libro",
'selectCliente' => "Seleccione cliente",
// Preview
'preview' => 'Previsualización de configuraciones',
'preview-conf-bn' => 'Configuración Blanco y Negro',
@ -302,10 +348,19 @@ return [
'no_lp_for_merma' => 'Inserte líneas de presupuesto para calcular la merma',
'ejemplares_envio' => 'El número de ejemplares enviados no coincide con la tirada',
'cliente' => 'Debe seleccionar un cliente',
'papelFormato' => 'Seleccione un formato',
'tipo_libro' => 'Seleccione un tipo de libro',
'disenio_interior' => 'Seleccione el diseño del interior',
'papel_interior' => 'Seleccione el tipo de papel',
'gramaje_interior' => 'Seleccione el gramaje',
'pais' => 'Debe seleccionar un país',
'integer_greatherThan_0' => 'Número entero > 0 requerido',
'tirada_no_valida' => "Tirada no valida",
'sin_gramaje' => "Seleccione gramaje",
'tipo_cubierta' => 'Seleccione tipo de cubierta',
'opcion_solapas' => 'Seleccione la opción para las solapas',
'paginas_cosido' => 'El número de páginas para <b>cosido</b> debe ser múltiplo de 4',
'paginas_pares' => 'El número de páginas debe ser par',
],
'errores' => [

View File

@ -10,6 +10,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Encuadernación',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precioMax' => 'Precio T. Mín',
'precioMin' => 'Precio T. Máx',
'importeFijo' => 'Importe Fijo',

View File

@ -7,6 +7,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Servicios Extra',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precio' => 'Precio',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',

View File

@ -10,6 +10,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Manipulado',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'importeMinimo' => 'Importe mínimo',
'precioMax' => 'Precio T. Mín',
'precioMin' => 'Precio T. Máx',

View File

@ -7,6 +7,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Preimpresión',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precio' => 'Precio',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
@ -25,7 +28,16 @@ return [
'required' => 'El campo {field} es obligatorio.',
],
'code' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'comment' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'precio' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',

View File

@ -9,6 +9,9 @@ return [
'isDeleted' => 'Is Deleted',
'moduleTitle' => 'Tarifas Envíos',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'paisId' => 'Pais',
'tarifaEnvio' => 'Tarifa Envío',
'tarifaEnvioList' => 'Lista Tarifas Envío',

View File

@ -210,6 +210,7 @@ class ChatModel extends Model
->join("chat_departments","chat_departments.id = chats.chat_department_id","left")
->join("pedidos","pedidos.id = chats.pedido_id","left")
->whereIn("pedidos.id",$pedidos)
->where("chats.chat_department_id is NOT NULL",NULL,FALSE)
->get()->getResultObject();
$chatMessageModel = model(ChatMessageModel::class);
$count = 0;
@ -237,6 +238,7 @@ class ChatModel extends Model
->join("chat_departments","chat_departments.id = chats.chat_department_id","left")
->join("facturas","facturas.id = chats.factura_id","left")
->whereIn("facturas.id",$facturas)
->where("chats.chat_department_id is NOT NULL",NULL,FALSE)
->get()->getResultObject();
$chatMessageModel = model(ChatMessageModel::class);
$count = 0;
@ -264,6 +266,7 @@ class ChatModel extends Model
->join("chat_departments","chat_departments.id = chats.chat_department_id","left")
->join("presupuestos","presupuestos.id = chats.presupuesto_id","left")
->whereIn("presupuestos.id",$presupuestos)
->where("chats.chat_department_id is NOT NULL",NULL,FALSE)
->get()->getResultObject();
$chatMessageModel = model(ChatMessageModel::class);
$count = 0;

View File

@ -54,7 +54,7 @@ class ClienteDireccionesModel extends \App\Models\BaseModel
],
"email" => [
"label" => "ClienteDirecciones.email",
"rules" => "trim|max_length[100]|valid_email",
"rules" => "trim|max_length[100]",
],
"cp" => [
"label" => "ClienteDirecciones.cp",

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Clientes;
class ClienteModel extends \App\Models\BaseModel
@ -293,30 +294,32 @@ class ClienteModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->orLike("t1.alias", $search)
->orLike("t1.cif", $search)
->orLike("t1.email", $search)
->orLike("t1.soporte_id", $search)
->orLike("t1.forma_pago_id", $search)
->orLike("t1.vencimiento", $search)
->orLike("t5.id", $search)
->orLike("t5.first_name", $search)
->orLike("t5.last_name", $search)
->orLike("t7.id", $search)
->orLike("t7.nombre", $search)
->groupEnd();
->groupStart()
->like("t1.nombre", $search)
->orLike("t1.alias", $search)
->orLike("t1.cif", $search)
->orLike("t1.email", $search)
->orLike("t1.soporte_id", $search)
->orLike("t1.forma_pago_id", $search)
->orLike("t1.vencimiento", $search)
->orLike("t5.id", $search)
->orLike("t5.first_name", $search)
->orLike("t5.last_name", $search)
->orLike("t7.id", $search)
->orLike("t7.nombre", $search)
->groupEnd();
}
/*
TO-DO: Implementar la lógica de negocio para el crédito disponible
*/
public function creditoDisponible($cliente_id){
public function creditoDisponible($cliente_id)
{
return true;
}
public function getClienteDataFacturas($cliente_id){
public function getClienteDataFacturas($cliente_id)
{
$builder = $this->db
->table($this->table . " t1")
->select(
@ -329,27 +332,27 @@ class ClienteModel extends \App\Models\BaseModel
->where("t1.id", $cliente_id);
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
$builder->join("lg_provincias t3", "t1.provincia_id = t3.id", "left");
return $builder->get()->getResultArray();
}
public function getClienteDataPresupuestoPedidoFactura(int $cliente_id) : array
public function getClienteDataPresupuestoPedidoFactura(int $cliente_id): array
{
$query = $this->db
->table($this->table." t1")
->select([
"t1.id as clienteId",
"presupuestos.id as presupuestoId",
"pedidos.id as pedidoId",
"presupuesto_estados.estado as presupuestoEstado",
"facturas_pedidos_lineas.factura_id as facturaId",
->table($this->table . " t1")
->select([
"t1.id as clienteId",
"presupuestos.id as presupuestoId",
"pedidos.id as pedidoId",
"presupuesto_estados.estado as presupuestoEstado",
"facturas_pedidos_lineas.factura_id as facturaId",
])
->join("presupuestos","t1.id = presupuestos.cliente_id","left")
->join("presupuesto_estados","presupuestos.estado_id = presupuesto_estados.id","left")
->join("pedidos_linea","presupuestos.id = pedidos_linea.presupuesto_id","left")
->join("pedidos","pedidos.id = pedidos_linea.pedido_id","left")
->join("facturas_pedidos_lineas","facturas_pedidos_lineas.pedido_linea_id = pedidos_linea.id","left")
->where("t1.id",$cliente_id);
->join("presupuestos", "t1.id = presupuestos.cliente_id", "left")
->join("presupuesto_estados", "presupuestos.estado_id = presupuesto_estados.id", "left")
->join("pedidos_linea", "presupuestos.id = pedidos_linea.presupuesto_id", "left")
->join("pedidos", "pedidos.id = pedidos_linea.pedido_id", "left")
->join("facturas_pedidos_lineas", "facturas_pedidos_lineas.pedido_linea_id = pedidos_linea.id", "left")
->where("t1.id", $cliente_id);
$data = $query->get()->getResultObject();
$facturas = [];
$presupuestos = [];
@ -367,4 +370,23 @@ class ClienteModel extends \App\Models\BaseModel
return $result;
}
public function getNombre($id = -1)
{
try {
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.nombre AS nombre"
)
->where("id", $id)
->where("is_deleted", 0);
return $builder->get()->getResultObject()[0]->nombre;
} catch (\Exception $e) {
return null;
}
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Configuracion;
class PapelFormatoModel extends \App\Models\BaseModel
@ -72,25 +73,64 @@ class PapelFormatoModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->groupEnd();
->groupStart()
->like("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t1.id", $search)
->orLike("t1.ancho", $search)
->orLike("t1.alto", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->groupEnd();
}
public function getElementsForMenu(){
public function getElementsForMenu()
{
return $this->db
->table($this->table . " t1")
->select(
"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 name"
)
->where('is_deleted', 0)
->where('id>', 0)
->orderBy('orden_select', 'asc');
return empty($search)
? $builder->get()->getResultObject()
: $builder
->groupStart()
->like('t1.ancho', $search)
->orLike('t1.alto', $search)
->groupEnd()->get()->getResultObject();
}
public function getNombre($id = -1)
{
try {
$builder = $this->db
->table($this->table . " t1")
->select(
"CONCAT(t1.ancho, ' x ', t1.alto) AS name"
)
->where('t1.id', $id);
return $builder->get()->getResultObject()[0]->name;
} catch (\Exception $e) {
return null;
}
}
}

View File

@ -61,6 +61,37 @@ class PapelGenericoModel extends \App\Models\BaseModel
],
];
public function getIdFromCode(string $code=""){
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre"
)
->where("t1.code", $code)
->where("t1.is_deleted", 0);
$data = $builder->get()->getFirstRow();
// se convierte a de stdClass a array
$data = json_decode(json_encode($data), true);
return $data;
}
public function getCodeFromId($id=0){
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.code AS code"
)
->where("t1.id", $id)
->where("t1.is_deleted", 0);
$data = $builder->get()->getFirstRow();
// se convierte a de stdClass a array
$data = json_decode(json_encode($data), true);
return $data;
}
/**
* Get resource data.
*

View File

@ -322,4 +322,22 @@ class PapelImpresionModel extends \App\Models\BaseModel
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
public function getPapelGenericoCode($papel_id = 0){
$builder = $this->db
->table($this->table . " t1")
->select("t2.code AS code")
->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left")
->where("t1.id", $papel_id)
->where("t1.is_deleted", 0)
->where("t1.isActivo", 1)
->where("t2.is_deleted", 0);
$result = $builder->get()->getResultObject();
if(count($result) > 0){
return $result[0]->code;
}
else
return "";
}
}

View File

@ -80,7 +80,7 @@ class BuscadorModel extends \App\Models\BaseModel
"comparador_json_data",
"is_deleted",
"comp_tipo_impresion",
"comp_pos_paginas_color",
"pos_paginas_color",
"total_coste_papel",
"total_margen_papel",
"total_margenPercent_papel",

View File

@ -0,0 +1,115 @@
<?php
namespace App\Models\Presupuestos;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Model;
class ErrorPresupuesto extends Model
{
protected $table = 'presupuesto_errores';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
"presupuesto_id",
"presupuesto_user_id",
"error",
"datos_presupuesto",
"visto",
"last_user_id",
"comment",
"created_at",
"updated_at",
"deleted_at",
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function insertError(int $presupuesto_id, int $presupuesto_user_id, string $error, mixed $datos)
{
$this->insert([
"presupuesto_id" => $presupuesto_id,
"presupuesto_user_id" => $presupuesto_user_id,
"error" => $error,
"datos_presupuesto" => json_encode($datos)
]);
}
public function updateComment(int $error_presupuesto_id, string $comment): bool
{
$updated = $this->update($error_presupuesto_id, [
"comment" => $comment
]);
return $updated;
}
public function getErrorPresupuestoForm(int $error_presupuesto_id) : array
{
$query = $this->builder()
->select([
"presupuesto_errores.id",
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
"presupuesto_errores.created_at",
"presupuesto_errores.datos_presupuesto",
"presupuesto_errores.error",
"presupuesto_errores.visto",
"presupuesto_errores.comment"
])
->join("users t1", "t1.id = presupuesto_errores.presupuesto_user_id", "left")
->join("users t2", "t2.id = presupuesto_errores.last_user_id", "left")
->where("presupuesto_errores.deleted_at", null)
->where("presupuesto_errores.id",$error_presupuesto_id);
return $query->get()->getResultObject();
}
public function getQueryDatatable(): BaseBuilder
{
$query = $this->builder()
->select([
"presupuesto_errores.id",
"presupuestos.id as presupuestoId",
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
"presupuesto_errores.created_at",
"presupuesto_errores.datos_presupuesto",
"presupuesto_errores.error",
"presupuesto_errores.visto",
"presupuesto_errores.comment",
])
->join("users t1", "t1.id = presupuesto_errores.presupuesto_user_id", "left")
->join("users t2", "t2.id = presupuesto_errores.last_user_id", "left")
->join("presupuestos", "presupuestos.id = presupuesto_errores.presupuesto_id", "left")
->where("presupuesto_errores.deleted_at", null);
return $query;
}
}

View File

@ -123,4 +123,21 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel
return $builder;
}
public function getDireccion($id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.att AS att,
t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t3.nombre AS pais,
t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono"
);
$builder->where('t1.id', $id);
$builder->join("lg_paises t3", "t1.pais_id = t3.id", "left");
return $builder->get()->getResultObject();
}
}

View File

@ -96,7 +96,9 @@ class PresupuestoModel extends \App\Models\BaseModel
"comparador_json_data",
"is_deleted",
"comp_tipo_impresion",
"comp_pos_paginas_color",
"pos_paginas_color",
"paginas_color_consecutivas",
"papel_interior_diferente",
"total_coste_papel",
"total_margen_papel",
"total_margenPercent_papel",
@ -121,8 +123,15 @@ class PresupuestoModel extends \App\Models\BaseModel
'iva_reducido',
'excluir_rotativa',
"acabado_cubierta_id",
"barniz_cubierta_id",
"estampado_cubierta_id",
"acabado_sobrecubierta_id",
"is_duplicado"
"is_duplicado",
'paginas_color_consecutivas',
'papel_interior_diferente',
'paginasCuadernillo',
'lomo_redondo',
'cabezada',
];
protected $returnType = "App\Entities\Presupuestos\PresupuestoEntity";
@ -395,35 +404,47 @@ class PresupuestoModel extends \App\Models\BaseModel
'cliente_id' => $data['clienteId'],
'tipo_impresion_id' => $data['tipo_impresion_id'],
'pais_id' => 1,
'retractilado' => in_array(3, $data['servicios']) ? 1 : 0,
'retractilado' => in_array("RETR", $data['cubierta']['acabadosCubierta']) ? 1 : 0,
'retractilado5' => in_array(5, $data['servicios']) ? 1 : 0,
'guardas' => in_array(62, $data['servicios']) ? 1 : 0,
'faja_color' => in_array(16, $data['servicios']) ? 1 : 0,
'ferro' => in_array(24, $data['servicios']) ? 1 : 0,
'prototipo' => in_array(9, $data['servicios']) ? 1 : 0,
'prototipo' => $data['prototipo'] ? 1 : 0,
'papel_formato_id' => is_null($papel_formato_id) ? 0 : $papel_formato_id->id,
'papel_formato_personalizado' => !$papel_formato_id ? 1 : 0,
'papel_formato_ancho' => !$papel_formato_id ? $data['tamanio']['ancho'] : null,
'papel_formato_alto' => !$papel_formato_id ? $data['tamanio']['alto'] : null,
'titulo' => $data_cabecera['titulo'],
'autor' => $data_cabecera['autor'],
'ISBN' => $data_cabecera['isbn'],
'coleccion' => $data_cabecera['coleccion'],
'referencia_cliente' => $data_cabecera['referenciaCliente'],
'paginas' => $data['interior']['paginas'],
'tirada' => $tirada,
'solapas' => $data['cubierta']['solapasCubierta'] > 0 ? 1 : 0,
'solapas_ancho' => $data['cubierta']['solapasCubierta'] > 0 ? $data['cubierta']['solapasCubierta'] : 0,
'solapas_sobrecubierta' => is_null($data['sobrecubierta']) ? 0 : 1,
'solapas_ancho_sobrecubierta' => is_null($data['sobrecubierta']) ? 0 : $data['sobrecubierta']['solapas'],
'solapas' => $data['cubierta']['solapasCubierta'] == 0 ? 0 : 1,
'lomo_redondo' => $data['cubierta']['lomoRedondo'] == 0 ? 0 : 1,
'cabezada' => $data['cubierta']['cabezada'] == 0 ? 0 : 1,
'solapas_ancho' => $data['cubierta']['solapasCubierta'] == 0 ? $data['cubierta']['solapasCubierta'] : 0,
'solapas_sobrecubierta' => !$data['sobrecubierta'] ? 0 : 1,
'solapas_ancho_sobrecubierta' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['solapas'],
'cosido' => $is_cosido,
'merma' => $extra_info['merma'],
'merma_cubierta' => $extra_info['merma'],
'paginasCuadernillo' => $data['paginasCuadernillo'],
'comp_pos_paginas_color' => $data['interior']['pos_paginas_color'],
'paginas_color_consecutivas' => $data['interior']['paginas_color_consecutivas'],
'papel_interior_diferente' => $data['interior']['papelInteriorDiferente'],
'lomo_cubierta' => $extra_info['lomo_cubierta'],
'lomo_sobrecubierta' => $extra_info['lomo_sobrecubierta'],
'comparador_json_data' => $this->generateJson($data),
'acabado_cubierta_id' => $data['acabadoCubierta'],
'acabado_sobrecubierta_id' => is_null($data['sobrecubierta']) ? 0 : $data['sobrecubierta']['acabado'],
'acabado_cubierta_id' => $data['cubierta']['acabadosCubierta']['plastificado'],
'barniz_cubierta_id' => $data['cubierta']['acabadosCubierta']['barniz'],
'estampado_cubierta_id' => $data['cubierta']['acabadosCubierta']['estampado'],
'acabado_sobrecubierta_id' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['acabados'],
'comp_tipo_impresion' => $data['isHq'] ? ($data['isColor'] ? 'colorhq' : 'negrohq') : ($data['isColor'] ? 'color' : 'negro'),
@ -444,7 +465,7 @@ class PresupuestoModel extends \App\Models\BaseModel
'total_margenPercent_servicios' => round($resumen_totales['porcentajeMargenServicios'], 2),
'total_coste_envios' => round($resumen_totales['coste_envio'], 2),
'total_margen_envios' => round($resumen_totales['margen_envio'], 2),
'total_costes' => round($totalCostes, 2),
'total_costes' => round($totalCostes, 2),
'total_margenes' => round($totalMargenes, 2),
'total_antes_descuento' => round($totalCostes + $totalMargenes, 2),
@ -482,29 +503,45 @@ class PresupuestoModel extends \App\Models\BaseModel
if (is_array($data)) {
// -- INTERIOR --
// Si hay negro
if ($data['interior']['paginas'] > $data['interior']['paginas_color']) {
if (intval($data['interior']['paginas']) > intval($data['interior']['paginas_color'])) {
if ($data['isHq'])
$key = 'bnhq';
else
$key = 'bn';
if (array_key_exists('id', $data['interior']['papel_generico'])) {
$papel_id = intval($data['interior']['papel_generico']['id']);
$gramaje = intval($data['interior']['gramaje']);
} else {
$papel_id = intval($data['interior']['papel_generico']['negro']['id']);
$gramaje = intval($data['interior']['gramaje']['negro']);
}
$values[$key] = array(
'paginas' => intval($data['interior']['paginas']) - intval($data['interior']['paginas_color']),
'papel_id' => intval($data['interior']['papel_generico']['id']),
'gramaje' => intval($data['interior']['gramaje']),
'paginas' => intval($data['interior']['paginas']) - intval(intval($data['interior']['paginas_color'])),
'papel_id' => $papel_id,
'gramaje' => $gramaje,
);
}
// Si hay color
if ($data['interior']['paginas_color'] > 0) {
if (intval($data['interior']['paginas_color']) > 0) {
if ($data['isHq'])
$key = 'colorhq';
else
$key = 'color';
if (array_key_exists('id', $data['interior']['papel_generico'])) {
$papel_id = intval($data['interior']['papel_generico']['id']);
$gramaje = intval($data['interior']['gramaje']);
} else {
$papel_id = intval($data['interior']['papel_generico']['color']['id']);
$gramaje = intval($data['interior']['gramaje']['color']);
}
$values[$key] = array(
'paginas' => intval($data['interior']['paginas_color']),
'papel_id' => intval($data['interior']['papel_generico']['id']),
'gramaje' => intval($data['interior']['gramaje']),
'paginas' => intval(intval($data['interior']['paginas_color'])),
'papel_id' => $papel_id,
'gramaje' => $gramaje,
);
}
@ -516,7 +553,7 @@ class PresupuestoModel extends \App\Models\BaseModel
);
// -- SOBRECUBIERTA --
if (!is_null($data['sobrecubierta'])) {
if ($data['sobrecubierta']) {
$values['sobrecubierta'] = array(
'papel_id' => intval($data['sobrecubierta']['papel']),
'gramaje' => intval($data['sobrecubierta']['gramaje']),
@ -542,7 +579,7 @@ class PresupuestoModel extends \App\Models\BaseModel
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS numero, t1.tipo_impresion_id as tipo, t1.tirada AS unidades, t1.total_aceptado as total, t1.paginas AS paginas,
"t1.id AS numero, t1.tipo_impresion_id as tipo, t1.tirada AS unidades, t1.total_aceptado as total, t1.paginas AS paginas,
t1.titulo AS titulo, t1.autor AS autor, t1.isbn AS isbn,
t1.papel_formato_id AS papel_formato_id, t1.papel_formato_personalizado AS papel_formato_personalizado,
t1.papel_formato_ancho AS papel_formato_ancho, t1.papel_formato_alto AS papel_formato_alto,
@ -550,7 +587,7 @@ class PresupuestoModel extends \App\Models\BaseModel
t3.codigo AS codigo_encuadernacion,
t1.solapas AS solapas_cubierta, CAST(t1.solapas_ancho AS INT) AS solapas_ancho_cubierta,
t1.solapas_sobrecubierta AS solapas_sobrecubierta, CAST(t1.solapas_ancho_sobrecubierta AS INT) AS solapas_ancho_sobrecubierta,"
);
);
$builder->join("lg_papel_formato t2", "t1.papel_formato_id = t2.id", "left");
$builder->join("tipos_presupuestos t3", "t1.tipo_impresion_id = t3.id", "left");
$builder->where("t1.is_deleted", 0);
@ -585,7 +622,7 @@ class PresupuestoModel extends \App\Models\BaseModel
);
$presupuesto->concepto .= $this->generarConceptoLineasPresupuestoLibro($lineas, $presupuesto);
$presupuesto = (object)[
$presupuesto = (object) [
'numero' => $presupuesto->numero,
'unidades' => $presupuesto->unidades,
'total' => $presupuesto->total,
@ -634,8 +671,8 @@ class PresupuestoModel extends \App\Models\BaseModel
->join('presupuesto_manipulados', 'presupuesto_manipulados.presupuesto_id = presupuestos.id', 'left')
->join('lg_tarifa_manipulado', 'lg_tarifa_manipulado.id = presupuesto_manipulados.tarifa_manipulado_id', 'left')
->where('presupuestos.id', $presupuesto_id);
$queryExtras = $this->db->table($this->table)
$queryExtras = $this->db->table($this->table)
->select(
[
'lg_tarifa_preimpresion.id',
@ -645,7 +682,7 @@ class PresupuestoModel extends \App\Models\BaseModel
)
->join('presupuesto_serviciosExtra', 'presupuesto_serviciosExtra.presupuesto_id = presupuestos.id', 'left')
->join('lg_tarifa_preimpresion', 'lg_tarifa_preimpresion.id = presupuesto_serviciosExtra.tarifa_extra_id', 'left')
->where('presupuestos.id', $presupuesto_id);
->where('presupuestos.id', $presupuesto_id);
$servicios['acabado'] = $queryAcabado->get()->getResultObject();
$servicios['manipulado'] = $queryManipulado->get()->getResultObject();
@ -783,5 +820,5 @@ class PresupuestoModel extends \App\Models\BaseModel
}
}

View File

@ -15,11 +15,10 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
const SORTABLE = [
0 => "t2.nombre",
1 => "t1.precio_unidad",
2 => "t1.precio_total"
1 => "t1.precio",
];
protected $allowedFields = ["presupuesto_id", "tarifa_extra_id", "precio_total", "precio_unidad", "margen"];
protected $allowedFields = ["presupuesto_id", "tarifa_extra_id", "precio", "margen"];
protected $returnType = "App\Entities\Presupuestos\PresupuestoServiciosExtraEntity";
protected $useTimestamps = true;

View File

@ -21,6 +21,8 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
protected $allowedFields = [
"nombre",
"code",
"comment",
"precio_min",
"importe_fijo",
"mostrar_en_presupuesto",
@ -83,13 +85,13 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select(
"t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
"t1.id AS id, t1.nombre AS nombre,t1.code AS code, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto, t1.acabado_cubierta AS acabado_cubierta, t1.acabado_sobrecubierta AS acabado_sobrecubierta"
);
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
@ -114,8 +116,9 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
}
public function getTarifaPresupuestoAcabado($tarifa_id, $tirada, $proveedor_id = -1){
public function getTarifaPresupuestoAcabado($tarifa_id, $tirada, $proveedor_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
@ -128,18 +131,18 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
->where("t1.is_deleted", 0)
//->where("t1.mostrar_en_presupuesto", 1)
->where("t2.is_deleted", 0);
$builder->where('t1.id =', $tarifa_id);
$builder->where('t2.tirada_min <=', $tirada);
$builder->where('t2.tirada_max >=', $tirada);
if($proveedor_id != -1){
if ($proveedor_id != -1) {
$builder->where('t2.proveedor_id', $proveedor_id);
}
return $builder->get()->getResultObject();
}
public function getNombreTarifaAcabado($id=-1)
public function getNombreTarifaAcabado($id = -1)
{
/*
Todos los servicios de encuadernacion activas que se pueden usar en presupuestos
@ -184,4 +187,23 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
}
public function getCodeFromId($id = 0)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.code AS code"
)
->where("t1.id", $id)
->where("t1.is_deleted", 0);
$data = $builder->get()->getResultObject();
if (count($data) > 0) {
return $data[0]->code;
} else {
return "";
}
}
}

View File

@ -22,6 +22,8 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
protected $allowedFields = [
"nombre",
"code",
"comment",
"mostrar_en_presupuesto",
"tipo_encuadernacion",
"servicio_encuadernacion",
@ -65,7 +67,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre,
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.code AS code,
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion,
t1.por_horas AS por_horas");

View File

@ -1,4 +1,5 @@
<?php
namespace App\Models\Tarifas;
class TarifaEnvioModel extends \App\Models\BaseModel
@ -17,7 +18,7 @@ class TarifaEnvioModel extends \App\Models\BaseModel
1 => "t2.nombre",
];
protected $allowedFields = ["pais_id", "nombre","deleted_at","is_deleted"];
protected $allowedFields = ["pais_id", "nombre", "code", "comment", "deleted_at", "is_deleted"];
protected $returnType = "App\Entities\Tarifas\TarifaEnvioEntity";
protected $useTimestamps = true;
@ -73,7 +74,7 @@ class TarifaEnvioModel extends \App\Models\BaseModel
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id as id, t1.nombre AS nombre, t2.nombre AS pais_id");
$builder = $this->db->table($this->table . " t1")->select("t1.id as id, t1.nombre AS nombre,t1.code AS code, t2.nombre AS pais_id");
$builder->join("lg_paises t2", "t1.pais_id = t2.id", "left");
//JJO
@ -82,43 +83,44 @@ class TarifaEnvioModel extends \App\Models\BaseModel
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->orLike("t2.id", $search)
->orLike("t1.pais_id", $search)
->orLike("t1.nombre", $search)
->orLike("t2.nombre", $search)
->groupEnd();
->groupStart()
->like("t1.nombre", $search)
->orLike("t2.code", $search)
->orLike("t2.id", $search)
->orLike("t1.pais_id", $search)
->orLike("t1.nombre", $search)
->orLike("t2.nombre", $search)
->groupEnd();
}
public function getTarifaEnvio($paisId, string $cp, $peso, $tipo_envio){
public function getTarifaEnvio($paisId, string $cp, $peso, $tipo_envio)
{
// Si el pais es españa se tienen que tener en cuenta los postales
// Se busca primero la tarifa a la que corresponde
$builder = $this->db->table($this->table . " t1")
->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo")
->join("tarifas_envios_zonas t2", "t1.id = t2.tarifa_envio_id")
->where("t1.pais_id", $paisId)
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0);
if($paisId == 1) {// España
->select("t1.id AS tarifa_envio_id, t2.importe_fijo as importe_fijo")
->join("tarifas_envios_zonas t2", "t1.id = t2.tarifa_envio_id")
->where("t1.pais_id", $paisId)
->where("t1.is_deleted", 0)
->where("t2.is_deleted", 0);
if ($paisId == 1) { // España
$builder->where("CAST(t2.cp_inicial AS UNSIGNED)<=", intval($cp))
->where("CAST(t2.cp_final AS UNSIGNED) >=", intval($cp));
->where("CAST(t2.cp_final AS UNSIGNED) >=", intval($cp));
}
$tarifas = $builder->get()->getResultObject();
$resultado = [];
$model = model('App\Models\Tarifas\TarifaEnvioPrecioModel');
foreach($tarifas as $tarifa){
foreach ($tarifas as $tarifa) {
$precio_tarifas = $model->getEnvioPrecio($tarifa->tarifa_envio_id, $peso, $tipo_envio);
foreach($precio_tarifas as $precio_tarifa){
foreach ($precio_tarifas as $precio_tarifa) {
$precio_tarifa->importe_fijo = $tarifa->importe_fijo;
array_push($resultado, $precio_tarifa);
}
}
return $resultado;
}
}

View File

@ -22,6 +22,8 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
protected $allowedFields = [
"nombre",
"precio_min",
"code",
"comment",
"importe_fijo",
"mostrar_en_presupuesto",
"deleted_at",
@ -80,7 +82,7 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id,t1.code AS code, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo
,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto");
//JJO

View File

@ -13,7 +13,9 @@ class TarifaextraModel extends \App\Models\BaseModel
protected $useAutoIncrement = true;
protected $allowedFields = [
"nombre",
"nombre",
"code",
"comment",
"precio",
"margen",
"mostrar_en_presupuesto",

View File

@ -13,7 +13,9 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
protected $useAutoIncrement = true;
protected $allowedFields = [
"nombre",
"nombre",
"code",
"comment",
"precio",
"margen",
"mostrar_en_presupuesto",
@ -37,6 +39,14 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
"label" => "Tarifapreimpresion.nombre",
"rules" => "trim|required|max_length[255]",
],
"code" => [
"label" => "Tarifapreimpresion.code",
"rules" => "trim|required|max_length[5]",
],
"comment" => [
"label" => "Tarifapreimpresion.comment",
"rules" => "trim|max_length[255]",
],
"precio" => [
"label" => "Tarifapreimpresion.precio",
"rules" => "required|decimal",
@ -52,6 +62,14 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
"max_length" => "Tarifapreimpresion.validation.nombre.max_length",
"required" => "Tarifapreimpresion.validation.nombre.required",
],
"code" => [
"max_length" => "Tarifapreimpresion.validation.code.max_length",
"required" => "Tarifapreimpresion.validation.code.required",
],
"comment" => [
"max_length" => "Tarifapreimpresion.validation.comment.max_length",
"required" => "Tarifapreimpresion.validation.comment.required",
],
"precio" => [
"decimal" => "Tarifapreimpresion.validation.precio.decimal",
"required" => "Tarifapreimpresion.validation.precio.required",

View File

@ -15,37 +15,44 @@ class PresupuestoClienteService extends BaseService
{
$rotativa = [];
$plana = PresupuestoClienteService::obtenerPresupuestoClienteInterior($data);
$plana = [];
// no se busca en plana cuando es estándar (no Premium)
if ($data['isHq'])
$plana = PresupuestoClienteService::obtenerPresupuestoClienteInterior($data);
if (!$data['excluirRotativa'] && !$data['isHq'])
$rotativa = PresupuestoClienteService::obtenerPresupuestoClienteInteriorRotativa($data);
$total_plana = -1;
$hay_plana = false;
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']);
if ($data['isColor']) {
if ($data['datosPedido']->paginas == $data['paginas_color']){
if(count($plana[1]) > 2)
$total_plana += floatval($plana[1]['total_impresion']);
else
return -1;
}
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{
} else {
foreach ($plana as $linea) {
if (count($linea) > 0)
if($linea['tipo_linea'] == 'lp_bn' || $linea['tipo_linea'] == 'lp_bnhq'){
if ($linea['tipo_linea'] == 'lp_bn' || $linea['tipo_linea'] == 'lp_bnhq') {
$total_plana = 0.0;
$total_plana = floatval($linea['total_impresion']);
}
}
}
$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)
@ -70,9 +77,10 @@ class PresupuestoClienteService extends BaseService
$isHq = $data['isHq'];
$cliente_id = $data['cliente_id'];
$paginas_color = $data['paginas_color'];
$lomoRedondo = $data['lomoRedondo'];
$lineas_cubierta = [];
for ($i = 0; $i < 2; $i++) {
$lineas = PresupuestoService::obtenerComparadorPlana([
@ -84,7 +92,8 @@ class PresupuestoClienteService extends BaseService
'isColor' => $isColor,
'isHq' => $isHq,
'cliente_id' => $cliente_id,
'a_favor_fibra' => $i
'a_favor_fibra' => $i,
'lomoRedondo' => $lomoRedondo
]);
if (count($lineas) > 0) {
@ -124,7 +133,7 @@ class PresupuestoClienteService extends BaseService
$paginas_color = $data['paginas_color'];
$lineas_sobrecubierta = [];
for ($i = 0; $i < 2; $i++) {
$lineas = PresupuestoService::obtenerComparadorPlana([
@ -175,7 +184,7 @@ class PresupuestoClienteService extends BaseService
$cliente_id = $data['cliente_id'];
$lineas_guardas = [];
for ($i = 0; $i < 2; $i++) {
$lineas = PresupuestoService::obtenerComparadorPlana([
@ -238,11 +247,21 @@ class PresupuestoClienteService extends BaseService
$uso = $data['uso'];
$tipo_impresion_id = $data['tipo_impresion_id'];
$datosPedido = $data['datosPedido'];
$papel_generico = $data['papel_generico'];
$gramaje = $data['gramaje'];
if ($data['papelInteriorDiferente'] == false)
$papel_generico = $data['papel_generico'];
else {
$papel_generico = $data['papel_generico']['negro'];
$papel_generico_color = $data['papel_generico']['color'];
}
if ($data['papelInteriorDiferente'] == false)
$gramaje = $data['gramaje'];
else {
$gramaje = $data['gramaje']['negro'];
$gramaje_color = $data['gramaje']['color'];
}
$isColor = $data['isColor'];
$isHq = $data['isHq'];
$cliente_id = $data['cliente_id'];
$cliente_id = $data['cliente_id'];
$paginas_color = $data['paginas_color'];
$paginas_negro = $datosPedido->paginas - $paginas_color;
@ -285,8 +304,6 @@ class PresupuestoClienteService extends BaseService
return $result;
}
);
$linea_negro_plana = $linea_negro_plana[0]['fields'];
$linea_negro_plana['tipo_linea'] = $isHq ? 'lp_bnhq' : 'lp_bn';
}
}
@ -296,6 +313,10 @@ class PresupuestoClienteService extends BaseService
$datosPedido->paginas = $paginas_color;
for ($i = 0; $i < 2; $i++) {
if ($data['papelInteriorDiferente'] == true) {
$papel_generico = $papel_generico_color;
$gramaje = $gramaje_color;
}
$lineas = PresupuestoService::obtenerComparadorPlana([
'uso' => $uso,
'tipo_impresion_id' => $tipo_impresion_id,
@ -325,14 +346,61 @@ class PresupuestoClienteService extends BaseService
return $result;
}
);
}
}
// Si hay negro y color, y se hace con el mismo papel, hay que buscar la combinación
// más económica con la misma máquna
if (
$paginas_negro > 0 && $paginas_color > 0 && $data['papelInteriorDiferente'] == 0 &&
count($linea_negro_plana) > 0 && count($linea_color_plana) > 0
) {
$mejor_combinacion = null;
$coste_menor = PHP_INT_MAX;
// Iteramos ambos arrays
foreach ($linea_color_plana as $color_item) {
foreach ($linea_negro_plana as $negro_item) {
// Comparar si tienen el mismo 'maquina_id'
if ($color_item['fields']['maquina_id'] == $negro_item['fields']['maquina_id']) {
// Sumar los 'total_impresion' de ambas líneas
$costo_total = $color_item['fields']['total_impresion'] + $negro_item['fields']['total_impresion'];
// Verificar si es la combinación más barata hasta ahora
if ($costo_total < $coste_menor) {
$coste_menor = $costo_total;
$mejor_combinacion = [
'maquina_id' => $color_item['fields']['maquina_id'],
'costo_total' => $costo_total,
'color_item' => $color_item,
'negro_item' => $negro_item,
];
}
}
}
// Retornar la mejor combinación encontrada
if ($mejor_combinacion !== null) {
return [$mejor_combinacion['negro_item']['fields'], $mejor_combinacion['color_item']['fields']];
} else {
return [];
}
}
} 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';
}
if (count($linea_color_plana) > 0) {
$linea_color_plana = $linea_color_plana[0]['fields'];
$linea_color_plana['tipo_linea'] = $isHq ? 'lp_colorhq' : 'lp_color';
}
}
return [$linea_negro_plana, $linea_color_plana];
}
public static function getServiciosEncuadernacionDefault($data){
public static function getServiciosEncuadernacionDefault($data)
{
$tipo_impresion_id = $data['tipo_impresion_id'] ?? -1;
$tirada = $data['tirada'] ?? -1;
@ -348,42 +416,46 @@ class PresupuestoClienteService extends BaseService
return $values;
}
public static function getServiciosManipulado($data){
public static function getServiciosManipulado($data)
{
$tarifa_id = $data['tarifa_id'] ?? -1;
$tirada = $data['tirada'] ?? -1;
$POD = $data['POD'] ?? -1;
$model = model('App\Models\Presupuestos\PresupuestoManipuladosModel');
$values = $model->getPrecioTarifa($tarifa_id, $tirada, $POD);
return $values;
}
public static function getServiciosPreimpresion($data){
public static function getServiciosPreimpresion($data)
{
$tarifa_id = $data['tarifa_id'] ?? -1;
$model = model('App\Models\Presupuestos\PresupuestoPreimpresionesModel');
$values = $model->getPrecioTarifa($tarifa_id);
return $values;
}
public static function getServiciosExtra($data){
public static function getServiciosExtra($data)
{
$tarifa_id = $data['tarifa_id'] ?? -1;
$model = model('App\Models\Presupuestos\PresupuestoServiciosExtraModel');
$values = $model->getPrecioTarifa($tarifa_id);
return $values;
}
public static function getServiciosAcabados($data){
public static function getServiciosAcabados($data)
{
$tarifa_id = $data['tarifa_id'] ?? -1;
$tirada = $data['tirada'] ?? -1;
$POD = $data['POD'] ?? -1;
$model = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
$values = $model->getPrecioTarifa($tarifa_id, $tirada, -1, $POD); // proveedor más barato
return $values;

View File

@ -838,9 +838,13 @@ class PresupuestoService extends BaseService
* Devuelve el ancho de la cubierta/sobrecubierta, incluido el lomo.
* El $uso tiene que ser "cubierta" o "sobrecubierta"
*/
public static function getAnchoTotalExteriores($uso = "cubierta", $tipo_impresion_id = 1, $datosPedido = null, $maquina_id = -1)
public static function getAnchoTotalExteriores($uso = "cubierta", $tipo_impresion_id = 1, $datosPedido = null, $maquina_id = -1, $lomoRedondo = 0)
{
$ancho_total = 0;
$sangre_cubierta = self::SANGRE_FORMAS_CUBIERTA;
if($datosPedido->ancho > 210 || $datosPedido->alto > 297){
$sangre_cubierta = 15;
}
if ($datosPedido) {
// Tapa blanda (cosido y fresado)
@ -861,8 +865,13 @@ class PresupuestoService extends BaseService
// si es cubierta
// se añade 7mm del ancho del cartón (2*3.5mm) por cada lado del lomo
// más 7mm de vuelo+cajo por cada lado. Por último, 20mm de sangre por cada lado
if ($uso == "cubierta")
$ancho_total += (2 * 7 + 2 * self::SANGRE_FORMAS_CUBIERTA + 7);
if ($uso == "cubierta"){
$ancho_total += (2 * 7 + 2 * $sangre_cubierta + 6);
if($lomoRedondo){
$ancho_total += 6;
}
}
// si es sobrecubierta
// Se añaden 5mm de sangre por cada lado + 2 * 7mm de vuelo portada y contraportada -> total 52
else
@ -893,7 +902,7 @@ class PresupuestoService extends BaseService
// Tapa dura
else{
// Se le suma 20mm de sangre por cada lado. Como son 2 hojas independientes, se multiplica por 4
$ancho_total += (4 * self::SANGRE_FORMAS_CUBIERTA);
$ancho_total += (4 * $sangre_cubierta);
}
}
else {
@ -1716,6 +1725,7 @@ class PresupuestoService extends BaseService
$cliente_id = $input_data['cliente_id'];
$datosTipolog = $input_data['datosTipolog'] ?? null;
$a_favor_fibra = $datosPedido->a_favor_fibra ?? false;
$lomoRedondo = $input_data['lomoRedondo'] ?? 0;
$tipo = $isColor ? ($isHq ? 'colorhq' : 'color') : ($isHq ? 'negrohq' : 'negro');
@ -1747,7 +1757,7 @@ class PresupuestoService extends BaseService
if ($uso == 'cubierta' || $uso == 'sobrecubierta') {
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido, $maquina->maquina_id);
$datosPedido->anchoExteriores = PresupuestoService::getAnchoTotalExteriores($uso, $tipo_impresion_id, $datosPedido, $maquina->maquina_id, $lomoRedondo);
$datosPedido->altoExteriores = PresupuestoService::getAltoTotalExteriores($uso, $tipo_impresion_id, $datosPedido);
}

View File

@ -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 } ?>

View File

@ -0,0 +1,24 @@
<div class="modal fade" id="modalInput" tabindex="-1" aria-modal="true" role="dialog">
<div class="modal-dialog modal-sm modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalTitle"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col mb-3">
<label for="inputData" class="form-label"></label>
<input type="number" id="inputData" class="inputData form-control" placeholder="">
</div>
</div>
</div>
<div class="modal-footer">
<button id="modalInputBtnClose" type="button" class="btn btn-label-secondary waves-effect" data-bs-dismiss="modal">
Cerrar
</button>
<button id="modalInputBtnSave" type="button" class="btn btn-primary waves-effect waves-light">Guardar cambios</button>
</div>
</div>
</div>
</div>

View File

@ -15,17 +15,21 @@
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-chat" aria-controls="navs-pills-top-internal-chat" aria-selected="false">Chat</button>
</li>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-internal-messages" aria-controls="navs-pills-top-internal-messages" aria-selected="false">Mensajes internos</button>
</li>
<?php } ?>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="navs-pills-top-chat" role="tabpanel">
<?= view("themes/vuexy/components/chat_factura", data: ["modelId" => $modelId,"type" => "factura"]) ?>
</div>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<div class="tab-pane fade" id="navs-pills-top-internal-messages" role="tabpanel">
<?= view("themes/vuexy/components/internal_messages", data: ["modelId" => $modelId,"type" => "factura"]) ?>
</div>
<?php } ?>
</div>
</div>
</div>

View File

@ -15,17 +15,21 @@
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-chat" aria-controls="navs-pills-top-internal-chat" aria-selected="false">Chat</button>
</li>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-internal-messages" aria-controls="navs-pills-top-internal-messages" aria-selected="false">Mensajes internos</button>
</li>
<?php } ?>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="navs-pills-top-chat" role="tabpanel">
<?= view("themes/vuexy/components/chat_pedido", data: ["modelId" => $modelId, "type" => "pedido"]) ?>
</div>
<div class="tab-pane fade" id="navs-pills-top-internal-messages" role="tabpanel">
<?= view("themes/vuexy/components/internal_messages", data: ["modelId" => $modelId, "type" => "pedido"]) ?>
</div>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<div class="tab-pane fade" id="navs-pills-top-internal-messages" role="tabpanel">
<?= view("themes/vuexy/components/internal_messages", data: ["modelId" => $modelId, "type" => "pedido"]) ?>
</div>
<?php } ?>
</div>
</div>
</div>

View File

@ -15,17 +15,21 @@
<li class="nav-item">
<button type="button" class="nav-link active" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-chat" aria-controls="navs-pills-top-internal-chat" aria-selected="false">Chat</button>
</li>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="nav-item">
<button type="button" class="nav-link" role="tab" data-bs-toggle="tab" data-bs-target="#navs-pills-top-internal-messages" aria-controls="navs-pills-top-internal-messages" aria-selected="false">Mensajes internos</button>
</li>
<?php } ?>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="navs-pills-top-chat" role="tabpanel">
<?= view("themes/vuexy/components/chat_presupuesto", data: ["modelId" => $modelId, "type" => "presupuesto"]) ?>
</div>
<div class="tab-pane fade" id="navs-pills-top-internal-messages" role="tabpanel">
<?= view("themes/vuexy/components/internal_messages", data: ["modelId" => $modelId, "type" => "presupuesto"]) ?>
</div>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<div class="tab-pane fade" id="navs-pills-top-internal-messages" role="tabpanel">
<?= view("themes/vuexy/components/internal_messages", data: ["modelId" => $modelId, "type" => "presupuesto"]) ?>
</div>
<?php } ?>
</div>
</div>
</div>

View File

@ -37,16 +37,6 @@
<!-- CHAT LIST -->
</ul>
<!-- Contacts -->
<ul class="list-unstyled chat-contact-list mb-0" id="contact-list">
<li class="chat-contact-list-item chat-contact-list-item-title">
<h5 class="text-primary mb-0">Contactos</h5>
</li>
<li class="chat-contact-list-item contact-list-item-0 d-none">
<h6 class="text-muted mb-0">No Contacts Found</h6>
</li>
</ul>
</div>
</div>
<!-- /Chat contacts -->

View File

@ -1,4 +1,4 @@
<div class="container-xl flex-grow-1 container-p-y" id="chat-presupuesto" data-id="<?= $modelId ?>">
<div id="chat-presupuesto" data-id="<?= $modelId ?>">
<div class="app-chat card overflow-hidden">
<div class="row g-0">

View File

@ -0,0 +1,114 @@
<div id="addressModal" action='create' class="modal fade addModal">
<div class="modal-dialog modal-lg modal-simple">
<div class="modal-content">
<div class="modal-header">
<h4 id="labelTitleConfirmDialog" class="modal-title"><?= lang('ClienteDirecciones.direccionTitle') ?></h4>
</div>
<div class="modal-body">
<div class="texto-error d-none">
Rellene los campos obligatorios
</div>
<div class="mb-3">
<label for="add_alias" class="form-label">
<?= lang('ClienteDirecciones.alias') ?>*
</label>
<input type="text" id="add_alias" tabindex="1" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_att" class="form-label">
<?= lang('ClienteDirecciones.att') ?>*
</label>
<input type="text" id="add_att" tabindex="1" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_email" class="form-label">
<?= lang('ClienteDirecciones.email') ?>
</label>
<input type="text" id="add_email" tabindex="2" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_direccion" class="form-label">
<?= lang('ClienteDirecciones.direccion') ?>*
</label>
<input type="text" id="add_direccion" tabindex="3" maxLength="255" class="form-control">
</div><!--//.mb-3 -->
<div class='row'>
<div id='divPais' class="col-md-12 col-lg-12 pl-4">
<div class="mb-3">
<label for="add_pais_id" class="form-label">
<?= lang('ClienteDirecciones.pais') ?>*
</label>
<select id="add_pais_id" tabindex="4" class="form-control select2bs" style="width: 100%;">
<option value="" disabled selected><?= lang('ClienteDirecciones.selectPais') ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>">
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
</div>
</div> <!-- //.row -->
<div class='row'>
<div id='divMunicipio' class="col-md-12 col-lg-12 pl-4">
<div class="mb-3">
<label for="add_municipio" class="form-label">
<?= lang('ClienteDirecciones.municipio') ?>*
</label>
<input type="text" id="add_municipio" tabindex="6" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-6 pl-4 spain-data" style="display: none;">
<div class="mb-3">
<label for="add_provincia" class="form-label">
<?= lang('ClienteDirecciones.provincia') ?>
</label>
<input type="text" id="add_provincia" tabindex="7" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
</div>
</div> <!-- //.row -->
<div class='row'>
<div class="col-md-12 col-lg-6 pl-4">
<div class="mb-3">
<label for="add_cp" class="form-label">
<?= lang('ClienteDirecciones.cp') ?>*
</label>
<input type="text" id="add_cp" tabindex="8" maxLength="100" class="form-control">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-6 pl-4">
<div class="mb-3">
<label for="add_telefono" class="form-label">
<?= lang('ClienteDirecciones.telefono') ?>
</label>
<input type="text" id="add_telefono" tabindex="9" maxLength="100" class="form-control"></input>
</div><!--//.mb-3 -->
</div>
</div> <!-- //.row -->
</div>
<div class="modal-footer">
<button id="saveAdd"
type="button"
class="btn btn-primary">Guardar</button>
<button id="cancelAdd"
type="button"
class="btn btn-secondary">Cancelar</button>
</div>
</div>
</div>
</div>

View File

@ -31,7 +31,7 @@
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.come_back') ?></button>
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.global_come_back') ?></button>
<button type="button" id="submit_new_hebra" class="btn btn-primary d-none"><?= lang('Chat.modal.btn_send') ?></button>
<button type="button" id="submit_update_hebra" class="btn btn-primary d-none"><?= lang('Chat.modal.btn_send_update') ?></button>
</div>

View File

@ -0,0 +1,89 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Error presupuesto</h3>
</div>
<!--//.card-header -->
<div class="card-body" id="error-presupuesto-container">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<form id="error-presupuesto-form">
<input id="error-presupuesto-id" value="<?= $error_presupuesto_id ?>" hidden>
<div class="row justify-content-start align-items-end mb-3">
<div class="col-md-10 overflow-hidden w-20">
<label for="presupuesto-user-id">Usuario presupuesto</label>
<input name="presupuesto_user_id" type="text" class="form-control" id="presupuesto-user-id"
disabled>
</div>
<div class="col-md-2 overflow-hidden w-20">
<label class="switch switch-square switch-lg">
<input type="checkbox" class="switch-input" id="error-presupuesto-visto" name="visto"
disabled>
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-eye"></i>
</span>
<span class="switch-off">
<i class="ti ti-eye-off"></i>
</span>
</span>
<span class="switch-label">Visto</span>
</label>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3 overflow-hidden">
<label for="datos-presupuesto">Datos</label>
<textarea rows="10" class="form-control" id="datos-presupuesto"
placeholder="Datos presupuesto" disabled></textarea>
</div>
<div class="col-md-6 mb-3 overflow-hidden">
<label for="error-presupuesto">Error</label>
<textarea rows="10" class="form-control" id="error-presupuesto-text" placeholder="Error"
disabled></textarea>
</div>
<div class="col-md-12 mb-3 overflow-hidden">
<label for="comments-presupuesto">Comentarios</label>
<textarea rows="10" class="form-control" id="comments-presupuesto"
placeholder="Comentarios"></textarea>
</div>
<div class="col-md-12">
<button class="btn btn-primary button-update-comment" type="button">
<span class="ti ti-sm ti-send me-1" id="update-button-icon"></span>
<span class="spinner-border me-1" role="status" aria-hidden="true"
id="update-button-loader" hidden></span>
<?= lang("App.global_save") ?></button>
<a class="btn btn-secondary" href="<?= route_to("erroresPresupuestoIndex") ?>"
class="btn btn-secondary"><?= lang("App.global_come_back") ?>
</a>
</div>
</div>
</div>
</form>
</div>
</div>
<!--//.card-body -->
<div class="card-footer">
</div>
<!--//.card-footer -->
</div>
<!--//.card -->
</div>
<!--//.col -->
<!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexForm.js') ?>">
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,50 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= lang('ErrorPresupuesto.cardTitle') ?></h3>
</div>
<!--//.card-header -->
<div class="card-body" id="errorPresupuestoCard">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableErrorPresupuesto" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th>ID Presupuesto</th>
<th><?= lang('ErrorPresupuesto.datatable.columns.usuario') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.last_user_id') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.visto') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.created_at') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<!--//.card-body -->
<div class="card-footer">
</div>
<!--//.card-footer -->
</div>
<!--//.card -->
</div>
<!--//.col -->
</div>
<!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js') ?>">
</script>
<?= $this->endSection() ?>

View File

@ -1,94 +0,0 @@
<div class="col-12 pb-2">
<input hidden readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="<?= old('id', $presupuestoEntity->id) ?>">
<div class="row g-2">
<div class="col-sm-6 mb-3">
<label for="titulo" class="form-label">
<?=lang('Presupuestos.titulo') ?>*
</label>
<input type="text" id="titulo" name="titulo" maxLength="300" class="form-control" value="<?=old('titulo', $presupuestoEntity->titulo) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-6 mb-3">
<label for="autor" class="form-label">
<?=lang('Presupuestos.autor') ?>
</label>
<input type="text" id="autor" name="autor" maxLength="150" class="form-control" value="<?=old('autor', $presupuestoEntity->autor) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-6 mb-3">
<label for="coleccion" class="form-label">
<?=lang('Presupuestos.coleccion') ?>
</label>
<input type="text" id="coleccion" name="coleccion" maxLength="255" class="form-control" value="<?=old('coleccion', $presupuestoEntity->coleccion) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-6 mb-3">
<label for="numeroEdicion" class="form-label">
<?=lang('Presupuestos.numeroEdicion') ?>
</label>
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="<?=old('numero_edicion', $presupuestoEntity->numero_edicion) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-6 mb-3">
<label for="numeroEdicion" class="form-label">
<?=lang('Presupuestos.numeroEdicion') ?>
</label>
<input type="text" id="numeroEdicion" name="numero_edicion" maxLength="50" class="form-control" value="<?=old('numero_edicion', $presupuestoEntity->numero_edicion) ?>">
</div>
<div class="col-sm-6 mb-3">
<label for="isbn" class="form-label">
<?=lang('Presupuestos.isbn') ?>
</label>
<input type="text" id="isbn" name="isbn" maxLength="50" class="form-control" value="<?=old('isbn', $presupuestoEntity->isbn) ?>">
</div>
<div class="col-sm-6 mb-3">
<label for="paisId" class="form-label">
<?=lang('Presupuestos.paisId') ?>*
</label>
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
<?php foreach ($datosPresupuesto->paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$presupuestoEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div>
<hr> <!-- Separador -->
<div class="col-sm-6 mb-3">
<label for="clienteId" class="form-label">
<?= lang('Presupuestos.clienteId') ?>*
</label>
<select id="clienteId" name="clienteId" class="form-control select2bs2" style="width: 100%;">
<?php if (isset($datosPresupuesto->clienteList) && is_array($datosPresupuesto->clienteList) && !empty($datosPresupuesto->clienteList)) :
foreach ($datosPresupuesto->clienteList as $k => $v) : ?>
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->cliente_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-sm-6 mb-3">
<label for="referenciaCliente" class="form-label">
<?=lang('Presupuestos.referenciaCliente') ?>
</label>
<input type="text" id="referenciaCliente" name="referencia_cliente" maxLength="100" class="form-control" value="<?=old('referencia_cliente', $presupuestoEntity->referencia_cliente) ?>">
</div>
</div>
</div><!--//.col -->

View File

@ -1,48 +0,0 @@
<div class="col-12 pb-2">
<div id="containerTiradasEnvios" class="row mb-3">
</div>
<div class="row mb-3">
<div class="col-sm-4 mb-3">
<label for="direcciones" class="form-label">Mis direcciones</label>
<select id="direcciones" name="direcciones" class="form-control select2bs2" style="width: 100%;"></select>
</div>
<div class="col-sm-2 mb-3">
<label for="unidadesEnvio" class="form-label">
Unidades
</label>
<input type="number" class="form-control" id="unidadesEnvio" name="unidadesEnvio" maxLength="8" step="1" class="form-control">
</div><!--//.mb-3 -->
<div class="col-sm-2 mb-3 mt-auto mb-0">
<button id="insertarDireccion" type="button" class="btn btn-secondary waves-effect waves-light">Insertar</button>
</div>
<div id="errorDirecciones" class="fv-plugins-message-container invalid-feedback" style="display: none;">
</div>
</div>
<div class="row mb-3">
<div class="col-sm-4 mb-3">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="entregaPieCalle" name="entregaPieCalle" value="1">
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
</div>
</div>
</div>
<div id="divDirecciones" class="col-12 pb-2">
</div>
</div>
<?= $this->section("additionalInlineJs") ?>
window.direcciones = <?= json_encode($presupuestoEntity->direcciones_envio) ?>;
window.direcciones_sel_tirada = <?= json_encode($presupuestoEntity->selected_tirada) ?>;
window.routes_direcciones = {
direcciones: "<?= route_to('getDirecciones') ?>",
getDatos: "<?= route_to('getDatosDireccion') ?>",
nuevaDireccion: "<?= route_to('nuevaDireccion') ?>",
}
<?= $this->endSection() ?>

View File

@ -1,665 +0,0 @@
<div class="col-12 pb-2">
<input hidden readonly style="background: #E8E8E8;" id="id" name="id" maxLength="12" class="form-control" value="<?= old('id', $presupuestoEntity->id) ?>">
<div class="row g-2">
<h3 id="tituloDisenioLibro">Fresado</h3>
<div class="row">
<div class="col-sm-12 mb-3">
<label for="titulo" class="form-label">
<?= lang('Presupuestos.titulo') ?>*
</label>
<input type="text" id="titulo" name="titulo" maxLength="300" class="form-control" value="<?= old('titulo', $presupuestoEntity->titulo) ?>">
</div><!--//.mb-3 -->
</div>
<div class="row">
<div class="col-sm-6 mb-3" <?= $clienteId != 0 && !(auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) ?' style="display:none;"':''?>>
<label for="clienteId" class="form-label">
<?= lang('Presupuestos.clienteId') ?>*
</label>
<select id="clienteId" name="clienteId" class="form-control select2bs2" style="width: 100%;">
<?php if (isset($datosPresupuesto->clienteList) && is_array($datosPresupuesto->clienteList) && !empty($datosPresupuesto->clienteList)) :
foreach ($datosPresupuesto->clienteList as $k => $v) : ?>
<option value="<?= $k ?>" <?= $k == $clienteId ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-sm-6 mb-3">
<label for="referenciaCliente" class="form-label">
<?php if($clienteId == 0): ?>
<?= lang('Presupuestos.referenciaCliente') ?>
<?php else: ?>
<?= lang('Presupuestos.referenciaCliente2') ?>
<?php endif; ?>
</label>
<input type="text" id="referenciaCliente" name="referencia_cliente" maxLength="100" class="form-control" value="<?= old('referencia_cliente', $presupuestoEntity->referencia_cliente) ?>">
</div>
</div>
<div id="tapaDiv" class="row mt-3">
<div class="col-sm-3 mb-md-0 mb-2" id="tapaBlandaDiv">
<div id="tapaBlandaInnerDiv" class="form-check custom-option custom-option-tapa custom-option-basic
<?php echo ($datosPresupuesto->tapa == 'blanda' ? ' checked"': '"'); ?> >
<label class="form-check-label custom-option-content" for="tapaBlanda">
<input name="tapaBlanda" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="" id="tapaBlanda"
<?php echo ($datosPresupuesto->tapa == 'blanda' ? ' checked=""': ''); ?> >
<span class="custom-option-header">
<span class="h6 mb-0">Tapa blanda</span>
</span>
</label>
</div>
</div>
<div id="tapaDuraDiv" class="col-sm-3 mb-md-0 mb-2">
<div class="form-check custom-option custom-option-tapa custom-option-basic
<?php echo ($datosPresupuesto->tapa == 'dura' ? ' checked"': '"'); ?> >
<label class="form-check-label custom-option-content" for="tapaDura">
<input name="tapaDura" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="" id="tapaDura"
<?php echo ($datosPresupuesto->tapa == 'dura' ? ' checked=""': ''); ?> >
<span class="custom-option-header">
<span class="h6 mb-0">Tapa Dura</span>
</span>
</label>
</div>
</div>
</div> <!--//.row -->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">
<h5>Datos presupuesto</h5>
</div>
</div>
<div class="row">
<div id="errorTiradas" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No puede mezclar tiradas mayores de 30 unidades con tiradas menores de 30 unidades</div>
</div>
<div class="row">
<div class="col-sm-3 mb-3">
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?> 1
</label>
<input type="number" class="calcular-presupuesto" id="tirada" name="tirada" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada2" class="form-label">
<?= lang('Presupuestos.tirada') ?> 2
</label>
<input type="number" class="calcular-presupuesto" id="tirada2" name="tirada2" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada2) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada3" class="form-label">
<?= lang('Presupuestos.tirada') ?> 3
</label>
<input type="number" class="calcular-presupuesto" id="tirada3" name="tirada3" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada3) ?>">
</div><!--//.mb-3 -->
<div class="col-sm-3 mb-3">
<label for="tirada4" class="form-label">
<?= lang('Presupuestos.tirada') ?> 4
</label>
<input type="number" class="calcular-presupuesto" id="tirada4" name="tirada4" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->tirada4) ?>">
</div><!--//.mb-3 -->
</div> <!--//.row -->
</div> <!--//.row -->
<div class="row">
<div class="col-sm-3 mb-3">
<label for="paginas" class="form-label">
<?= lang('Presupuestos.paginas') ?>
</label>
<input type="number" class="calcular-presupuesto" id="paginas" name="paginas" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->paginas) ?>">
</div><!--//.mb-3 -->
<div id="div_pagCuadernillo" class="col-sm-3 mb-3">
<label for="paginas_por_cuadernillo" class="form-label">
<?= lang('Presupuestos.paginasCuadernillo') ?>
</label>
<select id="paginasCuadernillo" name="paginas_por_cuadernillo" class="calcular-presupuesto form-control select2bs2" style="width: 100%;">
<?php if (isset($datosPresupuesto->paginasCuadernillo) && is_array($datosPresupuesto->paginasCuadernillo) && !empty($datosPresupuesto->paginasCuadernillo)) :
foreach ($datosPresupuesto->paginasCuadernillo as $value) : ?>
<option value="<?= $value ?>" <?= $value == $presupuestoEntity->paginas_por_cuadernillo ? ' selected' : '' ?>>
<?= $value ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
</div> <!--//.row -->
<div class="row">
<div id="tamanioLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == false ? '' : 'style="display: none"'; ?>>
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
Tamaño Libro*
</label>
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelFormatoList) && is_array($datosPresupuesto->papelFormatoList) && !empty($datosPresupuesto->papelFormatoList)) :
foreach ($datosPresupuesto->papelFormatoList as $formato) : ?>
<option value="<?= $formato->id ?>" <?= $formato->id == $presupuestoEntity->papel_formato_id ? ' selected' : '' ?>>
<?= $formato->tamanio ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div id="anchoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>>
<div class="mb-1">
<label class="form-label" for="papelFormatoAncho">Ancho Libro</label>
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" maxLength="8" step="1" class="form-control formato_libro calcular-presupuesto" value="<?= old('papel_formato_ancho', $presupuestoEntity->papel_formato_ancho) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div id="altoLibroDiv" class="col-sm-3 mb-3" <?= $presupuestoEntity->papel_formato_personalizado == true ? '' : 'style="display: none"'; ?>>
<div class="mb-1">
<label class="form-label" for="papelFormatoAlto">Alto Libro</label>
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" maxLength="8" step="1" class="form-control formato_libro calcular-presupuesto" value="<?= old('papel_formato_alto', $presupuestoEntity->papel_formato_alto) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-sm-3 mb-3 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="papelFormatoPersonalizado" name="papel_formato_personalizado" value="1" <?= $presupuestoEntity->papel_formato_personalizado == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div>
</div> <!--//.row -->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">
<h5>Interior</h5>
</div>
</div>
<div id="errorInterior" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<h6> Color del interior </h6>
<div class="row-color">
<!-- Fila 1 -->
<div class="row mb-2">
<!-- Imagen 1 (Color Negro) -->
<div class="col-sm-4 offset-sm-1 d-flex flex-column align-items-center justify-content-center">
<div id="colorNegroDiv" class="form-check change-tipo-impresion custom-option-color custom-option custom-option-image custom-option-image-radio">
<label class="form-check-label custom-option-content" for="colorNegro">
<span class="custom-option-body">
<img style="height:150px;width:240px" src="<?= site_url('assets/img/bn.png') ?>" alt="">
</span>
</label>
<input name="colorNegro" class="form-check-input calcular-presupuesto" type="radio" value="colorNegro" id="colorNegro"
<?php echo ($datosPresupuesto->color_impresion == 'negro' ? ' checked=""': ''); ?> >
</div>
<!-- Texto alineado debajo de la imagen -->
<div>
<h6 class="mt-2 text-center">Blanco y Negro Estándar</h6>
</div>
</div>
<!-- Imagen 2 (Color Negro HQ) -->
<div class="col-sm-4 d-flex flex-column align-items-center justify-content-center">
<div id="colorNegroHqDiv" class="form-check change-tipo-impresion custom-option-color custom-option custom-option-image custom-option-image-radio">
<label class="form-check-label custom-option-content" for="colorNegroHq">
<span class="custom-option-body">
<img style="height:150px;width:240px" src="<?= site_url('assets/img/bn_hq.png') ?>" alt="">
</span>
</label>
<input name="colorNegroHq" class="form-check-input calcular-presupuesto" type="radio" value="colorNegroHq" id="colorNegroHq"
<?php echo ($datosPresupuesto->color_impresion == 'negroHq' ? ' checked=""': ''); ?> >
</div>
<!-- Texto alineado debajo de la imagen -->
<div>
<h6 class="mt-2 text-center">Blanco y Negro Premium</h6>
</div>
</div>
</div> <!-- //.row -->
<!-- Fila 2 -->
<div class="row mb-2">
<!-- Imagen 3 (Color) -->
<div class="col-sm-4 offset-sm-1 d-flex flex-column align-items-center justify-content-center">
<div id="colorColorDiv" class="form-check change-tipo-impresion custom-option-color custom-option custom-option-image custom-option-image-radio">
<label class="form-check-label custom-option-content" for="colorColor">
<span class="custom-option-body">
<img style="height:150px;width:240px" src="<?= site_url('assets/img/color.png') ?>" alt="">
</span>
</label>
<input name="colorColor" class="form-check-input calcular-presupuesto" type="radio" value="colorColor" id="colorColor"
<?php echo ($datosPresupuesto->color_impresion == 'color' ? ' checked=""': ''); ?> >
</div>
<!-- Texto alineado debajo de la imagen -->
<div>
<h6 class="mt-2 text-center">Color Estándar</h6>
</div>
</div>
<!-- Imagen 4 (Color HQ) -->
<div class="col-sm-4 d-flex flex-column align-items-center justify-content-center">
<div id="colorColorHqDiv" class="form-check change-tipo-impresion custom-option-color custom-option custom-option-image custom-option-image-radio">
<label class="form-check-label custom-option-content" for="colorColorHq">
<span class="custom-option-body">
<img style="height:150px;width:240px" src="<?= site_url('assets/img/color_hq.png') ?>" alt="">
</span>
</label>
<input name="colorColorHq" class="form-check-input calcular-presupuesto" type="radio" value="colorColorHq" id="colorColorHq"
<?php echo ($datosPresupuesto->color_impresion == 'colorHq' ? ' checked=""': ''); ?> >
</div>
<!-- Texto alineado debajo de la imagen -->
<div>
<h6 class="mt-2 text-center">Color Premium</h6>
</div>
</div>
</div> <!-- //.row -->
</div> <!-- //.row-color -->
<div id="pagColorDiv" class="row">
<div class="col-sm-3 mb-3">
<label for="paginasColor" class="form-label">
Páginas a color
</label>
<input type="number" class="calcular-presupuesto" id="paginasColor" name="paginasColor" maxLength="8" step="1" class="form-control" value="<?= old(0, $presupuestoEntity->paginasColor) ?>">
</div><!--//.mb-3 -->
</div>
<h6> Papel </h6>
<div class="row">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelInterior" class="form-label">Tipo de papel</label>
<select id="papelInterior" name="papelInterior" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;"></select>
</div>
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeInterior" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeInterior" name="gramajeInterior" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
</div>
<h6> Opciones extra </h6>
<div class="row" <?= $clienteId != 0 ?' style="display:none;"':' '?>>
<div class="col-sm-3 mb-3 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input calcular-presupuesto" type="checkbox" id="excluirRotativa" name="excluir_rotativa" value="0" <?= $presupuestoEntity->excluir_rotativa == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
</div>
</div>
</div>
<!--SECCION DE CUBIERTA -->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">
<h5>Cubierta</h5>
</div>
</div>
<div id="errorCubierta" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<h6> Papel </h6>
<div class="row">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelCubierta" class="form-label">Tipo de papel</label>
<select id="papelCubierta" name="papelCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelCubierta) && is_array($datosPresupuesto->papelCubierta) && !empty($datosPresupuesto->papelCubierta)) :
foreach ($datosPresupuesto->papelCubierta as $k => $v) : ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeCubierta" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeCubierta" name="gramajeCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
</select>
</div>
</div>
<div class="row">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="carasCubierta" class="form-label">Caras impresas cubierta</label>
<select id="carasCubierta" name="carasCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<option value="2" <?php echo $presupuestoEntity->paginas_cubierta==2?'selected':''?> >
<p><?= lang('Presupuestos.unaCara') ?></p>
</option>
<option value="4" <?php echo $presupuestoEntity->paginas_cubierta==4?'selected':''?>>
<p><?= lang('Presupuestos.dosCaras') ?></p>
</option>
</select>
</div>
</div>
<h6 class='solapas-cubierta'> Opciones extra </h6>
<div class="row solapas-cubierta">
<div class="col-sm-3 mb-md-0 mb-2 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="solapasCubierta" name="solapasCubierta" value="0" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
<label class="form-check-label" for="solapasCubierta">Solapas cubierta</label>
</div>
</div>
<div id="tamanioSolapasCubierta" class="col-sm-3 mb-md-0 mb-2" <?= $presupuestoEntity->solapas == true ? '' : 'style="display: none;"'; ?>>
<label for="anchoSolapasCubierta" class="form-label">Tamaño</label>
<input type="number" id="anchoSolapasCubierta" name="anchoSolapasCubierta" maxLength="8" step="1" class="form-control calcular-presupuesto" value="<?= old(0, $presupuestoEntity->solapas_ancho) ?>">
</div>
</div>
<div class="row">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="acabadosCubierta" class="form-label">Acabados cubierta</label>
<select id="acabadosCubierta" name="acabadosCubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->acabadosCubierta) && is_array($datosPresupuesto->acabadosCubierta) && !empty($datosPresupuesto->acabadosCubierta)) :
foreach ($datosPresupuesto->acabadosCubierta as $acabado) : ?>
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_cubierta_id ? ' selected' : '' ?>>
<?= $acabado->label ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
</div>
<!--SECCION DE SOBRECUBIERTA -->
<div class="divider divider-dark text-start mb-1 sobrecubierta">
<div class="divider-text">
<h5>Sobrecubierta</h5>
</div>
</div>
<div id="errorSobrecubierta" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<div class="row sobrecubierta">
<div class="col-sm-3 mb-md-0 mb-2 d-flex align-items-end">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="enableSobrecubierta" name="enableSobrecubierta" value="0"
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
echo 'checked';
endif; ?>
>
<label class="form-check-label" for="enableSobrecubierta">Añadir sobrecubierta</label>
</div>
</div>
</div>
<h6 class="sobrecubierta enable-sobrecubierta"
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
echo '';
else:
echo 'style="display: none;"';
endif; ?>
> Papel </h6>
<div class="row sobrecubierta enable-sobrecubierta">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelSobrecubierta" class="form-label">Tipo de papel</label>
<select id="papelSobrecubierta" name="papelSobrecubierta" class="form-control select2bs2 calcular-presupuesto input-sobrecubierta" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelSobrecubierta) && is_array($datosPresupuesto->papelSobrecubierta) && !empty($datosPresupuesto->papelSobrecubierta)) :
foreach ($datosPresupuesto->papelSobrecubierta as $k => $v) : ?>
<option value="<?= $v->id ?>">
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
<div class="col-sm-2 mb-md-0 mb-2">
<label for="gramajeSobrecubierta" class="form-label">Gramaje (g/m2)</label>
<select id="gramajeSobrecubierta" name="gramajeSobrecubierta" class="form-control select2bs2 calcular-presupuesto input-sobrecubierta" style="width: 100%;">
</select>
</div>
</div>
<h6 class="sobrecubierta enable-sobrecubierta"
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
echo '';
else:
echo 'style="display: none;"';
endif; ?>
> Opciones extra </h6>
<div class="row sobrecubierta enable-sobrecubierta"
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
echo '';
else:
echo 'style="display: none;"';
endif; ?>
>
<div id="tamanioSolapasSobrecubierta" class="col-sm-3 mb-md-0 mb-2"">
<label for="anchoSolapasSobrecubierta" class="form-label">Tamaño solapas</label>
<input type="number" id="anchoSolapasSobrecubierta" name="anchoSolapasSobrecubierta" maxLength="8" step="1" class="form-control input-sobrecubierta calcular-presupuesto" value="<?= old(0, $presupuestoEntity->solapas_ancho_sobrecubierta) ?>">
</div>
</div>
<div class="row sobrecubierta enable-sobrecubierta"
<?php if (isset($presupuestoEntity->papel_sobrecubierta) && $presupuestoEntity->papel_sobrecubierta>0) :
echo '';
else:
echo 'style="display: none;"';
endif; ?>
>
<div class="col-sm-4 mb-md-0 mb-2">
<label for="acabadosSobrecubierta" class="form-label">Acabados sobrecubierta</label>
<select id="acabadosSobrecubierta" name="acabadosSobrecubierta" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->acabadosSobrecubierta) && is_array($datosPresupuesto->acabadosSobrecubierta) && !empty($datosPresupuesto->acabadosSobrecubierta)) :
foreach ($datosPresupuesto->acabadosSobrecubierta as $acabado) : ?>
<option value="<?= $acabado->id ?>" <?= $acabado->id == $presupuestoEntity->acabado_sobrecubierta_id ? ' selected' : '' ?>>
<?= $acabado->label ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
</div>
<!--SECCION DE GUARDAS -->
<div class="divider divider-dark text-start mb-1 guardas">
<div class="divider-text">
<h5>Guardas</h5>
</div>
</div>
<div id="errorGuardas" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<div>No existe combinación con las opciones seleccionadas. Pruebe con otro papel/gramaje</div>
</div>
<div id="divGuardas" class="row guardas">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="impresionGuardas" class="form-label">Impresión de guardas</label>
<select id="impresionGuardas" name="impresionGuardas" class="form-control select2bs2 comp_guardas_items calcular-presupuesto" style="width: 100%;">
<option value="0"
<?php echo ((!isset($presupuestoEntity->paginas_guardas) || $presupuestoEntity->paginas_guardas==0) ? 'selected' : ''); ?>
>
<p><?= lang('Presupuestos.sinImpresion') ?></p>
</option>
<option value="4"
<?php echo ($presupuestoEntity->paginas_guardas==4 ? 'selected' : ''); ?>
>
<p><?= lang('Presupuestos.unaCara') ?></p>
</option>
<option value="8"
<?php echo ($presupuestoEntity->paginas_guardas==8 ? 'selected' : ''); ?>
>
<p><?= lang('Presupuestos.dosCaras') ?></p>
</option>
</select>
</div>
</div>
<div class="row guardas">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="papelGuardas" class="form-label">Tipo de papel</label>
<select id="papelGuardas" name="papelGuardas" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<?php if (isset($datosPresupuesto->papelGuardas) && is_array($datosPresupuesto->papelGuardas) && !empty($datosPresupuesto->papelGuardas)) :
foreach ($datosPresupuesto->papelGuardas as $k => $v) : ?>
<option value="<?= $v->id ?>" <?php echo ($v->id==$presupuestoEntity->papel_guardas?'selected':'');?> >
<?= $v->nombre ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div>
</div>
<!--SECCION DE SERVICIOS EXTRA -->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">
<h5>Servicios Extra</h5>
</div>
</div>
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="retractilado" class="form-check-label">
<input type="checkbox" id="retractilado" name="retractilado" serv_id="3" value="1" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->retractilado == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.retractilado') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="retractilado5" class="form-check-label">
<input type="checkbox" id="retractilado5" name="retractilado_5" serv_id="5" value="1" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->retractilado5 == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.retractilado5') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="fajaColor" class="form-check-label">
<input type="checkbox" id="fajaColor" name="faja_color" value="1" serv_id="16" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->faja_color == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.fajaColor') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="prototipo" class="form-check-label">
<input type="checkbox" id="prototipo" name="prototipo" value="1" serv_id="9" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->prototipo == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.prototipo') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-3">
<div class="form-check">
<label for="ferro" class="form-check-label">
<input type="checkbox" id="ferro" name="ferro" value="1" serv_id="24" class="form-check-input servicio-extra calcular-presupuesto" <?= $presupuestoEntity->ferro == true ? 'checked' : ''; ?>>
<?= lang('Presupuestos.ferro') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!--//.row -->
<!--SECCION DE OTRAS OPCIONES -->
<div class="divider divider-dark text-start mb-1">
<div class="divider-text">
<h5>Otras opciones</h5>
</div>
</div>
<div class="row">
<div class="col-sm-2 mb-md-0 mb-2">
<label for="ivaReducido" class="form-label">I.V.A. reducido</label>
<select id="ivaReducido" name="ivaReducido" class="form-control select2bs2 calcular-presupuesto" style="width: 100%;">
<option value="1" <?= $presupuestoEntity->iva_reducido == 1? 'selected':''?> >
<p><?= lang('SI') ?></p>
</option>
<option value="0" <?= $presupuestoEntity->iva_reducido == 0? 'selected':''?> >
<p><?= lang('NO') ?></p>
</option>
</select>
</div>
<p class="mt-2">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%.</p>
</div>
</div><!--//.col -->
</div>
<?= $this->section("additionalInlineJs") ?>
window.datosDisenioLibro = {
papel_interior: <?php echo $presupuestoEntity->papel_interior ? $presupuestoEntity->papel_interior : 'null'; ?>,
gramaje_interior: <?php echo $presupuestoEntity->gramaje_interior ? $presupuestoEntity->gramaje_interior : 'null'; ?>,
papel_cubierta: <?php echo $presupuestoEntity->papel_cubierta ? $presupuestoEntity->papel_cubierta : 'null'; ?>,
gramaje_cubierta: <?php echo $presupuestoEntity->gramaje_cubierta ? $presupuestoEntity->gramaje_cubierta : 'null'; ?>,
papel_sobrecubierta: <?php echo $presupuestoEntity->papel_sobrecubierta ? $presupuestoEntity->papel_sobrecubierta : 'null'; ?>,
gramaje_sobrecubierta: <?php echo $presupuestoEntity->gramaje_sobrecubierta ? $presupuestoEntity->gramaje_sobrecubierta : 'null'; ?>,
}
window.routes_disenio_libro = {
obtenerGramaje: "<?= route_to('obtenerGramaje') ?>",
presupuestoCliente: "<?= route_to('presupuestoCliente') ?>",
}
<?= $this->endSection() ?>

View File

@ -1,316 +0,0 @@
<div class="col-12 pb-2">
<div class="row mb-3">
<?php if($presupuestoEntity->estado_id==2): ?>
<h2>PRESUPUESTO ACEPTADO</h2>
<input type="hidden" id="lomo_cubierta" value=<?php echo $presupuestoEntity->lomo_cubierta ?>>
<br>
<?php endif; ?>
<h3>Resumen</h3>
<div class="col-sm-6">
<h5 class="mb-1">Libro</h5>
<p class="mb-0"><small id="tipoLibro"><?php echo (isset($presupuestoEntity->resumen->titulo)?$presupuestoEntity->resumen->titulo:'') ?></small></p>
<p class="mb-0"><small id="resumenTamanio">Tamaño: <?php echo (isset($presupuestoEntity->resumen->tamanio)?$presupuestoEntity->resumen->tamanio:'') ?></small></p>
<p class="mb-0"><small id="resumenPaginas">Número de páginas: <?php echo $presupuestoEntity->paginas ?></small></p>
<p class="mb-0"><small id="resumenTirada">Tirada: <?php echo $presupuestoEntity->tirada ?></small></p>
<p class="mb-0"><small id="resumenPrototipo">Prototipo: <?php echo ($presupuestoEntity->prototipo?'SI':'NO') ?></small></p>
<p class="mb-3"><small id="resumenFerro">Ferro: <?php echo ($presupuestoEntity->ferro?'SI':'NO') ?></small></p>
<h5 class="mb-1">Interior</h5>
<p class="mb-0"><small id="tipoImpresion">Impresion:
<?php echo (isset($presupuestoEntity->resumen->tipo_impresion)?$presupuestoEntity->resumen->tipo_impresion:'') ?>
</small></p>
<p id="pResumenPaginasColor" class="mb-0" <?php echo ($presupuestoEntity->paginasColor==0?'style="display:none"':'')?>>
<small id="resumenPaginasColor">Páginas a color: <?php echo $presupuestoEntity->paginasColor?></small></p>
<p class="mb-3"><small id="resumenPapelInterior">Papel:
<?php echo (isset($presupuestoEntity->papel_interior_nombre)?$presupuestoEntity->papel_interior_nombre:'') ?>
<?php echo (isset($presupuestoEntity->gramaje_interior)?$presupuestoEntity->gramaje_interior:'') ?>gr/m²</small></p>
<h5 class="mb-1">Cubierta</h5>
<p class="mb-0"><small id="resumenPapelCubierta">Papel:
<?php echo (isset($presupuestoEntity->papel_cubierta_nombre)?$presupuestoEntity->papel_cubierta_nombre:''); ?>
<?php echo (isset($presupuestoEntity->gramaje_cubierta)?$presupuestoEntity->gramaje_cubierta:''); ?>gr/m²</small></p>
<p class="mb-0"><small id="resumenCarasCubierta">Impresión: <?php echo ($presupuestoEntity->paginas_cubierta==2?"1 cara":"2 caras");?></small></p>
<?php if($presupuestoEntity->solapas_ancho>0 || $presupuestoEntity->estado_id==1): ?>
<p class="mb-0"><small id="resumenSolapasCubierta">Solapas: <?php echo $presupuestoEntity->solapas_ancho;?>mm</small></p>
<?php endif; ?>
<?php if($presupuestoEntity->acabado_cubierta_id>0 || $presupuestoEntity->estado_id==1): ?>
<p class="mb-3"><small id="resumenAcabadoCubierta">Acabado:
<?php if (isset($datosPresupuesto->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; ?>
</small></p>
<?php endif; ?>
<?php if($presupuestoEntity->papel_sobrecubierta || $presupuestoEntity->estado_id==1): ?>
<h5 class="mb-1 resumen-sobrecubierta">Sobrecubierta</h5>
<p class="mb-0 resumen-sobrecubierta"><small id="resumenPapelSobrecubierta">Papel:
<?php echo (isset($presupuestoEntity->papel_sobrecubierta_nombre)?$presupuestoEntity->papel_sobrecubierta_nombre:'') ?>
<?php echo (isset($presupuestoEntity->gramaje_sobrecubierta)?$presupuestoEntity->gramaje_sobrecubierta:'') ?>gr/m²</small></p>
<?php if($presupuestoEntity->solapas_ancho_sobrecubierta>0 || $presupuestoEntity->estado_id==1): ?>
<p class="mb-0 resumen-sobrecubierta"><small id="resumenSolapasCubierta">Ancho solapas: <?php echo $presupuestoEntity->solapas_ancho_sobrecubierta;?>mm</small></p>
<?php endif; ?>
<p class="mb-3 resumen-sobrecubierta"><small id="resumenAcabadoSobrecubierta">Acabado:
<?php if (isset($datosPresupuesto->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; ?>
</small></p>
<?php endif; ?>
<?php if($presupuestoEntity->papel_guardas || $presupuestoEntity->estado_id==1): ?>
<h5 class="mb-1 resumen-guardas">Guardas</h5>
<p class="mb-0 resumen-guardas"><small id="resumenGuardasPapel">Papel:
<?php echo (isset($presupuestoEntity->papel_guardas_nombre)?$presupuestoEntity->papel_guardas_nombre:''); ?>
170gr/m²</small></p>
<p class="mb-3 resumen-guardas"><small id="resumenGuardasCaras">Impresión:
<?php if(!isset($presupuestoEntity->paginas_guardas) || $presupuestoEntity->paginas_guardas==0):
echo "Sin impresion";
elseif($presupuestoEntity->paginas_guardas==4):
echo "1 cara";
else:
echo "2 caras";
endif; ?></small></p>
<?php endif; ?>
<?php if($presupuestoEntity->retractiladol || $presupuestoEntity->retractilado5 || $presupuestoEntity->faja_color || $presupuestoEntity->estado_id==1): ?>
<h5 class="mb-1 resumen-extras">Extras</h5>
<?php endif; ?>
<?php if($presupuestoEntity->retractiladol): ?>
<p class="mb-0 resumen-extras" id="resumenRetractilado1"><small>Retractilado individual</small></p>
<?php elseif ($presupuestoEntity->retractilado5): ?>
<p class="mb-0 resumen-extras" id="resumenRetractilado5"><small>Retractilado de 5</small></p>
<?php elseif ($presupuestoEntity->faja_color): ?>
<p class="mb-0 resumen-extras" id="resumenFajaColor"><small>Imprimir faja a color</small></p>
<?php endif; ?>
</div>
<div class="col-sm-6">
<?php if($presupuestoEntity->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 '<h4 id="resumenTotalIVA" class="mb-1">Total: ' . round($total, 2) . '€</h4>';
echo '<h6 id="resumenPrecioU" class="mb-0">' . round($total_unidad, 4) . '€/ud</h6>'
?>
<?php else: ?>
<h4 id="resumenTotalIVA" class="mb-1">Total: 100€</h4>
<h6 id="resumenPrecioU" class="mb-0">10.4€/ud</h6>
<?php endif; ?>
<div id="shape-container">
<div id="thumbnail_ec_shape" style="width:350px;height:300px;margin:2.5% auto;"></div>
<div class="d-flex justify-content-center">
<button type="button" id="pv_details" class="btn btn-primary align-content-center"
data-bs-toggle="modal" data-bs-target="#pv_ec_modal">
Previsualizar detalles de cubierta
</button>
</div>
</div>
</div>
</div>
<?php if($presupuestoEntity->estado_id==2):
echo '<div class="row mb-3">';
echo '<h3>Direcciones de envío</h3>';
echo '<div class="col-sm-6">';
if(isset($presupuestoEntity->direcciones_envio)):
foreach ($presupuestoEntity->direcciones_envio as $direccion):
echo '<div class="row mb-3">';
echo '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
echo '<label class="form-check-label custom-option-content">';
echo '<span class="custom-option-header mb-2">';
echo '<h6 class="fw-semibold mb-0">' . $direccion['att'] . '</h6>';
echo '<span class="badge bg-label-primary">' . $direccion['cantidad'] . ' unidades</span>';
echo '</span>';
echo '<span class="custom-option-body">';
echo '<small>' . $direccion['direccion'] . '</small><br>';
echo '<small>' . $direccion['cp'] . '</small><br>';
echo '<small>' . $direccion['municipio'] .', ' . $direccion['pais'] . '</small><br>';
echo '<small>' . $direccion['telefono'] . '</small><br>';
echo '<small>' . $direccion['email'] . '</small><br>';
if($direccion['entregaPieCalle'] == 1){
echo '<small><i>Envío en palets</i></small><br>';
}
echo '<hr class="my-2">';
echo '</span>';
echo '</label>';
echo '</div>';
echo '</div>';
endforeach;
endif;
echo '</div>';
echo '</div>';
endif; ?>
<?php if($presupuestoEntity->estado_id==2): ?>
<div class="row mb-3">
<h3>Ficheros</h3>
<div class="col-12">
<div class="dropzone needsclick" id="dropzone-multi" >
<div class="dz-message needsclick">
Arrastre aquí los ficheros o haga click
</div>
<div class="fallback">
<input name="file" type="file" />
</div>
</div>
</div>
<button id="submit-all" class="btn mt-3 btn-primary btn-submit waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Actualizar ficheros</span>
<i class="ti ti-upload ti-xs"></i>
</button>
</div>
<?php endif; ?>
</div>
<!-- Modal -->
<div class="modal fade" id="pv_ec_modal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Esquema de cubierta</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body" >
<div id="pv_ec_shape" style="width:850px;height:600px;margin:2.5% auto;"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
<?= $this->section("additionalInlineJs") ?>
window.estado = <?= $presupuestoEntity->estado_id ?? 1?>;
window.tirada = <?= $presupuestoEntity->selected_tirada ?? 0?>;
window.total = <?= $presupuestoEntity->total_aceptado ?? 0?>;
window.total_unidad = <?= $presupuestoEntity->total_precio_unidad ?? 0 ?>;
window.routes_resumen = {
guardarPresupuesto: "<?= route_to('guardarPresupuesto') ?>",
duplicarPresupuesto: "<?= route_to('duplicarPresupuesto') ?>",
}
<?php if ($presupuestoEntity->estado_id===2): ?>
previewEsquemaCubierta(true);
const previewTemplate = `<div class="dz-preview dz-file-preview">
<div class="dz-details">
<div class="dz-thumbnail">
<!---<img data-dz-thumbnail>
<span class="dz-nopreview">No preview</span> --->
<div class="dz-success-mark"></div>
<div class="dz-error-mark"></div>
<div class="dz-error-message"><span data-dz-errormessage></span></div>
<div class="progress">
<div class="progress-bar progress-bar-primary" role="progressbar" aria-valuemin="0" aria-valuemax="100" data-dz-uploadprogress></div>
</div>
</div>
<div class="dz-filename" data-dz-name></div>
<div class="dz-size" data-dz-size></div>
</div>
</div>`;
Dropzone.autoDiscover = false;
var dropzoneMulti = new Dropzone('#dropzone-multi', {
url: "<?= site_url('presupuestos/presupuestocliente/upload_files') ?>",
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: "<?= site_url('presupuestos/presupuestocliente/get_files') ?>",
type: 'POST',
data: { presupuesto_id: <?= $presupuestoEntity->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("<span class='dz-remove'>Ver</span>");
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', <?= $presupuestoEntity->id ?>);
$.ajax({
url: "<?= site_url('presupuestos/presupuestocliente/upload_files') ?>",
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;
});
<?php endif; ?>
<?= $this->endSection() ?>

View File

@ -1,122 +0,0 @@
<div class="col-12 pb-2">
<div class="tipo_libro">
<input type="hidden" id="lomo_cubierta" value=<?php echo $presupuestoEntity->lomo_cubierta ?>>
<div class="row row-cols-3 mb-6 d-flex justify-content-center d-flex justify-content-center">
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="cosidoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio
<?php
if($datosPresupuesto->tipo_libro == 'cosido' || $datosPresupuesto->tipo_libro == ''){
echo ' checked"';
}
else
{
echo '"';
}
?>
>
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoCosido">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_cosido.png") ?>" alt="radioImg">
</span>
</label>
<input name="cosido" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoCosido"
id="tipoCosido"
<?php
if($datosPresupuesto->tipo_libro == 'cosido' || $datosPresupuesto->tipo_libro == ''){
echo 'checked=""';
}
?>
>
</div>
<h4 class="text-center">Rústica cosido</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="fresadoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio
<?php echo ($datosPresupuesto->tipo_libro == 'fresado' ? ' checked"': '"'); ?> >
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoFresado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_fresado.png") ?>" alt="radioImg2">
</span>
</label>
<input name="fresado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoFresado"
id="tipoFresado" <?php echo (($datosPresupuesto->tipo_libro)=='fresado'? 'checked=""':''); ?> >
</div>
<h4 class="text-center">Rústica fresado</h4>
</div>
</div>
<div class="container col-md-4 mb-6 d-flex justify-content-center" style="margin-bottom: 40px;">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="grapadoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio
<?php echo ($datosPresupuesto->tipo_libro == 'grapado' ? ' checked"': '"'); ?> >
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoGrapado">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_grapado.png") ?>" alt="radioImg3">
</span>
</label>
<input name="grapado" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoGrapado"
id="tipoGrapado" <?php echo (($datosPresupuesto->tipo_libro)=='grapado'? 'checked=""':''); ?> >
</div>
<h4 class="text-center">Cosido con grapas</h4>
</div>
</div>
</div>
<div class="row row-cols-3 d-flex justify-content-center d-flex justify-content-center">
<div class="col-md-4 mb-6 d-flex justify-content-center">
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="espiralDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio
<?php echo ($datosPresupuesto->tipo_libro == 'espiral' ? ' checked"': '"'); ?> >
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoEspiral">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_espiral.png") ?>" alt="radioImg4">
</span>
</label>
<input name="espiral" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoEspiral"
id="tipoEspiral" <?php echo (($datosPresupuesto->tipo_libro)=='espiral'? 'checked=""':''); ?> >
</div>
<h4 class="text-center">Espiral</h4>
</div>
</div>
<div class="col-md-4 mb-6 d-flex justify-content-center" >
<div>
<div style="max-width:200px;max-height:200px;padding-right:0px" id="wireoDiv"
class="form-check custom-option-tipo custom-option custom-option-image custom-option-image-radio
<?php echo ($datosPresupuesto->tipo_libro == 'wireo' ? ' checked"': '"'); ?> >
<label style="max-width:200px;max-height:200px;" class="form-check-label custom-option-content"
for="tipoWireO">
<span class="custom-option-body">
<img style="max-width:200px;max-height:200px;"
src="<?= site_url("assets/img/libro_wire-o.png") ?>" alt="radioImg5">
</span>
</label>
<input name="wireo" class="form-check-input elementos-libro calcular-presupuesto" type="radio" value="tipoWireO"
id="tipoWireO" <?php echo (($datosPresupuesto->tipo_libro)=='wireo'? 'checked=""':''); ?> >
</div>
<h4 class="text-center">Wire-o</h4>
</div>
</div>
</div>
</div>
</div>

View File

@ -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('<option value="' + value.id + '">' + value.text + '</option>');
});
$("#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 += '<div class="col-sm-3">';
html += '<div id=div-env_' + id + ' class="form-check custom-option custom-option-basic custom-option-tiradasDirecciones">';
html += '<label class="form-check-label custom-option-content" for="tiradaEnvios' + i + '">';
html += '<input name=env_"' + id + '" peso="' + peso + '" class="form-check-input" type="radio" value="" id="env_' + id + '"></input>';
html += '<span class="custom-option-header">';
html += '<span id="tiradaDireccionesValue' + i + '" class="h6 mb-0">' + $('#' + tirada_id).text().split(' ')[0] + '</span>';
html += '<span class="text-muted">' + $('#' + total_id).text() + '</span>';
html += '</span>';
html += '<span class="custom-option-body">';
html += '<small>' + $('#' + precio_u_id).text() + '</small>';
html += '</span>';
html += '</label>';
html += '</div>';
html += '</div>';
$('#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<window.direcciones.length; i++){
const tipo = window.direcciones[i].entregaPieCalle == 1?'palets':'cajas';
let html = '';
html += '<div id="envioId' + window.direcciones[i].direccion_id + '" t="' + tipo + '" p= ' +window.direcciones[i].precio + ' class="row mb-3">';
html += '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
html += '<label class="form-check-label custom-option-content" for="customRadioAddress1">';
html += '<span class="custom-option-header mb-2">';
html += '<h6 class="fw-semibold mb-0">' + window.direcciones[i].att + '</h6>';
html += '<span class="badge bg-label-primary">' + window.direcciones[i].cantidad + ' unidades</span>';
html += '</span>';
html += '<span class="custom-option-body">';
html += '<small>' + window.direcciones[i].direccion + '</small><br>';
html += '<small>' + window.direcciones[i].cp + '</small><br>';
html += '<small>' + window.direcciones[i].municipio +', ' + window.direcciones[i].pais + '</small><br>';
html += '<small>' + window.direcciones[i].telefono + '</small><br>';
html += '<small>' + window.direcciones[i].email + '</small><br>';
if(tipo == 'palets'){
html += '<small><i>Envío en palets</i></small><br>';
}
html += '<hr class="my-2">';
html += '<span class="d-flex">';
html += '<a class="eliminar-direccion" href="javascript:void(0)">Eliminar</a>';
html += '</span>';
html += '</span>';
html += '</label>';
html += '</div>';
html += '</div>';
$('#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<elements.length; index++){
let unidades_direcciones = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
total += unidades_direcciones;
};
}
return total;
}
$('#insertarDireccion').on('click', function() {
if( $('#direcciones').val() > 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 += '<div id="envioId' + response.data[0].id + '" t="' +response.data[0].tipo + '" p= ' +response.data[0].coste + ' class="row mb-3">';
html += '<div class="col-sm-5 form-check custom-option custom-option-basic checked">';
html += '<label class="form-check-label custom-option-content" for="customRadioAddress1">';
html += '<span class="custom-option-header mb-2">';
html += '<h6 class="fw-semibold mb-0">' + response.data[0].att + '</h6>';
html += '<span class="badge bg-label-primary">' + unidades + ' unidades</span>';
html += '</span>';
html += '<span class="custom-option-body">';
html += '<small>' + response.data[0].direccion + '</small><br>';
html += '<small>' + response.data[0].cp + '</small><br>';
html += '<small>' + response.data[0].municipio +', ' + response.data[0].pais + '</small><br>';
html += '<small>' + response.data[0].telefono + '</small><br>';
html += '<small>' + response.data[0].email + '</small><br>';
if(response.data[0].tipo == 'palets'){
html += '<small><i>Envío en palets</i></small><br>';
}
html += '<hr class="my-2">';
html += '<span class="d-flex">';
html += '<a class="eliminar-direccion" href="javascript:void(0)">Eliminar</a>';
html += '</span>';
html += '</span>';
html += '</label>';
html += '</div>';
html += '</div>';
$('#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<elements.length; index++){
let unidades_direcciones = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
total += unidades_direcciones;
};
}
if(total <= tirada) {
$('#errorDirecciones').hide();
}
return false;
});
$('#direcciones').on('change', function() {
if( $('#direcciones').val() == 0 ) {
$("#addressForm").attr('action','create')
var $newAddDialog = $("#addressForm")
$newAddDialog.modal('show')
$newAddDialog.on('hidden.bs.modal', function (e) {
$('#direcciones').val('');
});
}
})
function saveAdd_callback(){
if($('#addressForm').attr('action')=='create'){
let data = {
cliente_id: $('#clienteId').val(),
alias: $('#add_alias').val(),
att: $('#add_att').val(),
email: $('#add_email').val(),
direccion: $('#add_direccion').val(),
pais_id: $("#add_pais_id option:selected").val(),
municipio: $('#add_municipio').val(),
provincia: $('#add_provincia').val(),
cp: $('#add_cp').val(),
telefono: $('#add_telefono').val(),
}
data = Object.assign(data, window.token_ajax)
$.ajax({
url: window.routes_direcciones.nuevaDireccion,
type: 'POST',
data: data,
success: function(response) {
$("#direcciones").empty();
$.each(response.data, function(index, value) {
$("#direcciones").append('<option value="' + value.id + '">' + value.text + '</option>');
});
$("#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<elements.length; index++){
const unidades = parseInt($(elements[index]).find('div label span span').text().split(' ')[0]);
const id = $(elements[index]).attr('id').replace('envioId', '');
const tipo = $(elements[index]).attr('t');
direcciones.push({
unidades: unidades,
id: id,
tipo: tipo,
})
};
}
return direcciones;
}

View File

@ -1,789 +0,0 @@
$('#papelFormatoPersonalizado').on('change', function () {
if ($(this).is(":checked")) {
$('#tamanioLibroDiv').hide();
$('#anchoLibroDiv').show();
$('#altoLibroDiv').show();
$('#papelFormatoId').val('').trigger('change');
} else {
$('#tamanioLibroDiv').show();
$('#anchoLibroDiv').hide();
$('#altoLibroDiv').hide();
}
});
// Init custom option check
function initTapaCheck() {
const _this = this
const tapaOptionList = [].slice.call(document.querySelectorAll('.custom-option-tapa .form-check-input'))
tapaOptionList.map(function (customOptionEL) {
// Update custom options check on page load
_this.updateTapaCheck(customOptionEL)
// Update custom options check on click
customOptionEL.addEventListener('click', e => {
_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($('<option>', {
value: window.datosDisenioLibro.gramaje_interior,
text: window.datosDisenioLibro.gramaje_interior
}));
$('#gramajeInterior').val(window.datosDisenioLibro.gramaje_interior);
$('#papelCubierta').val('').trigger('change');
$('#papelCubierta').val(window.datosDisenioLibro.papel_cubierta);
$('#gramajeCubierta').append($('<option>', {
value: window.datosDisenioLibro.gramaje_cubierta,
text: window.datosDisenioLibro.gramaje_cubierta
}));
$('#gramajeCubierta').val(window.datosDisenioLibro.gramaje_cubierta);
$('#papelSobrecubierta').val('').trigger('change');
$('#papelSobrecubierta').val(window.datosDisenioLibro.papel_sobrecubierta);
$('#gramajeSobrecubierta').append($('<option>', {
value: window.datosDisenioLibro.gramaje_sobrecubierta,
text: window.datosDisenioLibro.gramaje_sobrecubierta
}));
$('#gramajeSobrecubierta').val(window.datosDisenioLibro.gramaje_sobrecubierta);
$('#enableSobrecubierta').trigger('change');
}
$('.change-tipo-impresion').on('change', function () {
let isColor = false;
if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isColor = true;
let isHq = false;
if($('#colorNegroDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isHq = true;
//si es color hay que mostrar el numero de paginas a color
if (isColor) {
$('#pagColorDiv').show();
if($('#paginasColor').val() == '')
$('#paginasColor').val('0');
}
else {
$('#pagColorDiv').hide();
$('#paginasColor').val('0');
}
var data = [];
if (!isColor && !isHq) {
data = window.datosPresupuesto.papelInteriorNegro;
}
else if (!isColor && isHq) {
data = window.datosPresupuesto.papelInteriorNegroHq;
}
else if (isColor && !isHq) {
data = window.datosPresupuesto.papelInteriorColor;
}
else if (isColor && isHq) {
data = window.datosPresupuesto.papelInteriorColorHq;
}
var dropdown = $("#papelInterior");
dropdown.empty();
$.each(data, function () {
dropdown.append($("<option />").val(this.id).text(this.nombre));
});
//Se quita la seleccion del dropdown
dropdown.val('').trigger('change');
$('#gramajeInterior').val('').trigger('change');
});
$('#tirada').on('change', function () {
const valInterior = $('#gramajeInterior option:selected').val();
const valCubierta = $('#gramajeCubierta option:selected').val();
const valSobrecubierta = $('#gramajeSobrecubierta option:selected').val();
$('#papelInterior').trigger('change');
$('#papelCubierta').trigger('change');
$('#papelSobrecubierta').trigger('change');
});
$('#papelInterior').on('change', function () {
let isColor = false;
if($('#colorColorDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isColor = true;
let isHq = false;
if($('#colorNegroDiv').hasClass('checked') || $('#colorColorHqDiv').hasClass('checked'))
isHq = true;
if ($('#papelInterior option:selected').val() != undefined) {
var uso = 'bn';
if (!isColor && !isHq) {
uso = 'bn';
}
else if (!isColor && isHq) {
uso = 'bnhq';
}
else if (isColor && !isHq) {
uso = 'color';
}
else if (isColor && isHq) {
uso = 'colorhq';
}
datos = {
tirada: $('#tirada').val(),
merma: 0,
uso: uso,
papel: $('#papelInterior option:selected').text()
};
datos = Object.assign(datos, window.token_ajax)
const valInterior = $('#gramajeInterior option:selected').val();
$.ajax({
url: window.routes_disenio_libro.obtenerGramaje,
type: 'POST',
data: datos,
success: function (response) {
if(response.menu){
$('#gramajeInterior').empty();
$(response.menu).each(function (index, element) {
$('#gramajeInterior').append($("<option />").val(element.id).text(element.text));
});
}
if (valInterior != undefined && valInterior != '')
$('#gramajeInterior option[value=' + valInterior + ']').prop('selected', true).trigger('change');
else
$('#gramajeInterior').val('').trigger('change');
}
});
}
});
$('#papelCubierta').on('change', function () {
let isColor = true;
let isHq = true;
if ($('#papelCubierta option:selected').val() != undefined) {
var uso = 'cubierta';
datos = {
tirada: $('#tirada').val(),
merma: 0,
uso: uso,
papel: $('#papelCubierta option:selected').text().trim()
};
datos = Object.assign(datos, window.token_ajax)
const valCubierta = $('#gramajeCubierta option:selected').val();
$.ajax({
url: window.routes_disenio_libro.obtenerGramaje,
type: 'POST',
data: datos,
success: function (response) {
$('#gramajeCubierta').empty();
$(response.menu).each(function (index, element) {
$('#gramajeCubierta').append($("<option />").val(element.id).text(element.text));
});
if (valCubierta != undefined && valCubierta != '')
$('#gramajeCubierta option[value=' + valCubierta + ']').prop('selected', true).trigger('change');
else
$('#gramajeCubierta').val('').trigger('change');
}
});
}
});
$('#papelSobrecubierta').on('change', function () {
let isColor = true;
let isHq = true;
if ($('#papelSobrecubierta option:selected').val() != undefined) {
var uso = 'sobrecubierta';
datos = {
tirada: $('#tirada').val(),
merma: 0,
uso: uso,
papel: $('#papelSobrecubierta option:selected').text().trim()
};
datos = Object.assign(datos, window.token_ajax)
const valSobrecubierta = $('#gramajeSobrecubierta option:selected').val();
$.ajax({
url: window.routes_disenio_libro.obtenerGramaje,
type: 'POST',
data: datos,
success: function (response) {
$('#gramajeSobrecubierta').empty();
$(response.menu).each(function (index, element) {
$('#gramajeSobrecubierta').append($("<option />").val(element.id).text(element.text));
});
if (valSobrecubierta != undefined)
$('#gramajeSobrecubierta option[value=' + valSobrecubierta + ']').prop('selected', true).trigger('change');
else
$('#gramajeSobrecubierta').val('').trigger('change');
}
});
}
});
$('#solapasCubierta').on('change', function () {
if ($(this).is(":checked")) {
$('#tamanioSolapasCubierta').show();
} else {
$('#tamanioSolapasCubierta').hide();
}
});
// Funcion que comprueba que están rellenos todos los datos necesarios para calcular el presupuesto
function checkValues() {
const tirada = $('#tirada').val();
const paginas = $('#paginas').val();
const papelInterior = $('#papelInterior option:selected').val();
const gramajeInterior = $('#gramajeInterior option:selected').text();
const papelCubierta = $('#papelCubierta option:selected').val();
const gramajeCubierta = $('#gramajeCubierta option:selected').text();
const papelFormatoAlto = $('#papelFormatoAlto').val();
const papelFormatoAncho = $('#papelFormatoAncho').val();
const clienteId = $('#clienteId').val();
if (paginas == '' || isNaN(paginas) || parseInt(paginas) <= 0) {
return false;
}
if(parseInt(paginas)%2!=0){
$('#paginas').val(parseInt(paginas)+1).trigger('change');
return false;
}
if(clienteId == '' || isNaN(clienteId) || parseInt(clienteId) <= 0){
return false;
}
if (tirada == '' || isNaN(tirada) || parseInt(tirada) <= 0) {
return false;
}
if (papelInterior == '' || gramajeInterior == '') {
return false;
}
if (papelCubierta == '' || gramajeCubierta == '') {
return false;
}
if ($('#papelFormatoId').val() == null && !$('#papelFormatoPersonalizado').is(':checked')){
return false;
}
if($('#papelFormatoPersonalizado').is(':checked')){
if(papelFormatoAncho == '' || parseInt(papelFormatoAncho) <= 0 ||
papelFormatoAlto == '' || parseInt(papelFormatoAlto) <= 0){
return false;
}
}
return true;
}
function getTiradas() {
let tiradas = [];
tiradas.push(parseInt($('#tirada').val()));
if ($('#tirada2').val().length > 0 && parseInt($('#tirada2').val()) > 0)
tiradas.push(parseInt($('#tirada2').val()));
if ($('#tirada3').val().length > 0 && parseInt($('#tirada3').val()) > 0)
tiradas.push(parseInt($('#tirada3').val()));
if ($('#tirada4').val().length > 0 && parseInt($('#tirada4').val()) > 0)
tiradas.push(parseInt($('#tirada4').val()));
return tiradas;
}
function getDimensionLibro() {
var ancho = 0;
var alto = 0;
if ($('#papelFormatoId option:selected').length > 0) {
var selectedText = $('#papelFormatoId option:selected').text();
if (selectedText.length > 0) {
ancho = parseFloat(selectedText.trim().split(" x ")[0]);
alto = parseFloat(selectedText.trim().split(" x ")[1]);
}
else if (document.getElementById('papelFormatoPersonalizado').checked) {
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
}
else if (document.getElementById('papelFormatoPersonalizado').checked) {
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
}
return {
ancho: ancho,
alto: alto
}
}
$('#retractilado').on('change', function () {
if ($(this).is(':checked')) {
if ($('#retractilado5').is(':checked'))
$('#retractilado5').prop('checked', false);
}
});
$('#retractilado5').on('change', function () {
if ($(this).is(':checked')) {
if ($('#retractilado').is(':checked'))
$('#retractilado').prop('checked', false);
}
});
$('.elementos-libro').on('change', function () {
// Libro cosido
if ($('#cosidoDiv').hasClass('checked')) {
$('#tituloDisenioLibro').text("Rústica cosido");
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
// Cosido tapa blanda
$('.guardas').hide();
$('.solapas-cubierta').show();
$('.sobrecubierta').show();
$('#enableSobrecubierta').trigger('change');
}
else {
// Cosido tapa dura
$('.guardas').show();
numCarasGuardas(2);
$('.solapas-cubierta').hide();
$('.sobrecubierta').show();
$('#enableSobrecubierta').trigger('change');
}
}
// Libro fresado
else if ($('#fresadoDiv').hasClass('checked')) {
$('#tituloDisenioLibro').text("Rústica fresado");
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
// fresado tapa blanda
$('.guardas').hide();
$('.solapas-cubierta').show();
$('.sobrecubierta').show();
$('#enableSobrecubierta').trigger('change');
}
else {
// fresado tapa dura
$('.guardas').show();
numCarasGuardas(2);
$('.solapas-cubierta').hide();
$('.sobrecubierta').show();
$('#enableSobrecubierta').trigger('change');
}
}
// Libro grapado
else if ($('#grapadoDiv').hasClass('checked')) {
$('#tituloDisenioLibro').text("Cosido con grapas");
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
// grapado tapa blanda
$('.guardas').hide();
$('.solapas-cubierta').show();
$('.sobrecubierta').hide();
$('#enableSobrecubierta').prop('checked', false);
}
}
// Libro wire-o
else if ($('#wireoDiv').hasClass('checked')) {
$('#tituloDisenioLibro').text("Wire-O");
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
// wire-o tapa blanda
$('.guardas').hide();
$('.solapas-cubierta').show();
$('.sobrecubierta').hide();
$('#enableSobrecubierta').prop('checked', false);
}
else {
// wire-o tapa dura
$('.guardas').show();
numCarasGuardas(1);
$('.solapas-cubierta').hide();
$('.sobrecubierta').hide();
$('#enableSobrecubierta').prop('checked', false);
}
}
// Libro espiral
else if ($('#espiralDiv').hasClass('checked')) {
$('#tituloDisenioLibro').text("Espiral");
if ($('#tapaBlandaInnerDiv').hasClass('checked')) {
// espiral tapa blanda
$('.guardas').hide();
$('.solapas-cubierta').show();
$('.sobrecubierta').hide();
$('#enableSobrecubierta').prop('checked', false);
}
else {
// espiral tapa dura
$('.espiral').show();
numCarasGuardas(1);
$('.solapas-cubierta').hide();
$('.sobrecubierta').hide();
$('#enableSobrecubierta').prop('checked', false);
}
}
});
function numCarasGuardas(numCaras) {
if (numCaras == 1) {
$("#impresionGuardas option[value='8']").remove();
}
else {
if ($("#impresionGuardas option[value='8']").length == 0)
$("#impresionGuardas").append('<option value="8">' + window.Presupuestos.dosCaras + '</option>');
}
}
$('.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 += '<div id="' + label + '" peso="' +response.peso[i]+ '" class="list-group" >';
html += '<a href="javascript:void(0);" class="list-group-item list-group-item-action">';
html += '<div class="li-wrapper d-flex justify-content-start align-items-center" >';
html += '<div class="list-content">';
html += '<h7 id="ud_' + label + '" class="mb-1">' + (response.tiradas[i] + ' ud.') + '</h7>';
html += '<h6 id="tot_' + label + '" class="mb-1">' + ('Total: ' + total + '€') + '</h6>';
html += '<h7 id="pu_' + label + '" class="mb-1">' + (response.precio_u[i] + '€/ud') + '</h7>';
html += '</div>';
html += '</div>'
html += '</a>';
html += '</div>';
$('#divTiradasPrecio').append(html);
}
}
if($('#resumen-libro').hasClass('active')) {
initDirecciones();
initTiradasDirecciones();
generarResumen();
previewEsquemaCubierta(true);
}
}
},
error: function (error) {
$('#loader').hide();
$('#divTiradasPrecio').empty();
}
});
}

View File

@ -0,0 +1,30 @@
<div class="col-12" style="min-height: 50px;">
<div id="btnsDiv" class="d-flex w-100 position-relative" style="margin-top: 40px;">
<div class="me-auto">
<div id="btnPrint" class="btn mt-3 btn-secondary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_print2') ?></span>
</div>
</div>
<div class="position-absolute start-50 translate-middle-x">
<div id="btnPrev" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_prev') ?></span>
</div>
<div id="btnNext" class="btn mt-3 btn-primary waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_next') ?></span>
</div>
</div>
<div class="ms-auto">
<div id="btnConfirm" class="btn mt-3 btn-success waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_confirm') ?></span>
</div>
<div id="btnSave" class="btn mt-3 btn-primary waves-effect waves-light ml-2 d-none">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i><?= lang('App.global_save') ?></span>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,296 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Datos del libro </h3>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<label for="titulo" class="form-label">
<?= lang('Presupuestos.titulo') ?>*
</label>
<input type="text" id="titulo" placeholder="Introduzca el título de la publicación" name="titulo"
maxLength="300" class="form-control text-center" value="">
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<label for="autor" class="form-label">
<?= lang('Presupuestos.autor') ?>
</label>
<input type="text" id="autor" placeholder="Autor" name="autor" maxLength="150" class="form-control text-center" value="">
</div>
<div class="row justify-content-center">
<div class="col-sm-4 mb-3">
<label for="isbn" class="form-label">
<?=lang('Presupuestos.isbn') ?>
</label>
<input type="text" id="isbn" name="isbn" placeholder="ISBN" maxLength="50" class="form-control" value="">
</div>
<div class="col-sm-4 mb-3">
<label for="coleccion" class="form-label">
<?= lang('Presupuestos.coleccion') ?>
</label>
<input type="text" id="coleccion" name="coleccion" placeholder="Coleccion" maxLength="255" class="form-control" value="">
</div>
<div class="col-sm-4 mb-3">
<label for="referenciaCliente" class="form-label">
<?=lang('Presupuestos.referenciaCliente') ?>
</label>
<input type="text" id="referenciaCliente" name="referencia_cliente" placeholder="Referencia cliente" maxLength="100" class="form-control" value="">
</div>
</div>
<div class="col-sm-5 mb-3 d-flex flex-column align-items-center">
<label id="label_clienteId" for="clienteId" class="form-label">
Cliente*
</label>
<select id="clienteId" name="cliente_id" class="form-control select2bs2 calcular-presupuesto"
style="width: 100%;">
</select>
</div>
<div class="row col-sm-5 mb-3 d-flex flex-column align-items-center">
<div class="form-check form-switch mb-2">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
name="excluir_rotativa" value="1">
<label class="form-check-label" for="excluirRotativa">Excluir rotativa</label>
</div>
</div>
<div class="row col-sm-10 mb-3 justify-content-center">
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada" class="form-label">
<?= lang('Presupuestos.tirada') ?> 1*
</label>
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada"
name="tirada" step="1" value="50">
</div>
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada2" class="form-label">
<?= lang('Presupuestos.tirada') ?> 2
</label>
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada2"
name="tirada2" step="1" value="">
</div>
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada3" class="form-label">
<?= lang('Presupuestos.tirada') ?> 3
</label>
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada3"
name="tirada3" step="1" value="">
</div>
<div class="col-sm-2 d-flex flex-column align-items-center mx-1">
<label for="tirada4" class="form-label">
<?= lang('Presupuestos.tirada') ?> 4
</label>
<input type="number" class="calcular-presupuesto form-control text-center num-input" id="tirada4"
name="tirada4" step="1" value="">
</div>
</div> <!--//.row -->
<div class="col-sm-10 d-flex flex-column align-items-center justify-content-center">
<div id="formatoEstandar" class="col-sm-4 mb-1 d-flex flex-column align-items-center">
<label id="label_papelFormatoId" for="papelFormatoId" class="form-label">
Formato Libro*
</label>
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2 calcular-presupuesto"
style="width: 100%;">
</select>
</div>
<div id="formatoPersonalizado" class="row col-sm-8 justify-content-center d-none">
<div class="col-sm-3 mb-1 mx-1">
<label class="form-label" for="papelFormatoAncho">Ancho Libro*</label>
<input type="number" id="papelFormatoAncho" name="papel_formato_ancho" step="1"
class="form-control formato_libro calcular-presupuesto num-input" min="60" value="60">
</div>
<div class="col-sm-3 mb-1 mx-1">
<label class="form-label" for="papelFormatoAlto">Alto Libro*</label>
<input type="number" id="papelFormatoAlto" name="papel_formato_alto" step="1"
class="form-control formato_libro calcular-presupuesto num-input" min="60" value="60">
</div>
</div>
<div class="row col-sm-4 mb-3 d-flex flex-column align-items-center">
<div class="form-check form-switch mb-2">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="papelFormatoPersonalizado"
name="papel_formato_personalizado" value="1">
<label class="form-check-label"
for="papelFormatoPersonalizado"><?= lang('Presupuestos.papelFormatoPersonalizado') ?></label>
</div>
</div>
</div>
<div class="row col-sm-9 mb-5 justify-content-center">
<div class="row justify-content-center">
<div class="col-sm-3">
<label for="paginasColor" class="form-label">
<?= lang('Presupuestos.paginasColor') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasColor"
name="paginasColor" step="1" value="0">
<div class="form-text">
Siempre deben ser pares
</div>
</div>
<div class="col-sm-3">
<label for="paginasNegro" class="form-label">
<?= lang('Presupuestos.paginasNegro') ?>
</label>
<input type="number" class="form-control calcular-presupuesto input-paginas num-input" id="paginasNegro"
name="paginasNegro" step="1" value="32">
<div class="form-text">
Siempre deben ser pares
</div>
</div>
<div class="col-sm-3">
<label for="paginas" class="form-label">
<?= lang('Presupuestos.totalPaginas') ?>
</label>
<input readonly class="form-control calcular-presupuesto" id="paginas" name="paginas" step="1"
value="32">
</div>
</div>
<div id='divPaginasCuadernillo' class="row col-sm-9 justify-content-left d-none">
<div class="col-sm-4 mb-5">
<label for="paginas_por_cuadernillo" class="form-label">
<?= lang('Presupuestos.paginasCuadernillo') ?>
</label>
<select id="paginasCuadernillo" name="paginas_por_cuadernillo"
class="calcular-presupuesto form-control select2bs2" style="width: 100%;">
<option value="32" selected>32</option>
<option value="28">28</option>
<option value="24">24</option>
<option value="20">20</option>
<option value="16">16</option>
</select>
</div>
</div>
<div class="row mt-2 justify-content-center">
<div id="divPaginasColorConsecutivas" class="form-check col-sm-9 form-switch mb-2 d-none">
<input class="form-check-input" type="checkbox" id="pagColorConsecutivas" name="pag_color_consecutivas"
value="1">
<label class="form-check-label"
for="pagColorConsecutivas"><?= lang('Presupuestos.paginasColorConsecutivas') ?></label>
</div>
<div id="divPosPaginasColor" class="col-sm-9 d-none">
<label for="posPaginasColor" class="form-label">
<?= lang('Presupuestos.posicionPagColor') ?>
</label>
<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>
</div>
</div>
<div class="row mt-2 justify-content-center">
<div id="divPapelDiferente" class="form-check col-sm-9 form-switch mb-2 d-none">
<input class="form-check-input" type="checkbox" id="papelDiferente" name="papel_diferente" value="1">
<label class="form-check-label" for="papelDiferente"><?= lang('Presupuestos.papelDiferente') ?></label>
</div>
</div>
</div>
<div id="divTipoLibro" name="div_tipo_libro" class="row col-sm-10 mb-3 justify-content-center">
<div id="fresado" class="tipo-libro calcular-presupuesto imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
alt="Fresado">
<div class="form-text text-center">
Fresado (a partir de 32 páginas)
</div>
</div>
<div id="grapado" class="tipo-libro calcular-presupuesto imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
alt="Grapado">
<div class="form-text text-center">
Grapado (entre 12 y 40 páginas)
</div>
</div>
<div id="espiral" class="tipo-libro calcular-presupuesto imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
alt="Espiral">
<div class="form-text text-center">
Espiral
</div>
</div>
<div id="cosido" class="tipo-libro calcular-presupuesto imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
alt="Cosido">
<div class="form-text text-center">
Cosido (a partir de 32 páginas)
</div>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Servicios extra </h3>
</div>
<div class="row col-sm-9 mb-3 d-flex flex-column align-items-left">
<div class="col-sm-3 form-check form-switch mb-2">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="prototipo" name="prototipo"
value="1">
<label class="form-check-label" for="prototipo">Prototipo</label>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Otros </h3>
</div>
<div class="row col-sm-10 mb-3">
<div class="col-sm-2 mb-md-0 mb-2">
<label for="ivaReducido" class="form-label">I.V.A. reducido</label>
<select id="ivaReducido" name="ivaReducido" class="form-control select2bs2 calcular-presupuesto"
style="width: 100%;">
<option value="1" selected>
<p><?= lang('SI') ?></p>
</option>
<option value="0">
<p><?= lang('NO') ?></p>
</option>
</select>
</div>
<p class="mt-2">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%.</p>
</div>
</div>

View File

@ -0,0 +1,64 @@
<div class="col-12 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h5 class="mb-1 fw-bold titulo"></h5>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Direcciones de envío </h3>
</div><!--//.mb-3 -->
<div id="divInputDirecciones" name="div_input_direcciones" class="row col-sm-12 mb-5 justify-content-center">
<div id="containerTiradasEnvios" class="row mb-3 justify-content-center">
</div>
<div class="row mb-3 justify-content-center">
<div class="col-sm-4 mb-3">
<label for="direcciones" class="form-label">Mis direcciones</label>
<select id="direcciones" name="direcciones" class="form-control select2bs2"
style="width: 100%;"></select>
</div>
<div class="col-sm-2 mb-3">
<label for="unidadesEnvio" class="form-label">
Unidades
</label>
<input type="number" class="form-control" id="unidadesEnvio" name="unidadesEnvio" maxLength="8" step="1"
class="form-control">
</div>
<div class="col-sm-2 mb-3 mt-auto mb-0">
<button id="insertarDireccion" type="button"
class="btn btn-secondary waves-effect waves-light">Insertar</button>
</div>
</div>
<div class="row mb-3 justify-content-center">
<div class="col-sm-4 mb-3">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="entregaPieCalle" name="entregaPieCalle"
value="1">
<label class="form-check-label"
for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
</div>
</div>
</div>
<div class="row mb-3 justify-content-center">
<div class="col-sm-2 mb-3 mt-auto mb-0">
<button id="nuevaDireccion" type="button"
class="btn btn-secondary waves-effect waves-light">Nueva Dirección</button>
</div>
</div>
<div id="divErrorEnvios" name="div_error_envios" class="col-sm-10 mb-3 justify-content-center"></div>
<div id="divDirecciones" class="calcular-presupuesto col-sm-12 d-flex flex-column align-items-center">
</div>
</div>
</div>

View File

@ -0,0 +1,419 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h5 class="mb-1 fw-bold titulo"></h5>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Diseño cubierta </h3>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-5 d-flex flex-column align-items-center">
<h6 class="mb-1 text-center"> Recuerde que la cubierta es el conjunto formado por la portada, contraportada,
lomo y solapas, en caso de que las lleve. </h6>
</div><!--//.mb-3 -->
<div id="divTipoCubierta" name="div_tipo_cubierta" class="row col-sm-10 mb-5 justify-content-center">
<div id="tapaBlanda"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/tapa-blanda.jpg") ?>"
alt="TapaBlanda">
<label class="form-label">
Tapa blanda
</label>
</div>
<div id="tapaDura"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto"
src="<?= site_url("assets/img/presupuestoCliente/tapa-dura-lomo-recto.jpg") ?>" alt="TapaDura">
<label class="form-label">
Tapa dura lomo recto
</label>
</div>
<div id="tapaDuraLomoRedondo"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center tipo-cubierta imagen-selector image-container">
<img class="image-presupuesto"
src="<?= site_url("assets/img/presupuestoCliente/tapa-dura-lomo-redondo.png") ?>"
alt="TapaDuraLomoRedondo">
<label class="form-label">
Tapa dura lomo redondo
</label>
</div>
</div>
<div id="divCarasImpresion" name="div_caras_impresion" class="row col-sm-10 mb-5 justify-content-center d-none">
<div class="col-sm-4 mb-md-0 mb-2">
<label for="carasCubierta" class="form-label">Caras impresas cubierta</label>
<select id="carasCubierta" name="carasCubierta" class="form-control select2bs2 calcular-presupuesto"
style="width: 100%;">
<option value="2" selected>
<p><?= lang('Presupuestos.unaCara') ?></p>
</option>
<option value="4">
<p><?= lang('Presupuestos.dosCaras') ?></p>
</option>
</select>
</div>
</div>
<div id="divSolapasCubierta" name="div_solapas_cubierta" class="row col-sm-10 mb-5 justify-content-center d-none">
<div id="solapasCubiertaNo"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center solapas-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/sinSolapasCubierta.png") ?>"
alt="Sin solapas">
<label class="form-label">
Sin solapas
</label>
</div>
<div id="solapasCubiertaSi"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center solapas-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/conSolapasCubierta.png") ?>"
alt="Con solapas">
<label class="form-label">
Con solapas
</label>
</div>
<div id="divTamanioSolapas"
class="d-flex flex-column align-items-center justify-content-center image-container d-none">
<label for="solapasCubierta" class="form-label">
Tamaño solapas
</label>
<input id="solapasCubierta" name="solapas_cubierta" type="number"
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1" value="60">
<div class="form-text">
Entre 60 y 120 mm
</div>
</div>
</div>
<div id="divConfigTapaDura" class="row col-sm-10 mb-5 justify-content-center d-none">
<div class="row justify-content-center">
<div class="col-sm-3">
<label for="papelGuardas" class="form-label">
<?= lang('Presupuestos.papelGuardas') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="papelGuardas" name="papel_guardas">
<option value="OFF1_170"><?= lang('Presupuestos.offsetBlancoGuardas') ?></option>
<option value="OFF2_170"><?= lang('Presupuestos.offsetAhuesadoGuardas') ?></option>
</select>
</div>
<div class="col-sm-3">
<label for="guardasImpresas" class="form-label">
<?= lang('Presupuestos.guardasImpresas') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="guardasImpresas"
name="guardas_impresas">
<option value="0"><?= lang('Presupuestos.sinImpresion') ?></option>
<option value="4"><?= lang('Presupuestos.unaCara') ?></option>
<option value="8"><?= lang('Presupuestos.dosCaras') ?></option>
</select>
</div>
<div class="col-sm-3">
<label for="cabezada" class="form-label">
<?= lang('Presupuestos.cabezada') ?>
</label>
<select class="form-select select2bs2" id="cabezada" name="cabezada">
<option value="WHI"><?= lang('Presupuestos.blanca') ?></option>
<option value="GRE"><?= lang('Presupuestos.verde') ?></option>
<option value="BLUE"><?= lang('Presupuestos.azul') ?></option>
<option value="REDYEL"><?= lang('Presupuestos.rojaAmarilla') ?></option>
</select>
</div>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Papel cubierta </h3>
</div><!--//.mb-3 -->
<div id="divPapelCubierta" name="div_papel_cubierta" class="row col-sm-10 mb-5 justify-content-center">
<div id="cartulinaEstucada" cod="CAR1"
class="calcular-presupuesto min-width-fit d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cartulina-grafica.png") ?>"
alt="Cartulina estucada">
<label class="form-label">
Cartulina gráfica estucada a una cara
</label>
</div>
<div id="estucadoMate" cod="EST2"
class="calcular-presupuesto min-width-fit d-flex flex-column align-items-center justify-content-center papel-cubierta imagen-selector image-container">
<img class="image-presupuesto"
src="<?= site_url("assets/img/presupuestoCliente/estucado-mate-cubierta.png") ?>" alt="Estucado mate">
<label class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeCubierta" name="div_gramaje_cubierta" class="row col-sm-10 mb-3 justify-content-center d-none">
<div id="divGramaje170Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
<label class="form-check-label custom-option-content" for="gramaje170Cubierta">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170Cubierta" name="gramajeCubiertaRadio" data-value="170"
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="170" />
</label>
</div>
</div>
<div id="divGramaje250Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
<label class="form-check-label custom-option-content" for="gramaje250Cubierta">
<span class="custom-option-body">
<span class="custom-option-title"> 250 gr </span>
</span>
<input id="gramaje250Cubierta" name="gramajeCubiertaRadio" data-value="250"
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="250" />
</label>
</div>
</div>
<div id="divGramaje270Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
<label class="form-check-label custom-option-content" for="gramaje270Cubierta">
<span class="custom-option-body">
<span class="custom-option-title"> 270 gr </span>
</span>
<input id="gramaje270Cubierta" name="gramajeCubiertaRadio" data-value="270"
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="270" />
</label>
</div>
</div>
<div id="divGramaje300Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
<label class="form-check-label custom-option-content" for="gramaje300Cubierta">
<span class="custom-option-body">
<span class="custom-option-title"> 300 gr </span>
</span>
<input id="gramaje300Cubierta" name="gramajeCubiertaRadio" data-value="300"
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="300" />
</label>
</div>
<div class="form-text">
Recomendado
</div>
</div>
<div id="divGramaje350Cubierta" class="checkbox-presupuesto-container col-md mb-md-0 mb-2">
<div class="form-check custom-option custom-option-icon gramaje-cubierta">
<label class="form-check-label custom-option-content" for="gramaje350Cubierta">
<span class="custom-option-body">
<span class="custom-option-title"> 350 gr </span>
</span>
<input id="gramaje350Cubierta" name="gramajeCubiertaRadio" data-value="350"
class="check-gramaje-cubierta calcular-presupuesto form-check-input" type="radio" value="350" />
</label>
</div>
</div>
</div>
<hr class="col-sm-10 my-10">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Acabados </h3>
</div><!--//.mb-3 -->
<div class="row col-sm-12 mb-5 justify-content-center">
<div class="row justify-content-center">
<div class="col-sm-3">
<label for="plastificado" class="form-label">
<?= lang('Presupuestos.plastificado') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="plastificado" name="plastificado">
<option value="NONE"><?= lang('Presupuestos.sinPlastificar') ?></option>
<option value="BRIL"><?= lang('Presupuestos.brillo') ?></option>
<option value="MATE"><?= lang('Presupuestos.mate') ?></option>
<option value="ANTI"><?= lang('Presupuestos.antirrayado') ?></option>
<option value="SAND"><?= lang('Presupuestos.rugoso') ?></option>
</select>
</div>
<div class="col-sm-3">
<label for="barniz" class="form-label">
<?= lang('Presupuestos.barniz') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="barniz" name="barniz">
<option value="NONE"> - </option>
<option value="R2D"><?= lang('Presupuestos.relieve2D') ?></option>
<option value="R3D"><?= lang('Presupuestos.relieve3D') ?></option>
</select>
<div class="form-text">
<?= lang('Presupuestos.barnizDescription') ?>
</div>
</div>
<div class="col-sm-3">
<label for="estampado" class="form-label">
<?= lang('Presupuestos.estampado') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="estampado" name="estampado">
<option value="NONE"> - </option>
<option value="GOLD"><?= lang('Presupuestos.oro') ?></option>
<option value="SILV"><?= lang('Presupuestos.plata') ?></option>
<option value="COPP"><?= lang('Presupuestos.cobre') ?></option>
<option value="BRON"><?= lang('Presupuestos.bronce') ?></option>
</select>
</div>
<div id="retractilado"
class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center solapas-cubierta imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/retractilado.png") ?>"
alt="Retractilado">
<label class="form-label">
Retractilado
</label>
</div>
</div>
</div>
<hr class="col-sm-10 my-10">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Extras </h3>
</div><!--//.mb-3 -->
<div class="row col-sm-12 mb-3 justify-content-center">
<div class="row justify-content-center">
<div class="row col-sm-3 mb-3 d-flex flex-column align-items-center sobrecubierta-items">
<div class="form-check form-switch mb-2">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="addSobrecubierta"
name="add_sobrecubierta" value="1">
<label class="form-check-label"
for="addSobrecubierta"><?= lang('Presupuestos.sobrecubierta') ?></label>
</div>
</div>
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
<label for="papelSobrecubierta" class="form-label">
<?= lang('Presupuestos.papelSobrecubierta') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="papelSobrecubierta"
name="papel_sobrecubierta">
<option value="EST2_170"><?= lang('Presupuestos.estucadoMate170gr') ?></option>
<option value="EST2_200"><?= lang('Presupuestos.estucadoMate200gr') ?></option>
</select>
</div>
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
<label for="solapasSobrecubierta" class="form-label">
<?= lang('Presupuestos.tamanioSolapasSobrecubierta') ?>
</label>
<input id="solapasSobrecubierta" name="solapas_sobrecubierta" type="number"
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
value="60">
<div class="form-text">
Entre 60 y 120 mm
</div>
</div>
<div class="col-sm-3 config-sobrecubierta d-none sobrecubierta-items">
<label for="plastificadoSobrecubierta" class="form-label">
<?= lang('Presupuestos.plastificadoSobrecubierta') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="plastificadoSobrecubierta"
name="plastificado_sobrecubierta">
<option value="NONE"> - </option>
<option value="BRIL"><?= lang('Presupuestos.brillo') ?></option>
<option value="MATE"><?= lang('Presupuestos.mate') ?></option>
<option value="ANTI"><?= lang('Presupuestos.antirrayado') ?></option>
</select>
</div>
</div>
</div>
<div class="row col-sm-12 mb-0 justify-content-center d-none">
<div class="row justify-content-center">
<div class="row col-sm-2 mb-3 d-flex flex-column align-items-center">
<div class="form-check form-switch mb-2">
<input class="calcular-presupuesto form-check-input" type="checkbox" id="addFaja" name="add_faja"
value="1">
<label class="form-check-label" for="addFaja"><?= lang('Presupuestos.faja') ?></label>
</div>
</div>
<div class="col-sm-2 config-faja d-none">
<label for="altoFaja" class="form-label">
<?= lang('Presupuestos.altoFaja') ?>
</label>
<input id="altoFaja" name="alto_faja" type="number"
class="calcular-presupuesto form-control text-center num-input" min="60" step="1" value="60">
<div class="form-text">
Mayor 60 mm
</div>
</div>
<div class="col-sm-3 config-faja d-none">
<label for="barniz" class="form-label">
<?= lang('Presupuestos.papelFaja') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="papelFaja" name="papel_sobrecubierta">
<option value="EST2_170"><?= lang('Presupuestos.estucadoMate170gr') ?></option>
<option value="EST2_200"><?= lang('Presupuestos.estucadoMate200gr') ?></option>
</select>
</div>
<div class="col-sm-2 config-faja d-none">
<label for="solapasFaja" class="form-label">
<?= lang('Presupuestos.tamanioSolapasFaja') ?>
</label>
<input id="solapasFaja" name="solapas_faja" type="number"
class="calcular-presupuesto form-control text-center num-input" min="60" max="120" step="1"
value="60">
<div class="form-text">
Entre 60 y 120 mm
</div>
</div>
<div class="col-sm-3 config-faja d-none">
<label for="plastificadoFaja" class="form-label">
<?= lang('Presupuestos.plastificadoFaja') ?>
</label>
<select class="form-select select2bs2 calcular-presupuesto" id="plastificadoFaja"
name="plastificado_faja">
<option value="NONE"> - </option>
<option value="BRIL"><?= lang('Presupuestos.brillo') ?></option>
<option value="MATE"><?= lang('Presupuestos.mate') ?></option>
<option value="ANTI"><?= lang('Presupuestos.antirrayado') ?></option>
</select>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,351 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h5 class="mb-1 fw-bold titulo"></h5>
</div><!--//.mb-3 -->
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Impresión interior </h3>
</div><!--//.mb-3 -->
<div id="divImpresionInterior" name="div_impresion_interior" class="row col-sm-10 mb-3 justify-content-center">
<div id="negroEstandar" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/blancoYnegro.png") ?>" alt="Negro">
<label for="titulo" class="form-label">
Blanco y Negro
</label>
</div>
<div id="negroPremium" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/negroFoto.png") ?>" alt="NegroPremium">
<label for="titulo" class="form-label">
Blanco y Negro Premium
</label>
</div>
<div id="colorEstandar" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/color.png") ?>" alt="Color">
<label for="titulo" class="form-label">
Color
</label>
</div>
<div id="colorPremium" class="d-flex flex-column align-items-center justify-content-center disenio-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/colorFoto.png") ?>" alt="ColorPremium">
<label for="titulo" class="form-label">
Color Premium
</label>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold"> Papel interior </h3>
</div><!--//.mb-3 -->
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-5 justify-content-center">
<div id="offsetBlanco" cod="OFF1" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
<label for="titulo" class="form-label">
Offset Blanco
</label>
</div>
<div id="offsetAhuesado" cod="OFF2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
<label for="titulo" class="form-label">
Offset Ahuesado
</label>
</div>
<div id="offsetAhuesadoVolumen" cod="OFF4" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
<label for="titulo" class="form-label">
Offset Ahuesado Volumen
</label>
</div>
<div id="estucadoMate" cod="EST2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
<label for="titulo" class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
<div id="interiorGramaje70" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje70">
<span class="custom-option-body">
<span class="custom-option-title"> 70 gr </span>
</span>
<input id="gramaje70" name="customRadioGramaje" data-value="70" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje80" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje80">
<span class="custom-option-body">
<span class="custom-option-title"> 80 gr </span>
</span>
<input id="gramaje80" name="customRadioGramaje" data-value="80" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje90" class="mb-md-0 mb-3 checkbox-presupuesto-container">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje90">
<span class="custom-option-body">
<span class="custom-option-title"> 90 gr </span>
</span>
<input id="gramaje90" name="customRadioGramaje" data-value="90" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje100" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje100">
<span class="custom-option-body">
<span class="custom-option-title"> 100 gr </span>
</span>
<input id="gramaje100" name="customRadioGramaje" data-value="100" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje115" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje115">
<span class="custom-option-body">
<span class="custom-option-title"> 115 gr </span>
</span>
<input id="gramaje115" name="customRadioGramaje" data-value="115" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje120" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje120">
<span class="custom-option-body">
<span class="custom-option-title"> 120 gr </span>
</span>
<input id="gramaje120" name="customRadioGramaje" data-value="120" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje135" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje135">
<span class="custom-option-body">
<span class="custom-option-title"> 135 gr </span>
</span>
<input id="gramaje135" name="customRadioGramaje" data-value="135" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje150" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje150">
<span class="custom-option-body">
<span class="custom-option-title"> 150 gr </span>
</span>
<input id="gramaje150" name="customRadioGramaje" data-value="150" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje170" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior">
<label class="form-check-label custom-option-content" for="gramaje170">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170" name="customRadioGramaje" data-value="170" class="check-interior-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
</div>
<div class="col-sm-8 mb-3 mt-10 d-flex flex-column align-items-center interior-color d-none">
<h3 class="mb-1 fw-bold"> Impresión interior color</h3>
</div><!--//.mb-3 -->
<div id="divImpresionInteriorColor" name="div_impresion_interior_color" class="row col-sm-10 mb-3 justify-content-center interior-color d-none">
<div id="colorEstandarColor" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center disenio-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/color.png") ?>" alt="Color">
<label for="titulo" class="form-label">
Color
</label>
</div>
<div id="colorPremiumColor" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center disenio-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/colorFoto.png") ?>" alt="ColorPremium">
<label for="titulo" class="form-label">
Color Premium
</label>
</div>
</div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center interior-color d-none">
<h3 class="mb-1 fw-bold"> Papel interior color</h3>
</div><!--//.mb-3 -->
<div id="divPapelInteriorColor" name="div_papel_interior_color" class="row col-sm-10 mb-5 interior-color justify-content-center interior-color d-none">
<div id="offsetBlancoColor" cod="OFF1" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-blanco.png") ?>" alt="offsetBlanco">
<label class="form-label">
Offset Blanco
</label>
</div>
<div id="offsetAhuesadoColor" cod="OFF2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado.png") ?>" alt="offsetAhuesado">
<label for="titulo" class="form-label">
Offset Ahuesado
</label>
</div>
<div id="offsetAhuesadoVolumenColor" cod="OFF4" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/offset-ahuesado-volumen.png") ?>" alt="offsetAhuesadoVolumen">
<label class="form-label">
Offset Ahuesado Volumen
</label>
</div>
<div id="estucadoMateColor" cod="EST2" class="calcular-presupuesto d-flex flex-column align-items-center justify-content-center papel-interior-color imagen-selector image-container">
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/estucado-mate.png") ?>" alt="estucadoMate">
<label class="form-label">
Estucado Mate
</label>
</div>
</div>
<div id="divGramajeInteriorColor" name="div_gramaje_interior_color" class="row col-sm-10 mb-3 justify-content-center d-none">
<div id="interiorGramaje70Color" class="checkbox-presupuesto-container col-md mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje70">
<span class="custom-option-body">
<span class="custom-option-title"> 70 gr </span>
</span>
<input id="gramaje70Color" name="customRadioGramajeColor" data-value="70" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje80Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje80">
<span class="custom-option-body">
<span class="custom-option-title"> 80 gr </span>
</span>
<input id="gramaje80Color" name="customRadioGramajeColor" data-value="80" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje90Color" class="mb-md-0 mb-3 checkbox-presupuesto-container">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje90">
<span class="custom-option-body">
<span class="custom-option-title"> 90 gr </span>
</span>
<input id="gramaje90Color" name="customRadioGramajeColor" data-value="90" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje100Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje100">
<span class="custom-option-body">
<span class="custom-option-title"> 100 gr </span>
</span>
<input id="gramaje100Color" name="customRadioGramajeColor" data-value="100" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje115Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje115">
<span class="custom-option-body">
<span class="custom-option-title"> 115 gr </span>
</span>
<input id="gramaje115Color" name="customRadioGramajeColor" data-value="115" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje120Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje120">
<span class="custom-option-body">
<span class="custom-option-title"> 120 gr </span>
</span>
<input id="gramaje120Color" name="customRadioGramajeColor" data-value="120" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje135Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje135">
<span class="custom-option-body">
<span class="custom-option-title"> 135 gr </span>
</span>
<input id="gramaje135Color" name="customRadioGramajeColor" data-value="135" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje150Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje150">
<span class="custom-option-body">
<span class="custom-option-title"> 150 gr </span>
</span>
<input id="gramaje150Color" name="customRadioGramajeColor" data-value="150" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
<div id="interiorGramaje170Color" class="checkbox-presupuesto-container mb-md-0 mb-3">
<div class="form-check custom-option custom-option-icon calcular-presupuesto gramaje-interior-color">
<label class="form-check-label custom-option-content" for="gramaje170">
<span class="custom-option-body">
<span class="custom-option-title"> 170 gr </span>
</span>
<input id="gramaje170Color" name="customRadioGramajeColor" data-value="170" class="check-interior-color-gramaje form-check-input" type="radio" value="" />
</label>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
<div class="col-12 pb-2 d-flex flex-column align-items-center">
</div>

View File

@ -0,0 +1,143 @@
<div id="addressForm" action='create' class="modal fade addModal">
<div class="modal-dialog modal-lg modal-simple">
<div class="modal-content">
<div class="modal-header">
<h4 id="labelTitleConfirmDialog" class="modal-title"><?= lang('PresupuestosDirecciones.direccionTitle') ?></h4>
</div>
<div class="modal-body">
<div class="mb-3">
<label for="add_clientedAdd" class="form-label">
<?= lang('PresupuestosDirecciones.clientedAdd') ?>*
</label>
<select id="add_clientedAdd" class="form-control select2bs" style="width: 100%;">
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_cantidad" class="form-label">
<?= lang('PresupuestosDirecciones.cantidad') ?>*
</label>
<input type="number" id="add_cantidad" class="form-control">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_att" class="form-label">
<?= lang('PresupuestosDirecciones.att') ?>*
</label>
<input type="text" id="add_att" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_email" class="form-label">
<?= lang('PresupuestosDirecciones.email') ?>*
</label>
<input type="text" id="add_email" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_direccion" class="form-label">
<?= lang('PresupuestosDirecciones.direccion') ?>*
</label>
<input type="text" id="add_direccion" maxLength="255" class="form-control new-address">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="add_pais_id" class="form-label">
<?= lang('PresupuestosDirecciones.pais') ?>*
</label>
<select id="add_pais_id" class="form-control select2bs new-address" style="width: 100%;">
<option value="" disabled selected><?= lang('PresupuestosDirecciones.selectPais') ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>" <?= $item->id == 1 ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class='row'>
<div id='divMunicipio' class="col-md-12 col-lg-12 pl-4">
<div class="mb-3">
<label for="add_municipio" class="form-label">
<?= lang('PresupuestosDirecciones.municipio') ?>*
</label>
<input type="text" id="add_municipio" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-6 pl-4 spain-data" style="display: none;">
<div class="mb-3">
<label for="add_provincia" class="form-label">
<?= lang('PresupuestosDirecciones.provincia') ?>*
</label>
<input type="text" id="add_provincia" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
</div> <!-- //.row -->
<div class='row'>
<div class="col-md-12 col-lg-6 pl-4">
<div class="mb-3">
<label for="add_cp" class="form-label">
<?= lang('PresupuestosDirecciones.cp') ?>*
</label>
<input type="text" id="add_cp" maxLength="100" class="form-control new-address">
</div><!--//.mb-3 -->
</div>
<div class="col-md-12 col-lg-6 pl-4">
<div class="mb-3">
<label for="add_telefono" class="form-label">
<?= lang('PresupuestosDirecciones.telefono') ?>*
</label>
<input type="text" id="add_telefono" maxLength="100" class="form-control new-address"></input>
</div><!--//.mb-3 -->
</div>
</div> <!-- //.row -->
<div class="col-md-12 col-lg-6 pl-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="add_entregaPieCalle" name="add_entregaPieCalle" value="1">
<label class="form-check-label" for="add_entregaPieCalle"><?= lang('PresupuestosDirecciones.entregaPieCalle') ?></label>
</div>
</div>
<div class="col-md-12 col-lg-6 pl-4">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="add_saveDirection" name="add_saveDirection" value="1">
<label class="form-check-label" for="add_saveDirection"><?= lang('PresupuestosDirecciones.saveDirection') ?></label>
</div>
</div>
<div class="mb-3">
<label style="display:none" for="add_alias" class="form-label save-alias">
<?= lang('PresupuestosDirecciones.alias') ?>*
</label>
<input type="text" id="add_alias" maxLength="100" class="form-control new-address save-alias" style='display: none;'>
</div><!--//.mb-3 -->
</div>
<div class="modal-footer">
<button id="saveDireccionEnvio"
type="button"
class="btn btn-primary">Guardar</button>
<button id="cancelAdd"
type="button"
class="btn btn-default">Cancelar</button>
</div>
</div>
</div>
</div>
<?= $this->section("additionalExternalJs") ?>
<?= $this->endSection() ?>

View File

@ -0,0 +1,185 @@
<div class="col-12 d-flex flex-column align-items-center">
<h3 class="mb-1 fw-bold">Resumen del presupuesto</h3>
<div class="line mb-4"></div>
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center">
<h5 class="mb-1 "> Precio unidad: <span id="resumenPrecioU"></span> </h5>
<h4 class="mb-1 "> Total base: <span id="resumenTotalBase"></span> </h>
<h4 class="mb-1 "> Iva (<span id="resumenIvaPorcentaje"></span>%): <span id="resumenIva"></span> </h>
<h3 class="mt-3 mb-1 fw-bold"> Total: <span id="resumenTotal"></span> </h>
</div><!--//.mb-3 -->
<div id="divFormaCubierta" class="col-sm-12 mb-3 d-flex flex-column align-items-center">
<div class="row justify-content-center col-sm-12">
<div id="btnPreviewCubierta" class="btn col-sm-4 btn-primary waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"></i>Mostrar desarrollo cubierta</span>
</div>
</div>
<div class="row">
<div id="pv_ec_shape" class="col-sm-12 d-none" style="width:850px;height:600px;margin:2.5% auto;"></div>
</div>
</div>
<div class="table-responsive col-10 mb-3">
<table class="table table-bordered">
<thead class="table-dark">
<tr>
<th colspan="2">Datos generales</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-item-resumen-table">Titulo</td>
<td id="resumenTitulo">Albert Cook</td>
</tr>
<tr>
<td class="col-item-resumen-table">Tipo libro</td>
<td id="resumenTipoLibro"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Formato</td>
<td id="resumenFormato"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Páginas negro</td>
<td id="resumenPaginasNegro"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Páginas color</td>
<td id="resumenPaginasColor"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Páginas en total</td>
<td id="resumenPaginas"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Tirada</td>
<td id="resumenTirada"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Prototipo</td>
<td id="resumenPrototipo"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive col-10 mb-3">
<table class="table table-bordered">
<thead class="table-dark">
<tr>
<th colspan="2">Interior</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-item-resumen-table">Impresion</td>
<td id="resumenImpresion"></td>
</tr>
<tr class="mismoInterior">
<td class="col-item-resumen-table">Papel</td>
<td id="resumenPapelInterior"></td>
</tr>
<tr class="mismoInterior">
<td class="col-item-resumen-table">Gramaje</td>
<td id="resumenGramajeInterior"></td>
</tr>
<tr class="diferenteInterior d-none">
<td class="col-item-resumen-table">Papel B&N</td>
<td id="resumenPapelInteriorNegro"></td>
</tr>
<tr class="diferenteInterior d-none">
<td class="col-item-resumen-table">Gramaje B&N</td>
<td id="resumenGramajeInteriorNegro"></td>
</tr>
<tr class="diferenteInterior d-none">
<td class="col-item-resumen-table">Papel Color</td>
<td id="resumenPapelInteriorColor"></td>
</tr>
<tr class="diferenteInterior d-none">
<td class="col-item-resumen-table">Gramaje Color</td>
<td id="resumenGramajeInteriorColor"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive col-10 mb-3">
<table class="table table-bordered">
<thead class="table-dark">
<tr>
<th colspan="2">Cubierta</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-item-resumen-table">Tipo</td>
<td id="resumenCubiertaTipo"></td>
</tr>
<tr class="cubierta-tapa-blanda d-none">
<td class="col-item-resumen-table">Caras impresas</td>
<td id="resumenCarasCubierta"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Papel</td>
<td id="resumenPapelCubierta"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Gramaje</td>
<td id="resumenGramajeCubierta"></td>
</tr>
<tr class="cubierta-tapa-blanda d-none">
<td class="col-item-resumen-table">Solapas</td>
<td id="resumenSolapasCubierta"></td>
</tr>
<tr class="cubierta-tapa-dura d-none">
<td class="col-item-resumen-table">Papel de guardas</td>
<td id="resumenPapelGuardas"></td>
</tr>
<tr class="cubierta-tapa-dura d-none">
<td class="col-item-resumen-table">Guardas impresas</td>
<td id="resumenGuardasImpresas"></td>
</tr>
<tr class="cubierta-tapa-dura d-none">
<td class="col-item-resumen-table">Cabezada</td>
<td id="resumenCabezada"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Acabados</td>
<td id="resumenCubiertaAcabados"></td>
</tr>
</tbody>
</table>
</div>
<div id="divResumenSobrecubierta" class="table-responsive col-10 mb-3 d-none">
<table class="table table-bordered">
<thead class="table-dark">
<tr>
<th colspan="2">Sobrecubierta</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-item-resumen-table">Papel</td>
<td id="resumenPapelSobrecubierta">Estucado Mate</td>
</tr>
<tr class="d-none">
<td class="col-item-resumen-table">Gramaje</td>
<td id="resumenGramajeSobrecubierta"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Tamaño solapas</td>
<td id="resumenSolapaSobrecubierta"></td>
</tr>
<tr>
<td class="col-item-resumen-table">Plastificado</td>
<td id="resumenPlastificadoSobreCubierta"></td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -1,5 +1,18 @@
<div id="loader" style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 9999;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<img src="<?= site_url("assets/img/loader.gif") ?>" alt="Loading..."/>
<div id="loader" class="modal modal-transparent" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="loader">
<div class="book">
<div class="book__pg-shadow"></div>
<div class="book__pg"></div>
<div class="book__pg book__pg--2"></div>
<div class="book__pg book__pg--3"></div>
<div class="book__pg book__pg--4"></div>
<div class="book__pg book__pg--5"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -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 += "<br>(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);
}
}
})();

View File

@ -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());
}

View File

@ -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<elements.length; index++){
let precio_envio = parseFloat($(elements[index]).attr('p'));
total += precio_envio;
};
}
return total;
}
$('#btnSave').on('click', function() {
finalizarPresupuesto(false);
});
$('#btnConfirm').on('click', function() {
finalizarPresupuesto(true);
});
$('#btnDuplicar').on('click', function() {
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];
}
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();
},
});
}

View File

@ -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();
}
}

View File

@ -1,259 +1,138 @@
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<?= view("themes/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
<?= view("themes/_commonPartialsBs/_modalInput") ?>
<?= view("themes/vuexy/components/modals/modalDireccion") ?>
<div class="container-xxl flex-grow-1 container-p-y">
<div class="col-12">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
<?= csrf_field() ?>
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= view("themes/vuexy/form/presupuestos/cliente/loader") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<input hidden id="lc" value=""></input>
<input hidden id="lsc" value=""></input>
<input readonly hidden id="pod" value="<?= $POD ?>"></input>
<input readonly hidden id="c" value="<?= $clienteId ?>"></input>
<!-- Create Deal Wizard -->
<div id="wizard-presupuesto-cliente" class="bs-stepper vertical mt-2 linear">
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<div class="bs-stepper-header">
<div class="step active" data-target="#tipo-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Tipo de libro</span>
<span class="bs-stepper-subtitle">Cosido, Fresado, ...</span>
</span>
</button>
</div>
<div class="line"></div>
<div class="step" data-target="#disenio-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Diseño del libro</span>
<span class="bs-stepper-subtitle">Detalles técnicos del libro</span>
</span>
</button>
</div>
<div class="line"></div>
<div class="step" data-target="#direcciones-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-map-pins ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Direcciones</span>
<span class="bs-stepper-subtitle">Dirección envío, facturación</span>
</span>
</button>
</div>
<div class="line"></div>
<div class="step" data-target="#resumen-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Resumen del presupuesto</span>
</span>
</button>
</div>
<div id="errorGeneral" class="fv-plugins-message-container invalid-feedback" style="display: none;">
<p>Se ha producido un error <br>
al calcular el presupuesto. <br>
Póngase en contacto con el <br>
administrador.</p>
</div>
<div id='divTiradasPrecio'>
</div>
<div class="bs-stepper-header">
<div class="step active" data-target="#datos-generales">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-info-circle ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Datos generales</span>
</span>
</button>
</div>
<div class="bs-stepper-content">
<form id="presupuesto-cliente-form" onsubmit="return false">
<!-- Tipo Libro -->
<div id="tipo-libro" class="content active" dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_tipoLibroItems") ?>
<div class="col-12 d-flex justify-content-between mt-4">
<button class="btn btn-primary btn-prev waves-effect waves-light">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none me-sm-1">Volver</span>
</button>
<button class="btn btn-primary btn-next waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
</div>
</div>
</div>
<!-- Diseño Libro -->
<div id="disenio-libro" class="content dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_disenioLibroItems") ?>
<div class="col-12 d-flex justify-content-between mt-4">
<button class="btn btn-primary btn-prev waves-effect waves-light">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none me-sm-1">Anterior</span>
</button>
<button class="btn btn-primary btn-next waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
</div>
</div>
</div>
<!-- Direcciones -->
<div id="direcciones-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_direccionesItems") ?>
<div class="col-12 d-flex justify-content-between mt-4">
<button class="btn btn-primary btn-prev waves-effect waves-light">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none me-sm-1">Anterior</span>
</button>
<button id="toReview" class="btn btn-primary btn-next waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Siguiente</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
</div>
</div>
</div>
<!-- Review & Complete -->
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/_resumenItems") ?>
</div>
<div class="col-12 d-flex justify-content-between mt-4">
<div class="col-6 d-flex flex-row">
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<button class="btn btn-primary btn-prev waves-effect waves-light">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none me-sm-1">Anterior</span>
</button>
<?php endif; ?>
</div>
<div class="col-6 d-flex flex-row-reverse">
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<button id="btnSave" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
<button id="btnConfirm" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Confirmar</span><i class="ti ti-check ti-xs"></i>
</button>
<?php else: ?>
<button id="btnBack" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Volver</span><i class="ti ti-check ti-xs"></i>
</button>
<?php endif; ?>
<button id="btnDuplicar" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Duplicar</span>
<i class="ti ti-copy ti-xs"></i>
</button>
<?php
// Mostrar boton de impresion solo en presupuestos guardados (no add!)
if ($formAction == "edit") {
echo anchor(
route_to("presupuestoToPdf", $presupuestoEntity->id),
lang("Basic.global.Print"),
[
"class" => "btn btn-dark float-start me-sm-3 ml-2",
"target" => "_blank"
]
);
}
?>
</div>
</div>
</div>
</form>
<div class="step" data-target="#interior-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-book ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Interior</span>
</span>
</button>
</div>
<?php else: ?>
<div class="step" data-target="#cubierta-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-books ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Cubierta</span>
</span>
</button>
</div>
<div class="row">
<div class="card">
<div class="card-body">
<form id="presupuesto-cliente-form" onsubmit="return false">
<div class="row g-3">
<div class="step" data-target="#direcciones-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-map-pins ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Direcciones</span>
</span>
</button>
</div>
<?= view("themes/vuexy/form/presupuestos/cliente/_resumenItems") ?>
<div class="step" data-target="#resumen-libro">
<button type="button" class="step-trigger" aria-selected="false" disabled="disabled">
<span class="bs-stepper-circle"><i class="ti ti-checkbox ti-sm"></i></span>
<span class="bs-stepper-label">
<span class="bs-stepper-title">Resumen del presupuesto</span>
</span>
</button>
</div>
<div class="col-12 d-flex justify-content-between mt-4">
<div class="col-6 d-flex flex-row">
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<button class="btn btn-primary btn-prev waves-effect waves-light">
<i class="ti ti-arrow-left ti-xs me-sm-1 me-0"></i>
<span class="align-middle d-sm-inline-block d-none me-sm-1">Anterior</span>
</button>
<?php endif; ?>
</div>
<div class="col-6 d-flex flex-row-reverse">
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<button id="btnSave" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Guardar</span>
<i class="ti ti-arrow-right ti-xs"></i>
</button>
<button id="btnConfirm" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Confirmar</span><i class="ti ti-check ti-xs"></i>
</button>
<?php else: ?>
<button id="btnBack" class="btn btn-success btn-submit btn-next mx-2 waves-effect waves-light">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Volver</span><i class="ti ti-check ti-xs"></i>
</button>
<?php endif; ?>
<button id="btnDuplicar" class="btn btn-primary btn-submit waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1">Duplicar</span>
<i class="ti ti-copy ti-xs"></i>
</button>
<?php
// Si esta confirmado siempre es un presupuesto guardado
echo anchor(
route_to("presupuestoToPdf", $presupuestoEntity->id),
lang("Basic.global.Print"),
[
"class" => "btn btn-dark float-start me-sm-3 ml-2",
"target" => "_blank"
]
);
?>
</div>
</div>
</form>
<div class="line"></div>
<div id='divTiradasPrecio'></div>
</div> <!--//.bs-stepper-header -->
<div class="bs-stepper-content" style="position: relative;">
<?= view("themes/vuexy/form/presupuestos/cliente/loader") ?>
<form id="presupuesto-cliente-form" onsubmit="return false">
<div id="datos-generales" class="content active dstepper-block fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_datosGenerales") ?>
</div>
</div>
<div id="interior-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioInterior") ?>
</div>
</div>
<div id="cubierta-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_disenioCubierta") ?>
</div>
</div>
<div id="direcciones-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_direcciones") ?>
</div>
</div>
<div id="resumen-libro" class="content fv-plugins-bootstrap5 fv-plugins-framework">
<div class="row g-3">
<?= view("themes/vuexy/form/presupuestos/cliente/items/_resumen") ?>
</div>
</div>
</div>
<?= view("themes/vuexy/form/presupuestos/cliente/items/_buttons") ?>
<?php endif; ?>
</form>
</div><!--//.col -->
<?= view("themes/vuexy/components/chat_presupuesto",data:["modelId" => $presupuestoEntity->id]) ?>
</div>
</div><!--//.wizard -->
<div id="form_buttons" class="row col-sm-12 justify-content-center" style="display: none;">
</div>
<?= view("themes/vuexy/components/chat_internal_presupuesto",data:["modelId" => $presupuestoId,"type" => "presupuesto"]) ?>
</div><!--//.row -->
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>
<?= view("themes/_commonPartialsBs/_modalMessageDialog") ?>
@ -262,81 +141,28 @@
<?= $this->section("additionalInlineJs") ?>
window.datosPresupuesto = <?= json_encode($datosPresupuesto) ?>;
window.token_ajax= {<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v};
<?php if ($presupuestoEntity->estado_id == 1) : ?>
$('#clienteId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfClientes") ?>',
type: 'post',
dataType: 'json',
data: function(params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function(response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
initDisenioLibro();
<?php endif; ?>
<?= $this->endSection() ?>
<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/bs-stepper/bs-stepper.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet"
href="<?= site_url('themes/vuexy/vendor/libs/formvalidation/dist/css/formValidation.min.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/dropzone/dropzone.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/presupuestoCliente.css') ?>">
<?= $this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/bs-stepper/bs-stepper.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/FormValidation.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/select/dataTables.select.min.js") ?>"></script>
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
<script src="<?= site_url('js_loader/translate_js/Presupuestos') ?>"></script>
<script src="<?= site_url('js_loader/presupuestoClienteResumen_js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
<?php if ($presupuestoEntity->estado_id == 1) : ?>
<script src="<?= site_url('js_loader/presupuestoCliente_js') ?>"></script>
<?php endif; ?>
<script src="<?= site_url('js_loader/presupuestoClienteTipoLibro_js') ?>"></script>
<script src="<?= site_url('js_loader/presupuestoClienteDisenioLibro_js') ?>"></script>
<script src="<?= site_url('js_loader/presupuestoClienteDirecciones_js') ?>"></script>
<script src="<?= site_url('js_loader/presupuestoClientePreview_js') ?>"></script>
<script type="module"
src="<?= site_url('assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js') ?>"></script>
<?= $this->endSection() ?>

View File

@ -305,7 +305,7 @@
<label for="compPosPaginasColor" class="form-label">
<?= lang('Presupuestos.posicionPagColor') ?>
</label>
<input type="text" id="compPosPaginasColor" name="comp_pos_paginas_color" maxLength="20" class="form-control" value="<?= isset($presupuestoEntity->comp_pos_paginas_color) ? (old('', $presupuestoEntity->comp_pos_paginas_color)) : '' ?>">
<input type="text" id="compPosPaginasColor" name="pos_paginas_color" maxLength="20" class="form-control" value="<?= isset($presupuestoEntity->pos_paginas_color) ? (old('', $presupuestoEntity->pos_paginas_color)) : '' ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-8 px-4">

View File

@ -5,15 +5,26 @@
<?= lang('Tarifaacabado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control"
value="<?= old('nombre', $tarifaacabadoEntity->nombre) ?>">
value="<?= old('nombre', $tarifaacabadoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('Tarifaacabado.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifaacabadoEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('Tarifaacabado.precioMin') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" class="form-control"
value="<?= old('precio_min', $tarifaacabadoEntity->precio_min) ?>">
value="<?= old('precio_min', $tarifaacabadoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
@ -21,9 +32,21 @@
<?= lang('Tarifaacabado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control"
value="<?= old('importe_fijo', $tarifaacabadoEntity->importe_fijo) ?>">
value="<?= old('importe_fijo', $tarifaacabadoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comment" class="form-label">
<?= lang('Tarifaacabado.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('Tarifaacabado.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifaacabadoEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
@ -32,7 +55,6 @@
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="acabado_cubierta" class="form-check-label">

View File

@ -17,6 +17,7 @@
<thead>
<tr>
<th><?= lang('Tarifaacabado.nombre') ?></th>
<th><?= lang('Tarifaacabado.code') ?></th>
<th><?= lang('Tarifaacabado.precioMin') ?></th>
<th><?= lang('Tarifaacabado.importeFijo') ?></th>
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th>
@ -90,6 +91,7 @@
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'code' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },

View File

@ -7,13 +7,37 @@
</label>
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('Tarifaencuadernacion.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifaEncuadernacionEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comment" class="form-label">
<?= lang('Tarifaencuadernacion.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('Tarifaencuadernacion.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifaEncuadernacionEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->
<div class="row">
<div class="col-md-12 col-lg-4 px-4">
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">

View File

@ -17,6 +17,7 @@
<thead>
<tr>
<th><?= lang('Tarifaencuadernacion.nombre') ?></th>
<th><?= lang('Tarifaencuadernacion.code') ?></th>
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
<th><?= lang('Tarifaencuadernacion.tipo_encuadernacion') ?></th>
<th><?= lang('Tarifaencuadernacion.servicio_encuadernacion') ?></th>
@ -88,6 +89,7 @@
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'code' },
{ 'data': 'mostrar_en_presupuesto' },
{ 'data': 'tipo_encuadernacion' },
{ 'data': 'servicio_encuadernacion' },

View File

@ -1,28 +1,51 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('TarifasEnvios.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?= old('nombre', $tarifaEnvioEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('TarifasEnvios.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifaEnvioEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?= lang('TarifasEnvios.paisId') ?>*
</label>
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;">
<option value=""><?= lang('Basic.global.pleaseSelectA', [lang('TarifasEnvios.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>" <?= $item->id == $tarifaEnvioEntity->pais_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('TarifasEnvios.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEnvioEntity->nombre) ?>">
</div><!--//.mb-3 -->
<label for="comment" class="form-label">
<?= lang('TarifasEnvios.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('TarifasEnvios.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifaEnvioEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('TarifasEnvios.paisId') ?>*
</label>
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('TarifasEnvios.paisId')]) ?></option>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$tarifaEnvioEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -176,7 +176,8 @@
idSrc: 'id',
fields: [ {
name: "nombre"
}, {
},
{
name: "cp_inicial"
}, {
name: "cp_final"

View File

@ -18,6 +18,7 @@
<thead>
<tr>
<th><?= lang('TarifasEnvios.nombre') ?></th>
<th><?= lang('TarifasEnvios.code') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
@ -87,6 +88,7 @@
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'code' },
{ 'data': 'pais_id' },
{ 'data': actionBtns }
]

View File

@ -14,7 +14,18 @@
value="<?= old('nombre', $tarifaextraEntity->nombre) ?>"
>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('Tarifaextra.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifaextraEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precio" class="form-label">
<?= lang('Tarifaextra.precio') ?>*
@ -45,7 +56,18 @@
>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comment" class="form-label">
<?= lang('Tarifaextra.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('Tarifaextra.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifaextraEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"

View File

@ -16,6 +16,7 @@
<thead>
<tr>
<th><?= lang('Tarifaextra.nombre') ?></th>
<th><?= lang('Tarifaextra.code') ?></th>
<th><?= lang('Tarifaextra.precio') ?></th>
<th><?= lang('Tarifaextra.margen') ?></th>
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
@ -28,6 +29,9 @@
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle">
<?= esc($item->code) ?>
</td>
<td class="align-middle">
<?= esc($item->precio) ?>
</td>

View File

@ -1,35 +1,57 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaManipuladoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.importeMinimo') ?>*
<?= lang('Tarifamanipulado.nombre') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?= old('nombre', $tarifaManipuladoEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('Tarifamanipulado.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifaManipuladoEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('Tarifamanipulado.importeMinimo') ?>*
</label>
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?= old('precio_min', $tarifaManipuladoEntity->precio_min) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Tarifamanipulado.importeFijo') ?>*
<?= lang('Tarifamanipulado.importeFijo') ?>*
</label>
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?= old('importe_fijo', $tarifaManipuladoEntity->importe_fijo) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="comment" class="form-label">
<?= lang('Tarifamanipulado.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('Tarifamanipulado.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifaManipuladoEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<label for="mostrar_en_presupuesto" class="form-check-label">
<input type="checkbox" id="mostrar_en_presupuesto" name="mostrar_en_presupuesto" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
</div><!--//.col -->

View File

@ -17,6 +17,7 @@
<thead>
<tr>
<th><?= lang('Tarifamanipulado.nombre') ?></th>
<th><?= lang('Tarifamanipulado.code') ?></th>
<th><?= lang('Tarifamanipulado.importeMinimo') ?></th>
<th><?= lang('Tarifamanipulado.importeFijo') ?></th>
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
@ -87,6 +88,7 @@
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'code' },
{ 'data': 'precio_min' },
{ 'data': 'importe_fijo' },
{ 'data': 'mostrar_en_presupuesto' },

View File

@ -5,62 +5,82 @@
<?= lang('Tarifapreimpresion.nombre') ?>*
</label>
<input
type="text"
id="nombre"
name="nombre"
required
maxLength="255"
class="form-control"
value="<?= old('nombre', $tarifapreimpresionEntity->nombre) ?>"
>
type="text"
id="nombre"
name="nombre"
required
maxLength="255"
class="form-control"
value="<?= old('nombre', $tarifapreimpresionEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?= lang('Tarifapreimpresion.code') ?>
</label>
<input
type="text"
id="code"
name="code"
maxLength="5"
class="form-control"
value="<?= old('code', $tarifapreimpresionEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="precio" class="form-label">
<?= lang('Tarifapreimpresion.precio') ?>*
</label>
<input
type="number"
id="precio"
name="precio"
required
maxLength="31"
step="0.01"
class="form-control"
value="<?= old('precio', $tarifapreimpresionEntity->precio) ?>"
>
type="number"
id="precio"
name="precio"
required
maxLength="31"
step="0.01"
class="form-control"
value="<?= old('precio', $tarifapreimpresionEntity->precio) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margen" class="form-label">
<?= lang('Tarifapreimpresion.margen') ?>*
</label>
<input
type="text"
id="margen"
name="margen"
required
class="form-control"
value="<?= old('margen', $tarifapreimpresionEntity->margen) ?>"
>
type="text"
id="margen"
name="margen"
required
class="form-control"
value="<?= old('margen', $tarifapreimpresionEntity->margen) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comment" class="form-label">
<?= lang('Tarifapreimpresion.comment') ?>
</label>
<textarea
id="comment"
name="comment"
rows="5"
cols="10"
placeholder="<?= lang('Tarifapreimpresion.comment_placeholder') ?>"
class="form-control"><?= old('comment', $tarifapreimpresionEntity->comment) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check form-check-inline">
<input type="checkbox"
id="mostrar_en_presupuesto"
name="mostrar_en_presupuesto"
value="1"
class="form-check-input"<?= $tarifapreimpresionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>
>
class="form-check-input" <?= $tarifapreimpresionEntity->mostrar_en_presupuesto == true ? 'checked' : ''; ?>>
<label for="mostrar_en_presupuesto" class="form-check-label">
<?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?>
</label>
</div>
</div>
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -16,6 +16,7 @@
<thead>
<tr>
<th><?= lang('Tarifapreimpresion.nombre') ?></th>
<th><?= lang('Tarifapreimpresion.code') ?></th>
<th><?= lang('Tarifapreimpresion.precio') ?></th>
<th><?= lang('Tarifapreimpresion.margen') ?></th>
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
@ -28,6 +29,9 @@
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle">
<?= esc($item->code) ?>
</td>
<td class="align-middle">
<?= esc($item->precio) ?>
</td>

View File

@ -20,6 +20,8 @@ $picture = "/assets/img/default-user.png";
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="locale" content="<?= $session->get("lang") ?>">
<title><?= config('Safekat')->appName ?></title>
<meta name="description" content="" />
@ -122,7 +124,7 @@ $picture = "/assets/img/default-user.png";
<div class="dropdown-menu dropdown-menu-end py-0">
<div class="dropdown-menu-header border-bottom">
<div class="dropdown-header d-flex align-items-center py-3">
<h5 class="text-body mb-0 me-auto">Chats</h5>
<h5 class="text-body mb-0 me-auto"><?= lang("Chat.messages") ?></h5>
</div>
</div>

View File

@ -14,97 +14,104 @@ if (
auth()->user()->can('roles-permisos.menu')
) {
?>
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
<?= lang("App.menu_configuration") ?>
</a>
<ul class="menu-sub">
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
<?= lang("App.menu_configuration") ?>
</a>
<ul class="menu-sub">
<?php if (auth()->user()->can('paises.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('paisList') ?>" class="menu-link">
<?= lang("App.menu_paises") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
<?= lang("App.menu_formas_pago") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
<?= lang("App.menu_papelgenerico") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
<?= lang("App.menu_papelimpresion") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
<?= lang("App.menu_maquina") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
<?= lang("App.menu_maquina_defecto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('usuarios.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
<?= lang("App.menu_users") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
<?= lang("App.menu_permission_group") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('proveedores.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
<?= lang("App.menu_proveedores") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
<?= lang("App.menu_ubicaciones") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
<?= lang("App.menu_series_facturas") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
<?= lang("App.menu_variables") ?>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php if (auth()->user()->can('paises.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('paisList') ?>" class="menu-link">
<?= lang("App.menu_paises") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
<?= lang("App.menu_formas_pago") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
<?= lang("App.menu_papelgenerico") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
<?= lang("App.menu_papelimpresion") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
<?= lang("App.menu_maquina") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
<?= lang("App.menu_maquina_defecto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('usuarios.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
<?= lang("App.menu_users") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
<?= lang("App.menu_permission_group") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('proveedores.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
<?= lang("App.menu_proveedores") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
<?= lang("App.menu_ubicaciones") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
<?= lang("App.menu_series_facturas") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
<?= lang("App.menu_error_presupuesto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
<?= lang("App.menu_variables") ?>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>

View File

@ -48,30 +48,30 @@ if (auth()->user()->can('presupuesto.menu')) {
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("presupuestos/grapados") ?>" class="menu-link">
<a href="<?= site_url("presupuestos/cosidotapablanda/list/21") ?>" class="menu-link">
<?= lang("App.menu_libros_grapados") ?>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("presupuestos/espiraltapadura") ?>" class="menu-link">
<a href="<?= site_url("presupuestos/cosidotapablanda/list/5") ?>" class="menu-link">
<?= lang("App.menu_libros_espiral_tapa_dura") ?>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("presupuestos/espiraltapablanda") ?>"
<a href="<?= site_url("presupuestos/cosidotapablanda/list/6") ?>"
class="menu-link">
<?= lang("App.menu_libros_espiral_tapa_blanda") ?>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("presupuestos/wireotapadura") ?>" class="menu-link">
<a href="<?= site_url("presupuestos/cosidotapablanda/list/7") ?>" class="menu-link">
<?= lang("App.menu_libros_wireo_tapa_dura") ?>
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("presupuestos/wireotapablanda") ?>" class="menu-link">
<a href="<?= site_url("presupuestos/cosidotapablanda/list/8") ?>" class="menu-link">
<?= lang("App.menu_libros_wireo_tapa_blanda") ?>
</a>
</li>

View File

@ -1,10 +0,0 @@
Database: testCI4
Usuario: testCI4
password: 1234
datos web guard:
email admin: jajaime.jim@gmail.com
password: 1234
FTP SK-IMN: pjS9~l138

View File

@ -1,71 +0,0 @@
Pasos para usar ficheros del mac
1.- Copiar controlador, modelo, vistas y entidad
2.- Copiar los ficheros de idioma. Le pone nombre raro (por ejemplo: Manipuladoes.php en lugar de Tarifamanipulado.php). Buscar y reemplazar en todos los ficheros. En este ejemplo: lang('Manipuladoes -> lang('Tarifamanipulado)
3.- Editar los idiomas
4.- En las vistas (formulario y lista) cambiar la segunda linea
Esto: <?= $this->extend("themes" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
por esto: <?=$this->extend('themes/vuexy/main/defaultlayout') ?>
5.- En las vistas cambiar Themes por themes
6.- Quitar de la tabla la primera columna para que no se repitan los botones. Es decir:
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editTarifamanipulado', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteTarifamanipulado', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
</td>
7.- Modificar las fechas de esto: date('mm/dd/YYYY H:i' a esto date('d/m/Y H:m:s'
8.- Cambiar los botones de exportar de sitio: "dom": 'lfrtipB' por "dom": 'lfBrtip'
9.- Poner el botón de añadir debajo del h3 del card header en lugar del footer
10.- Copiar las nuevas rutas
Pasos para añadir el soft delete a una tabla
1.- En la bbdd añadir la columna is_deleted (TINYINT, 4 bits, sin signo, valor predeterminado '0')
2.- En la bbdd añadir la columna deleted_at (TIMESTAMP, permitir NULL, valor predeterminado NULL)
3.- En la entidad añadir a los atributos:
"deleted_at" => null,
"is_deleted" => 0,
4.- En el modelo. Añadir en allowedFields:
"deleted_at",
"is_deleted",
También añadir la variable protected $deletedField = 'deleted_at';
5a.- Sin lazy tables:
En el controlador:
En el index añadir debajo de $this->view..
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
En el edit: justo al principio
// JJO
$session = session();
debajo de $sanitizedData = $this->sanitized($postData, $nullIfEmpty);
// JJO
if(isset($this->model->user_updated_id)){
$sanitizedData['user_updated_id'] = $session->id_user;
}
5b.- Con lazy-tables:
En el modelo cambiar:
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot, t1.show_in_client AS show_in_client"
);
por
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot, t1.show_in_client AS show_in_client"
)
->where("is_deleted", 0);

Some files were not shown because too many files have changed in this diff Show More