mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
26 Commits
feat/tarea
...
dev/presu_
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e80fddfb6 | |||
| 1e2d550301 | |||
| 0a3618cd00 | |||
| 33fbfc1a5d | |||
| a8612f64a4 | |||
| 0b614d4d58 | |||
| 55b225ab49 | |||
| 315d2a3acd | |||
| 83c8628645 | |||
| d0ee0b27bc | |||
| 8556887567 | |||
| f50987dc2b | |||
| 4180cea16a | |||
| 0b3bf0ed85 | |||
| 14fe3b1461 | |||
| 58ab81d8e8 | |||
| cdb9afc290 | |||
| adcf2fbec3 | |||
| eb806621c6 | |||
| 0963fae240 | |||
| daa10420c7 | |||
| 716019bf81 | |||
| 2ac99d14c0 | |||
| 0f00649f99 | |||
| 3dd9f8f7e3 | |||
| c79bc4343f |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
ci4/.env
|
||||
.vscode/
|
||||
|
||||
*xdebug*.log*
|
||||
xdebug.log
|
||||
xdebug.*
|
||||
|
||||
15
.idea/codeception.xml
generated
15
.idea/codeception.xml
generated
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Codeception">
|
||||
<option name="configurations">
|
||||
<list>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/ci4/tests" />
|
||||
</Configuration>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/php.xml
generated
7
.idea/php.xml
generated
@ -55,13 +55,6 @@
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/shield" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/settings" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/codeigniter4/framework" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/nicolab/php-ftp-client" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/hermawan/codeigniter4-datatables" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/firebase/php-jwt" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/greenlion/php-sql-parser" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/paragonie/random_compat" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/paragonie/constant_time_encoding" />
|
||||
<path value="$PROJECT_DIR$/ci4/vendor/phpseclib/phpseclib" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2">
|
||||
|
||||
16
.idea/phpspec.xml
generated
16
.idea/phpspec.xml
generated
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PHPSpec">
|
||||
<suites>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$/ci4" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$/ci4" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
</suites>
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/safekat.iml
generated
7
.idea/safekat.iml
generated
@ -7,13 +7,6 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/app/ThirdParty/DatatablesEditor/" isTestSource="false" packagePrefix="DataTables\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/ci4/tests/_support" isTestSource="true" packagePrefix="Tests\Support\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/firebase/php-jwt" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/greenlion/php-sql-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/hermawan/codeigniter4-datatables" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/nicolab/php-ftp-client" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/paragonie/constant_time_encoding" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/paragonie/random_compat" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ci4/vendor/phpseclib/phpseclib" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
92
README.md
92
README.md
@ -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.
|
||||
133
acciones.txt
133
acciones.txt
@ -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
|
||||
@ -39,13 +39,13 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
|
||||
|
||||
/* Cliente */
|
||||
$routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
|
||||
|
||||
$routes->get('', 'TarifaAcabados::index', ['as' => 'tarifaAcabadoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
|
||||
$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->get('select','TarifaAcabados::show_select',["as" => "showSelectTarifaAcabado"]);
|
||||
|
||||
$routes->group('lineas', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
|
||||
$routes->post('datatable', 'TarifaAcabadosLineas::datatable', ['as' => 'tarifaAcabadoLineasDT']);
|
||||
$routes->post('datatable_editor', 'TarifaAcabadosLineas::datatable_editor', ['as' => 'tarifaAcabadoLineasDTE']);
|
||||
@ -77,7 +77,14 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
|
||||
});
|
||||
|
||||
|
||||
/* Formas de Pago */
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$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->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
|
||||
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
||||
@ -92,19 +99,12 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
|
||||
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
|
||||
});
|
||||
$routes->group("servicios", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'ServicioCliente::index', ['as' => 'servicioClienteList']);
|
||||
$routes->get('(:num)', 'ServicioCliente::show/$1', ['as' => 'servicioClienteShow']);
|
||||
$routes->post('(:num)', 'ServicioCliente::store/$1', ['as' => 'servicioClienteStore']);
|
||||
$routes->post('update/(:num)', 'ServicioCliente::update_servicio_cliente/$1', ['as' => 'updateServicioCliente']);
|
||||
$routes->get('edit/(:num)', 'ServicioCliente::viewForm/$1', ['as' => 'servicioClienteViewForm']);
|
||||
$routes->get('datatable', 'ServicioCliente::datatable', ['as' => 'servicioClienteDatatable']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Users::index', ['as' => 'userList']);
|
||||
$routes->get('index', 'Users::index', ['as' => 'userIndex']);
|
||||
$routes->get('list', 'Users::index', ['as' => 'userList2']);
|
||||
$routes->get('add', 'Users::add', ['as' => 'newUser']);
|
||||
$routes->post('add', 'Users::add', ['as' => 'createUser']);
|
||||
@ -113,10 +113,8 @@ $routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], functi
|
||||
$routes->get('delete/(:num)', 'Users::delete/$1', ['as' => 'deleteUser']);
|
||||
$routes->post('allmenuitems', 'Users::allItemsSelect', ['as' => 'select2ItemsOfUsers']);
|
||||
$routes->post('menuitems', 'Users::menuItems', ['as' => 'menuItemsOfUsers']);
|
||||
$routes->get('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
|
||||
$routes->post('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
|
||||
});
|
||||
$routes->resource('users', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Users', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Group::index', ['as' => 'userGroupList']);
|
||||
@ -167,8 +165,6 @@ $routes->group('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas'],
|
||||
$routes->post('datatable', 'Tarifasmanipulado::datatable', ['as' => 'dataTableOfTarifasManipulado']);
|
||||
$routes->post('allmenuitems', 'Tarifasmanipulado::allItemsSelect', ['as' => 'select2ItemsOfTarifasManipulado']);
|
||||
$routes->post('menuitems', 'Tarifasmanipulado::menuItems', ['as' => 'menuItemsOfTarifasManipulado']);
|
||||
$routes->get('select','Tarifasmanipulado::show_select',["as" => "showSelectTarifaManipulado"]);
|
||||
|
||||
});
|
||||
$routes->resource('tarifasmanipulado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifasmanipulado', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -225,8 +221,6 @@ $routes->group('papelesgenericos', ['namespace' => 'App\Controllers\Configuracio
|
||||
$routes->post('datatable', 'Papelesgenericos::datatable', ['as' => 'dataTableOfPapelesGenericos']);
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
});
|
||||
$routes->resource('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelesgenericos', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -338,22 +332,10 @@ $routes->group('comunidades-autonomas', ['namespace' => 'App\Controllers\Configu
|
||||
$routes->post('datatable', 'Comunidadesautonomas::datatable', ['as' => 'dataTableOfComunidadesAutonomas']);
|
||||
$routes->post('allmenuitems', 'Comunidadesautonomas::allItemsSelect', ['as' => 'select2ItemsOfComunidadesAutonomas']);
|
||||
$routes->post('menuitems', 'Comunidadesautonomas::menuItems', ['as' => 'menuItemsOfComunidadesAutonomas']);
|
||||
$routes->get('menuitems2', 'Comunidadesautonomas::menuItems2', ['as' => 'menuItemsOfComunidadesAutonomas2']);
|
||||
});
|
||||
$routes->resource('comunidades-autonomas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Comunidadesautonomas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
||||
$routes->get('menuitems', 'FormasPago::menuItems', ['as' => 'menuItemsOfFormasDePagos']);
|
||||
});
|
||||
$routes->resource('formas-pago', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'FormasPago', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Paises::index', ['as' => 'paisList']);
|
||||
$routes->get('add', 'Paises::add', ['as' => 'newPais']);
|
||||
@ -364,7 +346,6 @@ $routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], funct
|
||||
$routes->post('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']);
|
||||
$routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']);
|
||||
$routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']);
|
||||
$routes->get('menuitems2', 'Paises::menuItems2', ['as' => 'menuItemsOfPaises2']);
|
||||
});
|
||||
$routes->resource('paises', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Paises', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -379,7 +360,6 @@ $routes->group('provincias', ['namespace' => 'App\Controllers\Configuracion'], f
|
||||
$routes->post('datatable', 'Provincias::datatable', ['as' => 'dataTableOfProvincias']);
|
||||
$routes->post('allmenuitems', 'Provincias::allItemsSelect', ['as' => 'select2ItemsOfProvincias']);
|
||||
$routes->post('menuitems', 'Provincias::menuItems', ['as' => 'menuItemsOfProvincias']);
|
||||
$routes->get('menuitems2', 'Provincias::menuItems2', ['as' => 'menuItemsOfProvincias2']);
|
||||
});
|
||||
$routes->resource('provincias', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Provincias', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -404,9 +384,6 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
|
||||
$routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||
$routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||
$routes->post('changeplantilla', 'ClientePrecios::updatePlantilla', ['as' => 'changePlantillaOfClienteprecios']);
|
||||
$routes->get('getplantilla', 'ClientePrecios::getCurrentPlantilla', ['as' => 'getPlantillaOfClienteprecios']);
|
||||
$routes->post('update', 'ClientePrecios::updatePlantilla', ['as' => 'updateClienteprecios']);
|
||||
});
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'ClientePrecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -416,13 +393,11 @@ $routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clien
|
||||
$routes->get('add', 'Clienteplantillaprecios::add', ['as' => 'newClienteplantillaprecios']);
|
||||
$routes->post('add', 'Clienteplantillaprecios::add', ['as' => 'createClienteplantillaprecios']);
|
||||
$routes->post('edit/(:num)', 'Clienteplantillaprecios::edit/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
$routes->get('edit/(:num)', 'Clienteplantillaprecios::edit/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
$routes->get('delete/(:num)', 'Clienteplantillaprecios::delete/$1', ['as' => 'deleteClienteplantillaprecios']);
|
||||
$routes->post('datatable', 'Clienteplantillaprecios::datatable', ['as' => 'dataTableOfClientesplantillaprecios']);
|
||||
$routes->get('menuitems', 'Clienteplantillaprecios::menuItems', ['as' => 'menuItemsOfClienteplantillaprecios']);
|
||||
$routes->post('update/(:num)', 'Clienteplantillaprecios::update/$1', ['as' => 'updateClienteplantillaprecios']);
|
||||
$routes->post('menuitems', 'Clienteplantillaprecios::menuItems', ['as' => 'menuItemsOfClienteplantillaprecios']);
|
||||
});
|
||||
$routes->resource('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteplantillaprecios', 'except' => 'show,new,create']);
|
||||
$routes->resource('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteplantillaprecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
@ -445,6 +420,18 @@ $routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], fu
|
||||
});
|
||||
|
||||
|
||||
$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']);
|
||||
$routes->get('add', 'Formaspagos::add', ['as' => 'newFormaDePago']);
|
||||
$routes->post('add', 'Formaspagos::add', ['as' => 'createFormaDePago']);
|
||||
$routes->post('create', 'Formaspagos::create', ['as' => 'ajaxCreateFormaDePago']);
|
||||
$routes->put('(:num)/update', 'Formaspagos::update/$1', ['as' => 'ajaxUpdateFormaDePago']);
|
||||
$routes->post('(:num)/edit', 'Formaspagos::edit/$1', ['as' => 'updateFormaDePago']);
|
||||
$routes->post('datatable', 'Formaspagos::datatable', ['as' => 'dataTableOfFormasDePagos']);
|
||||
$routes->post('allmenuitems', 'Formaspagos::allItemsSelect', ['as' => 'select2ItemsOfFormasDePagos']);
|
||||
$routes->post('menuitems', 'Formaspagos::menuItems', ['as' => 'menuItemsOfFormasDePagos']);
|
||||
});
|
||||
$routes->resource('formas-pagos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Formaspagos', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifasencuadernacion::index', ['as' => 'tarifaEncuadernacionList']);
|
||||
@ -569,20 +556,20 @@ $routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes']
|
||||
$routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clientedirecciones', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Presupuestoadmin::list/$1', ['as' => 'presupuestoAdminList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'newPresupuestoAdmin']);
|
||||
$routes->get('edit/(:any)', 'Presupuestoadmin::edit/$1', ['as' => 'editarPresupuestoAdmin']);
|
||||
$routes->post('add/(:num)', 'Presupuestoadmin::add/$1', ['as' => 'createPresupuestoAdmin']);
|
||||
$routes->post('create', 'Presupuestoadmin::create', ['as' => 'ajaxCreatePresupuestoAdmin']);
|
||||
$routes->put('(:num)/update', 'Presupuestoadmin::update/$1', ['as' => 'ajaxUpdatePresupuestoAdmin']);
|
||||
$routes->post('edit/(:num)', 'Presupuestoadmin::edit/$1', ['as' => 'updatePresupuestoAdmin']);
|
||||
$routes->post('datatable', 'Presupuestoadmin::datatable', ['as' => 'dataTableOfPresupuestoAdmin']);
|
||||
$routes->post('datatable_2', 'Presupuestoadmin::datatable_2', ['as' => 'updateDataOfPresupuestoAdmin']);
|
||||
$routes->post('allmenuitems', 'Presupuestoadmin::allItemsSelect', ['as' => 'select2ItemsOfPresupuestoAdmin']);
|
||||
$routes->post('menuitems', 'Presupuestoadmin::menuItems', ['as' => 'menuItemsOfPresupuestoAdmin']);
|
||||
$routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||
$routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!!
|
||||
$routes->get('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'newCosidotapablanda']);
|
||||
$routes->get('edit/(:any)', 'Cosidotapablanda::edit/$1', ['as' => 'editarPresupuesto']);
|
||||
$routes->post('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'createCosidotapablanda']);
|
||||
$routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']);
|
||||
$routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']);
|
||||
$routes->post('edit/(:num)', 'Cosidotapablanda::edit/$1', ['as' => 'updateCosidotapablanda']);
|
||||
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'dataTableOfCosidotapablanda']);
|
||||
$routes->post('datatable_2', 'Cosidotapablanda::datatable_2', ['as' => 'updateDataOfCosidotapablanda']);
|
||||
$routes->post('allmenuitems', 'Cosidotapablanda::allItemsSelect', ['as' => 'select2ItemsOfCosidotapablanda']);
|
||||
$routes->post('menuitems', 'Cosidotapablanda::menuItems', ['as' => 'menuItemsOfCosidotapablanda']);
|
||||
});
|
||||
$routes->resource('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestoadmin', 'except' => 'show,new,create,update']);
|
||||
$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']);
|
||||
@ -599,7 +586,6 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
|
||||
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
|
||||
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
|
||||
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
|
||||
$routes->post('calcularsolapas', 'Presupuestocliente::calcularMaxSolapas', ['as' => 'calcularSolapas']);
|
||||
});
|
||||
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -776,36 +762,9 @@ $routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], functi
|
||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
|
||||
});
|
||||
});
|
||||
$routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
$routes->get('datatable', 'ChatController::datatable_messages', ['as' => 'getDatatableMessages']);
|
||||
$routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']);
|
||||
$routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']);
|
||||
$routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']);
|
||||
|
||||
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
|
||||
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
|
||||
|
||||
|
||||
});
|
||||
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
|
||||
$routes->get('direct/(:num)', 'ChatController::get_chat_direct_view/$1', ['as' => 'getChatDirectView']);
|
||||
$routes->get('presupuesto/(:num)', 'ChatController::get_chat_presupuesto_view/$1', ['as' => 'getChatPresupuestoView']);
|
||||
$routes->get('pedido/(:num)', 'ChatController::get_chat_pedido_view/$1', ['as' => 'getChatPedidoView']);
|
||||
$routes->get('factura/(:num)', 'ChatController::get_chat_factura_view/$1', ['as' => 'getChatFacturaView']);
|
||||
|
||||
$routes->get('direct/conversation/(:num)', 'ChatController::get_chat_direct/$1', ['as' => 'getChatDirect']);
|
||||
$routes->get('direct/users/select/(:num)', 'ChatController::get_chat_direct_select_users/$1', ['as' => 'getChatDirectSelectUsers']);
|
||||
$routes->get('direct/users/(:num)', 'ChatController::get_chat_direct_users', ['as' => 'getChatDirectUsers']);
|
||||
$routes->post('direct/users/(:num)', 'ChatController::store_chat_direct_users/$1', ['as' => 'storeChatDirectUsers']);
|
||||
$routes->get('direct/messages/(:num)', 'ChatController::get_chat_direct_messages/$1', ['as' => 'getChatDirectMessages']);
|
||||
$routes->post('direct/messages/(:num)', 'ChatController::store_chat_direct_message/$1', ['as' => 'storeChatDirectMessages']);
|
||||
$routes->post('direct/messages/unread/(:num)', 'ChatController::update_chat_direct_message_unread/$1', ['as' => 'updateChatDirectMessageUnread']);
|
||||
|
||||
|
||||
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
|
||||
$routes->get('departments/select', 'ChatController::get_chat_department_select', ['as' => 'getChatDepartmentSelect']);
|
||||
$routes->get('department/presupuesto/(:num)/(:num)', 'ChatController::get_chat_presupuesto/$1/$2', ['as' => 'getChatPresupuesto']);
|
||||
$routes->get('department/pedido/(:num)/(:num)', 'ChatController::get_chat_pedido/$1/$2', ['as' => 'getChatPedido']);
|
||||
$routes->get('department/factura/(:num)/(:num)', 'ChatController::get_chat_factura/$1/$2', ['as' => 'getChatFactura']);
|
||||
@ -822,8 +781,6 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
$routes->get('contact/(:num)/messages', 'ChatController::get_chat_internal_messages/$1', ['as' => 'getChatInternalMessages']);
|
||||
$routes->get('notifications', 'ChatController::get_chat_cliente/$1', ['as' => 'getChatCliente']);
|
||||
$routes->get('users/internal', 'ChatController::get_chat_users_internal', ['as' => 'getChatUsersInternal']);
|
||||
$routes->get('users/all', 'ChatController::get_chat_users_all', ['as' => 'getChatUsersAll']);
|
||||
|
||||
$routes->post('hebra/presupuesto', 'ChatController::store_hebra_presupuesto', ['as' => 'storeHebraPresupuesto']);
|
||||
$routes->post('hebra/pedido', 'ChatController::store_hebra_pedido', ['as' => 'storeHebraPedido']);
|
||||
$routes->post('hebra/factura', 'ChatController::store_hebra_factura', ['as' => 'storeHebraFactura']);
|
||||
@ -834,14 +791,6 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
});
|
||||
|
||||
|
||||
|
||||
$routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->group('ordentrabajo', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->get('', 'Ordentrabajo::index', ['as' => 'viewOrdenTrabajoIndex']);
|
||||
$routes->get('edit/$1', 'Ordentrabajo::edit/$1', ['as' => 'viewOrdenTrabajoEdit']);
|
||||
|
||||
});
|
||||
});
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* APIs Route Definitions
|
||||
|
||||
@ -34,7 +34,7 @@ class Validation extends BaseConfig
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $templates = [
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'single' => 'CodeIgniter\Validation\Views\single',
|
||||
'bootstrap_style' => 'themes/_commonPartialsBs/_form_validation_errors',
|
||||
];
|
||||
@ -42,6 +42,4 @@ class Validation extends BaseConfig
|
||||
// --------------------------------------------------------------------
|
||||
// Rules
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,13 +11,10 @@ use App\Models\ChatNotification;
|
||||
use App\Models\ChatUser;
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use App\Services\MessageService;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\Log\Logger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use CodeIgniter\I18n\Time;
|
||||
|
||||
class ChatController extends BaseController
|
||||
{
|
||||
@ -29,8 +26,8 @@ class ChatController extends BaseController
|
||||
protected ClienteModel $clienteModel;
|
||||
protected ChatUser $chatUserModel;
|
||||
protected ChatNotification $chatNotificationModel;
|
||||
protected array $viewData;
|
||||
protected static $viewPath = 'themes/vuexy/form/mensajes/';
|
||||
|
||||
|
||||
|
||||
|
||||
public function initController(
|
||||
@ -49,6 +46,8 @@ class ChatController extends BaseController
|
||||
$this->clienteModel = model(ClienteModel::class);
|
||||
$this->chatUserModel = model(ChatUser::class);
|
||||
$this->chatNotificationModel = model(ChatNotification::class);
|
||||
|
||||
|
||||
}
|
||||
public function index() {}
|
||||
public function get_chat_departments()
|
||||
@ -57,10 +56,6 @@ class ChatController extends BaseController
|
||||
$data = $this->chatDeparmentModel->getChatDepartments();
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_department_select(){
|
||||
$query = $this->chatDeparmentModel->getChatDepartmentSelect($this->request->getGet("q"));
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function get_chat_presupuesto(int $chat_department_id, int $presupuesto_id)
|
||||
{
|
||||
|
||||
@ -91,6 +86,7 @@ class ChatController extends BaseController
|
||||
$data["messages"] = $this->chatMessageModel->get_chat_messages($chat->id);
|
||||
$this->chatMessageModel->set_chat_department_messages_as_read($chat->id);
|
||||
$data["count"] = count($data["messages"]);
|
||||
|
||||
}
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
@ -112,76 +108,6 @@ class ChatController extends BaseController
|
||||
$data["chat"] = $chat;
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_chat_direct_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["chatId"] = $chat_id;
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
return view(static::$viewPath . 'messageChat', $this->viewData);
|
||||
}
|
||||
public function get_chat_presupuesto_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->presupuesto_id;
|
||||
$this->viewData["type"] = "presupuesto";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
if($chat->chat_department_id){
|
||||
return view(static::$viewPath . 'messageChatPresupuesto', $this->viewData);
|
||||
}else{
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat_pedido_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->pedido_id;
|
||||
$this->viewData["type"] = "pedido";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
if($chat->chat_department_id ){
|
||||
return view(static::$viewPath . 'messageChatPedido', $this->viewData);
|
||||
}else{
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat_factura_view($chat_id)
|
||||
{
|
||||
$chat = $this->chatModel->find($chat_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("Chat.chat"), 'route' => route_to("mensajeriaView"), 'active' => false],
|
||||
['title' => $chat->title, 'route' => 'javascript:void(0);', 'active' => true]
|
||||
];
|
||||
$this->viewData["modelId"] = $chat->factura_id;
|
||||
$this->viewData["type"] = "factura";
|
||||
$auth_user = auth()->user();
|
||||
$this->chatModel->setAsViewedChatUserNotifications($chat_id, $auth_user->id);
|
||||
$this->chatModel->setAsUnviewedChatUserMessages($chat_id, $auth_user->id);
|
||||
|
||||
if($chat->chat_department_id){
|
||||
return view(static::$viewPath . 'messageChatFactura', $this->viewData);
|
||||
}else{
|
||||
return view(static::$viewPath . 'messageChatInternal', $this->viewData);
|
||||
}
|
||||
}
|
||||
public function get_chat(int $chat_id)
|
||||
{
|
||||
|
||||
@ -202,12 +128,6 @@ class ChatController extends BaseController
|
||||
}
|
||||
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
$chatDepartmentUsers = $this->chatDeparmentModel->getChatDepartmentUsers($data["chat_department_id"]);
|
||||
foreach ($chatDepartmentUsers as $user) {
|
||||
if ($user->id != auth()->user()->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user->id]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON($dataResponse);
|
||||
}
|
||||
public function store_chat_message_pedido()
|
||||
@ -223,12 +143,6 @@ class ChatController extends BaseController
|
||||
}
|
||||
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
$chatDepartmentUsers = $this->chatDeparmentModel->getChatDepartmentUsers($data["chat_department_id"]);
|
||||
foreach ($chatDepartmentUsers as $user) {
|
||||
if ($user->id != auth()->user()->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user->id]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON($dataResponse);
|
||||
}
|
||||
public function store_chat_message_factura()
|
||||
@ -244,12 +158,6 @@ class ChatController extends BaseController
|
||||
}
|
||||
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
$chatDepartmentUsers = $this->chatDeparmentModel->getChatDepartmentUsers($data["chat_department_id"]);
|
||||
foreach ($chatDepartmentUsers as $user) {
|
||||
if ($user->id != auth()->user()->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user->id]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON($dataResponse);
|
||||
}
|
||||
public function store_chat_message_single()
|
||||
@ -267,46 +175,44 @@ class ChatController extends BaseController
|
||||
"chat_id" => $chatId,
|
||||
"sender_id" => auth()->user()->id,
|
||||
"message" => $data["message"],
|
||||
"receiver_id" => $data["receiver_id"],
|
||||
"receiver_id" => $data["receiver_id"]
|
||||
]
|
||||
);
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $data["receiver_id"]]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
return $this->response->setJSON($dataResponse);
|
||||
}
|
||||
public function get_chat_internal_contacts()
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
if ($auth_user->cliente_id) {
|
||||
$users = $this->chatModel->getOpenChatCliente($auth_user->id);
|
||||
} else {
|
||||
$users = $this->userModel->builder()
|
||||
->whereNotIn("id", [$auth_user->id])
|
||||
->where("deleted_at", null)
|
||||
->get()->getResultObject();
|
||||
if (auth()->user()->cliente_id) {
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
$users = $this->userModel->builder()
|
||||
->where("cliente_id", null)
|
||||
->whereNotIn("id", [auth()->user()->id])
|
||||
->where("deleted_at", null)
|
||||
->get()->getResultObject();
|
||||
foreach ($users as $user) {
|
||||
$user->unreadMessages = $this->chatMessageModel->get_chat_messages_count($user->id);
|
||||
$user->unreadMessages = $this->chatMessageModel->get_chat_unread_messages_count($user->id);
|
||||
}
|
||||
usort($users, fn($a, $b) => $a->unreadMessages < $b->unreadMessages);
|
||||
return $this->response->setJSON($users);
|
||||
}
|
||||
public function get_chat_internal_contact(int $user_id)
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
// if ($auth_user->cliente_id) {
|
||||
// return $this->response->setJSON([]);
|
||||
// }
|
||||
if (auth()->user()->cliente_id) {
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
$users = $this->userModel->builder()
|
||||
->where("cliente_id", null)
|
||||
->where("deleted_at", null)
|
||||
->where("id", $user_id)
|
||||
->get()->getFirstRow();
|
||||
$this->chatMessageModel->set_chat_messages_as_read($user_id);
|
||||
return $this->response->setJSON($users);
|
||||
}
|
||||
public function get_chat_internal_messages(int $user_id)
|
||||
{
|
||||
$conversation = $this->chatMessageModel->get_chat_contact_messages($user_id);
|
||||
|
||||
return $this->response->setJSON($conversation);
|
||||
}
|
||||
public function get_chat_cliente()
|
||||
@ -317,8 +223,6 @@ class ChatController extends BaseController
|
||||
$data = $this->clienteModel->getClienteDataPresupuestoPedidoFactura($cliente_id);
|
||||
$response["totalMessages"] = 0;
|
||||
$response["chatFacturas"] = $this->chatModel->getClienteChatFacturas($data["facturas"]);
|
||||
$mensajes_directos = $this->chatModel->getChatDirectMessageNotifications();
|
||||
|
||||
foreach ($response["chatFacturas"] as $key => $value) {
|
||||
$response["totalMessages"] += $value->unreadMessages;
|
||||
}
|
||||
@ -326,10 +230,6 @@ class ChatController extends BaseController
|
||||
foreach ($response["chatPresupuestos"] as $key => $value) {
|
||||
$response["totalMessages"] += $value->unreadMessages;
|
||||
}
|
||||
foreach ($mensajes_directos as $value) {
|
||||
$response["internals"][] = $value;
|
||||
$response["totalMessages"] += $value->unreadMessages;
|
||||
}
|
||||
$response["chatPedidos"] = $this->chatModel->getClienteChatPedidos($data["pedidos"]);
|
||||
foreach ($response["chatPedidos"] as $key => $value) {
|
||||
$response["totalMessages"] += $value->unreadMessages;
|
||||
@ -338,13 +238,9 @@ class ChatController extends BaseController
|
||||
} else {
|
||||
$response["internals"] = $this->chatModel->getChatDepartmentNotifications();
|
||||
$internal_notifications = $this->chatModel->getChatInternalNotifications();
|
||||
$mensajes_directos = $this->chatModel->getChatDirectMessageNotifications();
|
||||
foreach ($internal_notifications as $value) {
|
||||
$response["internals"][] = $value;
|
||||
}
|
||||
foreach ($mensajes_directos as $value) {
|
||||
$response["internals"][] = $value;
|
||||
}
|
||||
$response["totalMessages"] = 0;
|
||||
foreach ($response["internals"] as $key => $value) {
|
||||
$response["totalMessages"] += $value->unreadMessages;
|
||||
@ -367,26 +263,7 @@ class ChatController extends BaseController
|
||||
]
|
||||
)->where("cliente_id", null)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", [auth()->user()->id]);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("users.username", $this->request->getGet("q"))
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function get_chat_users_all()
|
||||
{
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name,'(',username,')') as name"
|
||||
]
|
||||
)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", [auth()->user()->id]);
|
||||
->whereNotIn("id",[auth()->user()->id]);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("users.username", $this->request->getGet("q"))
|
||||
@ -398,7 +275,6 @@ class ChatController extends BaseController
|
||||
}
|
||||
public function store_hebra_presupuesto()
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
$bodyData = $this->request->getPost();
|
||||
$chat_id = $this->chatModel->insert([
|
||||
"presupuesto_id" => $bodyData["modelId"],
|
||||
@ -407,19 +283,17 @@ class ChatController extends BaseController
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => $auth_user->id
|
||||
"sender_id" => auth()->user()->id
|
||||
]);
|
||||
if (isset($bodyData["users"])) {
|
||||
$bodyData["users"][] = $auth_user->id;
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x, "chat_id" => $chat_id], $bodyData["users"]);
|
||||
if(isset($bodyData["users"])){
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x,"chat_id" => $chat_id],$bodyData["users"]);
|
||||
$this->chatUserModel->insertBatch($chatUserData);
|
||||
foreach ($bodyData["users"] as $userId) {
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $userId]
|
||||
);
|
||||
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente", "status" => true]);
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
|
||||
}
|
||||
|
||||
public function store_hebra_pedido()
|
||||
@ -435,16 +309,15 @@ class ChatController extends BaseController
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => auth()->user()->id
|
||||
]);
|
||||
if (isset($bodyData["users"])) {
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x, "chat_id" => $chat_id], $bodyData["users"]);
|
||||
if(isset($bodyData["users"])){
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x,"chat_id" => $chat_id],$bodyData["users"]);
|
||||
$this->chatUserModel->insertBatch($chatUserData);
|
||||
foreach ($bodyData["users"] as $userId) {
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $userId]
|
||||
);
|
||||
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente", "status" => true]);
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
|
||||
}
|
||||
|
||||
public function store_hebra_factura()
|
||||
@ -459,242 +332,89 @@ class ChatController extends BaseController
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => auth()->user()->id
|
||||
]);
|
||||
if (isset($bodyData["users"])) {
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x, "chat_id" => $chat_id], $bodyData["users"]);
|
||||
if(isset($bodyData["users"])){
|
||||
$chatUserData = array_map(fn($x) => ["user_id" => $x,"chat_id" => $chat_id],$bodyData["users"]);
|
||||
$this->chatUserModel->insertBatch($chatUserData);
|
||||
foreach ($bodyData["users"] as $userId) {
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $userId]
|
||||
);
|
||||
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente", "status" => true]);
|
||||
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
|
||||
|
||||
}
|
||||
public function update_hebra($chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
$chatMessageId = $this->chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"message" => $bodyData["message"],
|
||||
"sender_id" => auth()->user()->id
|
||||
]);
|
||||
$actualUsers = $this->chatUserModel->builder()->select("user_id")->where("chat_id", $chat_id)->get()->getResultArray();
|
||||
$actualUsersArray = array_map(fn($x) => $x["user_id"], $actualUsers);
|
||||
$actualUsers = $this->chatUserModel->builder()->select("user_id")->where("chat_id",$chat_id)->get()->getResultArray();
|
||||
$actualUsersArray = array_map(fn($x) => $x["user_id"],$actualUsers);
|
||||
foreach ($actualUsersArray as $key => $user_id) {
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $user_id]
|
||||
);
|
||||
["chat_message_id" => $chatMessageId,"user_id" => $user_id]);
|
||||
}
|
||||
if (isset($bodyData["users"])) {
|
||||
if(isset($bodyData["users"])){
|
||||
foreach ($bodyData["users"] as $userId) {
|
||||
if (in_array($userId, $actualUsersArray) == false) {
|
||||
$chatUserData = ["user_id" => $userId, "chat_id" => $chat_id];
|
||||
if(in_array($userId,$actualUsersArray) == false){
|
||||
$chatUserData = ["user_id" => $userId,"chat_id" => $chat_id];
|
||||
$this->chatUserModel->insert($chatUserData);
|
||||
|
||||
}
|
||||
$this->chatNotificationModel->insert(
|
||||
["chat_message_id" => $chatMessageId, "user_id" => $userId]
|
||||
);
|
||||
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
|
||||
}
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Hebra actualizada correctamente", "status" => true]);
|
||||
return $this->response->setJSON(["message" => "Hebra actualizada correctamente","status" => true]);
|
||||
}
|
||||
public function get_hebra_presupuesto($presupuesto_id)
|
||||
{
|
||||
public function get_hebra_presupuesto($presupuesto_id){
|
||||
$data = $this->chatModel->getPresupuestoHebras($presupuesto_id);
|
||||
$notifications = $this->chatModel->builder()->select([
|
||||
"chat_notifications.id"
|
||||
])
|
||||
->join("chat_messages", "chat_messages.chat_id = chats.id", "left")
|
||||
->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left")
|
||||
->where("chats.presupuesto_id", $presupuesto_id)
|
||||
->where("chat_notifications.user_id", auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
->join("chat_messages","chat_messages.chat_id = chats.id","left")
|
||||
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
|
||||
->where("chats.presupuesto_id",$presupuesto_id)
|
||||
->where("chat_notifications.user_id",auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
foreach ($notifications as $notification) {
|
||||
$this->chatNotificationModel->update($notification["id"], ["viewed" => true]);
|
||||
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
|
||||
}
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_hebra_pedido($pedido_id)
|
||||
{
|
||||
public function get_hebra_pedido($pedido_id){
|
||||
$data = $this->chatModel->getPedidoHebras($pedido_id);
|
||||
$notifications = $this->chatModel->builder()->select([
|
||||
"chat_notifications.id"
|
||||
])
|
||||
->join("chat_messages", "chat_messages.chat_id = chats.id", "left")
|
||||
->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left")
|
||||
->where("chats.pedido_id", $pedido_id)
|
||||
->where("chat_notifications.user_id", auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
->join("chat_messages","chat_messages.chat_id = chats.id","left")
|
||||
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
|
||||
->where("chats.pedido_id",$pedido_id)
|
||||
->where("chat_notifications.user_id",auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
foreach ($notifications as $notification) {
|
||||
$this->chatNotificationModel->update($notification["id"], ["viewed" => true]);
|
||||
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
|
||||
}
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function get_hebra_factura($factura_id)
|
||||
{
|
||||
public function get_hebra_factura($factura_id){
|
||||
$data = $this->chatModel->getFacturaHebras($factura_id);
|
||||
$notifications = $this->chatModel->builder()->select([
|
||||
"chat_notifications.id"
|
||||
])
|
||||
->join("chat_messages", "chat_messages.chat_id = chats.id", "left")
|
||||
->join("chat_notifications", "chat_notifications.chat_message_id = chat_messages.id", "left")
|
||||
->where("chats.factura_id", $factura_id)
|
||||
->where("chat_notifications.user_id", auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
->join("chat_messages","chat_messages.chat_id = chats.id","left")
|
||||
->join("chat_notifications","chat_notifications.chat_message_id = chat_messages.id","left")
|
||||
->where("chats.factura_id",$factura_id)
|
||||
->where("chat_notifications.user_id",auth()->user()->id)
|
||||
->get()->getResultArray();
|
||||
foreach ($notifications as $notification) {
|
||||
$this->chatNotificationModel->update($notification["id"], ["viewed" => true]);
|
||||
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
|
||||
}
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
|
||||
public function datatable_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$query = $this->chatModel->getQueryDatatable($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i"))
|
||||
->edit('updated_at', fn($q) => Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i"))
|
||||
->add("creator", fn($q) => $this->chatModel->getChatFirstUser($q->id)->userFullName)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => ["type" => "direct","modelId" => $q->id])
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_presupuesto_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$query = $this->chatModel->getQueryDatatableMessagePresupuesto($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->add("creator", fn($q) => $this->chatModel->getChatFirstUser($q->id)->userFullName)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => ["type" => "presupuesto","modelId" => $q->id])
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_pedido_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$query = $this->chatModel->getQueryDatatableMessagePedido($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->add("creator", fn($q) => $this->chatModel->getChatFirstUser($q->id)->userFullName)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => ["type" => "pedido","modelId" => $q->id])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function datatable_factura_messages()
|
||||
{
|
||||
$auth_user_id = auth()->user()->id;
|
||||
$query = $this->chatModel->getQueryDatatableMessageFactura($auth_user_id);
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->edit('updated_at', fn($q) => $q->updated_at ? Time::createFromFormat('Y-m-d H:i:s', $q->updated_at)->format("d/m/Y H:i") : "")
|
||||
->add("creator", fn($q) => $this->chatModel->getChatFirstUser($q->id)->userFullName)
|
||||
->add("viewed", fn($q) => $this->chatModel->isMessageChatViewed($q->id, $auth_user_id))
|
||||
->add("action", fn($q) => ["type" => "factura","modelId" => $q->id])
|
||||
|
||||
->toJson(true);
|
||||
}
|
||||
public function store_new_direct_message()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$rules = [
|
||||
"title" => "required|string",
|
||||
"message" => "required|string",
|
||||
"users" => "required",
|
||||
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'message' => lang('App.global_alert_save_error'),
|
||||
'status' => 'error',
|
||||
'errors' => $this->validator->getErrors(),
|
||||
]);
|
||||
}
|
||||
$this->chatModel->createNewDirectChat(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("Chat.new_message_ok"), "status" => true]);
|
||||
}
|
||||
public function store_new_direct_message_client()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$rules = [
|
||||
"title" => "required|string",
|
||||
"message" => "required|string",
|
||||
"chat_department_id" => "required",
|
||||
|
||||
];
|
||||
if (!$this->validate($rules)) {
|
||||
return $this->response->setStatusCode(400)->setJSON([
|
||||
'message' => lang('App.global_alert_save_error'),
|
||||
'status' => 'error',
|
||||
'errors' => $this->validator->getErrors(),
|
||||
]);
|
||||
}
|
||||
$users = $this->chatDeparmentModel->getChatDepartmentUsers($bodyData["chat_department_id"]);
|
||||
$bodyData["users"] = array_map(fn($q) => $q->id,$users);
|
||||
dd(1);
|
||||
$this->chatModel->createNewDirectChat(...$bodyData);
|
||||
return $this->response->setJSON(["message" => lang("Chat.new_message_ok"), "status" => true]);
|
||||
}
|
||||
public function get_chat_direct($chat_id)
|
||||
{
|
||||
$chatData = $this->chatModel->getChatDirect($chat_id);
|
||||
return $this->response->setJSON($chatData);
|
||||
}
|
||||
public function get_chat_direct_select_users($chat_id)
|
||||
{
|
||||
$chat_users_id = $this->chatUserModel->getChatUserArrayId($chat_id);
|
||||
|
||||
$query = $this->userModel->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"CONCAT(first_name,' ',last_name,'(',username,')') as name"
|
||||
]
|
||||
)
|
||||
->where("deleted_at", null)
|
||||
->whereNotIn("id", $chat_users_id);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("users.username", $this->request->getGet("q"))
|
||||
->orLike("CONCAT(first_name,' ',last_name)", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
public function store_chat_direct_users($chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$chat_users = [];
|
||||
foreach ($bodyData["users"] as $user_id) {
|
||||
$chat_users[] = ["chat_id" => $chat_id, "user_id" => $user_id];
|
||||
if ($bodyData["notification"]) {
|
||||
$this->chatModel->createNotificationsToNewChatUser($chat_id, $user_id);
|
||||
}
|
||||
}
|
||||
$this->chatUserModel->insertBatch($chat_users);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
public function store_chat_direct_message(int $chat_id)
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$auth_user = auth()->user();
|
||||
$bodyData["sender_id"] = $auth_user->id;
|
||||
$chat_message_id = $this->chatMessageModel->insert($bodyData);
|
||||
$users_id = $this->chatUserModel->getChatUserArrayId($chat_id);
|
||||
foreach ($users_id as $user_id) {
|
||||
if ($user_id != $auth_user->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user_id]);
|
||||
}
|
||||
};
|
||||
$message = $this->chatMessageModel->get_chat_message($chat_message_id);
|
||||
return $this->response->setJSON($message);
|
||||
}
|
||||
public function update_chat_direct_message_unread($chat_id)
|
||||
{
|
||||
$this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
namespace App\Controllers\Clientes;
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -46,36 +45,40 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function updatePlantilla()
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$cliente_id = $postData['cliente_id'] ?? -1;
|
||||
$plantilla_id = $postData['plantilla_id'] ?? -1;
|
||||
$postData = $this->request->getJSON();
|
||||
|
||||
$plantilla_id = $postData->plantilla_id ?? -1;
|
||||
|
||||
// Se ha actualizado un registro por lo que no es una plantilla
|
||||
if ($plantilla_id == -1) {
|
||||
$this->model->clean_plantilla_id($cliente_id);
|
||||
} else if ($cliente_id == -1) { // actualizar todos los clientes que usan una plantilla
|
||||
$this->model->update_from_plantilla($plantilla_id);
|
||||
} else {
|
||||
$this->model->copy_from_plantilla($cliente_id, $plantilla_id);
|
||||
if($plantilla_id == -1){
|
||||
$this->model->clean_plantilla_id($requestedId);
|
||||
}
|
||||
|
||||
else if($requestedId== -1){ // actualizar todos los clientes que usan una plantilla
|
||||
$this->model->update_from_plantilla($plantilla_id);
|
||||
}
|
||||
else{
|
||||
$this->model->copy_from_plantilla($requestedId, $plantilla_id);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
endif; // ($requestMethod === 'post')
|
||||
}
|
||||
|
||||
|
||||
@ -90,114 +93,92 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
|
||||
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
|
||||
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
|
||||
$requestedOrder5 = $reqData['order']['4']['column'] ?? $requestedOrder;
|
||||
$order = ClientePreciosModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$order2 = ClientePreciosModel::SORTABLE[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
|
||||
$order3 = ClientePreciosModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
|
||||
$order4 = ClientePreciosModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
|
||||
$order5 = ClientePreciosModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder5 : $requestedOrder];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
|
||||
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
|
||||
$dir4= $reqData['order']['3']['dir'] ?? $dir;
|
||||
$dir5= $reqData['order']['4']['dir'] ?? $dir;
|
||||
|
||||
$cliente_id = $reqData['cliente_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues, $cliente_id);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClientePreciosModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
$resourceData = $this->model->getResource($cliente_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->orderBy($order5, $dir5)
|
||||
->limit($length, $start)->get()->getResultObject();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($searchValues, $cliente_id)->countAllResults(),
|
||||
$this->model->getResource($searchValues, $cliente_id)->countAllResults()
|
||||
$this->model->getResource($cliente_id)->countAllResults(),
|
||||
$this->model->getResource($cliente_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable_editor()
|
||||
{
|
||||
public function datatable_editor() {
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
|
||||
|
||||
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst($db, 'cliente_precios')
|
||||
$response = Editor::inst( $db, 'cliente_precios' )
|
||||
->fields(
|
||||
Field::inst('plantilla_id'),
|
||||
Field::inst('cliente_id'),
|
||||
Field::inst('tipo'),
|
||||
Field::inst('tipo_maquina'),
|
||||
Field::inst('tipo_impresion'),
|
||||
Field::inst('user_updated_id'),
|
||||
Field::inst('updated_at'),
|
||||
Field::inst('is_deleted'),
|
||||
Field::inst('tiempo_min')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
Field::inst( 'plantilla_id' ),
|
||||
Field::inst( 'cliente_id' ),
|
||||
Field::inst( 'tipo' ),
|
||||
Field::inst( 'tipo_maquina' ),
|
||||
Field::inst( 'tipo_impresion' ),
|
||||
Field::inst( 'user_updated_id' ),
|
||||
Field::inst( 'updated_at' ),
|
||||
Field::inst( 'is_deleted' ),
|
||||
Field::inst( 'tiempo_min' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
Field::inst('tiempo_max')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
|
||||
Field::inst( 'tiempo_max' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
Field::inst('precio_hora')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
|
||||
Field::inst( 'precio_hora' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
Field::inst('margen')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::notEmpty',
|
||||
array(
|
||||
'message' => lang('ClientePrecios.validation.required')
|
||||
)
|
||||
|
||||
Field::inst( 'margen' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator( 'Validate::notEmpty',array(
|
||||
'message' => lang('ClientePrecios.validation.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('ClientePrecios.validation.decimal')
|
||||
)
|
||||
'message' => lang('ClientePrecios.validation.decimal'))
|
||||
),
|
||||
|
||||
)
|
||||
@ -222,19 +203,21 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
})
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
->setValue($session->id_user);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
})
|
||||
->on('preEdit', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
->setValue($session->id_user);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
@ -255,16 +238,4 @@ class ClientePrecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurrentPlantilla()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
$cliente_id = $this->request->getGet('cliente_id');
|
||||
$plantilla = $this->model->getPlantilla($cliente_id);
|
||||
return $this->respond($plantilla);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -234,10 +234,6 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
|
||||
try {
|
||||
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
|
||||
$resourceData = $model->getDireccion($id);
|
||||
if(count($resourceData) > 0){
|
||||
$resourceData[0]->direccionId = $id;
|
||||
}
|
||||
|
||||
$response = (object)[
|
||||
'error' => false,
|
||||
'data' => $resourceData
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
namespace App\Controllers\Clientes;
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -71,48 +70,51 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
// plantilla desde la lista
|
||||
public function update($requestedId = null)
|
||||
{
|
||||
|
||||
|
||||
if ($requestedId == null):
|
||||
return;
|
||||
endif;
|
||||
$model = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$model->delete_values($requestedId);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
if ($requestedId == null) :
|
||||
return;
|
||||
endif;
|
||||
$model = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$model->delete_values($requestedId);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$cliente_id = $postData['cliente_id'] ?? -1;
|
||||
$from_client_data = $postData['from_client_data'] ?? 0;
|
||||
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_created_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -124,27 +126,24 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
if ($from_client_data == 1) {
|
||||
$thenRedirect = false;
|
||||
} else {
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
}
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($cliente_id != -1) {
|
||||
if($cliente_id != -1){
|
||||
$modelLineas = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$modelLineas->copy_from_cliente($cliente_id, $id);
|
||||
$modelClientePrecios = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$modelClientePrecios->set_plantilla_id($cliente_id, $id);
|
||||
return $this->respond(['status' => 'success', 'id' => $id]);
|
||||
} else {
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return ;
|
||||
}
|
||||
else{
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('/clientes/clienteplantillaprecios/edit/' . $id))->with('message', $message);
|
||||
else:
|
||||
@ -172,35 +171,35 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
if ($requestedId == null):
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$clientePlantillaPreciosEntity = $this->model->find($id);
|
||||
|
||||
if ($clientePlantillaPreciosEntity == false):
|
||||
if ($clientePlantillaPreciosEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Clientes.cliente')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -217,12 +216,12 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $clientePlantillaPreciosEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
@ -237,7 +236,7 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
//var_dump($clientePlantillaPreciosEntity); dd();
|
||||
|
||||
$this->viewData['clienteplantillapreciosEntity'] = $clientePlantillaPreciosEntity;
|
||||
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateClienteplantillaprecios', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Clientes.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
@ -247,23 +246,6 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function updatePlantillaEnCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$plantilla_id = $reqData['plantilla_id'] ?? -1;
|
||||
|
||||
$model = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$model->update_plantilla_id($plantilla_id);
|
||||
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -275,16 +257,16 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ClientePlantillaPreciosModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
$this->model->getResource($search)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -293,32 +275,34 @@ class Clienteplantillaprecios extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
|
||||
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("cliente_plantilla_precios.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
$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 ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr, true);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
}
|
||||
catch(Exception $e){
|
||||
$menu = [];
|
||||
}
|
||||
|
||||
$items = $query->get()->getResultObject();
|
||||
// add a custom item at the beginning
|
||||
$customItem = new \stdClass;
|
||||
$customItem->id = 0;
|
||||
$customItem->name = "Personalizado";
|
||||
array_unshift($items, $customItem);
|
||||
|
||||
return $this->response->setJSON($items);
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -93,27 +93,31 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
|
||||
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
|
||||
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
|
||||
$requestedOrder4 = $reqData['order']['3']['column'] ?? $requestedOrder;
|
||||
$requestedOrder5 = $reqData['order']['4']['column'] ?? $requestedOrder;
|
||||
$order = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 0];
|
||||
$order2 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder2 >= 0 ? $requestedOrder2 : $requestedOrder];
|
||||
$order3 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder3 >= 0 ? $requestedOrder3 : $requestedOrder];
|
||||
$order4 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder4 : $requestedOrder];
|
||||
$order5 = ClientePlantillaPreciosLineasModel::SORTABLE[$requestedOrder4 >= 0 ? $requestedOrder5 : $requestedOrder];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$dir2 = $reqData['order']['1']['dir'] ?? $dir;
|
||||
$dir3 = $reqData['order']['2']['dir'] ?? $dir;
|
||||
$dir4= $reqData['order']['3']['dir'] ?? $dir;
|
||||
$dir5= $reqData['order']['4']['dir'] ?? $dir;
|
||||
|
||||
$plantilla_id = $reqData['plantilla_id'] ?? 0;
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues, $plantilla_id);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = ClientePlantillaPreciosLineasModel::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
$resourceData = $this->model->getResource($plantilla_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)->orderBy($order4, $dir4)->orderBy($order5, $dir5)
|
||||
->limit($length, $start)->get()->getResultObject();
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource([], $plantilla_id)->countAllResults(),
|
||||
$this->model->getResource($searchValues, $plantilla_id)->countAllResults()
|
||||
$this->model->getResource($plantilla_id)->countAllResults(),
|
||||
$this->model->getResource($plantilla_id)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
@ -134,8 +138,6 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
||||
Field::inst( 'tipo_maquina' ),
|
||||
Field::inst( 'tipo_impresion' ),
|
||||
Field::inst( 'user_updated_id' ),
|
||||
Field::inst( 'deleted_at' ),
|
||||
Field::inst( 'is_deleted' ),
|
||||
Field::inst( 'updated_at' ),
|
||||
Field::inst( 'tiempo_min' )
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
@ -199,20 +201,21 @@ class Clienteplantillaprecioslineas extends \App\Controllers\BaseResourceControl
|
||||
}
|
||||
})
|
||||
->on('preCreate', function ($editor, &$values) {
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
->setValue($session->id_user);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
})
|
||||
->on('preEdit', function ($editor, &$values) {
|
||||
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$editor
|
||||
->field('user_updated_id')
|
||||
->setValue(auth()->user()->id);
|
||||
->setValue($session->id_user);
|
||||
$editor
|
||||
->field('updated_at')
|
||||
->setValue($datetime->format('Y-m-d H:i:s'));
|
||||
|
||||
@ -271,27 +271,6 @@ class Comunidadesautonomas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_comunidades_autonomas.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)
|
||||
{
|
||||
|
||||
@ -230,19 +230,25 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("formas_pago.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
$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 ?? 'nombre'];
|
||||
$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);
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -269,25 +269,4 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_paises.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -156,13 +156,8 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('show_in_client') == null) {
|
||||
$sanitizedData['show_in_client'] = false;
|
||||
}
|
||||
if ($this->request->getPost('show_in_client_special') == null) {
|
||||
$sanitizedData['show_in_client_special'] = false;
|
||||
}
|
||||
|
||||
if($sanitizedData['show_in_client_special']){
|
||||
$sanitizedData['show_in_client'] = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
@ -293,74 +288,4 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if($tirada != null){
|
||||
$POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
if(intval($tirada) <= intval($POD_value)){
|
||||
$POD = true;
|
||||
}
|
||||
else{
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, false, $POD);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, $tapa_dura, true, $POD);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
'papeles_especiales' => $menu2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if($tirada != null){
|
||||
$POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
if(intval($tirada) <= intval($POD_value)){
|
||||
$POD = true;
|
||||
}
|
||||
else{
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, null, true, $POD);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
}, $items);
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = false; // !(phpversion() >= '8.1');
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
@ -188,9 +188,6 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('defecto') == null) {
|
||||
$sanitizedData['defecto'] = false;
|
||||
}
|
||||
if ($this->request->getPost('interior') == null) {
|
||||
$sanitizedData['interior'] = false;
|
||||
}
|
||||
if ($this->request->getPost('bn') == null) {
|
||||
$sanitizedData['bn'] = false;
|
||||
}
|
||||
@ -200,9 +197,6 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('cubierta') == null) {
|
||||
$sanitizedData['cubierta'] = false;
|
||||
}
|
||||
if ($this->request->getPost('use_for_tapa_dura') == null) {
|
||||
$sanitizedData['use_for_tapa_dura'] = false;
|
||||
}
|
||||
if ($this->request->getPost('sobrecubierta') == null) {
|
||||
$sanitizedData['sobrecubierta'] = false;
|
||||
}
|
||||
@ -215,12 +209,6 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('inkjet') == null) {
|
||||
$sanitizedData['inkjet'] = false;
|
||||
}
|
||||
if ($this->request->getPost('isActivo') == null) {
|
||||
$sanitizedData['isActivo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('use_in_client') == null) {
|
||||
$sanitizedData['use_in_client'] = false;
|
||||
}
|
||||
|
||||
// Hay que asegurarse de que se quitan los consumos de tintas de rotativa
|
||||
// en caso de que se haya deseleccionado la opción rotativa
|
||||
|
||||
@ -271,27 +271,6 @@ class Provincias extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_provincias.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)
|
||||
{
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Configuracion\ServicioClienteModel;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use Hermawan\DataTables\DataTable;
|
||||
use CodeIgniter\I18n\Time;
|
||||
|
||||
class ServicioCliente extends BaseController
|
||||
{
|
||||
|
||||
protected ServicioClienteModel $servicioClienteModel;
|
||||
protected $format = 'json';
|
||||
protected array $viewData = [];
|
||||
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/configuracion/servicios_cliente/';
|
||||
protected static $controllerSlug = "servicios";
|
||||
protected $indexRoute = 'viewServicioCliente';
|
||||
protected $editRoute = 'ServicioClienteEdit';
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->servicioClienteModel = model(ServicioClienteModel::class);
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_servicios_cliente"), 'route' => site_url('configuracion/servicios'), 'active' => true]
|
||||
];
|
||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||
}
|
||||
public function viewForm(int $servicio_cliente_id)
|
||||
{
|
||||
$servicioCliente = $this->servicioClienteModel->find($servicio_cliente_id);
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_servicios_cliente"), 'route' => site_url('configuracion/servicios'), 'active' => false],
|
||||
['title' => $servicioCliente->nombre, 'route' => site_url('configuracion/servicios/edit/' . $servicio_cliente_id), 'active' => true]
|
||||
];
|
||||
$this->viewData["model"] = $servicioCliente;
|
||||
|
||||
return view(static::$viewPath . 'ServicioClienteEdit', $this->viewData);
|
||||
}
|
||||
public function show(int $id)
|
||||
{
|
||||
$data = $this->servicioClienteModel->find($id)->withAllTarifas();
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function update_servicio_cliente(int $id)
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
$status = $this->servicioClienteModel->update($id, [
|
||||
"nombre" => $data["nombre"],
|
||||
"code" => $data["code"]
|
||||
]);
|
||||
if (isset($data["tarifa_manipulado_id"])) {
|
||||
$this->servicioClienteModel->upsertTarifaManipulado($id, $data["tarifa_manipulado_id"]);
|
||||
}else if(isset($data["tarifa_acabado_id"])) {
|
||||
|
||||
$this->servicioClienteModel->upsertTarifaAcabado($id, $data["tarifa_acabado_id"]);
|
||||
}else{
|
||||
$this->servicioClienteModel->detachTarifas($id);
|
||||
}
|
||||
|
||||
return $this->response->setJSON(["message" => lang("App.global_success"), "status" => $status]);
|
||||
}
|
||||
public function store()
|
||||
{
|
||||
// $this->servicioClienteModel->update($id,[$this->request->getPost()]);
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
public function datatable()
|
||||
{
|
||||
$query = $this->servicioClienteModel->getQueryDatatable()->orderBy("created_at", "DESC");
|
||||
return DataTable::of($query)
|
||||
->edit('created_at', fn($q) => $q->created_at ? Time::createFromFormat('Y-m-d H:i:s', $q->created_at)->format("d/m/Y H:i") : "")
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
private ChatDeparmentUserModel $chat_department_user_model;
|
||||
|
||||
|
||||
|
||||
use \CodeIgniter\API\ResponseTrait;
|
||||
|
||||
protected static $primaryModelName = 'App\Models\UserModel';
|
||||
@ -61,7 +62,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$this->viewData['usingClientSideDataTable'] = true;
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Users.user')]);
|
||||
$this->viewData['user_model'] = $this->user_model;
|
||||
$this->viewData['userList2'] = auth()->getProvider()->findAll();
|
||||
$this->viewData['userList2'] = auth()->getProvider()->findAll();
|
||||
|
||||
parent::index();
|
||||
}
|
||||
@ -76,17 +77,17 @@ class Users extends \App\Controllers\GoBaseController
|
||||
// Obtener contraseña nueva si se ha introducido en texto plano
|
||||
if (empty($postData['new_pwd'])) {
|
||||
$postData['password'] = 'Safekat2024'; // Contraseña por defecto
|
||||
} else {
|
||||
}else{
|
||||
$postData['password'] = $postData['new_pwd'];
|
||||
}
|
||||
|
||||
// Obtener los grupos a los que pertenece
|
||||
$currentGroups = $postData['group'] ?? [];
|
||||
$chatDepartments = $postData['chatDepartments'] ?? [];
|
||||
unset($postData['group']);
|
||||
unset($postData['chatDepartments']);
|
||||
|
||||
// Marcar el username como NULL
|
||||
// Generar el nombre de usuario
|
||||
$postData['username'] = strstr($postData['email'], '@', true);
|
||||
$sanitizedData = $this->sanitized($postData, true);
|
||||
|
||||
$noException = true;
|
||||
@ -98,43 +99,33 @@ class Users extends \App\Controllers\GoBaseController
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
|
||||
// The Email is unique
|
||||
if ($this->user_model->isEmailUnique($sanitizedData['email'])) {
|
||||
|
||||
// Crear el usuario si pasa la validación
|
||||
$user = new \CodeIgniter\Shield\Entities\User([
|
||||
'username' => null, // If you don't have a username, be sure to set the value to null anyway, so that it passes CodeIgniter's empty data check
|
||||
'first_name' => $sanitizedData['first_name'],
|
||||
'last_name' => $sanitizedData['last_name'],
|
||||
'cliente_id' => $sanitizedData['cliente_id'],
|
||||
'comments' => $sanitizedData['comments'],
|
||||
'email' => $sanitizedData['email'],
|
||||
'password' => $sanitizedData['password'],
|
||||
'status' => $sanitizedData['status'] ?? 0,
|
||||
'active' => $sanitizedData['active'] ?? 0,
|
||||
]);
|
||||
// Add the user to the system
|
||||
$users->save($user);
|
||||
$successfulResult = true; // Hacked
|
||||
|
||||
} // Email is not unique!
|
||||
else {
|
||||
$this->viewData['errorMessage'] = "El correo '". $sanitizedData['email'] ."' ya está registrado en el sistema";
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
$successfulResult = false; // Hacked
|
||||
}
|
||||
|
||||
$user = new User([
|
||||
'username' => $sanitizedData['username'],
|
||||
'first_name' => $sanitizedData['first_name'],
|
||||
'last_name' => $sanitizedData['last_name'],
|
||||
'email' => $sanitizedData['email'],
|
||||
'password' => $sanitizedData['password'],
|
||||
'status' => $sanitizedData['status'] ?? 0,
|
||||
'active' => $sanitizedData['active'] ?? 0,
|
||||
]);
|
||||
$users->save($user);
|
||||
$successfulResult = true; // Hacked
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->viewData['errorMessage'] = $e->getMessage();
|
||||
//$this->dealWithException($e);
|
||||
if (strpos($e->getMessage(), 'correo duplicado') !== false) {
|
||||
$this->viewData['errorMessage'] = "El correo electrónico ya está registrado en el sistema";
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
}
|
||||
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $users->getInsertID();
|
||||
@ -146,11 +137,12 @@ class Users extends \App\Controllers\GoBaseController
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->where("user_id",$id)->delete();
|
||||
foreach($chatDepartments as $chatDepartment)
|
||||
{
|
||||
$this->chat_department_user_model->insert([
|
||||
"user_id" => $id,
|
||||
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()["id"]
|
||||
"chat_department_id" => $this->chat_department_model->where("name",$chatDepartment)->first()["id"]
|
||||
]);
|
||||
}
|
||||
|
||||
@ -207,6 +199,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
unset($postData['group']);
|
||||
unset($postData['chatDepartments']);
|
||||
|
||||
// Obtener contraseña nueva si se ha introducido en texto plano
|
||||
// Obtener contraseña nueva si se ha introducido en texto plano
|
||||
if (!empty($postData['new_pwd'])) {
|
||||
$postData['password'] = $postData['new_pwd'];
|
||||
@ -261,11 +254,12 @@ class Users extends \App\Controllers\GoBaseController
|
||||
];
|
||||
$this->group_user_model->insert($group_user_data);
|
||||
}
|
||||
$this->chat_department_user_model->where("user_id", $id)->delete();
|
||||
foreach ($chatDepartments as $chatDepartment) {
|
||||
$this->chat_department_user_model->where("user_id",$id)->delete();
|
||||
foreach($chatDepartments as $chatDepartment)
|
||||
{
|
||||
$this->chat_department_user_model->insert([
|
||||
"user_id" => $id,
|
||||
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()->id
|
||||
"chat_department_id" => $this->chat_department_model->where("name",$chatDepartment)->first()["id"]
|
||||
]);
|
||||
}
|
||||
$id = $user->id ?? $id;
|
||||
@ -290,7 +284,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
$this->viewData['formAction'] = route_to('updateUser', $id);
|
||||
$this->viewData['selectedGroups'] = $this->group_model->getUsersRoles($requestedId);
|
||||
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->select(["display", "name", "id as chatDepartmentId"])->findAll();
|
||||
$this->viewData['chatDepartments'] = $this->chat_department_model->select(["display","name","id as chatDepartmentId"])->findAll();
|
||||
$this->viewData['chatDepartmentUser'] = $this->chat_department_user_model->getChatDepartmentUser($user->id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
@ -314,7 +308,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
endif;
|
||||
|
||||
$users = auth()->getProvider();
|
||||
$users->delete($user->id, true);
|
||||
$users->delete($user->id);
|
||||
|
||||
$message = "Usuario eliminado correctamente";
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
@ -378,7 +372,13 @@ class Users extends \App\Controllers\GoBaseController
|
||||
if ($this->request->isAJAX()) {
|
||||
$comerciales = $this->model->getComerciales();
|
||||
|
||||
return $this->respond($comerciales);
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $comerciales,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@ class Js_loader extends BaseController
|
||||
|
||||
|
||||
|
||||
function comparadorPresupuestoAdmin_js()
|
||||
function comparadorCosidoTapaBlanda_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/comparador.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/comparador.js');
|
||||
|
||||
}
|
||||
|
||||
@ -37,49 +37,49 @@ class Js_loader extends BaseController
|
||||
function datosLibro_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_datosLibroItems.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.js');
|
||||
}
|
||||
|
||||
function previsualizador_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/previews.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/previews.js');
|
||||
}
|
||||
|
||||
function lineasPresupuesto_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.js');
|
||||
}
|
||||
|
||||
function tiradasAlternativas_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_tiradasAlternativasItems.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js');
|
||||
}
|
||||
|
||||
function datosServicios_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_datosServiciosItems.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js');
|
||||
}
|
||||
|
||||
function datosEnvios_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_datosEnvios.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.js');
|
||||
}
|
||||
|
||||
function resumenPresupuestos_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_resumenPresupuestos.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js');
|
||||
}
|
||||
|
||||
function presupuestos_js()
|
||||
{
|
||||
$this->response->setHeader('Content-Type', 'text/javascript');
|
||||
return view('themes/vuexy/form/presupuestos/admin/_presupuestos.js');
|
||||
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_presupuestos.js');
|
||||
}
|
||||
|
||||
function presupuestoCliente_js()
|
||||
|
||||
@ -21,22 +21,9 @@ class Language extends BaseController
|
||||
public function getTranslation()
|
||||
{
|
||||
$translationFile = $this->request->getPost('translationFile');
|
||||
$data = [];
|
||||
if(is_array($translationFile)){
|
||||
foreach($translationFile as $file){
|
||||
$locale = $this->request->getPost('locale');
|
||||
$path = "Language/{$locale}/$file.php";
|
||||
$lang = require APPPATH.$path;
|
||||
$data[$file] = $lang;
|
||||
}
|
||||
return json_encode($data);
|
||||
}
|
||||
else{
|
||||
$locale = $this->request->getPost('locale');
|
||||
$path = "Language/{$locale}/$translationFile.php";
|
||||
$lang = require APPPATH.$path;
|
||||
return json_encode($lang);
|
||||
}
|
||||
|
||||
$locale = $this->request->getPost('locale');
|
||||
$path = "Language/{$locale}/$translationFile.php";
|
||||
$lang = require APPPATH.$path;
|
||||
return json_encode($lang);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,13 +56,8 @@ class PrintPresupuestos extends BaseController
|
||||
$options->set('isRemoteEnabled', true);
|
||||
$dompdf = new \Dompdf\Dompdf($options);
|
||||
|
||||
// Metodo que funciona en el docker
|
||||
$css = file_get_contents(getenv('theme.path'). 'css/pdf.presupuesto.css');
|
||||
$html = view(getenv('theme.path') . 'pdfs/presupuesto', $data);
|
||||
$html = "<style>$css</style>" . $html;
|
||||
$dompdf->loadHtml($html);
|
||||
|
||||
//$dompdf->loadHtml(view(getenv('theme.path') . 'pdfs/presupuesto', $data));
|
||||
// Contenido HTML del documento
|
||||
$dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto', $data));
|
||||
|
||||
// Establecer el tamaño del papel
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
|
||||
@ -388,9 +388,5 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
// $xml_service = new PedidoXMLService($this->model);
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
public function pedidoToProduction(int $pedido_id){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
26
ci4/app/Controllers/Presupuestos/Presupuestoadmin.php → ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
Normal file → Executable file
26
ci4/app/Controllers/Presupuestos/Presupuestoadmin.php → ci4/app/Controllers/Presupuestos/Cosidotapablanda.php
Normal file → Executable file
@ -19,22 +19,22 @@ use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
|
||||
use App\Services\PresupuestoService;
|
||||
use Exception;
|
||||
|
||||
class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
class Cosidotapablanda extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = "PresupuestoModel";
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Presupuesto Admin';
|
||||
protected static $singularObjectNameCc = 'Presupuestoadmin';
|
||||
protected static $pluralObjectName = 'Presupuestos Admin';
|
||||
protected static $pluralObjectNameCc = 'PresupuestosAdmin';
|
||||
protected static $singularObjectName = 'Cosido Tapa Blanda';
|
||||
protected static $singularObjectNameCc = 'Cosidotapablanda';
|
||||
protected static $pluralObjectName = 'Cosidos Tapa Blanda';
|
||||
protected static $pluralObjectNameCc = 'cosidosTapaBlanda';
|
||||
|
||||
protected static $controllerSlug = 'presupuestoadmin';
|
||||
protected static $controllerSlug = 'cosidotapablanda';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/presupuestos/admin/';
|
||||
protected static $viewPath = 'themes/vuexy/form/presupuestos/cosidotapablanda/';
|
||||
|
||||
protected $indexRoute = 'presupuestoadminList';
|
||||
protected $indexRoute = 'cosidotapablandaList';
|
||||
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
|
||||
return view(static::$viewPath . 'viewPresupuestoAdminList', $viewData);
|
||||
return view(static::$viewPath . 'viewCosidotapablandaList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
//return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('presupuestoadmin/edit/' . $id))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('presupuestos/cosidotapablanda/edit/' . $id))->with('sweet-success', $message);
|
||||
else :
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -151,7 +151,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['POD'] = $this->getPOD();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createPresupuestoAdmin', $tipo_impresion_id);
|
||||
$this->viewData['formAction'] = route_to('createCosidotapablanda', $tipo_impresion_id);
|
||||
|
||||
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($tipo_impresion_id));
|
||||
|
||||
@ -387,7 +387,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($presupuestoEntity->tipo_impresion_id));
|
||||
|
||||
$this->viewData['formAction'] = route_to('updatePresupuestoAdmin', $id);
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||
@ -840,7 +840,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
// Breadcrumbs
|
||||
$viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => $breadcrumbTitle, 'route' => site_url('presupuestoadmin/list/' . $tipo_impresion_id), 'active' => true]
|
||||
['title' => $breadcrumbTitle, 'route' => site_url('presupuestos/cosidotapablanda/list/' . $tipo_impresion_id), 'active' => true]
|
||||
];
|
||||
|
||||
return $viewData;
|
||||
@ -118,8 +118,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['formAction'] = 'add';
|
||||
|
||||
$this->viewData['state'] = 1;
|
||||
|
||||
$this->viewData['paisList'] = model('App\Models\Configuracion\PaisModel')->getAllForMenu('id, nombre', 'nombre', true);
|
||||
$this->viewData['clienteId'] = $clienteId;
|
||||
$this->viewData['POD'] = $POD;
|
||||
@ -166,7 +164,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
if ($presupuestoEntity->is_duplicado) {
|
||||
$this->model->removeIsDuplicado($presupuestoEntity->id);
|
||||
}
|
||||
|
||||
|
||||
$this->viewData['presupuestoId'] = $presupuestoEntity->id;
|
||||
$this->viewData['state'] = intval($presupuestoEntity->estado_id);
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
||||
@ -296,6 +294,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$faja = $reqData['faja'] ?? [];
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$excluirRotativa = intval($excluirRotativa);
|
||||
$ivaReducido = intval($reqData['ivaReducido']) ?? 0;
|
||||
|
||||
$direcciones = $reqData['direcciones'] ?? [];
|
||||
|
||||
@ -303,12 +302,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$lomoRedondo = $cubierta['lomoRedondo'] ?? 0;
|
||||
|
||||
if ($papelInteriorDiferente) {
|
||||
$papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray();
|
||||
$papel['color'] = $modelPapelGenerico->where('id', $interior['papelInterior']['color'])->first()->toArray();
|
||||
$papel['negro'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['negro']);
|
||||
$papel['color'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['color']);
|
||||
$gramaje['negro'] = intval($interior['gramajeInterior']['negro']);
|
||||
$gramaje['color'] = intval($interior['gramajeInterior']['color']);
|
||||
} else {
|
||||
$papel = $modelPapelGenerico->where('id', $interior['papelInterior'])->first()->toArray();
|
||||
$papel = $modelPapelGenerico->getIdFromCode($interior['papelInterior']);
|
||||
$gramaje = intval($interior['gramajeInterior']);
|
||||
}
|
||||
// Interior
|
||||
@ -324,10 +323,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
// Cubierta
|
||||
$cubierta = [
|
||||
'papel_generico_cubierta' => $modelPapelGenerico->where('id', $cubierta['papelCubierta'])->first()->toArray(),
|
||||
'papel_generico_cubierta' => $modelPapelGenerico->getIdFromCode($cubierta['papelCubierta']),
|
||||
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
||||
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1 ? intval($cubierta['tamanioSolapas']) : 0,
|
||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0),
|
||||
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
||||
'lomoRedondo' => $lomoRedondo,
|
||||
];
|
||||
@ -395,16 +394,14 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
for ($i = 0; $i < count($tirada); $i++) {
|
||||
|
||||
$coste_envio = 0.0;
|
||||
$primer_envio = false;
|
||||
foreach ($direcciones as $direccion) {
|
||||
$coste_direccion = $this->getCosteEnvio(
|
||||
$direccion['id'],
|
||||
$return_data['peso'][$i],
|
||||
!$primer_envio ? intval($tirada[$i]) : $direccion['unidades'],
|
||||
$direccion['unidades'],
|
||||
$direccion['entregaPalets'] == 'true' ? 1 : 0
|
||||
)[0];
|
||||
|
||||
$primer_envio = true;
|
||||
|
||||
if (!property_exists($coste_direccion, 'coste')) {
|
||||
|
||||
@ -464,106 +461,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
return $this->respond($return_data);
|
||||
} catch (Exception $e) {
|
||||
return $this->failServerError($e->getMessage() . ' - ' . $e->getFile() . ' - ' . $e->getLine());
|
||||
return $this->failServerError($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function calcularMaxSolapas()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
$modelPapelGenerico = new PapelGenericoModel();
|
||||
|
||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
|
||||
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$tamanio = $reqData['tamanio'];
|
||||
$paginas = $reqData['paginas'] ?? 0;
|
||||
$paginas_color = $reqData['paginasColor'] ?? 0;
|
||||
$papelInteriorDiferente = intval($reqData['papelInteriorDiferente']) ?? null;
|
||||
$excluirRotativa = $reqData['excluirRotativa'] ?? 0;
|
||||
$excluirRotativa = intval($excluirRotativa);
|
||||
|
||||
$tipo = $reqData['tipo'];
|
||||
$tipoCubierta = 'blanda'; // solapas sólo tapa blanda y sobre cubierta
|
||||
|
||||
$isColor = intval($reqData['isColor']) ?? 0;
|
||||
$isHq = intval($reqData['isHq']) ?? 0;
|
||||
|
||||
$tipo_impresion_id = $this->getTipoImpresion($tipo, $tipoCubierta);
|
||||
$is_cosido = (new TipoPresupuestoModel())->get_isCosido($tipo_impresion_id);
|
||||
|
||||
$interior = $reqData['interior'] ?? [];
|
||||
|
||||
if ($papelInteriorDiferente) {
|
||||
$papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray();
|
||||
$papel['color'] = $modelPapelGenerico->where('id', $interior['papelInterior']['color'])->first()->toArray();
|
||||
$gramaje['negro'] = intval($interior['gramajeInterior']['negro']);
|
||||
$gramaje['color'] = intval($interior['gramajeInterior']['color']);
|
||||
} else {
|
||||
$papel = $modelPapelGenerico->where('id', $interior['papelInterior'])->first()->toArray();
|
||||
$gramaje = intval($interior['gramajeInterior']);
|
||||
}
|
||||
|
||||
$datosPedido = (object) array(
|
||||
'paginas' => $paginas,
|
||||
'tirada' => $tirada[0],
|
||||
'merma' => $tirada[0] > $POD ? $this->calcular_merma($tirada[0], $POD) : 0,
|
||||
'ancho' => intval($tamanio['ancho']) ?? 100000,
|
||||
'alto' => intval($tamanio['alto']) ?? 100000,
|
||||
'isCosido' => $is_cosido,
|
||||
'a_favor_fibra' => 1,
|
||||
);
|
||||
|
||||
// Para POD siempre es HQ
|
||||
if ($tirada[0] <= $POD) {
|
||||
$isHq = true;
|
||||
}
|
||||
|
||||
$input_data = array(
|
||||
'uso' => 'interior',
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
'datosPedido' => $datosPedido,
|
||||
'papel_generico' => $papel,
|
||||
'gramaje' => $gramaje,
|
||||
'isColor' => $isColor,
|
||||
'isHq' => $isHq,
|
||||
'cliente_id' => $cliente_id,
|
||||
'paginas_color' => $paginas_color,
|
||||
'excluirRotativa' => $excluirRotativa,
|
||||
'papelInteriorDiferente' => $papelInteriorDiferente
|
||||
);
|
||||
|
||||
$interior = PresupuestoClienteService::obtenerInterior($input_data);
|
||||
if ($interior == null) {
|
||||
return $this->failServerError('Error al calcular el interior');
|
||||
}
|
||||
$anchoTotal = $interior[0]['mano'];
|
||||
// le añadimos 2*ancho libro
|
||||
$anchoTotal += 2 * $datosPedido->ancho;
|
||||
// le añadimos los dobleces de las solapas
|
||||
$anchoTotal += 6;
|
||||
// le añadimos la sangre
|
||||
$anchoTotal += PresupuestoService::SANGRE_FORMAS;
|
||||
// 863 es el ancho máximo permitido por las máquinas
|
||||
$maxSolapa = (865 - floor($anchoTotal)) / 2;
|
||||
$maxSolapa = min($maxSolapa, 0.75 * $datosPedido->ancho);
|
||||
return $this->respond($maxSolapa);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getDireccionesCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
@ -581,7 +485,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
'menu' => $data,
|
||||
$csrfTokenName => $newTokenHash
|
||||
]);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -747,11 +650,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$isHq = intval($reqData['isHq']) ?? 0;
|
||||
|
||||
$prototipo = intval($reqData['prototipo']) ?? 0;
|
||||
$ferro = intval($reqData['ferro']) ?? 0;
|
||||
$ferroDigital = intval($reqData['ferroDigital']) ?? 0;
|
||||
$marcapaginas = intval($reqData['marcapaginas']) ?? 0;
|
||||
$retractilado = intval($reqData['retractilado']) ?? 0;
|
||||
$retractilado5 = intval($reqData['retractilado5']) ?? 0;
|
||||
|
||||
$interior = $reqData['interior'] ?? [];
|
||||
$cubierta = $reqData['cubierta'] ?? [];
|
||||
@ -767,12 +665,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$tipo_impresion_id = $this->getTipoImpresion($tipo, $cubierta['tipoCubierta']);
|
||||
|
||||
if ($papelInteriorDiferente) {
|
||||
$papel['negro'] = $modelPapelGenerico->where('id', $interior['papelInterior']['negro'])->first()->toArray();
|
||||
$papel['color'] = $modelPapelGenerico->where('id', $interior['papelInterior']['color'])->first()->toArray();
|
||||
$papel['negro'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['negro']);
|
||||
$papel['color'] = $modelPapelGenerico->getIdFromCode($interior['papelInterior']['color']);
|
||||
$gramaje['negro'] = intval($interior['gramajeInterior']['negro']);
|
||||
$gramaje['color'] = intval($interior['gramajeInterior']['color']);
|
||||
} else {
|
||||
$papel = $modelPapelGenerico->where('id', $interior['papelInterior'])->first()->toArray();
|
||||
$papel = $modelPapelGenerico->getIdFromCode($interior['papelInterior']);
|
||||
$gramaje = intval($interior['gramajeInterior']);
|
||||
}
|
||||
// Interior
|
||||
@ -790,10 +688,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
// Cubierta
|
||||
$cubierta = [
|
||||
'papel_generico_cubierta' => $modelPapelGenerico->where('id', $cubierta['papelCubierta'])->first()->toArray(),
|
||||
'papel_generico_cubierta' => $modelPapelGenerico->getIdFromCode($cubierta['papelCubierta']),
|
||||
'gramajeCubierta' => intval($cubierta['gramajeCubierta']),
|
||||
'carasCubierta' => intval($cubierta['carasImpresion'] ?? 0),
|
||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0) == 1 ? intval($cubierta['tamanioSolapas']) : 0,
|
||||
'solapasCubierta' => intval($cubierta['solapas'] ?? 0),
|
||||
'acabadosCubierta' => $cubierta['acabados'] ?? 0,
|
||||
'lomoRedondo' => $cubierta['lomoRedondo'] ?? 0,
|
||||
'cabezada' => $cubierta['cabezada'] ?? 'WHI',
|
||||
@ -955,11 +853,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
$datos_presupuesto['prototipo'] = $prototipo;
|
||||
$datos_presupuesto['ferro'] = $ferro;
|
||||
$datos_presupuesto['ferro_digital'] = $ferroDigital;
|
||||
$datos_presupuesto['marcapaginas'] = $marcapaginas;
|
||||
$datos_presupuesto['retractilado'] = $retractilado;
|
||||
$datos_presupuesto['retractilado5'] = $retractilado5;
|
||||
|
||||
$id = $model_presupuesto->insertarPresupuestoCliente(
|
||||
$id,
|
||||
@ -1007,9 +900,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
} else if ($servicio->tarifa_id == 62) {
|
||||
// Servicios manipulado
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
} else if ($servicio->tarifa_id == 73) {
|
||||
// Servicios manipulado
|
||||
$this->guardarServicio($id, $servicio, 'manipulado');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1043,7 +933,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$modelPapelFormato = new PapelFormatoModel();
|
||||
$modelCliente = new ClienteModel();
|
||||
|
||||
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$data = [];
|
||||
if ($presupuesto) {
|
||||
@ -1076,11 +966,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$data['datosGenerales']['tipo'] = $this->getTipoLibro($presupuesto->tipo_impresion_id ?? null);
|
||||
$data['datosGenerales']['prototipo'] = $presupuesto->prototipo;
|
||||
$data['datosGenerales']['ferro'] = $presupuesto->ferro;
|
||||
$data['datosGenerales']['ferroDigital'] = $presupuesto->ferro_digital;
|
||||
$data['datosGenerales']['marcapaginas'] = $presupuesto->marcapaginas;
|
||||
$data['datosGenerales']['retractilado'] = $presupuesto->retractilado;
|
||||
$data['datosGenerales']['retractilado5'] = $presupuesto->retractilado5;
|
||||
|
||||
$datos_papel = $this->obtenerDatosPapel($presupuesto->id);
|
||||
$data['interior'] = $datos_papel['interior'] ? $datos_papel['interior'] : [];
|
||||
@ -1110,9 +995,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$data['sobrecubierta']['solapas'] = $presupuesto->solapas_sobrecubierta ? 1 : 0;
|
||||
$data['sobrecubierta']['solapas_ancho'] = $presupuesto->solapas_ancho_sobrecubierta;
|
||||
$data['sobrecubierta']['plastificado'] = $modelAcabado->getCodeFromId($presupuesto->acabado_sobrecubierta_id);
|
||||
if ($data['sobrecubierta']['plastificado'] == '') {
|
||||
$data['sobrecubierta']['plastificado'] = 'NONE';
|
||||
}
|
||||
|
||||
$data['guardas'] = array_key_exists('guardas', $datos_papel) ? $datos_papel['guardas'] : [];
|
||||
|
||||
@ -1124,17 +1006,15 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$data['direcciones'] = $this->obtenerDireccionesEnvio($id, $presupuesto->cliente_id);
|
||||
|
||||
if (intval($presupuesto->estado_id) == 2) {
|
||||
if(intval($presupuesto->estado_id) == 2){
|
||||
$data['resumen']['base'] = $presupuesto->total_aceptado;
|
||||
$data['resumen']['precio_unidad'] = $presupuesto->total_precio_unidad;
|
||||
}
|
||||
|
||||
$tiradas_alternativas = json_decode($presupuesto->tirada_alternativa_json_data);
|
||||
if (!is_null($tiradas_alternativas)) {
|
||||
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
||||
$tirada = $tiradas_alternativas[$i];
|
||||
$data['datosGenerales']['tirada' . ($i + 2)] = $tirada->tirada;
|
||||
}
|
||||
for ($i = 0; $i < count($tiradas_alternativas); $i++) {
|
||||
$tirada = $tiradas_alternativas[$i];
|
||||
$data['datosGenerales']['tirada' . ($i + 2)] = $tirada->tirada;
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
@ -1388,7 +1268,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$coste = 0;
|
||||
$margen = 0;
|
||||
|
||||
if (count($data) > 0) {
|
||||
if ($data > 0) {
|
||||
$peso_envio = round(floatval($peso * $unidades / 1000.0)); // peso libro * unidades y se pasa a kilogramos
|
||||
$tarifas_envio = $modelTarifaEnvio->getTarifaEnvio($data[0]->pais_id, $data[0]->cp, $peso_envio, $entregaPieCalle ? 'palets' : 'cajas');
|
||||
for ($i = 0; $i < count($tarifas_envio); $i++) {
|
||||
@ -1514,11 +1394,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$info['merma'] = $datosPedido->merma;
|
||||
}
|
||||
|
||||
// Para POD siempre es HQ
|
||||
if ($tirada[$t] <= $POD) {
|
||||
$isHq = true;
|
||||
}
|
||||
|
||||
$input_data = array(
|
||||
'uso' => 'interior',
|
||||
'tipo_impresion_id' => $tipo_impresion_id,
|
||||
@ -1901,9 +1776,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
'solapas' => intval($solapasCubierta) > 0 ? 1 : 0,
|
||||
'paginasCuadernillo' => $paginasCuadernillo,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$costeServiciosDefecto = 0.0;
|
||||
foreach ($servDefecto as $servicio) {
|
||||
if ($servicio->total <= 0) {
|
||||
@ -1937,14 +1809,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
// Servicios
|
||||
|
||||
|
||||
/*
|
||||
'retractilado' => 3,
|
||||
'prototipo' => 9,
|
||||
*/
|
||||
$serviciosAutomaticos = [];
|
||||
$servicios = [];
|
||||
// se comprueba si $datos guardas es un array
|
||||
if (is_array($datos_guardas)) {
|
||||
if (count($datos_guardas) > 0) {
|
||||
@ -1955,19 +1819,20 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
array_push($servicios, 62); // Plegado de guardas
|
||||
}
|
||||
}
|
||||
if ($datos_entrada['servicios']['retractilado']) // acabado
|
||||
|
||||
/*
|
||||
'retractilado' => 3,
|
||||
'prototipo' => 9,
|
||||
*/
|
||||
$serviciosAutomaticos = [];
|
||||
$servicios = [];
|
||||
if ($datos_entrada['cubierta']['acabadosCubierta']['retractilado'] === 'true')
|
||||
array_push($servicios, 3);
|
||||
if ($datos_entrada['servicios']['retractilado5']) // acabado
|
||||
array_push($servicios, 98);
|
||||
if ($datos_entrada['servicios']['prototipo']) // extra
|
||||
if ($datos_entrada['servicios']['prototipo'])
|
||||
array_push($servicios, 9);
|
||||
if ($datos_entrada['servicios']['ferro']) // extra
|
||||
array_push($servicios, 30);
|
||||
/*if ($datos_entrada['servicios']['ferroDigital'])
|
||||
array_push($servicios, 29);*/ // Es gratis
|
||||
foreach ($servicios as $servicio) {
|
||||
|
||||
if (intval($servicio) == 3 || intval($servicio) == 98) {
|
||||
if (intval($servicio) == 3) {
|
||||
// Servicios acabado
|
||||
$resultado = PresupuestoCLienteService::getServiciosAcabados([
|
||||
'tarifa_id' => $servicio,
|
||||
@ -1982,7 +1847,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$errorModel->insertError(
|
||||
$datos_entrada['id'],
|
||||
auth()->user()->id,
|
||||
'No se puede obtener servicio con id ' . ((string) $servicio),
|
||||
'No se puede obtener servicio con id 3',
|
||||
$input_data
|
||||
);
|
||||
$return_data = [
|
||||
@ -1998,8 +1863,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$totalServicios += floatval($resultado[0]->total);
|
||||
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
||||
}
|
||||
} else if (intval($servicio) == 9 || intval($servicio) == 30 || intval($servicio) == 29) {
|
||||
// Extra
|
||||
} else if (intval($servicio) == 9) {
|
||||
// Prototipo
|
||||
$resultado = PresupuestoCLienteService::getServiciosExtra([
|
||||
'tarifa_id' => $servicio,
|
||||
]);
|
||||
@ -2010,7 +1875,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$errorModel->insertError(
|
||||
$datos_entrada['id'],
|
||||
auth()->user()->id,
|
||||
'No se puede obtener servicio con id ' . ((string) $servicio),
|
||||
'No se puede obtener servicio con id 9',
|
||||
$input_data
|
||||
);
|
||||
$return_data = [
|
||||
@ -2030,45 +1895,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
// Plegado de solapas grandes
|
||||
if (
|
||||
(intval($solapasCubierta) > 0 && intval($cubierta['dimension_desarrollo']['ancho']) > 630) ||
|
||||
(is_array($sobreCubierta) && ($sobreCubierta['solapas'] > 0 && intval($linea_sobrecubierta['dimension_desarrollo']['ancho']) > 630))
|
||||
) {
|
||||
|
||||
// Servicios acabado
|
||||
$resultado = PresupuestoCLienteService::getServiciosManipulado([
|
||||
'tarifa_id' => 73,
|
||||
'tirada' => $datosPedido->tirada,
|
||||
'POD' => $POD,
|
||||
]);
|
||||
array_push($serviciosAutomaticos, $resultado[0]);
|
||||
|
||||
if ($resultado[0]->total <= 0) {
|
||||
|
||||
$errorModel = new ErrorPresupuesto();
|
||||
$errorModel->insertError(
|
||||
$datos_entrada['id'],
|
||||
auth()->user()->id,
|
||||
'No se puede obtener servicio de manupulado con id ' . ((string) $servicio),
|
||||
$input_data
|
||||
);
|
||||
$return_data = [
|
||||
'errors' => (object) ([
|
||||
'status' => 1
|
||||
]),
|
||||
];
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
$coste_servicios += floatval($resultado[0]->total);
|
||||
if ($extra_info) {
|
||||
$totalServicios += floatval($resultado[0]->total);
|
||||
$margenServicios += floatval($resultado[0]->total) * floatval($resultado[0]->margen) / 100.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
array_push($precio_u, round(($costeInterior + $coste_cubierta + $coste_sobrecubierta + $costeServiciosDefecto + $coste_servicios) / $tirada[$t], 4));
|
||||
array_push($peso, round($peso_interior + $peso_cubierta + $peso_sobrecubierta + $peso_guardas, 2));
|
||||
|
||||
@ -2448,16 +2274,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
if ($linea->tipo == 'lp_bn' || $linea->tipo == 'lp_bnhq' || $linea->tipo == 'lp_rot_bn') {
|
||||
$return_data['interior']['negro']['tipo'] = $linea->tipo == 'lp_bn' || $linea->tipo == 'lp_rot_bn' ? 'negroEstandar' : 'negroPremium';
|
||||
$return_data['interior']['negro']['papel'] = $modelPapelGenerico->getCodeFromId($linea->papel_id);
|
||||
$return_data['interior']['negro']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['negro']['gramaje'] = $linea->gramaje;
|
||||
} else if ($linea->tipo == 'lp_color' || $linea->tipo == 'lp_colorhq' || $linea->tipo == 'lp_rot_color') {
|
||||
$return_data['interior']['color']['tipo'] = $linea->tipo == 'lp_color' || $linea->tipo == 'lp_rot_color' ? 'colorEstandar' : 'colorPremium';
|
||||
$return_data['interior']['color']['papel'] = $modelPapelGenerico->getCodeFromId($linea->papel_id);
|
||||
$return_data['interior']['color']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['color']['gramaje'] = $linea->gramaje;
|
||||
} else if ($linea->tipo == 'lp_cubierta') {
|
||||
$return_data['cubierta']['papel'] = $modelPapelGenerico->getCodeFromId($linea->papel_id);
|
||||
$return_data['cubierta']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['cubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['cubierta']['paginas'] = $linea->paginas;
|
||||
} else if ($linea->tipo == 'lp_sobrecubierta') {
|
||||
|
||||
@ -2,34 +2,18 @@
|
||||
|
||||
namespace App\Controllers\Produccion;
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
class Ordentrabajo extends BaseController
|
||||
{
|
||||
protected $format = 'json';
|
||||
protected array $viewData = [];
|
||||
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/produccion/';
|
||||
protected static $controllerSlug = "orden-trabajo";
|
||||
protected $indexRoute = 'viewOrdenTrabajoList';
|
||||
protected $editRoute = 'viewOrdenTrabajoEdit';
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.orden_trabajo"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => "Table", 'route' => site_url('produccion/ordentrabajo'), 'active' => true]
|
||||
];
|
||||
return view(static::$viewPath . $this->indexRoute, $this->viewData);
|
||||
echo 'Orden trabajo';
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@ -42,14 +26,9 @@ class Ordentrabajo extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function edit($orden_trabajo_id)
|
||||
public function edit()
|
||||
{
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.orden_trabajo"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => "Table", 'route' => site_url('produccion/ordentrabajo'), 'active' => true]
|
||||
];
|
||||
return view(static::$viewPath . $this->editRoute, $this->viewData);
|
||||
|
||||
}
|
||||
|
||||
public function cien()
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Tarifas\Acabados;
|
||||
<?php namespace App\Controllers\Tarifas\Acabados;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
@ -24,7 +22,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
|
||||
protected static $controllerSlug = 'tarifasacabado';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/tarifas/acabado/';
|
||||
protected static $viewPath = 'themes/vuexy/form/tarifas/acabado/';
|
||||
|
||||
protected $indexRoute = 'tarifaAcabadoList';
|
||||
|
||||
@ -135,7 +133,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['proveedores'] = $this->getProveedores();
|
||||
$this->viewData['proveedores'] = $this->getProveedores();
|
||||
|
||||
$this->viewData['tarifaacabadoEntity'] = isset($sanitizedData) ? new TarifaAcabadoEntity($sanitizedData) : new TarifaAcabadoEntity();
|
||||
$this->viewData['formAction'] = route_to('tarifaAcabadoAdd');
|
||||
@ -171,7 +169,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
||||
|
||||
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
@ -183,7 +181,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
if ($this->request->getPost('acabado_sobrecubierta') == null) {
|
||||
$sanitizedData['acabado_sobrecubierta'] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
@ -209,7 +207,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $tarifaacabadoEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) .'.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
@ -314,26 +312,12 @@ class TarifaAcabados extends BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
private function getProveedores()
|
||||
{
|
||||
private function getProveedores(){
|
||||
$provTipoModel = new ProveedorTipoModel();
|
||||
$provModel = new ProveedorModel();
|
||||
|
||||
$tipoId = $provTipoModel->getTipoId("Acabados");
|
||||
return $provModel->getProvList($tipoId);
|
||||
}
|
||||
public function show_select()
|
||||
{
|
||||
$query = $this->model->builder()
|
||||
->select(
|
||||
["id", "nombre as name", "code as description"]
|
||||
)
|
||||
->where("deleted_at",null);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
namespace App\Controllers\Tarifas;
|
||||
<?php namespace App\Controllers\Tarifas;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -15,11 +14,10 @@ use App\Models\Tarifas\TarifaEnvioModel;
|
||||
use App\Models\Tarifas\TarifaEnvioPrecioModel;
|
||||
|
||||
use
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
DataTables\Editor,
|
||||
DataTables\Editor\Field;
|
||||
|
||||
class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
class Tarifasenviosprecios extends \App\Controllers\BaseResourceController {
|
||||
|
||||
protected $modelName = TarifaEnvioPrecioModel::class;
|
||||
protected $format = 'json';
|
||||
@ -35,10 +33,9 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
|
||||
protected $indexRoute = 'tarifaEnvioPrecioList';
|
||||
|
||||
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
||||
$this->viewData['pageTitle'] = lang('TarifasEnviosPrecios.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
@ -51,68 +48,66 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
public function index() {
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('TarifasEnviosPrecios.tarifaEnvioPrecio')]),
|
||||
'tarifaEnvioPrecioEntity' => new TarifaEnvioPrecioEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('TarifasEnviosPrecios.tarifaEnvioPrecio')]),
|
||||
'tarifaEnvioPrecioEntity' => new TarifaEnvioPrecioEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewTarifaEnvioPrecioList', $viewData);
|
||||
return view(static::$viewPath.'viewTarifaEnvioPrecioList', $viewData);
|
||||
}
|
||||
|
||||
|
||||
public function add()
|
||||
{
|
||||
public function add() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]) . '.';
|
||||
$message .= anchor("admin/tarifasenviosprecios/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]).'.';
|
||||
$message .= anchor( "admin/tarifasenviosprecios/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
@ -125,98 +120,97 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['tarifaEnvioPrecioEntity'] = isset($sanitizedData) ? new TarifaEnvioPrecioEntity($sanitizedData) : new TarifaEnvioPrecioEntity();
|
||||
$this->viewData['tarifaEnvioList'] = $this->getTarifaEnvioListItems($tarifaEnvioPrecioEntity->tarifa_envio_id ?? null);
|
||||
$this->viewData['proveedorList'] = $this->getProveedorListItems($tarifaEnvioPrecioEntity->proveedor_id ?? null);
|
||||
$this->viewData['tipoEnvioList'] = $this->getTipoEnvioOptions();
|
||||
$this->viewData['tarifaEnvioList'] = $this->getTarifaEnvioListItems($tarifaEnvioPrecioEntity->tarifa_envio_id ?? null);
|
||||
$this->viewData['proveedorList'] = $this->getProveedorListItems($tarifaEnvioPrecioEntity->proveedor_id ?? null);
|
||||
$this->viewData['tipoEnvioList'] = $this->getTipoEnvioOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createTarifaEnvioPrecio');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('TarifasEnviosPrecios.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('TarifasEnviosPrecios.moduleTitle').' '.lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null):
|
||||
public function edit($requestedId = null) {
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$tarifaEnvioPrecioEntity = $this->model->find($id);
|
||||
|
||||
if ($tarifaEnvioPrecioEntity == false):
|
||||
if ($tarifaEnvioPrecioEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()):
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$tarifaEnvioPrecioEntity->fill($sanitizedData);
|
||||
|
||||
|
||||
if ($this->canValidate()):
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$tarifaEnvioPrecioEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = true;
|
||||
$thenRedirect = true;
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $tarifaEnvioPrecioEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]) . '.';
|
||||
$message .= anchor("admin/tarifasenviosprecios/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifasEnviosPrecios.tarifaEnvioPrecio'))]).'.';
|
||||
$message .= anchor( "admin/tarifasenviosprecios/{$id}/edit" , lang('Basic.global.continueEditing').'?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['tarifaEnvioPrecioEntity'] = $tarifaEnvioPrecioEntity;
|
||||
$this->viewData['tarifaEnvioList'] = $this->getTarifaEnvioListItems($tarifaEnvioPrecioEntity->tarifa_envio_id ?? null);
|
||||
$this->viewData['proveedorList'] = $this->getProveedorListItems($tarifaEnvioPrecioEntity->proveedor_id ?? null);
|
||||
$this->viewData['tipoEnvioList'] = $this->getTipoEnvioOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateTarifaEnvioPrecio', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('TarifasEnviosPrecios.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
$this->viewData['tarifaEnvioList'] = $this->getTarifaEnvioListItems($tarifaEnvioPrecioEntity->tarifa_envio_id ?? null);
|
||||
$this->viewData['proveedorList'] = $this->getProveedorListItems($tarifaEnvioPrecioEntity->proveedor_id ?? null);
|
||||
$this->viewData['tipoEnvioList'] = $this->getTipoEnvioOptions();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateTarifaEnvioPrecio', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('TarifasEnviosPrecios.moduleTitle').' '.lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
|
||||
public function datatable_editor()
|
||||
{
|
||||
@ -228,101 +222,62 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
$response = Editor::inst($db, 'tarifas_envios_precios')
|
||||
->fields(
|
||||
Field::inst('tipo_envio')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.tipo_envio.required')
|
||||
)
|
||||
),
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.tipo_envio.required'))
|
||||
),
|
||||
Field::inst('peso_min')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_min.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_min.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_min.decimal')
|
||||
)
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_min.decimal'))
|
||||
),
|
||||
Field::inst('peso_max')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_max.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_max.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_max.decimal')
|
||||
)
|
||||
'message' => lang('TarifasEnviosPrecios.validation.peso_max.decimal'))
|
||||
),
|
||||
Field::inst('precio_min')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.decimal')
|
||||
)
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.decimal'))
|
||||
),
|
||||
Field::inst('precio_max')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.decimal')
|
||||
)
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio.decimal'))
|
||||
),
|
||||
Field::inst('precio_adicional')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal')
|
||||
)
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal'))
|
||||
),
|
||||
Field::inst('margen')
|
||||
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
|
||||
->validator(
|
||||
'Validate::required',
|
||||
array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.required')
|
||||
)
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::required', array(
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.required'))
|
||||
)
|
||||
->validator(
|
||||
'Validate::numeric',
|
||||
array(
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal')
|
||||
)
|
||||
'message' => lang('TarifasEnviosPrecios.validation.precio_adicional.decimal'))
|
||||
),
|
||||
Field::inst('tarifa_envio_id'),
|
||||
Field::inst('proveedor_id'),
|
||||
@ -389,35 +344,24 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
public function datatable() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
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);
|
||||
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$requestedOrder2 = $reqData['order']['1']['column'] ?? $requestedOrder;
|
||||
$requestedOrder3 = $reqData['order']['2']['column'] ?? $requestedOrder;
|
||||
$order = TarifaEnvioPrecioModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
|
||||
$order2 = TarifaEnvioPrecioModel::SORTABLE[$requestedOrder2 > 0 ? $requestedOrder2 : 1];
|
||||
$order3 = TarifaEnvioPrecioModel::SORTABLE[$requestedOrder3 > 0 ? $requestedOrder3 : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
$dir2 = $reqData['order']['0']['dir'] ?? $dir;
|
||||
$dir3 = $reqData['order']['0']['dir'] ?? $dir;
|
||||
|
||||
|
||||
|
||||
$tarifa_envio_id = $reqData['tarifa_envio_id'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource($search, $tarifa_envio_id)
|
||||
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)
|
||||
->limit($length, $start)->get()->getResultObject();
|
||||
$resourceData = $this->model->getResource($search, $tarifa_envio_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
@ -429,16 +373,15 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function allItemsSelect()
|
||||
{
|
||||
public function allItemsSelect() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', tarifa_envio_id', 'tarifa_envio_id', $onlyActiveOnes, false);
|
||||
$menu = $this->model->getAllForMenu($reqVal.', tarifa_envio_id', 'tarifa_envio_id', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->tarifa_envio_id = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
$nonItem->tarifa_envio_id = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -452,8 +395,7 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
public function menuItems() {
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
@ -464,8 +406,8 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
$nonItem->text = '- '.lang('Basic.global.None').' -';
|
||||
array_unshift($menu , $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -480,45 +422,42 @@ class Tarifasenviosprecios extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
|
||||
protected function getTarifaEnvioListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TarifasEnvios.tarifaEnvio'))])];
|
||||
if (!empty($selId)):
|
||||
$tarifaEnvioModel = model('App\Models\Tarifas\TarifaEnvioModel');
|
||||
protected function getTarifaEnvioListItems($selId = null) {
|
||||
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('TarifasEnvios.tarifaEnvio'))])];
|
||||
if (!empty($selId)) :
|
||||
$tarifaEnvioModel = model('App\Models\Tarifas\TarifaEnvioModel');
|
||||
|
||||
$selOption = $tarifaEnvioModel->where('id', $selId)->findColumn('id');
|
||||
if (!empty($selOption)):
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getProveedorListItems($selId = null)
|
||||
{
|
||||
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('LgProveedores.proveedor'))])];
|
||||
if (!empty($selId)):
|
||||
$proveedorModel = model('App\Models\compras\ProveedorModel');
|
||||
protected function getProveedorListItems($selId = null) {
|
||||
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('LgProveedores.proveedor'))])];
|
||||
if (!empty($selId)) :
|
||||
$proveedorModel = model('App\Models\compras\ProveedorModel');
|
||||
|
||||
$selOption = $proveedorModel->where('id', $selId)->findColumn('id');
|
||||
if (!empty($selOption)):
|
||||
if (!empty($selOption)) :
|
||||
$data[$selId] = $selOption[0];
|
||||
endif;
|
||||
endif;
|
||||
return $data;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getTipoEnvioOptions()
|
||||
{
|
||||
$tipoEnvioOptions = [
|
||||
'' => lang('Basic.global.pleaseSelect'),
|
||||
'cajas' => 'cajas',
|
||||
'palets' => 'palets',
|
||||
];
|
||||
return $tipoEnvioOptions;
|
||||
}
|
||||
protected function getTipoEnvioOptions() {
|
||||
$tipoEnvioOptions = [
|
||||
'' => lang('Basic.global.pleaseSelect'),
|
||||
'cajas' => 'cajas',
|
||||
'palets' => 'palets',
|
||||
];
|
||||
return $tipoEnvioOptions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Tarifas;
|
||||
<?php namespace App\Controllers\Tarifas;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -132,7 +130,7 @@ class Tarifasmanipulado extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['tarifaManipuladoEntity'] = isset($sanitizedData) ? new TarifaManipuladoEntity($sanitizedData) : new TarifaManipuladoEntity();
|
||||
|
||||
$this->viewData['formAction'] = site_url('tarifas/tarifasmanipulado/add'); //route_to('createTarifaManipulado');
|
||||
$this->viewData['formAction'] = site_url('tarifas/tarifasmanipulado/add');//route_to('createTarifaManipulado');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifamanipulado.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
@ -155,7 +153,7 @@ class Tarifasmanipulado extends \App\Controllers\BaseResourceController
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifamanipulado.tarifamanipulado')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -295,19 +293,5 @@ class Tarifasmanipulado extends \App\Controllers\BaseResourceController
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
public function show_select()
|
||||
{
|
||||
$query = $this->model->builder()
|
||||
->select(
|
||||
["id", "nombre as name", "code as description"]
|
||||
)
|
||||
->where("deleted_at", null);
|
||||
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,320 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Usuarios\GroupModel;
|
||||
use App\Models\Usuarios\PermisosModel;
|
||||
use App\Services\PresupuestoService;
|
||||
use CodeIgniter\Shield\Entities\User;
|
||||
|
||||
class Utiles extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function echo()
|
||||
{
|
||||
|
||||
echo "echo";
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo "ok";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function get_tarifas_encuadernacion()
|
||||
{
|
||||
// Llamar al modelo
|
||||
$model = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
// Obtener todos los resultados
|
||||
$results = $model->where(['is_deleted' => 0])->findAll();
|
||||
|
||||
// Iterar sobre cada entidad
|
||||
echo '<pre>';
|
||||
foreach ($results as $result) {
|
||||
// Cada $result es una instancia de una entidad
|
||||
print_r($result->toArray()); // Convierte la entidad a un array para imprimir sus valores
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
public function get_tarifa_encuadernacion($tarifaEncuadernacionId)
|
||||
{
|
||||
// Llamar a los modelos
|
||||
$modelTE = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||
|
||||
|
||||
// Obtener el registro principal de tarifa_encuadernacion
|
||||
$tarifas_encuadernacion = $modelTE->where([
|
||||
'id' => $tarifaEncuadernacionId,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
// Verificar si se encontró la tarifa
|
||||
if (empty($tarifas_encuadernacion)) {
|
||||
echo "No se encontraron datos para la tarifa de encuadernación con ID: $tarifaEncuadernacionId.";
|
||||
return;
|
||||
}
|
||||
|
||||
// Imprimir la tarifa de encuadernación principal
|
||||
echo "<h3>---------------------- DATO TARIFA ENCUADERNACION ----------------------</h3>";
|
||||
foreach ($tarifas_encuadernacion as $tarifa_encuadernacion) {
|
||||
echo "<strong>ID Tarifa: </strong>" . $tarifa_encuadernacion->id . "<br>";
|
||||
echo "<strong>Nombre: </strong>" . $tarifa_encuadernacion->nombre . "<br>";
|
||||
echo "<hr>";
|
||||
}
|
||||
|
||||
// Obtener las tiradas asociadas a esta tarifa de encuadernación
|
||||
$tarifas_encuadernacion_tiradas = $modelTETiradas->where([
|
||||
'tarifa_encuadernacion_id' => $tarifaEncuadernacionId,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
// Verificar si existen tiradas para la tarifa de encuadernación
|
||||
if (empty($tarifas_encuadernacion_tiradas)) {
|
||||
echo "No hay tiradas asociadas a esta tarifa de encuadernación.";
|
||||
return;
|
||||
}
|
||||
|
||||
// Imprimir las tiradas asociadas
|
||||
echo "<h3>---------------------- DATO TARIFA ENCUADERNACION (TIRADAS) -------------</h3>";
|
||||
foreach ($tarifas_encuadernacion_tiradas as $tarifa_encuadernacion_tirada) {
|
||||
echo "<strong>ID Tirada: </strong>" . $tarifa_encuadernacion_tirada->id . "<br>";
|
||||
echo "<strong>Tirada Min: </strong>" . $tarifa_encuadernacion_tirada->tirada_min . "<br>";
|
||||
echo "<strong>Tirada Max: </strong>" . $tarifa_encuadernacion_tirada->tirada_max . "<br>";
|
||||
|
||||
// Obtener las líneas asociadas a esta tirada
|
||||
$tarifas_encuadernacion_lineas = $modelTELineas->where([
|
||||
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
// Verificar si existen líneas asociadas a la tirada
|
||||
if (empty($tarifas_encuadernacion_lineas)) {
|
||||
echo "No hay líneas asociadas a esta tirada de encuadernación.<br>";
|
||||
} else {
|
||||
// Imprimir las líneas asociadas
|
||||
echo "<ul>";
|
||||
foreach ($tarifas_encuadernacion_lineas as $tarifa_encuadernacion_linea) {
|
||||
echo "<li><strong>ID Línea: </strong>" . $tarifa_encuadernacion_linea->id . "<br>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
// Obtener las líneas y horas asociadas a esta tirada
|
||||
$tarifas_encuadernacion_lineas_horas = $modelTELineasHoras->where([
|
||||
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
// Verificar si existen líneas y horas asociadas a la tirada
|
||||
if (empty($tarifas_encuadernacion_lineas_horas)) {
|
||||
echo "No hay líneas y horas asociadas a esta tirada de encuadernación.<br>";
|
||||
} else {
|
||||
// Imprimir las líneas asociadas
|
||||
echo "<ul>";
|
||||
foreach ($tarifas_encuadernacion_lineas_horas as $tarifas_encuadernacion_linea_hora) {
|
||||
echo "<li><strong>ID Línea/Hora: </strong>" . $tarifas_encuadernacion_linea_hora->id . "<br>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
}
|
||||
|
||||
echo "<h3>---------------------- FIN DE DATO TARIFA ENCUADERNACION ----------------------</h3>";
|
||||
}
|
||||
|
||||
public function delete_tarifa_encuadernacion($tarifaEncuadernacionId)
|
||||
{
|
||||
// Llamar a los modelos
|
||||
$modelTE = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||
|
||||
// Obtener el registro principal de tarifa_encuadernacion
|
||||
$tarifas_encuadernacion = $modelTE->where([
|
||||
'id' => $tarifaEncuadernacionId,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
// Verificar si se encontró la tarifa
|
||||
if (empty($tarifas_encuadernacion)) {
|
||||
echo "No se encontró la tarifa de encuadernación con ID: $tarifaEncuadernacionId.";
|
||||
return;
|
||||
}
|
||||
|
||||
// Iniciar eliminación de datos asociados
|
||||
echo "Eliminando datos asociados a la tarifa de encuadernación ID: $tarifaEncuadernacionId...<br>";
|
||||
|
||||
// Eliminar las tiradas asociadas a la tarifa de encuadernación
|
||||
$tarifas_encuadernacion_tiradas = $modelTETiradas->where([
|
||||
'tarifa_encuadernacion_id' => $tarifaEncuadernacionId,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
if (!empty($tarifas_encuadernacion_tiradas)) {
|
||||
foreach ($tarifas_encuadernacion_tiradas as $tarifa_encuadernacion_tirada) {
|
||||
// Eliminar las líneas de horas asociadas a cada tirada
|
||||
$tarifas_encuadernacion_lineas_horas = $modelTELineasHoras->where([
|
||||
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
if (!empty($tarifas_encuadernacion_lineas_horas)) {
|
||||
foreach ($tarifas_encuadernacion_lineas_horas as $tarifa_encuadernacion_linea_hora) {
|
||||
$modelTELineasHoras->delete($tarifa_encuadernacion_linea_hora->id); // Eliminar la línea/hora
|
||||
echo "===sk >-Eliminando Línea/Hora ID: " . $tarifa_encuadernacion_linea_hora->id . "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
// Eliminar las líneas asociadas a cada tirada
|
||||
$tarifas_encuadernacion_lineas = $modelTELineas->where([
|
||||
'tirada_encuadernacion_id' => $tarifa_encuadernacion_tirada->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
if (!empty($tarifas_encuadernacion_lineas)) {
|
||||
foreach ($tarifas_encuadernacion_lineas as $tarifa_encuadernacion_linea) {
|
||||
$modelTELineas->delete($tarifa_encuadernacion_linea->id); // Eliminar la línea
|
||||
echo "===>-Eliminando Línea ID: " . $tarifa_encuadernacion_linea->id . "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
// Eliminar la tirada
|
||||
$modelTETiradas->delete($tarifa_encuadernacion_tirada->id); // Eliminar la tirada
|
||||
echo "=>-Eliminando Tirada ID: " . $tarifa_encuadernacion_tirada->id . "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
echo " *** Proceso de eliminación completado. ***<br><br>";
|
||||
}
|
||||
|
||||
public function clone_tarifa_encuadernacion($origenId, $destinoId)
|
||||
{
|
||||
// Llamar a los modelos
|
||||
$modelTETiradas = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
|
||||
$modelTELineas = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
|
||||
$modelTELineasHoras = model('App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel');
|
||||
|
||||
// 1. Eliminar el contenido asociado de la tarifa destino
|
||||
$this->delete_tarifa_encuadernacion($destinoId);
|
||||
|
||||
// 2. Obtener las tiradas asociadas a la tarifa origen
|
||||
$tiradasOrigen = $modelTETiradas->where([
|
||||
'tarifa_encuadernacion_id' => $origenId,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
foreach ($tiradasOrigen as $tiradaOrigen) {
|
||||
// Crear un nuevo registro para la tirada en la tarifa destino
|
||||
$nuevaTirada = [
|
||||
'tarifa_encuadernacion_id' => (int) $destinoId,
|
||||
'proveedor_id' => (int) $tiradaOrigen->proveedor_id,
|
||||
'importe_fijo' => (float) $tiradaOrigen->importe_fijo,
|
||||
'tirada_min' => (int) $tiradaOrigen->tirada_min,
|
||||
'tirada_max' => (int) $tiradaOrigen->tirada_max,
|
||||
'user_created_id' => (int) auth()->id(),
|
||||
'is_deleted' => 0
|
||||
];
|
||||
|
||||
try {
|
||||
$nuevaTiradaId = $modelTETiradas->insert($nuevaTirada);
|
||||
if (!$nuevaTiradaId) {
|
||||
throw new \Exception("Error al insertar el registro.");
|
||||
}
|
||||
echo "<br>==>+Tirada creada con ID: " . $nuevaTiradaId;
|
||||
} catch (\Exception $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
// 3. Clonar las líneas asociadas a esta tirada
|
||||
$lineasOrigen = $modelTELineas->where([
|
||||
'tirada_encuadernacion_id' => $tiradaOrigen->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
foreach ($lineasOrigen as $lineaOrigen) {
|
||||
$nuevaLinea = [
|
||||
'tirada_encuadernacion_id' => (int) $nuevaTiradaId,
|
||||
'paginas_libro_min' => (float) $lineaOrigen->paginas_libro_min,
|
||||
'paginas_libro_max' => (float) $lineaOrigen->paginas_libro_max,
|
||||
'dimensiones_id' => (int) $lineaOrigen->dimensiones_id,
|
||||
'precio_min' => (float) $lineaOrigen->precio_min,
|
||||
'precio_max' => (float) $lineaOrigen->precio_max,
|
||||
'tirada_min' => (float) $lineaOrigen->tirada_min,
|
||||
'tirada_max' => (float) $lineaOrigen->tirada_max,
|
||||
'total_min' => (float) $lineaOrigen->total_min,
|
||||
'margen' => (float) $lineaOrigen->margen,
|
||||
'user_created_id' => (int) auth()->id(),
|
||||
'is_deleted' => 0
|
||||
];
|
||||
|
||||
try {
|
||||
$nuevaLineaId = $modelTELineas->insert($nuevaLinea);
|
||||
if (!$nuevaLineaId) {
|
||||
throw new \Exception("Error al insertar el registro.");
|
||||
}
|
||||
echo "<br>====>+Linea creada con ID: " . $nuevaLineaId;
|
||||
} catch (\Exception $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 4. Clonar las líneas y horas asociadas a esta tirada
|
||||
$lineasHorasOrigen = $modelTELineasHoras->where([
|
||||
'tirada_encuadernacion_id' => $tiradaOrigen->id,
|
||||
'is_deleted' => 0
|
||||
])->findAll();
|
||||
|
||||
foreach ($lineasHorasOrigen as $lineaHoraOrigen) {
|
||||
$nuevaLineaHora = [
|
||||
'tirada_encuadernacion_id' => (int) $nuevaTiradaId,
|
||||
'tiempo_min' => (float) $lineaHoraOrigen->tiempo_min,
|
||||
'tiempo_max' => (float) $lineaHoraOrigen->tiempo_max,
|
||||
'precio_hora' => (float) $lineaHoraOrigen->precio_hora,
|
||||
'total_min' => (float) $lineaHoraOrigen->total_min,
|
||||
'margen' => (float) $lineaHoraOrigen->margen,
|
||||
'user_created_id' => (int) auth()->id(),
|
||||
'is_deleted' => 0
|
||||
];
|
||||
|
||||
try {
|
||||
$nuevaLineaHoraId = $modelTELineasHoras->insert($nuevaLineaHora);
|
||||
if (!$nuevaLineaHoraId) {
|
||||
throw new \Exception("Error al insertar el registro.");
|
||||
}
|
||||
echo "<br>====>+Linea/Hora creado con ID: " . $nuevaLineaHoraId;
|
||||
} catch (\Exception $e) {
|
||||
echo "Error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br> *** Proceso de clonacion completado. ***<br><br>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CheckWebClientesPapeles extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client');
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class ModifyNullableComercialSoporte extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class TicksPapeles extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_generico', $fields);
|
||||
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_generico', 'show_in_client_special');
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client_special');
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CambiarTicksPapelImpresion extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'use_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client');
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client_special');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
'show_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'use_in_client');
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddTickInteriorPapelImpresion extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'interior' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'interior');
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddTickTapaDuraPapelImp extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'use_for_tapa_dura' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'use_for_tapa_dura');
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class ServicioClienteTareas extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"auto_increment" => true
|
||||
],
|
||||
"servicio_cliente_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"comment" => "Servicio cliente asociado"
|
||||
],
|
||||
"tarifa_acabado_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true,
|
||||
"comment" => "Tarifa de acabado asociada a servicio"
|
||||
],
|
||||
"tarifa_manipulado_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true,
|
||||
"comment" => "Tarifa de manipulado asociada a servicio",
|
||||
|
||||
]
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey("id");
|
||||
$this->forge->addForeignKey('servicio_cliente_id','servicios_cliente','id');
|
||||
$this->forge->addForeignKey('tarifa_acabado_id','lg_tarifa_acabado','id');
|
||||
$this->forge->addForeignKey('tarifa_manipulado_id','lg_tarifa_manipulado','id');
|
||||
|
||||
$this->forge->createTable("servicio_cliente_tareas", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("servicio_cliente_tareas");
|
||||
}
|
||||
}
|
||||
@ -1,299 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"auto_increment" => true
|
||||
],
|
||||
"pedido_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"comment" => "Pedido asociado",
|
||||
],
|
||||
"user_created_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
],
|
||||
"user_update_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
],
|
||||
"maquina_orden_negro_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
],
|
||||
"maquina_orden_color_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"maquina_orden_portada_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"maquina_orden_cubierta_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"negro_forma_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"color_forma_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"portada_forma_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"cubierta_forma_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
|
||||
],
|
||||
"tirada" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"negro_pliegos_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
"null" => true
|
||||
],
|
||||
"color_pliegos_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
"null" => true
|
||||
],
|
||||
"portada_pliegos_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
"null" => true
|
||||
],
|
||||
"cubierta_pliegos_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
"null" => true
|
||||
],
|
||||
"negro_clicks_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"color_clicks_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"portada_clicks_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"cubierta_clicks_pedido" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"pliegos1" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 11,
|
||||
],
|
||||
"paginas1" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 11,
|
||||
],
|
||||
"pliegos2" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 11,
|
||||
],
|
||||
"paginas2" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 11,
|
||||
],
|
||||
"negro_proveedor_nombre" => [
|
||||
"type" => "VARCHAR",
|
||||
"constraint" => 225
|
||||
],
|
||||
"color_proveedor_nombre" => [
|
||||
"type" => "VARCHAR",
|
||||
"constraint" => 225
|
||||
],
|
||||
"portada_proveedor_nombre" => [
|
||||
"type" => "VARCHAR",
|
||||
"constraint" => 225
|
||||
],
|
||||
"corte_pie" => [
|
||||
"type" => "DOUBLE",
|
||||
],
|
||||
"lomo" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 11,
|
||||
"null" => true,
|
||||
],
|
||||
"tipo_entrada" => [
|
||||
"type" => "ENUM",
|
||||
"constraint" => ["in", "out"],
|
||||
"default" => "out"
|
||||
],
|
||||
|
||||
|
||||
|
||||
"fecha_entrega_real_warning" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false,
|
||||
],
|
||||
|
||||
|
||||
|
||||
"fecha_entrega_warning" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false
|
||||
],
|
||||
"fecha_entrega_warning_revised" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false
|
||||
],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"ferro_disponible" => [
|
||||
"type" => "TINYINT",
|
||||
"constraint" => 4,
|
||||
],
|
||||
"ferro_disponible_thread_id" => [
|
||||
"type" => "INT",
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
|
||||
"ferro_cp" => [
|
||||
"type" => "VARCHAR",
|
||||
"constraint" => 10,
|
||||
"null" => true
|
||||
],
|
||||
"ferro_proveedor" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"ferro_tracking" => [
|
||||
"type" => "VARCHAR",
|
||||
"constraint" => 100,
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"pre_formato" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false
|
||||
],
|
||||
|
||||
|
||||
"pre_lomo" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
|
||||
"pre_solapa" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
|
||||
"pre_isbn" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
"pre_codbarras" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
|
||||
"pre_imposicion" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
|
||||
"pre_imprimir" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
"pre_faltan_materiales" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
|
||||
"pre_faltan_materiales_note" => [
|
||||
"type" => "TEXT",
|
||||
"null" => true,
|
||||
],
|
||||
"progreso" => [
|
||||
"type" => "DOUBLE",
|
||||
"default" => 0.00,
|
||||
],
|
||||
"message_production_send" => [
|
||||
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
"finalizado" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0,
|
||||
],
|
||||
"comentarios" => [
|
||||
"type" => "TEXT",
|
||||
"null" => true,
|
||||
]
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey("id");
|
||||
// $this->forge->addForeignKey(["maquina_orden_portada_id"],"lg_maquinas",["id"]);
|
||||
// $this->forge->addForeignKey(["maquina_orden_negro_id"],"lg_maquinas",["id"]);
|
||||
// $this->forge->addForeignKey(["maquina_orden_cubierta_id"],"lg_maquinas",["id"]);
|
||||
// $this->forge->addForeignKey(["maquina_orden_color_id"],"lg_maquinas",["id"]);
|
||||
$this->forge->createTable("ordenes_trabajo", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("ordenes_trabajo");
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoTareasTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"autoincrement" => true
|
||||
],
|
||||
"tarea_servicio_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
],
|
||||
"orden_trabajo_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
],
|
||||
]);
|
||||
// $this->forge->addPrimaryKey("id");
|
||||
// $this->forge->addForeignKey("orden_trabajo_id","ordenes_trabajo","id");
|
||||
// $this->forge->addForeignKey("tarea_servicio_id","tareas_servicio","id");
|
||||
$this->forge->createTable("orden_trabajo_tareas", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("orden_trabajo_tareas");
|
||||
}
|
||||
}
|
||||
@ -1,171 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoDatesTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"fecha_entrada_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_entrega_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_entrega_change_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"fecha_entrega_real_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_entrega_real_warning" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false,
|
||||
],
|
||||
"fecha_impresion_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_encuardernado_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_externo_at" => [
|
||||
"type" => "DATE",
|
||||
"null" => true,
|
||||
],
|
||||
"fecha_entrega_warning" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false
|
||||
],
|
||||
"fecha_entrega_warning_revised" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => false
|
||||
],
|
||||
|
||||
"pendiente_ferro_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"ferro_en_cliente_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"ferro_ok_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"interior_bn_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"interior_color_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"preparacion_interiores_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"cubierta_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"plastificado_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"encuadernacion_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"corte_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"embalaje_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"envio_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"entrada_manipulado_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
|
||||
"ferro_disponible_hecho_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"ferro_disponible_ok_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"ferro_entregado_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
"pre_formato_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"pre_lomo_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"pre_solapa_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"pre_codbarras_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
|
||||
"pre_imposicion_at" => [
|
||||
"type" => "DATETIME",
|
||||
"null" => true,
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
],
|
||||
]);
|
||||
$this->forge->createTable("orden_trabajo_dates", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("orden_trabajo_dates");
|
||||
}
|
||||
}
|
||||
@ -1,190 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoUsers extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
|
||||
|
||||
"user_created_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"user_update_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"inaplazable_revised_change_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
"ferro_disponible_hecho_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
"ferro_disponible_ok_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"ferro_entregado_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
"pendiente_ferro_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"ferro_en_cliente_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"ferro_ok_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
|
||||
"interior_bn_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"interior_color_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"preparacion_interior_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"cubierda_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"plastificado_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"encuadernacion_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"corte_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"embalaje_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"envio_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"entrada_manipulado_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
"pre_formato_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
"pre_lomo_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
"pre_solapa_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
|
||||
"pre_codbarras_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
|
||||
"pre_imposicion_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"pre_imprimir_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"pre_imprimir_user_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
]);
|
||||
foreach ($this->COLUMNS as $key => $value) {
|
||||
$this->forge->addForeignKey([$key],"users",["id"]);
|
||||
}
|
||||
$this->forge->createTable("orden_trabajo_users", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("orden_trabajo_users");
|
||||
}
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoMaquetacionesTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"auto_increment" => true
|
||||
],
|
||||
"pedido_maquetacion_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"user_created_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"user_update_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"constraint" => 10,
|
||||
],
|
||||
"entrada_at" => [
|
||||
"type" => "DATETIME",
|
||||
"default" => null
|
||||
],
|
||||
"salida_at" => [
|
||||
"type" => "DATETIME",
|
||||
"default" => null
|
||||
],
|
||||
"progreso" => [
|
||||
"type" => "DOUBLE",
|
||||
"default" => 0
|
||||
],
|
||||
"finalizado" => [
|
||||
"type" => "BOOLEAN",
|
||||
"default" => 0
|
||||
]
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey("id");
|
||||
$this->forge->createTable("orden_trabajo_maquetaciones", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("orden_trabajo_maquetaciones");
|
||||
}
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class OrdenTrabajoMaquetacionMovimientosTable extends Migration
|
||||
{
|
||||
protected array $COLUMNS = [
|
||||
"id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"auto_increment" => true
|
||||
],
|
||||
"orden_trabajo_maquetacion_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"orden_trabajo_maquetacion_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"file_id" => [
|
||||
"type" => "INT",
|
||||
"unsigned" => true,
|
||||
"null" => true,
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField($this->COLUMNS);
|
||||
$currenttime = new RawSql("CURRENT_TIMESTAMP");
|
||||
$this->forge->addField([
|
||||
"created_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"default" => $currenttime,
|
||||
|
||||
],
|
||||
"updated_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
"deleted_at" => [
|
||||
"type" => "TIMESTAMP",
|
||||
"null" => true,
|
||||
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey("id");
|
||||
$this->forge->createTable("orden_trabajo_maquetacion_movimientos", true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable("orden_trabajo_maquetacion_movimientos");
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AlterColumnServiciosCliente extends Migration
|
||||
{
|
||||
protected array $ALTER_COLUMNS = [
|
||||
"deleted_at" => [
|
||||
"name" => "deleted_at",
|
||||
"type" => "datetime",
|
||||
"default" => null,
|
||||
"null" => true,
|
||||
],
|
||||
"updated_at" => [
|
||||
"name" => "updated_at",
|
||||
"type" => "datetime",
|
||||
"default" => null,
|
||||
"null" => true,
|
||||
],
|
||||
];
|
||||
public function up()
|
||||
{
|
||||
$this->forge->modifyColumn("servicios_cliente", $this->ALTER_COLUMNS);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->addField([
|
||||
"is_deleted" => [
|
||||
"type" => "boolean",
|
||||
"default" => false,
|
||||
"null" => false,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use App\Models\Chat\ChatDeparmentModel;
|
||||
use App\Models\Chat\ChatDeparmentUserModel;
|
||||
use App\Models\Chat\ChatMessageModel;
|
||||
use App\Models\Chat\ChatModel;
|
||||
use App\Models\ChatNotification;
|
||||
use CodeIgniter\Database\Seeder;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
class MessageSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
$data = [
|
||||
"title" => "Message Test",
|
||||
"messages" => [
|
||||
[
|
||||
"sender_id" => 1,
|
||||
"receiver_id" => 127,
|
||||
],
|
||||
[
|
||||
"sender_id" => 127,
|
||||
"receiver_id" => 1,
|
||||
]
|
||||
]
|
||||
];
|
||||
$chatModel = model(ChatModel::class);
|
||||
$chatMessageModel = model(ChatMessageModel::class);
|
||||
$chatNotificationModel = model(ChatNotification::class);
|
||||
$userModel = model(UserModel::class);
|
||||
foreach (range(1,100) as $key => $value) {
|
||||
$chat_id = $chatModel->insert(["title" => $data["title"]." ".$value]);
|
||||
foreach ($data["messages"] as $key => $value) {
|
||||
$first_name = $userModel->find($value["receiver_id"])?->first_name;
|
||||
$chat_message_id = $chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"sender_id" => $value["sender_id"],
|
||||
"receiver_id" => $value["receiver_id"],
|
||||
"message" => "Hola"." ".$first_name
|
||||
]);
|
||||
$chatNotificationModel->insert([
|
||||
"chat_message_id" => $chat_message_id,
|
||||
"user_id" => $value["receiver_id"]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,15 +10,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
|
||||
"nombre" => null,
|
||||
"code" => null,
|
||||
"code_ot" => null,
|
||||
"show_in_client" => false,
|
||||
"show_in_client_special" => false,
|
||||
"show_in_client" => true,
|
||||
"is_deleted" => 0,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"show_in_client" => "boolean",
|
||||
"show_in_client_special" => "boolean",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
||||
"espesor" => 0.0,
|
||||
"gramaje" => null,
|
||||
"precio_tonelada" => null,
|
||||
"interior" => true,
|
||||
"bn" => true,
|
||||
"color" => true,
|
||||
"cubierta" => false,
|
||||
@ -23,9 +22,6 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
||||
"guardas" => false,
|
||||
"inkjet" => false,
|
||||
"rotativa" => false,
|
||||
"isActivo" => true,
|
||||
"use_in_client" => false,
|
||||
"use_for_tapa_dura" => false,
|
||||
"is_deleted" => 0,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
@ -37,16 +33,12 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
|
||||
"espesor" => "float",
|
||||
"gramaje" => "float",
|
||||
"precio_tonelada" => "float",
|
||||
"interior" => "boolean",
|
||||
"bn" => "boolean",
|
||||
"color" => "boolean",
|
||||
"cubierta" => "boolean",
|
||||
"sobrecubierta" => "boolean",
|
||||
"guardas" => "boolean",
|
||||
"rotativa" => "boolean",
|
||||
"isActivo" => "boolean",
|
||||
"use_in_client" => "boolean",
|
||||
"use_for_tapa_dura" => "boolean",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Configuracion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
|
||||
use App\Entities\Tarifas\TarifaManipuladoEntity;
|
||||
use App\Models\Configuracion\ServicioClienteModel;
|
||||
use CodeIgniter\Database\MySQLi\Result;
|
||||
|
||||
class ServicioClienteEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"nombre" => null,
|
||||
"code" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"nombre" => "string",
|
||||
"code" => "string",
|
||||
];
|
||||
|
||||
public function withManipuladoTarifas()
|
||||
{
|
||||
$this->attributes["tarifas_manipulado"] = $this->getManipuladoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function withAcabadoTarifas()
|
||||
{
|
||||
$this->attributes["tarifas_acabado"] = $this->getAcabadoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function withAllTarifas(){
|
||||
$this->withManipuladoTarifas();
|
||||
$this->withAcabadoTarifas();
|
||||
return $this;
|
||||
}
|
||||
public function getManipuladoTarifas(): ?object
|
||||
{
|
||||
$model = model(ServicioClienteModel::class);
|
||||
return $model->builder()->select("lg_tarifa_manipulado.*")
|
||||
->join("servicio_cliente_tareas","servicio_cliente_tareas.servicio_cliente_id = servicios_cliente.id",'left')
|
||||
->join("lg_tarifa_manipulado","lg_tarifa_manipulado.id = servicio_cliente_tareas.tarifa_manipulado_id",'left')
|
||||
->where("servicio_cliente_tareas.servicio_cliente_id",$this->attributes["id"])
|
||||
->where("lg_tarifa_manipulado.id IS NOT NULL",NULL,FALSE)
|
||||
->where("servicio_cliente_tareas.deleted_at", NULL) // Exclude soft-deleted rows
|
||||
->get()->getFirstRow();
|
||||
}
|
||||
public function getAcabadoTarifas(): ?object
|
||||
{
|
||||
$model = model(ServicioClienteModel::class);
|
||||
return $model->builder()->select("lg_tarifa_acabado.*")
|
||||
->join("servicio_cliente_tareas","servicio_cliente_tareas.servicio_cliente_id = servicios_cliente.id",'left')
|
||||
->join("lg_tarifa_acabado","lg_tarifa_acabado.id = servicio_cliente_tareas.tarifa_acabado_id",'left')
|
||||
->where("servicio_cliente_tareas.servicio_cliente_id",$this->attributes["id"])
|
||||
->where("servicio_cliente_tareas.deleted_at", NULL) // Exclude soft-deleted rows
|
||||
->where("lg_tarifa_acabado.id IS NOT NULL",NULL,FALSE)
|
||||
->get()->getFirstRow();
|
||||
}
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
<?php
|
||||
namespace App\Entities\Produccion;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
|
||||
class OrdenTrabajoEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"pedido_id" => null,
|
||||
"maquina_orden_negro_id" => null,
|
||||
"maquina_orden_color_id" => null,
|
||||
"maquina_orden_portada_id" => null,
|
||||
"maquina_orden_cubierta_id" => null,
|
||||
"negro_forma_id" => null,
|
||||
"color_forma_id" => null,
|
||||
"portada_forma_id" => null,
|
||||
"cubierta_forma_id" => null,
|
||||
"tirada" => null,
|
||||
"negro_pliegos_pedido" => null,
|
||||
"color_pliegos_pedido" => null,
|
||||
"portada_pliegos_pedido" => null,
|
||||
"cubierta_pliegos_pedido" => null,
|
||||
"negro_clicks_pedido" => null,
|
||||
"color_clicks_pedido" => null,
|
||||
"portada_clicks_pedido" => null,
|
||||
"cubierta_clicks_pedido" => null,
|
||||
"pliegos1" => null,
|
||||
"paginas1" => null,
|
||||
"pliegos2" => null,
|
||||
"paginas2" => null,
|
||||
"negro_proveedor_nombre" => null,
|
||||
"color_proveedor_nombre" => null,
|
||||
"portada_proveedor_nombre" => null,
|
||||
"corte_pie" => null,
|
||||
"lomo" => null,
|
||||
"tipo_entrada" => null,
|
||||
"fecha_entrega_real_warning" => null,
|
||||
"fecha_entrega_warning" => null,
|
||||
"fecha_entrega_warning_revised" => null,
|
||||
"ferro_disponible" => null,
|
||||
"ferro_disponible_thread_id" => null,
|
||||
"ferro_cp" => null,
|
||||
"ferro_proveedor" => null,
|
||||
"ferro_tracking" => null,
|
||||
"pre_formato" => null,
|
||||
"pre_lomo" => null,
|
||||
"pre_solapa" => null,
|
||||
"pre_isbn" => null,
|
||||
"pre_codbarras" => null,
|
||||
"pre_imposicion" => null,
|
||||
"pre_imprimir" => null,
|
||||
"pre_faltan_materiales" => null,
|
||||
"pre_faltan_materiales_note" => null,
|
||||
"progreso" => null,
|
||||
"message_production_send" => null,
|
||||
"finalizado" => null,
|
||||
"comentarios" => null
|
||||
];
|
||||
protected $casts = [
|
||||
"pedido_id" => 'integer',
|
||||
"maquina_orden_negro_id" => '?integer',
|
||||
"maquina_orden_color_id" => '?integer',
|
||||
"maquina_orden_portada_id" => '?integer',
|
||||
"maquina_orden_cubierta_id" => '?integer',
|
||||
"negro_forma_id" => '?integer',
|
||||
"color_forma_id" => '?integer',
|
||||
"portada_forma_id" => '?integer',
|
||||
"cubierta_forma_id" => '?integer',
|
||||
"tirada" => 'integer',
|
||||
"negro_pliegos_pedido" => '?integer',
|
||||
"color_pliegos_pedido" => 'string',
|
||||
"portada_pliegos_pedido" => 'string',
|
||||
"cubierta_pliegos_pedido" => 'string',
|
||||
"negro_clicks_pedido" => '?integer',
|
||||
"color_clicks_pedido" => '?integer',
|
||||
"portada_clicks_pedido" => '?integer',
|
||||
"cubierta_clicks_pedido" => null,
|
||||
"pliegos1" => '?integer',
|
||||
"paginas1" => '?integer',
|
||||
"pliegos2" => '?integer',
|
||||
"paginas2" => '?integer',
|
||||
"negro_proveedor_nombre" => null,
|
||||
"color_proveedor_nombre" => null,
|
||||
"portada_proveedor_nombre" => null,
|
||||
"corte_pie" => null,
|
||||
"lomo" => null,
|
||||
"tipo_entrada" => 'string',
|
||||
"fecha_entrega_real_warning" => 'boolean',
|
||||
"fecha_entrega_warning" => 'boolean',
|
||||
"fecha_entrega_warning_revised" => 'boolean',
|
||||
"ferro_disponible" => 'boolean',
|
||||
"ferro_disponible_thread_id" => '?integer',
|
||||
"ferro_cp" => '?string',
|
||||
"ferro_proveedor" => '?string',
|
||||
"ferro_tracking" => '?string',
|
||||
"pre_formato" => '?string',
|
||||
"pre_lomo" => '?string',
|
||||
"pre_solapa" => '?string',
|
||||
"pre_isbn" => '?string',
|
||||
"pre_codbarras" => '?string',
|
||||
"pre_imposicion" => '?string',
|
||||
"pre_imprimir" => 'boolean',
|
||||
"pre_faltan_materiales" => 'boolean',
|
||||
"pre_faltan_materiales_note" => '?string',
|
||||
"progreso" => 'float',
|
||||
"message_production_send" => 'boolean',
|
||||
"finalizado" => 'boolean',
|
||||
"comentarios" => 'string'
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -6,7 +6,7 @@ return [
|
||||
'moduleTitleCosidoTB' => 'Budget for Softcover Stitched Book',
|
||||
'moduleTitleFresadoTB' => 'Budget for Softcover Milling Book',
|
||||
|
||||
'presupuestoPresupuestoAdminList' => 'List of budgets for Softcover Stitched Books',
|
||||
'presupuestoCosidotapablandaList' => 'List of budgets for Softcover Stitched Books',
|
||||
'presupuestoFresadotapablandaList' => 'List of budgets for Milling Stitched Books',
|
||||
'presupuesto' => 'Budget',
|
||||
|
||||
@ -51,7 +51,7 @@ return [
|
||||
'merma' => 'Weakening',
|
||||
'mermacubierta' => 'Cover weakening',
|
||||
'tipoImpresion' => 'Printing type',
|
||||
'papelesComparadorPresupuestoAdmin' => 'Interior and cover papers',
|
||||
'papelesComparadorCosidoTapaBlanda' => 'Interior and cover papers',
|
||||
'posicionPagColor' => 'Color pages position',
|
||||
'colorPageInstructions' => 'Enter the position of the color pages within the book. E.g., 3,5,7 or 4-10,20,155.',
|
||||
'numeroPaginas' => 'Nº Pages',
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"ot" => "Orden de trabajo",
|
||||
"ots" => "Órdenes de trabajo",
|
||||
"btn_pedido_produccion_accion" => "Pasar a producción",
|
||||
"datatable" => [
|
||||
"pedido_id"=> "Order ID",
|
||||
"fecha_encuadernacion"=> "Bookbinding date",
|
||||
"cliente"=> "Client",
|
||||
"titulo"=> "Title",
|
||||
"ubicacion"=> "Location",
|
||||
"tirada"=> "Runs",
|
||||
"impresion"=> "Printing",
|
||||
]
|
||||
];
|
||||
@ -15,7 +15,7 @@ return [
|
||||
'createdAt' => 'Created At',
|
||||
'dateBirth' => 'Date Birth',
|
||||
'email' => 'Email',
|
||||
'emailConfirmed' => 'Email Confirmed',
|
||||
'emailConfirmed' => 'Email Confirmed',
|
||||
'firstName' => 'First Name',
|
||||
'group' => 'Group',
|
||||
'idUser' => 'ID User',
|
||||
|
||||
@ -695,7 +695,6 @@ return [
|
||||
"menu_papelgenerico" => "Papel generico",
|
||||
"menu_papelimpresion" => "Papel impresión",
|
||||
"menu_series_facturas" => "Series facturas",
|
||||
"menu_servicios_cliente" => "Servicios cliente",
|
||||
"menu_ubicaciones" => "Ubicaciones",
|
||||
"menu_serviciocliente" => "Servicio cliente",
|
||||
"menu_tamanioformatos" => "Tamaño formatos",
|
||||
|
||||
@ -3,31 +3,12 @@
|
||||
return [
|
||||
"chat" => "Mensajería",
|
||||
"messages" => "Mensajes",
|
||||
"message" => "Mensaje",
|
||||
"modal" => [
|
||||
"new_hebra" => "Nuevo hilo",
|
||||
"new_hebra" => "Nueva hebra",
|
||||
"title" => "Título",
|
||||
"new_message" => "Nuevo mensaje",
|
||||
"new_receivers" => "Nuevos participantes",
|
||||
"btn_send" => "Enviar",
|
||||
"btn_send_update" => "Enviar"
|
||||
],
|
||||
"datatable_messages" => [
|
||||
"created_at" => "Fecha creación",
|
||||
"updated_at" => "Fecha actualización",
|
||||
"title" => "Título",
|
||||
"creator" => "Creador",
|
||||
"viewed" => "Leído",
|
||||
|
||||
],
|
||||
"new_message_ok" => "Mensaje enviado correctamente",
|
||||
"participants" => "Participantes",
|
||||
"choose_department" => "Elige un departamento",
|
||||
"new_participant" => "Añadir nuevos participantes",
|
||||
"write_message_placeholder" => "Escriba aquí su mensaje...",
|
||||
"add_notification" => "Notificación",
|
||||
"check_as_unviewed" => "Marcar como no leídos",
|
||||
"add_notification_message" => "Envía a los usuarios añadidos una notificación con los mensajes presentes en el chat.",
|
||||
"chat_title_presupuesto" => 'Presupuesto[{title,string,0}][{id}]',
|
||||
"no_messages_notification" => 'No hay mensajes que revisar por el momento'
|
||||
]
|
||||
];
|
||||
@ -16,7 +16,6 @@ return [
|
||||
'papelGenericoList' => 'Lista Papeles Genéricos',
|
||||
'papelesGenericos' => 'Papeles Genéricos',
|
||||
'showInClient' => 'Mostrar en cliente',
|
||||
'showInClientSpecial' => 'Papel especial cliente',
|
||||
'updatedAt' => 'Actualizado el',
|
||||
'form_acordion_title' => 'Propiedades Papel Genérico',
|
||||
|
||||
|
||||
@ -5,12 +5,10 @@
|
||||
return [
|
||||
'alto' => 'Alto',
|
||||
'ancho' => 'Ancho',
|
||||
'interior' => 'Interior',
|
||||
'bn' => 'B/N',
|
||||
'color' => 'Color',
|
||||
'createdAt' => 'Creado en',
|
||||
'cubierta' => 'Cubierta',
|
||||
'use_for_tapa_dura' => 'Papel tapa dura',
|
||||
'sobrecubierta' => 'Sobrecubierta',
|
||||
'guardas' => 'Guardas',
|
||||
'defecto' => 'Por defecto',
|
||||
@ -37,7 +35,6 @@ return [
|
||||
'rotativa' => 'Rotativa',
|
||||
'updatedAt' => 'Actualizado en',
|
||||
'activo' => 'Activo?',
|
||||
'useInClient' => 'Usar en presup. cliente',
|
||||
'userUpdateId' => 'ID usuario actualización',
|
||||
|
||||
'consumo_tintas_rotativas' => 'Consumo tintas',
|
||||
|
||||
@ -17,7 +17,7 @@ return [
|
||||
'presupuestoFresadotapaduraList' => 'Lista presupuestos Libros Fresado Tapa Dura',
|
||||
'presupuestoFresadotapablandaList' => 'Lista presupuestos Libros Fresado Tapa Blanda',
|
||||
'presupuestoCosidotapaduraList' => 'Lista presupuestos Libros Cosido Tapa Dura',
|
||||
'presupuestoPresupuestoAdminList' => 'Lista presupuestos Libros Cosido Tapa Blanda',
|
||||
'presupuestoCosidotapablandaList' => 'Lista presupuestos Libros Cosido Tapa Blanda',
|
||||
'presupuesto' => 'Presupuesto',
|
||||
'presupuestos' => 'Presupuestos',
|
||||
|
||||
@ -80,7 +80,7 @@ return [
|
||||
'merma' => 'Merma',
|
||||
'mermacubierta' => 'Merma cubierta',
|
||||
'tipoImpresion' => 'Tipo de impresión',
|
||||
'papelesComparadorPresupuestoAdmin' => 'Papeles interior y cubierta',
|
||||
'papelesComparadorCosidoTapaBlanda' => 'Papeles interior y cubierta',
|
||||
'posicionPagColor' => 'Posición páginas a color',
|
||||
'papelDiferente' => 'Papel color y negro diferente',
|
||||
'paginasColorConsecutivas' => 'Páginas color consecutivas',
|
||||
@ -256,7 +256,6 @@ return [
|
||||
// Placeholders
|
||||
'formatoLibro' => "Formato libro",
|
||||
'selectCliente' => "Seleccione cliente",
|
||||
'selectPapel' => "Seleccione papel",
|
||||
|
||||
|
||||
// Preview
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"datatable" => [
|
||||
"pedido_id"=> "Pedido ID",
|
||||
"fecha_encuadernacion"=> "Fecha encuadernación",
|
||||
"cliente"=> "Cliente",
|
||||
"titulo"=> "Título",
|
||||
"ubicacion"=> "Ubicación",
|
||||
"tirada"=> "Tirada",
|
||||
"impresion"=> "Impresión",
|
||||
]
|
||||
];
|
||||
@ -19,7 +19,6 @@ return [
|
||||
'adminRolTooltip' => 'Permitir acceso completo al sistema',
|
||||
|
||||
// System permissions
|
||||
'viewPermission' => 'Visualizar',
|
||||
'createPermission' => 'Crear',
|
||||
'editPermission' => 'Editar',
|
||||
'deletePermission' => 'Eliminar',
|
||||
@ -31,10 +30,6 @@ return [
|
||||
'direccionesSection' => 'Direcciones',
|
||||
'presupuestoSection' => 'Presupuestos',
|
||||
'presupuestoClienteSection' => 'Presupuestos',
|
||||
'pedidosActivosSection' => 'Activos',
|
||||
'pedidosFinalizadosSection' => 'Finalizados',
|
||||
'pedidosCanceladosSection' => 'Cancelados',
|
||||
'pedidosTodosSection' => 'Todos',
|
||||
'tarifaPreimpresionSection' => 'Tarifas de preimpresión',
|
||||
'tarifaManipuladoSection' => 'Tarifas de manipulado',
|
||||
'tarifaAcabadoSection' => 'Tarifas de acabado',
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
return [
|
||||
"cardTitle" => "Servicios cliente",
|
||||
"infoTarifaManipulado" => "La tarifa seleccionada estará asociada al servicio.",
|
||||
"infoTarifaAcabado" => "La tarifa seleccionada estará asociada al servicio.",
|
||||
|
||||
"datatable" => [
|
||||
"nombre" => "Nombre",
|
||||
"code" => "Código",
|
||||
"created_at" => "Fecha creación",
|
||||
]
|
||||
];
|
||||
@ -10,7 +10,7 @@ class ChatDeparmentModel extends Model
|
||||
protected $table = 'chat_departments';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'object';
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
@ -53,9 +53,9 @@ class ChatDeparmentModel extends Model
|
||||
public function getChatDepartments(string $type = "general"): array
|
||||
{
|
||||
$userModel = model(UserModel::class);
|
||||
$chatModel = model(ChatModel::class);
|
||||
$chatMessageModel = model(ChatMessageModel::class);
|
||||
|
||||
$query = $this->builder()
|
||||
$query = $this->db->table('chat_departments')
|
||||
->select(
|
||||
[
|
||||
|
||||
@ -63,6 +63,7 @@ class ChatDeparmentModel extends Model
|
||||
'chat_departments.name',
|
||||
'chat_departments.display',
|
||||
'chat_department_users.user_id',
|
||||
'chats.id as chatId',
|
||||
]
|
||||
)
|
||||
->join(
|
||||
@ -70,26 +71,30 @@ class ChatDeparmentModel extends Model
|
||||
"chat_department_users.chat_department_id = chat_departments.id",
|
||||
'left'
|
||||
)
|
||||
->join("chats", "chats.chat_department_id = chat_departments.id", "left")
|
||||
->join(
|
||||
"users",
|
||||
"chat_department_users.user_id = users.id",
|
||||
'left'
|
||||
)->join(
|
||||
"chat_messages",
|
||||
"chat_messages.chat_id = chats.id",
|
||||
"left"
|
||||
)
|
||||
->where("chat_departments.type", $type);
|
||||
|
||||
|
||||
// if (auth()->user()->cliente_id == null) {
|
||||
// $query->where("chat_department_users.user_id", auth()->user()->id);
|
||||
// }
|
||||
if (auth()->user()->cliente_id == null) {
|
||||
$query->where("chat_department_users.user_id", auth()->user()->id);
|
||||
}
|
||||
|
||||
$results = $query->get()->getResultArray();
|
||||
// Create the desired structure
|
||||
$departments = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
$departmentName = $row['name'];
|
||||
|
||||
// If the department is not yet added to the array, initialize it
|
||||
if (!isset($departments[$departmentName])) {
|
||||
|
||||
$departments[$departmentName] = [
|
||||
'id' => $row['id'],
|
||||
'name' => $row['name'],
|
||||
@ -126,21 +131,4 @@ class ChatDeparmentModel extends Model
|
||||
->get()->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
public function getDisplay(int $chat_deparment_id) : string
|
||||
{
|
||||
return $this->find($chat_deparment_id)->display;
|
||||
}
|
||||
public function getChatDepartmentSelect(string $query = null)
|
||||
{
|
||||
$q = $this->builder()->select([
|
||||
"id",
|
||||
"display as name",
|
||||
"description"
|
||||
]);
|
||||
if($query){
|
||||
$q->orLike("display",$query)
|
||||
->orLike("name",$query);
|
||||
}
|
||||
return $q;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,18 +2,16 @@
|
||||
|
||||
namespace App\Models\Chat;
|
||||
|
||||
use App\Models\ChatNotification;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Model;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
|
||||
class ChatMessageModel extends Model
|
||||
{
|
||||
protected $table = 'chat_messages';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'object';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"message",
|
||||
@ -30,7 +28,7 @@ class ChatMessageModel extends Model
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
@ -73,30 +71,11 @@ class ChatMessageModel extends Model
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
public function get_chat_message(int $chat_message_id): object
|
||||
{
|
||||
$user = model(UserModel::class);
|
||||
$auth_user = auth()->user();
|
||||
$message = $this->find($chat_message_id);
|
||||
$message->pos = $auth_user->id == $message->sender_id ? "right" : "left";
|
||||
if ($auth_user->id == $message->sender_id) {
|
||||
$message->sender_first_name = $auth_user->first_name;
|
||||
$message->sender_last_name = $auth_user->last_name;
|
||||
|
||||
} else {
|
||||
$sender_user = $user->find($message->sender_id);
|
||||
$message->sender_first_name = $sender_user->first_name;
|
||||
$message->sender_last_name = $sender_user->last_name;
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
public function get_chat_contact_messages(int $receiver_id): array
|
||||
{
|
||||
$conversationArray = [];
|
||||
$userModel = model(UserModel::class);
|
||||
$chatNotificationModel = model(ChatNotification::class);
|
||||
$receiverUser = $userModel->find($receiver_id);
|
||||
$chat_id = null;
|
||||
$messagesFromClient = $this->builder()
|
||||
->where("sender_id", auth()->user()->id)
|
||||
->where("receiver_id", $receiverUser->id)
|
||||
@ -116,9 +95,7 @@ class ChatMessageModel extends Model
|
||||
$conversationArray[] = $message;
|
||||
}
|
||||
$dates = array();
|
||||
|
||||
foreach ($conversationArray as $key => $row) {
|
||||
$chatNotificationModel->builder()->set("viewed", true)->where("chat_message_id", $row->id)->where("user_id", auth()->user()->id)->update();
|
||||
$dates[$key] = strtotime($row->created_at);
|
||||
}
|
||||
array_multisort($dates, SORT_ASC, $conversationArray);
|
||||
@ -133,32 +110,11 @@ class ChatMessageModel extends Model
|
||||
->where("receiver_id", auth()->user()->id)->countAllResults();
|
||||
return $messagesFromReceiver;
|
||||
}
|
||||
public function get_chat_department_messages_count(int $chat_id) : int
|
||||
{
|
||||
$chatDepartmentMessagesCount = $this->builder()
|
||||
->where("id",$chat_id)
|
||||
->countAllResults();
|
||||
return $chatDepartmentMessagesCount;
|
||||
}
|
||||
public function get_chat_messages_count(int $sender_id): int
|
||||
{
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->groupStart()
|
||||
->where("sender_id", $sender_id)
|
||||
->where("receiver_id", auth()->user()->id)
|
||||
->orGroupStart()
|
||||
->where("receiver_id", $sender_id)
|
||||
->where("sender_id", auth()->user()->id)
|
||||
->groupEnd()
|
||||
->groupEnd()
|
||||
->countAllResults();
|
||||
return $messagesFromReceiver;
|
||||
}
|
||||
public function set_chat_messages_as_read(int $sender_id): int
|
||||
{
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->set("viewed", true)
|
||||
->where("user_id", $sender_id)
|
||||
->where("sender_id", $sender_id)
|
||||
->where("receiver_id", auth()->user()->id)->update();
|
||||
return $messagesFromReceiver;
|
||||
}
|
||||
@ -166,32 +122,23 @@ class ChatMessageModel extends Model
|
||||
{
|
||||
$chatDepartmentModel = model(ChatDeparmentModel::class);
|
||||
$chatModel = model(ChatModel::class);
|
||||
$messagesFromReceiver = 0;
|
||||
$auth_user = auth()->user();
|
||||
$chat_department_id = $chatModel->find($chat_id)->chat_department_id;
|
||||
$users_in_chat = array_map(fn($x) => $x->id, $chatDepartmentModel->getChatDepartmentUsers($chat_department_id));
|
||||
if (auth()->user()->cliente_id) {
|
||||
// Si el usuario es cliente, marca como leídos todos los mensajes exceptos los suyos
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->set("viewed", true)
|
||||
->where("chat_id", $chat_id)
|
||||
->whereNotIn("sender_id", [$auth_user->id])->update();
|
||||
} else {
|
||||
// Si el usuario no es cliente y está dentro de los usuarios de departamento
|
||||
// marca como leido todos los mensajes, excepto los mensajes de los usuarios
|
||||
// de dentro del departamento
|
||||
if (in_array($auth_user->id, $users_in_chat) == true) {
|
||||
// if (($key = array_search($auth_user->id, $users_in_chat)) !== false) {
|
||||
// unset($users_in_chat[$key]);
|
||||
// }
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->set("viewed", true)
|
||||
->where("chat_id", $chat_id)
|
||||
->whereNotIn("sender_id", $users_in_chat)
|
||||
->update();
|
||||
}
|
||||
}
|
||||
|
||||
if(auth()->user()->cliente_id){
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->set("viewed", true)
|
||||
->where("chat_id", $chat_id)
|
||||
->whereNotIn("sender_id", [auth()->user()->id])->update();
|
||||
}else{
|
||||
$chat_department_id = $chatModel->find($chat_id)->chat_department_id;
|
||||
$users_in_chat = array_map(fn($x) => $x->id, $chatDepartmentModel->getChatDepartmentUsers($chat_department_id));
|
||||
$messagesFromReceiver = $this->builder()
|
||||
->set("viewed", true)
|
||||
->where("chat_id", $chat_id)
|
||||
->whereNotIn("sender_id", $users_in_chat)
|
||||
->update();
|
||||
}
|
||||
|
||||
return $messagesFromReceiver;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -47,16 +47,4 @@ class ChatNotification extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function isChatMessageViewed(int $chat_message_id) : bool
|
||||
{
|
||||
$status = false;
|
||||
$count = $this->where("chat_message_id",$chat_message_id)->where("viewed",false)->countAllResults();
|
||||
if($count>0){
|
||||
$status = false;
|
||||
}else{
|
||||
$status = true;
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ class ChatUser extends Model
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"user_id",
|
||||
@ -24,7 +24,7 @@ class ChatUser extends Model
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
@ -46,12 +46,4 @@ class ChatUser extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
public function getChatUserArrayId(int $chat_id) : array
|
||||
{
|
||||
$queryResult = $this->builder()
|
||||
->select(['chat_users.user_id'])
|
||||
->where("chat_users.chat_id",$chat_id)
|
||||
->get()->getResultObject();
|
||||
return array_map(fn($q) => $q->user_id,$queryResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,16 +7,14 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
protected $table = "cliente_plantilla_precios_lineas";
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.id",
|
||||
1 => "t1.tipo",
|
||||
2 => "t1.tipo_maquina",
|
||||
3 => "t1.tipo_impresion",
|
||||
4 => "t1.tiempo_min",
|
||||
5 => "t1.tiempo_max",
|
||||
6 => "t1.precio_hora",
|
||||
7 => "t1.margen",
|
||||
8 => "CONCAT(t2.first_name, ' ', t2.last_name)",
|
||||
9 => "t1.updated_at",
|
||||
0 => "t1.tipo",
|
||||
1 => "t1.tipo_maquina",
|
||||
2 => "t1.tipo_impresion",
|
||||
3 => "t1.tiempo_min",
|
||||
4 => "t1.tiempo_max",
|
||||
5 => "t1.precio_hora",
|
||||
6 => "t1.margen",
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
@ -115,20 +113,10 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
|
||||
|
||||
function delete_values($plantilla_id = 0){
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where('t1.plantilla_id', $plantilla_id)
|
||||
->set('is_deleted', 1)
|
||||
->set('deleted_at', $date_value)
|
||||
->update();
|
||||
|
||||
$this->db
|
||||
->table('cliente_precios' . " t1")
|
||||
->where('t1.plantilla_id', $plantilla_id)
|
||||
->set('plantilla_id', null)
|
||||
->update();
|
||||
}
|
||||
|
||||
@ -139,15 +127,14 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource($search = [], $plantilla_id = -1)
|
||||
public function getResource($plantilla_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.tipo AS tipo, t1.tipo_maquina AS tipo_maquina, t1.tipo_impresion AS tipo_impresion,
|
||||
t1.tiempo_min AS tiempo_min, t1.tiempo_max AS tiempo_max, t1.precio_hora AS precio_hora, t1.margen AS margen,
|
||||
t1.user_updated_id AS user_updated_id, t1.updated_at AS updated_at, CONCAT(t2.first_name, ' ', t2.last_name) AS user_updated,
|
||||
t1.id AS DT_RowId"
|
||||
t1.user_updated_id AS user_updated_id, t1.updated_at AS updated_at, CONCAT(t2.first_name, ' ', t2.last_name) AS user_updated"
|
||||
);
|
||||
|
||||
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
||||
@ -155,19 +142,8 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.plantilla_id', $plantilla_id);
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach ($search as $col_search) {
|
||||
if ($col_search[1] > 0 && $col_search[0] < 4)
|
||||
$builder->where(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
else
|
||||
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
}
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function checkIntervals($data = [], $id_linea = null, $plantilla_id = null){
|
||||
@ -207,13 +183,14 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
|
||||
function copy_from_cliente($cliente_id = 0, $plantilla_id = 0){
|
||||
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
// Se cargan los valores en la plantilla
|
||||
$clientePreciosModel = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$values = $clientePreciosModel->getResource([], $cliente_id)->get()->getResultObject();
|
||||
$values = $clientePreciosModel->getResource($cliente_id)->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
@ -224,7 +201,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
->set('tiempo_min', $value->tiempo_min)
|
||||
->set('tiempo_max', $value->tiempo_max)
|
||||
->set('margen', $value->margen)
|
||||
->set('user_updated_id', auth()->user()->id)
|
||||
->set('user_updated_id', $session->id_user)
|
||||
->set('updated_at', $date_value)
|
||||
->insert();
|
||||
}
|
||||
|
||||
@ -7,8 +7,7 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
|
||||
protected $table = "cliente_plantilla_precios";
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.id",
|
||||
1 => "t1.nombre",
|
||||
0 => "t1.nombre",
|
||||
];
|
||||
|
||||
/**
|
||||
@ -49,11 +48,11 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param array $search
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource($search = [])
|
||||
public function getResource(string $search = "", $cliente_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -62,17 +61,14 @@ class ClientePlantillaPreciosModel extends \App\Models\BaseModel
|
||||
);
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach ($search as $col_search) {
|
||||
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
}
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,14 +14,14 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.id",
|
||||
1 => "t1.tipo",
|
||||
2 => "t1.tipo_maquina",
|
||||
3 => "t1.tipo_impresion",
|
||||
4 => "t1.tiempo_min",
|
||||
5 => "t1.tiempo_max",
|
||||
6 => "t1.precio_hora",
|
||||
7 => "t1.margen",
|
||||
0 => "t1.tipo",
|
||||
1 => "t1.tipo_maquina",
|
||||
2 => "t1.tipo_impresion",
|
||||
3 => "t1.tiempo_min",
|
||||
4 => "t1.tiempo_max",
|
||||
5 => "t1.precio_hora",
|
||||
6 => "t1.margen",
|
||||
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
@ -153,7 +153,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
|
||||
// Se cargan los valores de la plantilla
|
||||
$plantillaModel = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$values = $plantillaModel->getResource([],$plantilla_id)->get()->getResultObject();
|
||||
$values = $plantillaModel->getResource($plantilla_id)->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
@ -178,6 +178,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
|
||||
function update_from_plantilla($plantilla_id = 0){
|
||||
|
||||
$session = session();
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
$date_value = $datetime->format('Y-m-d H:i:s');
|
||||
|
||||
@ -186,7 +187,6 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
->table($this->table . " t1")
|
||||
->select("t1.cliente_id AS id")
|
||||
->where('t1.plantilla_id', $plantilla_id)
|
||||
->where('t1.is_deleted', 0)
|
||||
->distinct()
|
||||
->get()->getResultObject();
|
||||
|
||||
@ -200,7 +200,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
|
||||
// Se cargan los valores de la plantilla
|
||||
$plantillaModel = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
$values = $plantillaModel->getResource([], $plantilla_id)->get()->getResultObject();
|
||||
$values = $plantillaModel->getResource($plantilla_id)->get()->getResultObject();
|
||||
foreach ($values as $value) {
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
@ -215,7 +215,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
->set('margen', $value->margen)
|
||||
->set('user_updated_id', $value->user_updated_id)
|
||||
->set('updated_at', $value->updated_at)
|
||||
->set('user_created_id', auth()->user()->id)
|
||||
->set('user_created_id', $session->id_user)
|
||||
->set('created_at', $date_value)
|
||||
->insert();
|
||||
}
|
||||
@ -256,7 +256,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource($search = [], $cliente_id = -1)
|
||||
public function getResource($cliente_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -271,44 +271,12 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.cliente_id', $cliente_id);
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach ($search as $col_search) {
|
||||
if ($col_search[0] > 0 && $col_search[0] < 4)
|
||||
$builder->where(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
else
|
||||
$builder->like(self::SORTABLE[$col_search[0]], $col_search[2]);
|
||||
}
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
}
|
||||
}
|
||||
|
||||
public function getPlantilla($cliente_id = -1){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.plantilla_id AS id, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.cliente_id', $cliente_id);
|
||||
$builder->join("cliente_plantilla_precios t2", "t1.plantilla_id = t2.id", "left");
|
||||
$builder->limit(1);
|
||||
|
||||
$values = $builder->get()->getResultArray();
|
||||
if(count($values)>0){
|
||||
return $values[0];
|
||||
}
|
||||
|
||||
return [];
|
||||
return $builder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function checkIntervals($data = [], $id_linea = null, $cliente_id = null){
|
||||
|
||||
helper('general');
|
||||
|
||||
@ -19,10 +19,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
1 => "t1.code",
|
||||
2 => "t1.code_ot",
|
||||
3 => "t1.show_in_client",
|
||||
4 => "t1.show_in_client_special",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
|
||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "deleted_at", "is_deleted"];
|
||||
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -63,8 +62,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
];
|
||||
|
||||
|
||||
public function getIdFromCode(string $code = "")
|
||||
{
|
||||
public function getIdFromCode(string $code=""){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
@ -79,8 +77,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getCodeFromId($id = 0)
|
||||
{
|
||||
public function getCodeFromId($id=0){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
@ -107,24 +104,23 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
$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, t1.show_in_client_special AS show_in_client_special"
|
||||
"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);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -132,9 +128,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -157,48 +153,48 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo);
|
||||
|
||||
if ($is_cubierta == true) {
|
||||
if($is_cubierta==true){
|
||||
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
}
|
||||
|
||||
if($is_sobrecubierta==true){
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
}
|
||||
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
}
|
||||
if($is_cubierta==false && $is_sobrecubierta==false){
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
|
||||
if ($is_sobrecubierta == true) {
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
}
|
||||
if($is_guardas==true){
|
||||
$builder->where("t2.guardas", 1);
|
||||
}
|
||||
|
||||
if ($is_cubierta == false && $is_sobrecubierta == false) {
|
||||
$builder->where("t5.uso", 'interior');
|
||||
}
|
||||
if($rotativa==true){
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
|
||||
if ($is_guardas == true) {
|
||||
$builder->where("t2.guardas", 1);
|
||||
}
|
||||
|
||||
if ($rotativa == true) {
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
|
||||
if ($mostrar_cliente != null) {
|
||||
$builder->where("t1.show_in_client", $mostrar_cliente);
|
||||
}
|
||||
if($mostrar_cliente!=null){
|
||||
$builder->where("t1.show_in_client", $mostrar_cliente);
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getGramajeComparador(string $papel_generico_nombre = "", $uso = "", $ejemplares = 0)
|
||||
public function getGramajeComparador(string $papel_generico_nombre="", $uso="", $ejemplares=0)
|
||||
{
|
||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta')
|
||||
if($uso == 'cubierta' || $uso == 'sobrecubierta')
|
||||
$tipo = 'colorhq';
|
||||
else
|
||||
$tipo = $uso; // color y colorhq valen para los dos
|
||||
if ($uso == 'bn')
|
||||
$tipo = "negro";
|
||||
if ($uso == 'bnhq')
|
||||
$tipo = "negrohq";
|
||||
$tipo=$uso; // color y colorhq valen para los dos
|
||||
if($uso == 'bn')
|
||||
$tipo="negro";
|
||||
if($uso == 'bnhq')
|
||||
$tipo="negrohq";
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -209,7 +205,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
|
||||
|
||||
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
@ -218,43 +214,44 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.nombre", $papel_generico_nombre);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
if($uso == 'bn' || $uso == 'bnhq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($uso == 'color' || $uso == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
else if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
|
||||
if ($uso == 'bn' || $uso == 'bnhq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($uso == 'color' || $uso == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
else if ($uso == 'cubierta') {
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
} else if ($uso == 'sobrecubierta') {
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
$builder->where("t4.min <=", $ejemplares);
|
||||
$builder->where("t4.max >=", $ejemplares);
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
foreach ($values as $value) {
|
||||
$value->id = $id;
|
||||
$id++;
|
||||
}
|
||||
$values_array = array_map(function ($value) {
|
||||
return $value->text;
|
||||
}, $values);
|
||||
$unique_values = array_unique($values_array);
|
||||
return array_values(array_intersect_key($values, $unique_values));
|
||||
$builder->where("t4.min <=", $ejemplares);
|
||||
$builder->where("t4.max >=", $ejemplares);
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
foreach ($values as $value){
|
||||
$value->id = $id;
|
||||
$id++;
|
||||
}
|
||||
$values_array = array_map( function( $value ) {
|
||||
return $value->text;
|
||||
}, $values );
|
||||
$unique_values = array_unique($values_array);
|
||||
return array_values(array_intersect_key($values, $unique_values));
|
||||
|
||||
}
|
||||
|
||||
//tipo: negro, negrohq, color, colorhq
|
||||
//uso: interior, rotativa, cubierta, sobrecubierta
|
||||
public function getGramajeLineasPresupuesto($papel_generico_id = 0, $tipo = "", $uso = "")
|
||||
public function getGramajeLineasPresupuesto($papel_generico_id=0, $tipo="", $uso="")
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
@ -265,7 +262,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
|
||||
|
||||
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
@ -275,157 +272,42 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.id", $papel_generico_id);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if ($uso == 'cubierta') {
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
} else if ($uso == 'sobrecubierta') {
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
} else {
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if ($uso == 'rotativa')
|
||||
$builder->where("t2.rotativa", 1);
|
||||
else
|
||||
$builder->where("t2.rotativa", 0);
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
foreach ($values as $value) {
|
||||
$value->id = $id;
|
||||
$id++;
|
||||
}
|
||||
$values_array = array_map(function ($value) {
|
||||
return $value->text;
|
||||
}, $values);
|
||||
$unique_values = array_unique($values_array);
|
||||
return array_values(array_intersect_key($values, $unique_values));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getPapelCliente($tipo, $is_cubierta = false, $selected_papel_id = null, $tapa_dura = null, $papel_especial = false, $POD = null)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
|
||||
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
|
||||
if($tipo == 'color')
|
||||
$tipo = 'colorhq';
|
||||
else if($tipo == 'negro')
|
||||
$tipo = 'negrohq';
|
||||
}
|
||||
|
||||
if ($selected_papel_id != null) {
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t2.gramaje as gramaje",
|
||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t1.id", $selected_papel_id)
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.show_in_client", 1)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
->where("t2.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo)
|
||||
->distinct('t2.gramaje');
|
||||
} else {
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.nombre AS nombre",
|
||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.show_in_client", 1)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
->where("t2.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $tipo)
|
||||
->distinct('t1.id');
|
||||
}
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t1.id", function ($subQuery) {
|
||||
$subQuery->select("t1_inner.id")
|
||||
->from("lg_papel_generico t1_inner")
|
||||
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
if ($is_cubierta == true) {
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
if($tapa_dura == true){
|
||||
$builder->where("t2.use_for_tapa_dura", 1);
|
||||
if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
} else {
|
||||
$builder->where("t2.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if ($papel_especial == true) {
|
||||
$builder->where("t1.show_in_client_special", 1);
|
||||
}
|
||||
else{
|
||||
$builder->where("t1.show_in_client_special", 0);
|
||||
}
|
||||
|
||||
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
||||
$builder->where("t2.rotativa", 0);
|
||||
}
|
||||
else{
|
||||
if($POD == false){
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
else if ($POD == true){
|
||||
else
|
||||
$builder->where("t2.rotativa", 0);
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
foreach ($values as $value){
|
||||
$value->id = $id;
|
||||
$id++;
|
||||
}
|
||||
}
|
||||
$values_array = array_map( function( $value ) {
|
||||
return $value->text;
|
||||
}, $values );
|
||||
$unique_values = array_unique($values_array);
|
||||
return array_values(array_intersect_key($values, $unique_values));
|
||||
|
||||
|
||||
if ($selected_papel_id != null)
|
||||
$data = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
else
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//$query = $this->db->getLastQuery();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,17 +16,14 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
0 => "t1.nombre",
|
||||
1 => "t2.nombre",
|
||||
2 => "t1.gramaje",
|
||||
3 => "t1.interior",
|
||||
4 => "t1.bn",
|
||||
5 => "t1.color",
|
||||
6 => "t1.cubierta",
|
||||
7 => "t1.use_for_tapa_dura",
|
||||
8 => "t1.sobrecubierta",
|
||||
9 => "t1.guardas",
|
||||
10 => "t1.inkjet",
|
||||
11 => "t1.rotativa",
|
||||
12 => "t1.isActivo",
|
||||
13 => "t1.use_in_client",
|
||||
3 => "t1.bn",
|
||||
4 => "t1.color",
|
||||
5 => "t1.cubierta",
|
||||
6 => "t1.sobrecubierta",
|
||||
7 => "t1.guardas",
|
||||
8 => "t1.inkjet",
|
||||
9 => "t1.rotativa",
|
||||
10 => "t1.isActivo"
|
||||
];
|
||||
|
||||
|
||||
@ -39,7 +36,6 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
"espesor",
|
||||
"gramaje",
|
||||
"precio_tonelada",
|
||||
"interior",
|
||||
"bn",
|
||||
"color",
|
||||
"cubierta",
|
||||
@ -48,8 +44,6 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
"inkjet",
|
||||
"rotativa",
|
||||
"isActivo",
|
||||
"use_in_client",
|
||||
"use_for_tapa_dura",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_updated_id",
|
||||
@ -147,25 +141,23 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $generico_id = -1)
|
||||
public function getResource(string $search = "", $generico_id=-1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.defecto AS defecto, t1.referencia AS referencia, t1.mano AS mano,
|
||||
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.interior AS interior, t1.precio_tonelada AS precio_tonelada,
|
||||
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.use_for_tapa_dura AS use_for_tapa_dura,
|
||||
t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
|
||||
t1.espesor AS espesor, t1.gramaje AS gramaje, t1.precio_tonelada AS precio_tonelada,
|
||||
t1.bn AS bn, t1.color AS color, t1.cubierta AS cubierta, t1.sobrecubierta AS sobrecubierta, t1.guardas AS guardas,
|
||||
t1.inkjet AS inkjet, t1.rotativa AS rotativa,
|
||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id,
|
||||
t1.use_in_client AS use_in_client"
|
||||
t1.isActivo AS isActivo, t2.nombre AS papel_generico_id"
|
||||
);
|
||||
|
||||
|
||||
$builder->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "left");
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
if ($generico_id > 0) {
|
||||
$builder->where("t1.papel_generico_id", $generico_id);
|
||||
if($generico_id>0){
|
||||
$builder->where("t1.papel_generico_id", $generico_id);
|
||||
}
|
||||
|
||||
return empty($search)
|
||||
@ -185,29 +177,29 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"'" . $maquina_id . "'" . " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
|
||||
"'".$maquina_id."'". " as maquina_id, t1.id AS papel_impresion_id, '0' as active"
|
||||
);
|
||||
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
|
||||
$isFirst = true;
|
||||
$where_str = "";
|
||||
//Si hay tarifas...
|
||||
if (!empty($tarifas)) {
|
||||
foreach ($tarifas as $tarifa) {
|
||||
if (!empty($tarifas)){
|
||||
foreach ($tarifas as $tarifa){
|
||||
if (!$isFirst)
|
||||
$where_str .= ' OR ';
|
||||
else {
|
||||
else{
|
||||
$isFirst = false;
|
||||
}
|
||||
if ($tarifa->uso == 'cubierta')
|
||||
$where_str .= "`t1`.`cubierta`=1";
|
||||
else if ($tarifa->uso == 'sobrecubierta')
|
||||
$where_str .= "`t1`.`sobrecubierta`=1";
|
||||
else {
|
||||
else{
|
||||
if ($tarifa->tipo == 'negro' || $tarifa->tipo == 'negrohq')
|
||||
$where_str .= "`t1`.`bn`=1 ";
|
||||
$where_str .= "`t1`.`bn`=1 ";
|
||||
else
|
||||
$where_str .= "`t1`.`color`=1 ";
|
||||
}
|
||||
@ -215,11 +207,11 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder->where($where_str);
|
||||
}
|
||||
// si no hay tarifas no hay que devolver nada
|
||||
else {
|
||||
else{
|
||||
// Se pone una condicion que no se puede dar
|
||||
$builder->where("t1.bn", 2);
|
||||
}
|
||||
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
@ -232,45 +224,43 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
*
|
||||
* @return [type]
|
||||
*/
|
||||
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options = [])
|
||||
{
|
||||
public function getIdPapelesImpresionForPresupuesto($papel_generico_id = null, $gramaje = null, $options=[]){
|
||||
$bn = array_key_exists('bn', $options) ? $options['bn'] : null;
|
||||
$color = array_key_exists('color', $options) ? $options['color'] : null;
|
||||
$cubierta = array_key_exists('cubierta', $options) ? $options['cubierta'] : null;
|
||||
$sobrecubierta = array_key_exists('sobrecubierta', $options) ? $options['sobrecubierta'] : null;
|
||||
$guardas = array_key_exists('guardas', $options) ? $options['guardas'] : null;
|
||||
$rotativa = array_key_exists('rotativa', $options) ? $options['rotativa'] : null;
|
||||
$color = array_key_exists('color', $options)? $options['color'] : null;
|
||||
$cubierta = array_key_exists('cubierta', $options)? $options['cubierta'] : null;
|
||||
$sobrecubierta = array_key_exists('sobrecubierta', $options)? $options['sobrecubierta'] : null;
|
||||
$guardas = array_key_exists('guardas', $options)? $options['guardas'] : null;
|
||||
$rotativa = array_key_exists('rotativa', $options)? $options['rotativa'] : null;
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->distinct("t1.id")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.papel_generico_id AS papel_generico_id,
|
||||
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa"
|
||||
);
|
||||
|
||||
t1.gramaje as gramaje, t1.espesor AS espesor, t1.precio_tonelada AS precio_tonelada, t1.rotativa AS rotativa");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
|
||||
$builder->where("t1.papel_generico_id", $papel_generico_id);
|
||||
$builder->where("t1.gramaje", $gramaje);
|
||||
|
||||
if (!is_null($bn)) {
|
||||
|
||||
if(!is_null($bn)){
|
||||
$builder->where("t1.bn", $bn);
|
||||
}
|
||||
if (!is_null($color)) {
|
||||
if(!is_null($color)){
|
||||
$builder->where("t1.color", $color);
|
||||
}
|
||||
if (!is_null($cubierta)) {
|
||||
if(!is_null($cubierta)){
|
||||
$builder->where("t1.cubierta", $cubierta);
|
||||
}
|
||||
if (!is_null($sobrecubierta)) {
|
||||
if(!is_null($sobrecubierta)){
|
||||
$builder->where("t1.sobrecubierta", $sobrecubierta);
|
||||
}
|
||||
if (!is_null($guardas)) {
|
||||
if(!is_null($guardas)){
|
||||
$builder->where("t1.guardas", $guardas);
|
||||
}
|
||||
if (!is_null($rotativa)) {
|
||||
if(!is_null($rotativa)){
|
||||
$builder->where("t1.rotativa", $rotativa);
|
||||
}
|
||||
|
||||
@ -279,8 +269,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
|
||||
//tipo: negro, negrohq, color, colorhq
|
||||
//uso: interior, rotativa, cubierta, sobrecubierta
|
||||
public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso = "")
|
||||
{
|
||||
public function getPapelesImpresionForMenu($papel_generico = null, $gramaje = null, $tipo = null, $uso=""){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->distinct("t1.id")
|
||||
@ -289,9 +278,8 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t4.id = t5.maquina_id", "left")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS text"
|
||||
);
|
||||
|
||||
"t1.id AS id, t1.nombre AS text");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t1.isActivo", 1);
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
@ -300,7 +288,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder->where("t4.tipo", 'impresion');
|
||||
$builder->where("t5.is_deleted", 0);
|
||||
$builder->where("t5.tipo", $tipo);
|
||||
|
||||
|
||||
$builder->where("t2.id", $papel_generico);
|
||||
$builder->where("t1.gramaje", $gramaje);
|
||||
|
||||
@ -310,35 +298,32 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
else if ($uso == 'guardas')
|
||||
$builder->where("t1.guardas", 1);
|
||||
else {
|
||||
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
if ($uso == 'rotativa')
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t1.rotativa", 1);
|
||||
else
|
||||
$builder->where("t1.rotativa", 0);
|
||||
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getNombre($id)
|
||||
{
|
||||
public function getNombre($id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.nombre AS text"
|
||||
);
|
||||
|
||||
"t1.nombre AS text");
|
||||
|
||||
$builder->where("t1.id", $id);
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getPapelGenericoCode($papel_id = 0)
|
||||
{
|
||||
public function getPapelGenericoCode($papel_id = 0){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select("t2.code AS code")
|
||||
@ -347,13 +332,12 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.isActivo", 1)
|
||||
->where("t2.is_deleted", 0);
|
||||
|
||||
|
||||
$result = $builder->get()->getResultObject();
|
||||
if (count($result) > 0) {
|
||||
if(count($result) > 0){
|
||||
return $result[0]->code;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
use App\Entities\Configuracion\ServicioClienteEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ServicioClienteModel extends Model
|
||||
{
|
||||
|
||||
protected $table = 'servicios_cliente';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = ServicioClienteEntity::class;
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"code",
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
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 = [];
|
||||
|
||||
/**
|
||||
* Query para datatable
|
||||
*
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function getQueryDatatable(): BaseBuilder
|
||||
{
|
||||
$q = $this->builder()->select(["id", "nombre", "code", "created_at"])->where("deleted_at", null);
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Actualiza la tarifa de acabado `lg_tarifas_acabado` si ya existe una asociada o inserta si ya no existe.
|
||||
*
|
||||
* @param integer $servicio_cliente_id
|
||||
* @param integer $tarifa_acabado_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function upsertTarifaAcabado(int $servicio_cliente_id, int $tarifa_acabado_id): bool
|
||||
{
|
||||
$servicioClienteTareaModel = model(ServicioClienteTareaModel::class);
|
||||
$q = $servicioClienteTareaModel
|
||||
->where("servicio_cliente_id", $servicio_cliente_id);
|
||||
if ($q->countAllResults() > 0) {
|
||||
$this->detachTarifas($servicio_cliente_id);
|
||||
}
|
||||
$r = $this->attachTarifaAcabado($servicio_cliente_id, $tarifa_acabado_id);
|
||||
return $r;
|
||||
}
|
||||
/**
|
||||
* Actualiza la tarifa de manipulado `lg_tarifas_manipulado` si ya existe una asociada o inserta si ya no existe.
|
||||
*
|
||||
* @param integer $servicio_cliente_id
|
||||
* @param integer $tarifa_manipulado_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function upsertTarifaManipulado(int $servicio_cliente_id, int $tarifa_manipulado_id): bool
|
||||
{
|
||||
$servicioClienteTareaModel = model(ServicioClienteTareaModel::class);
|
||||
$q = $servicioClienteTareaModel
|
||||
->where("servicio_cliente_id", $servicio_cliente_id);
|
||||
if ($q->countAllResults() > 0) {
|
||||
$this->detachTarifas($servicio_cliente_id);
|
||||
}
|
||||
$r = $this->attachTarifaManipulado($servicio_cliente_id, $tarifa_manipulado_id);
|
||||
return $r;
|
||||
}
|
||||
/**
|
||||
* Asocia tarifa de acabado a servicio cliente
|
||||
*
|
||||
* @param integer $servicio_cliente_id
|
||||
* @param integer $tarifa_acabado_id
|
||||
* @return integer
|
||||
*/
|
||||
public function attachTarifaAcabado(int $servicio_cliente_id, int $tarifa_acabado_id): int
|
||||
{
|
||||
$servicioClienteTareaModel = model(ServicioClienteTareaModel::class);
|
||||
$id = $servicioClienteTareaModel->insert([
|
||||
"servicio_cliente_id" => $servicio_cliente_id,
|
||||
"tarifa_acabado_id" => $tarifa_acabado_id
|
||||
]);
|
||||
return $id;
|
||||
}
|
||||
/**
|
||||
* Asocia tarifa de manipulado a servicio cliente
|
||||
*
|
||||
* @param integer $servicio_cliente_id
|
||||
* @param integer $tarifa_manipulado_id
|
||||
* @return integer
|
||||
*/
|
||||
public function attachTarifaManipulado(int $servicio_cliente_id, int $tarifa_manipulado_id): int
|
||||
{
|
||||
$servicioClienteTareaModel = model(ServicioClienteTareaModel::class);
|
||||
$id = $servicioClienteTareaModel->insert([
|
||||
"servicio_cliente_id" => $servicio_cliente_id,
|
||||
"tarifa_manipulado_id" => $tarifa_manipulado_id
|
||||
]);
|
||||
return $id;
|
||||
}
|
||||
/**
|
||||
* Elimina todas las tarifas asociadas a un servicio cliente
|
||||
*
|
||||
* @param integer $servicio_cliente_id
|
||||
* @return bool
|
||||
*/
|
||||
public function detachTarifas(int $servicio_cliente_id): bool
|
||||
{
|
||||
$servicioClienteTareaModel = model(ServicioClienteTareaModel::class);
|
||||
$s = $servicioClienteTareaModel->where("servicio_cliente_id", $servicio_cliente_id)->delete();
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Configuracion;
|
||||
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ServicioClienteTareaModel extends Model
|
||||
{
|
||||
protected $table = 'servicio_cliente_tareas';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"servicio_cliente_id",
|
||||
"tarifa_acabado_id",
|
||||
"tarifa_manipulado_id",
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
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 = [];
|
||||
|
||||
|
||||
}
|
||||
@ -1,124 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OrdenTrabajo;
|
||||
|
||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Model;
|
||||
class OrdenTrabajoModel extends Model
|
||||
{
|
||||
protected $table = 'ordenes_trabajo';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = OrdenTrabajoEntity::class;
|
||||
protected $useSoftDeletes = true;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
"pedido_id",
|
||||
"maquina_orden_negro_id",
|
||||
"maquina_orden_color_id",
|
||||
"maquina_orden_portada_id",
|
||||
"maquina_orden_cubierta_id",
|
||||
"negro_forma_id",
|
||||
"color_forma_id",
|
||||
"portada_forma_id",
|
||||
"cubierta_forma_id",
|
||||
"tirada",
|
||||
"negro_pliegos_pedido",
|
||||
"color_pliegos_pedido",
|
||||
"portada_pliegos_pedido",
|
||||
"cubierta_pliegos_pedido",
|
||||
"negro_clicks_pedido",
|
||||
"color_clicks_pedido",
|
||||
"portada_clicks_pedido",
|
||||
"cubierta_clicks_pedido",
|
||||
"pliegos1",
|
||||
"paginas1",
|
||||
"pliegos2",
|
||||
"paginas2",
|
||||
"negro_proveedor_nombre",
|
||||
"color_proveedor_nombre",
|
||||
"portada_proveedor_nombre",
|
||||
"corte_pie",
|
||||
"lomo",
|
||||
"tipo_entrada",
|
||||
"fecha_entrega_real_warning",
|
||||
"fecha_entrega_warning",
|
||||
"fecha_entrega_warning_revised",
|
||||
"ferro_disponible",
|
||||
"ferro_disponible_thread_id",
|
||||
"ferro_cp",
|
||||
"ferro_proveedor",
|
||||
"ferro_tracking",
|
||||
"pre_formato",
|
||||
"pre_lomo",
|
||||
"pre_solapa",
|
||||
"pre_isbn",
|
||||
"pre_codbarras",
|
||||
"pre_imposicion",
|
||||
"pre_imprimir",
|
||||
"pre_faltan_materiales",
|
||||
"pre_faltan_materiales_note",
|
||||
"progreso",
|
||||
"message_production_send",
|
||||
"finalizado",
|
||||
"comentarios"
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
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 getDatatableQuery() : BaseBuilder
|
||||
{
|
||||
$q = $this->builder("ordenes_trabajo ot")
|
||||
->select([
|
||||
"pedidos.id",
|
||||
"orden_trabajo_dates.fecha_encuadernado_at",
|
||||
"clientes.nombre as client_name",
|
||||
"presupuestos.titulo as presupuesto_title",
|
||||
"tp.codigo as tipo_presupuesto_impresion",
|
||||
"ubicaciones.nombre as ubicacion_name",
|
||||
])
|
||||
->join("orden_trabajo_dates otdates","otdates.orden_trabajo_id = ot.id","left")
|
||||
->join("pedidos","pedidos.id = ot.pedido_id","left")
|
||||
->join("pedidos_linea","pedidos.id = pedidos_linea.pedido_id","left")
|
||||
->join("presupuestos","presupuestos.id = pedidos_linea.presupuesto_id","left")
|
||||
->join("clientes","clientes.id = presupuestos.cliente_id","left")
|
||||
->join("tipos_presupuestos tp","presupuestos.tipo_impresion_id = tp.id","left")
|
||||
->join("ubicaciones","ubicaciones.id = pedidos_linea.ubicacion_id","left")
|
||||
->groupBy("ot.id");
|
||||
return $q;
|
||||
}
|
||||
|
||||
public function updateMaquinas(OrdenTrabajoEntity $ot)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Models\Pedidos;
|
||||
|
||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
|
||||
use function PHPSTORM_META\map;
|
||||
|
||||
class PedidoModel extends \App\Models\BaseModel
|
||||
@ -93,7 +90,7 @@ class PedidoModel extends \App\Models\BaseModel
|
||||
|
||||
return $lineasPresupuesto;
|
||||
}
|
||||
public function getPedidoPresupuestoTipoImpresion(int $presupuesto_id): array|object|null
|
||||
public function getPedidoPresupuestoTipoImpresion(int $presupuesto_id) : array|object|null
|
||||
{
|
||||
$q = $this->db->table($this->table)
|
||||
->select(
|
||||
@ -188,51 +185,15 @@ class PedidoModel extends \App\Models\BaseModel
|
||||
public function getPedidoPresupuestoFicheros($pedido_id)
|
||||
{
|
||||
$query = $this->db->table($this->table)
|
||||
->select([
|
||||
'presupuesto_ficheros.nombre as fileName',
|
||||
'presupuesto_ficheros.file_path as filePath'
|
||||
])
|
||||
->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left')
|
||||
->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left')
|
||||
->join('presupuesto_ficheros', 'presupuesto_ficheros.presupuesto_id = presupuestos.id', 'left')
|
||||
->where('pedidos.id', $pedido_id);
|
||||
$presupuesto_ficheros = $query->get()->getFirstRow();
|
||||
return $presupuesto_ficheros;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea una orden de trabajo asociada al pedido
|
||||
*
|
||||
* @param integer $pedido_id
|
||||
* @return void
|
||||
*/
|
||||
public function createOrdenTrabajo(int $pedido_id)
|
||||
{
|
||||
$otModel = model(OrdenTrabajoModel::class);
|
||||
$ot = new OrdenTrabajoEntity(["pedido_id" => $pedido_id]);
|
||||
$existOt = $this->hasOrdenTrabajo($pedido_id);
|
||||
if ($existOt) {
|
||||
$ot = $otModel->find($pedido_id);
|
||||
return $ot;
|
||||
}
|
||||
$otModel->updateMaquinas($ot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprueba si el pedido tiene ya una orden de trabajo asociada
|
||||
*
|
||||
* @param integer $pedido_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasOrdenTrabajo(int $pedido_id): bool
|
||||
{
|
||||
$hasOrdenTrabajo = false;
|
||||
$q = $this->builder()->select("orden_trabajo.pedido_id")
|
||||
->join("ordenes_trabajo", "ordenes_trabajo.pedido_id = pedidos.id", "left")
|
||||
->where("ordenes_trabajo.pedido_id", $pedido_id)->countAllResults();
|
||||
if ($q > 0) {
|
||||
$hasOrdenTrabajo = true;
|
||||
}
|
||||
return $hasOrdenTrabajo;
|
||||
->select([
|
||||
'presupuesto_ficheros.nombre as fileName',
|
||||
'presupuesto_ficheros.file_path as filePath'
|
||||
])
|
||||
->join('pedidos_linea', 'pedidos_linea.id = pedidos.id', 'left')
|
||||
->join('presupuestos', 'presupuestos.id = pedidos_linea.presupuesto_id', 'left')
|
||||
->join('presupuesto_ficheros', 'presupuesto_ficheros.presupuesto_id = presupuestos.id', 'left')
|
||||
->where('pedidos.id', $pedido_id);
|
||||
$presupuesto_ficheros = $query->get()->getFirstRow();
|
||||
return $presupuesto_ficheros;
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$result_array = [];
|
||||
foreach($tarifa_value as $tarifa_proveedor){
|
||||
$precio_total = floatval(1.0* $tarifa_proveedor->precio_hora* $tiempo) * (1+$tarifa_value[0]->margen/100.0);
|
||||
if ($tirada>=$POD){
|
||||
if (!$POD){
|
||||
$precio_total += floatval($tarifa_proveedor->tarifa_importe_fijo);
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = 32){
|
||||
public function getPrecioTarifaHoras($tarifa_encuadernacion_id, $paginas, $tirada, $proveedor_id, $POD, $paginas_cuadernillo = null){
|
||||
|
||||
$modelTarifa = model('App\Models\Tarifas\TarifaEncuadernacionModel');
|
||||
|
||||
@ -265,7 +265,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\BaseModel
|
||||
$ret_array = [];
|
||||
foreach($tarifa_value as $tarifa_proveedor){
|
||||
$precio_total = floatval(1.0* $tarifa_proveedor->precio_hora* $tiempo) * (1+$tarifa_value[0]->margen/100.0);
|
||||
if ($tirada>=$POD){
|
||||
if (!$POD){
|
||||
$precio_total += floatval($tarifa_proveedor->tarifa_importe_fijo);
|
||||
}
|
||||
|
||||
|
||||
@ -404,13 +404,11 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
'cliente_id' => $data['clienteId'],
|
||||
'tipo_impresion_id' => $data['tipo_impresion_id'],
|
||||
'pais_id' => 1,
|
||||
'retractilado' => $data['retractilado'] ? 1 : 0,
|
||||
'retractilado5' => $data['retractilado5'] ? 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' => $data['ferro'] ? 1 : 0,
|
||||
'ferro_digital' => $data['ferro_digital'] ? 1 : 0,
|
||||
'marcapaginas' => $data['marcapaginas'] ? 1 : 0,
|
||||
'ferro' => in_array(24, $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,
|
||||
@ -426,7 +424,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
'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_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,
|
||||
|
||||
@ -79,7 +79,6 @@ class TipoPresupuestoServiciosDefectoModel extends \App\Models\BaseModel
|
||||
$where = "(t1.solapas IS NULL OR t1.solapas='" . $solapas . "')";
|
||||
$builder->where($where);
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
$builder->where("t2.is_deleted", 0);
|
||||
$builder->select("t1.tarifa_id AS tarifa_id, t2.nombre AS tarifa_nombre");
|
||||
|
||||
|
||||
@ -153,10 +153,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
||||
$builder->where('t2.proveedor_id', $proveedor_id);
|
||||
}
|
||||
|
||||
|
||||
$data = $builder->get()->getResultObject();
|
||||
$sql = $this->db->getLastQuery();
|
||||
return $data;
|
||||
return $builder->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getTarifaPresupuestoEncuadernacionHoras($tarifa_id, $horas, $tirada, $proveedor_id=-1){
|
||||
|
||||
@ -30,6 +30,7 @@ class UserModel extends ShieldUserModel
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
|
||||
protected $validationRules = [
|
||||
"first_name" => "required|trim|max_length[150]",
|
||||
"last_name" => "required|trim|max_length[150]",
|
||||
@ -65,7 +66,7 @@ class UserModel extends ShieldUserModel
|
||||
$builder = $this->db
|
||||
->table("users" . " t1")
|
||||
->select(
|
||||
"t1.id AS id, CONCAT(t1.first_name, ' ', t1.last_name) AS name"
|
||||
"t1.id AS id, CONCAT(t1.first_name, ' ', t1.last_name) AS text"
|
||||
);
|
||||
|
||||
$builder->where('t1.deleted_at', null);
|
||||
@ -76,19 +77,5 @@ class UserModel extends ShieldUserModel
|
||||
|
||||
}
|
||||
|
||||
// Método para comprobar si el email ya está registrado
|
||||
public function isEmailUnique($email)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table("auth_identities t1") // La tabla correcta
|
||||
->select("t1.secret AS email")
|
||||
->where('secret', $email);
|
||||
|
||||
// Obtener resultados
|
||||
$result = $builder->get()->getRow();
|
||||
|
||||
// Devuelve true si no se encuentra el correo (es único), false en caso contrario
|
||||
return $result === null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ class UserModel extends \App\Models\BaseModel
|
||||
|
||||
protected $allowedFields = [
|
||||
"username",
|
||||
"email",
|
||||
"first_name",
|
||||
"last_name",
|
||||
"client_id",
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
class MessageService extends BaseService
|
||||
{
|
||||
public static function get_chat_title_from_presupuesto(int $presuesto_id,?string $department_name = null) : string
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -25,19 +25,19 @@ class PresupuestoClienteService extends BaseService
|
||||
$total_plana = -1;
|
||||
$hay_plana = false;
|
||||
if ($data['isColor']) {
|
||||
if (count($plana) > 0) {
|
||||
if ($data['datosPedido']->paginas == $data['paginas_color']) {
|
||||
if (count($plana[1]) > 2)
|
||||
$total_plana += floatval($plana[1]['total_impresion']);
|
||||
else
|
||||
return -1;
|
||||
} else {
|
||||
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']);
|
||||
}
|
||||
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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,17 +416,6 @@ class PresupuestoClienteService extends BaseService
|
||||
return $values;
|
||||
}
|
||||
|
||||
public static function getServiciosManipuladoDefault($data)
|
||||
{
|
||||
|
||||
$tirada = $data['tirada'] ?? -1;
|
||||
$anchoDesarrollo = $data['anchoDesarrollo'] ?? -1;
|
||||
|
||||
/*$model = model('App\Models\Presupuestos\PresupuestoEncuadernacionesModel');
|
||||
$values = $model->initPresupuesto($tipo_impresion_id, $solapas, $tirada, $paginas, $ancho, $alto, $POD, $paginasCuadernillo);*/
|
||||
//return $values;
|
||||
}
|
||||
|
||||
public static function getServiciosManipulado($data)
|
||||
{
|
||||
|
||||
@ -523,11 +512,6 @@ class PresupuestoClienteService extends BaseService
|
||||
$linea_rotativa = array_merge($linea_rotativa, $lineas);
|
||||
}
|
||||
}
|
||||
|
||||
$linea_rotativa = array_filter($linea_rotativa, function($item) {
|
||||
return count($item['fields']['num_formas']) > 1;
|
||||
});
|
||||
|
||||
if (count($linea_rotativa) > 0) {
|
||||
|
||||
usort(
|
||||
|
||||
@ -639,11 +639,11 @@ class PresupuestoService extends BaseService
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h1_temp);
|
||||
// Si son mas de 2 formas
|
||||
if (count($calles) > 0)
|
||||
$h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < (floatval($maquina->ancho))) ? $h1_temp : $h1_temp - 1;
|
||||
$h1 = ($h1_temp * $anchoForCalculo + 2 * $calles[0]->externas + ($h1_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h1_temp : $h1_temp - 1;
|
||||
else
|
||||
$h1 = $h1_temp;
|
||||
|
||||
$v1 = floor(floatval($maquina->alto_click) / $altoForCalculo);
|
||||
$v1 = floor($maquina->alto_click / $altoForCalculo);
|
||||
$formas_h = $h1 * $v1; //p1
|
||||
}
|
||||
// verticales
|
||||
@ -651,10 +651,10 @@ class PresupuestoService extends BaseService
|
||||
|
||||
$calles = (new \App\Models\Configuracion\MaquinasCallesModel())->getCallesForMaquina($maquina->maquina_id, $h2_temp);
|
||||
if (count($calles) > 0)
|
||||
$h2 = ($h2_temp * $altoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < (floatval($maquina->ancho))) ? $h2_temp : $h2_temp - 1;
|
||||
$h2 = ($h2_temp * $altoForCalculo + 2 * $calles[0]->externas + ($h2_temp - 1) * $calles[0]->internas < ($maquina->ancho)) ? $h2_temp : $h2_temp - 1;
|
||||
else
|
||||
$h2 = $h2_temp;
|
||||
$v2 = floor(floatval($maquina->alto_click) / $anchoForCalculo);
|
||||
$v2 = floor($maquina->alto_click / $anchoForCalculo);
|
||||
$formas_v = $h2 * $v2; //p2
|
||||
}
|
||||
|
||||
@ -1061,16 +1061,16 @@ class PresupuestoService extends BaseService
|
||||
),
|
||||
'cliente_id' => ($input_data['presupuesto'])->cliente_id,
|
||||
'datosTipolog' => [
|
||||
(object) array(
|
||||
'negro' => $linea->rotativa_negro,
|
||||
'cyan' => $linea->rotativa_cyan,
|
||||
'magenta' => $linea->rotativa_magenta,
|
||||
'amarillo' => $linea->rotativa_amarillo,
|
||||
'cg' => $linea->rotativa_cg,
|
||||
'gota_negro' => $linea->rotativa_gota_negro,
|
||||
'gota_color' => $linea->rotativa_gota_color,
|
||||
)
|
||||
]
|
||||
(object) array(
|
||||
'negro' => $linea->rotativa_negro,
|
||||
'cyan' => $linea->rotativa_cyan,
|
||||
'magenta' => $linea->rotativa_magenta,
|
||||
'amarillo' => $linea->rotativa_amarillo,
|
||||
'cg' => $linea->rotativa_cg,
|
||||
'gota_negro' => $linea->rotativa_gota_negro,
|
||||
'gota_color' => $linea->rotativa_gota_color,
|
||||
)
|
||||
]
|
||||
];
|
||||
|
||||
$comp_data = PresupuestoService::obtenerComparadorRotativa($datos);
|
||||
@ -1479,7 +1479,7 @@ class PresupuestoService extends BaseService
|
||||
// con el mismo proveedor
|
||||
else {
|
||||
if ($tarifaModel->isTarifaPorHoras($servicio->tarifa_encuadernado_id)) {
|
||||
$paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? 32;
|
||||
$paginas_cuadernillo = $servicio->paginas_por_cuadernillo ?? null;
|
||||
$nueva_tarifa = $model->getPrecioTarifaHoras(
|
||||
$servicio->tarifa_encuadernado_id,
|
||||
$input_data['paginas'],
|
||||
@ -1815,12 +1815,6 @@ class PresupuestoService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta') {
|
||||
|
||||
$linea['fields']['dimension_desarrollo']['ancho'] = $datosPedido->anchoExteriores;
|
||||
$linea['fields']['dimension_desarrollo']['alto'] = $datosPedido->altoExteriores;
|
||||
}
|
||||
|
||||
if (!array_key_exists('tipo_linea', $linea['fields'])) {
|
||||
if ($isColor) {
|
||||
if ($isHq)
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<div class="alert alert-success d-flex align-items-baseline d-none" role="alert" id="<?= $id ?>">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-sm icon-alert"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"></h5>
|
||||
<div class="alert-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,153 +0,0 @@
|
||||
<div class="col-md-12" id="chat-direct-message" data-id="<?= $modelId ?>" data-user-id="<?= $userId ?>">
|
||||
<div class="app-chat card overflow-hidden">
|
||||
|
||||
<div class="row g-0">
|
||||
|
||||
|
||||
<!-- Chat & Contacts -->
|
||||
<div class="col app-chat-contacts app-sidebar flex-grow-0 overflow-hidden border-end"
|
||||
id="app-chat-contacts">
|
||||
|
||||
<div class="sidebar-header">
|
||||
|
||||
<div class="d-flex align-items-center me-3 me-lg-0">
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<div class="flex-shrink-0 avatar me-3">
|
||||
<button title="<?= lang("Chat.new_participant") ?>" class="btn btn-primary btn-icon me-2 rounded-circle" id="btn-chat-add-participant"><span class="ti ti-sm ti-user-plus"></span></button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="flex-grow-1 input-group input-group-merge rounded-pill">
|
||||
<span class="input-group-text" id="basic-addon-search31">
|
||||
<i class="ti ti-search"></i>
|
||||
</span>
|
||||
<input type="text" class="form-control chat-search-input"
|
||||
placeholder="Buscar..." aria-label="Buscar..."
|
||||
aria-describedby="basic-addon-search31" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <i class="ti ti-x cursor-pointer d-lg-none d-block position-absolute mt-2 me-1 top-0 end-0"
|
||||
data-overlay data-bs-toggle="sidebar" data-target="#app-chat-contacts"></i> -->
|
||||
</div>
|
||||
<div class="sidebar-body">
|
||||
|
||||
<!-- CLIENTES -->
|
||||
<ul class="list-unstyled chat-contact-list mb-0">
|
||||
|
||||
<li class="chat-contact-list-item chat-contact-list-item-title">
|
||||
<h5 class="text-primary mb-0"><?= lang("Chat.participants") ?></h5>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-unstyled chat-contact-list mb-0" id="contact-list">
|
||||
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
<div class="sk-wave sk-primary ">
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <li class="chat-contact-list-item">
|
||||
<a class="d-flex align-items-center">
|
||||
<div class="avatar d-block flex-shrink-0">
|
||||
<span class="avatar-initial rounded-circle bg-label-primary">JJ</span>
|
||||
</div>
|
||||
<div class="chat-contact-info flex-grow-1 ms-2">
|
||||
<h6 class="chat-contact-name text-truncate m-0">Jaime Jimenez</h6>
|
||||
</div>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Chat contacts -->
|
||||
|
||||
<!-- Chat History -->
|
||||
<div class="col app-chat-history bg-body">
|
||||
<div class="chat-history-wrapper ">
|
||||
<div class="chat-history-header border-bottom">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex overflow-hidden align-items-center">
|
||||
<i class="ti ti-menu-2 ti-sm cursor-pointer d-lg-none d-block me-2"
|
||||
data-bs-toggle="sidebar" data-overlay
|
||||
data-target="#app-chat-contacts"></i>
|
||||
<h5 class="text-primary mb-0" id="chat-direct-title"><br></h5>
|
||||
<div class="chat-contact-info flex-grow-1 ms-2">
|
||||
<h6 class="m-0"></h6>
|
||||
<small class="user-status text-muted"></small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="dropdown d-flex align-self-center">
|
||||
<button class="btn p-0" type="button" id="chat-header-actions"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<i class="ti ti-dots-vertical"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end"
|
||||
aria-labelledby="chat-header-actions">
|
||||
<a class="dropdown-item" id="update-message-unviewed" href="javascript:void(0);"><?= lang("Chat.check_as_unviewed") ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-history-body bg-body ">
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
<div class="sk-wave sk-primary ">
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-unstyled chat-history" id="chat-conversation">
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Chat message form -->
|
||||
<div class="chat-history-footer shadow-sm">
|
||||
<div
|
||||
class="form-send-message d-flex justify-content-between align-items-center">
|
||||
<input class="form-control message-input border-0 me-3 shadow-none"
|
||||
placeholder="<?= lang("Chat.write_message_placeholder") ?>" />
|
||||
<div class="message-actions d-flex align-items-center">
|
||||
|
||||
<div class="message-actions d-flex align-items-center">
|
||||
<a class="btn btn-primary d-flex send-msg-btn" style="color:white"
|
||||
id="send-msg-btn-direct">
|
||||
<i class="ti ti-send me-md-1 me-0"></i>
|
||||
<span class="align-middle d-md-inline-block"><?= lang("Chat.modal.btn_send") ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Chat History -->
|
||||
|
||||
<div class="app-overlay"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= view("themes/vuexy/components/modals/modalAddNewChatParticipant") ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------------------->
|
||||
<!-- Código JS logica -->
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/messages/directMessagePage.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/perfect-scrollbar/perfect-scrollbar.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="col-md-12" id="chat-factura" data-id="<?= $modelId ?>">
|
||||
<div class="container-xxl flex-grow-1 container-p-y" id="chat-factura" data-id="<?= $modelId ?>">
|
||||
<div class="app-chat card overflow-hidden">
|
||||
<div class="row g-0">
|
||||
|
||||
@ -30,10 +30,9 @@
|
||||
</div>
|
||||
<!-- Chats -->
|
||||
<ul class="list-unstyled chat-contact-list" id="chat-list">
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
|
||||
</div>
|
||||
|
||||
<li class="chat-contact-list-item chat-list-item-0 d-none">
|
||||
<h6 class="text-muted mb-0">No Chats Found</h6>
|
||||
</li>
|
||||
<!-- CHAT LIST -->
|
||||
|
||||
</ul>
|
||||
@ -77,15 +76,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-history-body bg-body ">
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
<div class="sk-wave sk-primary ">
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-unstyled chat-history" id="chat-conversation">
|
||||
|
||||
|
||||
@ -122,7 +112,6 @@
|
||||
</div>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------------------->
|
||||
|
||||
@ -37,11 +37,14 @@
|
||||
<hr class="container-m-nx m-0" />
|
||||
<div class="sidebar-body">
|
||||
|
||||
<!-- CLIENTES -->
|
||||
<!-- 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 ">
|
||||
<h6 class="text-muted mb-0">No Contacts Found</h6>
|
||||
</li>
|
||||
<!-- <li class="chat-contact-list-item">
|
||||
<a class="d-flex align-items-center">
|
||||
<div class="avatar d-block flex-shrink-0">
|
||||
@ -54,7 +57,6 @@
|
||||
</li> -->
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Chat contacts -->
|
||||
@ -73,8 +75,9 @@
|
||||
class="avatar-initial rounded-circle bg-label-primary">P</span>
|
||||
</div>
|
||||
<div class="chat-contact-info flex-grow-1 ms-2">
|
||||
<h6 class="m-0"></h6>
|
||||
<small class="user-status text-muted"></small>
|
||||
<h6 class="m-0">Departamento Producción</h6>
|
||||
<small class="user-status text-muted">Consulta sobre el presupuesto
|
||||
P001</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center">
|
||||
@ -84,13 +87,13 @@
|
||||
aria-expanded="false">
|
||||
<i class="ti ti-dots-vertical"></i>
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu dropdown-menu-end"
|
||||
<div class="dropdown-menu dropdown-menu-end"
|
||||
aria-labelledby="chat-header-actions">
|
||||
<a class="dropdown-item" href="javascript:void(0);">Silenciar
|
||||
Conversacion</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);">Limpiar
|
||||
Conversacion</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -137,7 +140,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------------------->
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="col-md-12" id="chat-pedido" data-id="<?= $modelId ?>">
|
||||
<div class="container-xxl flex-grow-1 container-p-y" id="chat-pedido" data-id="<?= $modelId ?>">
|
||||
|
||||
<div class="app-chat card overflow-hidden">
|
||||
<div class="row g-0">
|
||||
@ -31,8 +31,9 @@
|
||||
</div>
|
||||
<!-- Chats -->
|
||||
<ul class="list-unstyled chat-contact-list" id="chat-list">
|
||||
|
||||
|
||||
<li class="chat-contact-list-item chat-list-item-0 d-none">
|
||||
<h6 class="text-muted mb-0">No Chats Found</h6>
|
||||
</li>
|
||||
<!-- CHAT LIST -->
|
||||
|
||||
</ul>
|
||||
@ -75,15 +76,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-history-body bg-body ">
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
<div class="sk-wave sk-primary ">
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-unstyled chat-history" id="chat-conversation">
|
||||
|
||||
|
||||
@ -121,7 +113,6 @@
|
||||
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------------------->
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="col-md-12" 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">
|
||||
|
||||
@ -30,8 +30,9 @@
|
||||
</div>
|
||||
<!-- Chats -->
|
||||
<ul class="list-unstyled chat-contact-list" id="chat-list">
|
||||
|
||||
|
||||
<li class="chat-contact-list-item chat-list-item-0 d-none">
|
||||
<h6 class="text-muted mb-0">No Chats Found</h6>
|
||||
</li>
|
||||
<!-- CHAT LIST -->
|
||||
|
||||
</ul>
|
||||
@ -75,17 +76,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-history-body bg-body ">
|
||||
<div class="d-flex justify-content-center chat-loader">
|
||||
<div class="sk-wave sk-primary ">
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
<div class="sk-wave-rect"></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-unstyled chat-history" id="chat-conversation">
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Chat message form -->
|
||||
@ -119,7 +112,6 @@
|
||||
</div>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/spinkit/spinkit.css') ?>" />
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/css/pages/app-chat.css') ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------------------->
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
<form class="form-control" id="<?= $id ?>" data-id="<?= $model->id ?>">
|
||||
<div class="row mb-2">
|
||||
<!-- Servicio cliente nombre-->
|
||||
<div class="col-xs-12 col-md-6 col-lg-6 mb-2">
|
||||
<label for="servicio-cliente-nombre" class="form-label"><?= @lang("ServicioCliente.datatable.nombre") ?></label>
|
||||
<input type="text" class="form-control" name="nombre" id="servicio-cliente-nombre">
|
||||
</div>
|
||||
<!-- Servicio cliente code-->
|
||||
<div class="col-xs-12 col-md-6 col-lg-6 mb-2">
|
||||
<label for="servicio-cliente-code" class="form-label"><?= @lang("ServicioCliente.datatable.code") ?></label>
|
||||
<input type="text" class="form-control" name="code" id="servicio-cliente-code">
|
||||
|
||||
</div>
|
||||
<!-- Tarifa acabado asociada a servicio -->
|
||||
<div class="col-xs-12 col-md-8 col-lg-6 mb-2" id="container-tarifa-acabado-select">
|
||||
<label for="servicio-cliente-tarifa-acabado" class="form-label"><?= @lang("Tarifaacabado.tarifaacabado") ?></label>
|
||||
<select class="select2 form-select" name="tarifa_acabado_id" id="servicio-cliente-tarifa-acabado" placeholder="<?= @lang("Tarifaacabado.tarifasacabado") ?>">
|
||||
</select>
|
||||
<div class="form-text"><?= @lang("ServicioCliente.infoTarifaAcabado") ?></div>
|
||||
|
||||
</div>
|
||||
<!-- Tarifa manipulado asociada a servicio-->
|
||||
<div class="col-xs-12 col-md-8 col-lg-6 mb-2 d-none" id="container-tarifa-manipulado-select">
|
||||
<label for="servicio-cliente-tarifa-manipulado" class="form-label"><?= @lang("Tarifamanipulado.tarifamanipulado") ?></label>
|
||||
<select class="select2 form-select" name="tarifa_manipulado_id" id="servicio-cliente-tarifa-manipulado" placeholder="<?= @lang("Tarifamanipulado.tarifasmanipulado") ?>">
|
||||
</select>
|
||||
<div class="form-text"><?= @lang("ServicioCliente.infoTarifaManipulado") ?></div>
|
||||
</div>
|
||||
<!-- Check tarifa acabado o manipulado -->
|
||||
<div class="col-xs-12 col-md-4 col-lg-6 mb-2">
|
||||
<div class="text-light small fw-medium mb-2">Seleccione tipo de tarifa</div>
|
||||
<div class="switches-stacked">
|
||||
<label class="switch">
|
||||
<input type="radio" class="switch-input" id="check-tarifa-acabado" name="switches-stacked-radio" checked />
|
||||
<span class="switch-toggle-slider">
|
||||
<span class="switch-on"></span>
|
||||
<span class="switch-off"></span>
|
||||
</span>
|
||||
<span class="switch-label"><?= @lang("Tarifaacabado.tarifasacabado") ?></span>
|
||||
</label>
|
||||
<label class="switch">
|
||||
<input type="radio" class="switch-input" id="check-tarifa-manipulado" name="switches-stacked-radio" />
|
||||
<span class="switch-toggle-slider">
|
||||
<span class="switch-on"></span>
|
||||
<span class="switch-off"></span>
|
||||
</span>
|
||||
<span class="switch-label"><?= @lang("Tarifamanipulado.tarifasmanipulado") ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-12 d-flex justify-content-start gap-4">
|
||||
<button type="button" class="btn btn-primary btn-md d-none" id="btn-new-servicio-cliente"><?= lang("App.global_save") ?></button>
|
||||
<button type="button" class="btn btn-primary btn-md d-none" id="btn-update-servicio-cliente"><?= lang("App.global_save") ?></button>
|
||||
<button type="button" class="btn btn-secondary btn-md"><?= lang("App.global_come_back") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@ -1,42 +0,0 @@
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modalAddNewChatParticipant" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel1"><?= lang('Chat.modal.new_receivers') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="col-12 mb-0">
|
||||
<?= view("themes/vuexy/components/alerts/alert", ["id" => "alertNewParticipant"]) ?>
|
||||
</div>
|
||||
<form id="formNewParticipant">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2">
|
||||
<label for="select-users" class="required form-label"><?= lang('Chat.modal.new_receivers') ?></label>
|
||||
<select id="select-users" name="users" class="select2 form-control" multiple required>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12 mb-2">
|
||||
<div class="text-light small fw-medium mb-2"><?= lang("Chat.add_notification") ?></div>
|
||||
<label class="switch">
|
||||
<input type="checkbox" class="switch-input" name="notification" id="checkbox-notification-chat" checked />
|
||||
<span class="switch-toggle-slider">
|
||||
<span class="switch-on"></span>
|
||||
<span class="switch-off"></span>
|
||||
</span>
|
||||
<span class="switch-label"><?= lang("Chat.add_notification_message") ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.global_come_back') ?></button>
|
||||
<button type="button" id="btn-chat-add-participant-submit" class="btn btn-primary d-none"><?= lang('App.global_save') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,47 +0,0 @@
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modalNewDirectMessage" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel1"><?= lang('Chat.modal.new_message') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="col-12 mb-0">
|
||||
<?= view("themes/vuexy/components/alerts/alert", ["id" => "alertDirectMessage"]) ?>
|
||||
</div>
|
||||
<form id="formNewDirectMessage">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12 mb-0">
|
||||
<label for="new-direct-message-title" class="form-label"><?= lang('Chat.modal.title') ?></label>
|
||||
<input type="input" rows="4" cols="10" id="new-direct-message-title" name="title" placeholder="Escriba un título" name="title" class="form-control" required />
|
||||
</div>
|
||||
<div class="col-12 mb-0">
|
||||
<label for="description" class="required form-label"><?= lang('Chat.modal.new_message') ?></label>
|
||||
<textarea type="input" rows="4" cols="10" id="new-direct-message-text" name="message" placeholder="Escribe el mensaje ..." name="message" class="form-control" required></textarea>
|
||||
</div>
|
||||
<div class="col-12 mb-0">
|
||||
<label for="select-users" class="required form-label"><?= lang('Chat.modal.new_receivers') ?></label>
|
||||
<select id="select-users" name="users" class="form-control" multiple required>
|
||||
<option value="0"></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal"><?= lang('App.global_come_back') ?></button>
|
||||
<?php if (auth()->user()->inGroup('admin')) { ?>
|
||||
<button type="button" id="submit-new-direct-message" class="btn btn-primary"><?= lang('Chat.modal.btn_send') ?></button>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,15 +0,0 @@
|
||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Chat.datatable_messages.created_at') ?></th>
|
||||
<th><?= lang('Chat.datatable_messages.updated_at') ?></th>
|
||||
<th><?= lang('Chat.datatable_messages.title') ?></th>
|
||||
<th><?= lang('Chat.datatable_messages.creator') ?></th>
|
||||
<th><?= lang('Chat.datatable_messages.viewed') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1,17 +0,0 @@
|
||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Produccion.datatable.pedido_id') ?></th>
|
||||
<th><?= lang('Produccion.datatable.fecha_encuadernacion') ?></th>
|
||||
<th><?= lang('Produccion.datatable.cliente') ?></th>
|
||||
<th><?= lang('Produccion.datatable.titulo') ?></th>
|
||||
<th><?= lang('Produccion.datatable.ubicacion') ?></th>
|
||||
<th><?= lang('Produccion.datatable.tirada') ?></th>
|
||||
<th><?= lang('Produccion.datatable.impresion') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1,14 +0,0 @@
|
||||
|
||||
<table id="<?= $id ?>" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('ServicioCliente.datatable.nombre') ?></th>
|
||||
<th><?= lang('ServicioCliente.datatable.code') ?></th>
|
||||
<th><?= lang('ServicioCliente.datatable.created_at') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -158,6 +158,11 @@
|
||||
<?= lang('Clientes.paisId') ?>
|
||||
</label>
|
||||
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?=$item->id ?>"<?=$item->id==$clienteEntity->pais_id ? ' selected':'' ?>>
|
||||
<?=$item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
@ -561,6 +566,7 @@
|
||||
|
||||
<?php if ($formAction !== route_to('clienteAdd')){ ?>
|
||||
<div class="tab-pane fade" id="tarifascliente" role="tabpanel">
|
||||
<?= view("themes/vuexy/form/clientes/cliente/convert2templateModal") ?>
|
||||
<div class='row'>
|
||||
<div class="col-md-12 col-lg-4 px-4">
|
||||
<div class="mb-3">
|
||||
@ -583,7 +589,6 @@
|
||||
<table id="tableOfPrecios" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th><?= lang('ClientePrecios.tipo') ?></th>
|
||||
<th><?= lang('ClientePrecios.tipo_maquina') ?></th>
|
||||
<th><?= lang('ClientePrecios.tipo_impresion') ?></th>
|
||||
@ -591,10 +596,10 @@
|
||||
<th><?= lang('ClientePrecios.tiempo_max') ?></th>
|
||||
<th><?= lang('ClientePrecios.precio_hora') ?></th>
|
||||
<th><?= lang('ClientePrecios.margen') ?></th>
|
||||
<th class="noFilter"><?= lang('ClientePrecios.user_updated_id') ?></th>
|
||||
<th class="noFilter"><?= lang('ClientePrecios.updated_at') ?></th>
|
||||
<th class="noFilter noVis">plantilla_id</th>
|
||||
<th class="text-nowrap noFilter noVis" style="min-width:100px"><?= lang('Basic.global.Action') ?></th>
|
||||
<th><?= lang('ClientePrecios.user_updated_id') ?></th>
|
||||
<th><?= lang('ClientePrecios.updated_at') ?></th>
|
||||
<th>plantilla_id</th>
|
||||
<th class="text-nowrap" style="min-width:100px"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -880,6 +885,345 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/**************************************
|
||||
Tarifas cliente
|
||||
***************************************/
|
||||
|
||||
$('#plantillas').select2({
|
||||
allowClear: false,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsOfClienteplantillaprecios") ?>',
|
||||
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
|
||||
}
|
||||
});
|
||||
|
||||
const lastColNr_lineas = $('#tableOfPrecios').find("tr:first th").length - 1;
|
||||
|
||||
const actionBtns_lineas = function(data) {
|
||||
return `
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<span class="cancel"></span>
|
||||
`;
|
||||
};
|
||||
|
||||
|
||||
const tipo_linea = [
|
||||
{label:'<?= lang('ClientePrecios.interior') ?>', value:'interior'},
|
||||
{label:'<?= lang('ClientePrecios.cubierta') ?>', value: 'cubierta'},
|
||||
{label:'<?= lang('ClientePrecios.sobrecubierta') ?>', value: 'sobrecubierta'}
|
||||
];
|
||||
|
||||
const tipo_maquina = [
|
||||
{label: '<?= lang('ClientePrecios.toner') ?>', value:'toner'},
|
||||
{label: '<?= lang('ClientePrecios.inkjet') ?>', value:'inkjet'},
|
||||
];
|
||||
|
||||
const tipo_impresion = [
|
||||
{label: '<?= lang('ClientePrecios.negro') ?>', value:'negro'},
|
||||
{label: '<?= lang('ClientePrecios.negrohq') ?>', value:'negrohq'},
|
||||
{label: '<?= lang('ClientePrecios.color') ?>', value:'color'},
|
||||
{label: '<?= lang('ClientePrecios.colorhq') ?>', value:'colorhq'},
|
||||
];
|
||||
|
||||
var editorPrecios = new $.fn.dataTable.Editor( {
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfClienteprecios') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfPrecios",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
name: "tipo",
|
||||
type: "select",
|
||||
options: tipo_linea
|
||||
}, {
|
||||
name: "tipo_maquina",
|
||||
type: "select",
|
||||
options: tipo_maquina
|
||||
}, {
|
||||
name: "tipo_impresion",
|
||||
type: "select",
|
||||
options: tipo_impresion
|
||||
}, {
|
||||
name: "tiempo_min"
|
||||
}, {
|
||||
name: "tiempo_max"
|
||||
}, {
|
||||
name: "precio_hora"
|
||||
}, {
|
||||
name: "margen"
|
||||
}, {
|
||||
name: "user_updated_id",
|
||||
type:'hidden',
|
||||
|
||||
}, {
|
||||
name: "updated_at",
|
||||
type:'hidden',
|
||||
|
||||
}, {
|
||||
"name": "plantilla_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "cliente_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
},{
|
||||
"name": "is_deleted",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
} );
|
||||
|
||||
editorPrecios.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
d.data[0]['cliente_id'] = id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
d.data[v]['cliente_id'] = id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
editorPrecios.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
|
||||
});
|
||||
|
||||
editorPrecios.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
|
||||
theTablePrecios.clearPipeline();
|
||||
theTablePrecios.draw();
|
||||
});
|
||||
|
||||
editorPrecios.on ('postEdit', function ( e, json, data, action ) {
|
||||
const domain = window.location.origin
|
||||
fetch(domain + "/clientes/clienteprecios/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
editorPrecios.on ('postCreate', function ( e, json, data, action ) {
|
||||
const domain = window.location.origin
|
||||
fetch(domain + "/clientes/clienteprecios/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
var theTablePrecios = $('#tableOfPrecios').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 10, 25, 50, 100],
|
||||
order: [[ 0, "asc" ], [ 1, "asc" ], [ 2, "asc" ], [ 3, "asc" ]],
|
||||
pageLength: 50,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
url: '<?= route_to('dataTableOfClienteprecios') ?>',
|
||||
data: {
|
||||
cliente_id: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'tipo' ,
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='interior')
|
||||
return '<?= lang('ClientePrecios.interior') ?>';
|
||||
else if(data=='cubierta')
|
||||
return '<?= lang('ClientePrecios.cubierta') ?>';
|
||||
else if(data=='sobrecubierta')
|
||||
return '<?= lang('ClientePrecios.sobrecubierta') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'tipo_maquina',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='toner')
|
||||
return '<?= lang('ClientePrecios.toner') ?>';
|
||||
else if(data=='inkjet')
|
||||
return '<?= lang('ClientePrecios.inkjet') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'tipo_impresion',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='negro')
|
||||
return '<?= lang('ClientePrecios.negro') ?>';
|
||||
else if(data=='negrohq')
|
||||
return '<?= lang('ClientePrecios.negrohq') ?>';
|
||||
else if(data=='color')
|
||||
return '<?= lang('ClientePrecios.color') ?>';
|
||||
else if(data=='colorhq')
|
||||
return '<?= lang('ClientePrecios.colorhq') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'tiempo_min' },
|
||||
{ 'data': 'tiempo_max' },
|
||||
{ 'data': 'precio_hora' },
|
||||
{ 'data': 'margen' },
|
||||
{ 'data': 'user_updated_id',
|
||||
'render': function ( data, type, row, meta ) {
|
||||
return row.user_updated
|
||||
}
|
||||
},
|
||||
{ 'data': 'updated_at' },
|
||||
{ 'data': 'plantilla_id' },
|
||||
{
|
||||
data: actionBtns_lineas,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
target: 9,
|
||||
orderable: false,
|
||||
visible: false,
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNr_lineas]
|
||||
},
|
||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
buttons: [ {
|
||||
className: 'btn btn-primary me-sm-3 me-1',
|
||||
extend: "createInline",
|
||||
editor: editorPrecios,
|
||||
formOptions: {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
}
|
||||
} ]
|
||||
} );
|
||||
|
||||
|
||||
const initPrecioTemplate = <?php echo json_encode($precioTemplate);?>;
|
||||
if(initPrecioTemplate != null){
|
||||
var newOption = new Option(initPrecioTemplate.label, initPrecioTemplate.value, false, false);
|
||||
$('#plantillas').append(newOption);
|
||||
}
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfPrecios').on( 'click', 'tbody span.edit', function (e) {
|
||||
editorPrecios.inline(
|
||||
theTablePrecios.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||
cancelTrigger: 'span.cancel',
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
||||
submitTrigger: 'span.edit',
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
$(".btn-remove").attr('table-id', '#tableOfPrecios');
|
||||
$(".btn-remove").attr('row', $(this).closest('tr')[0]._DT_RowIndex);
|
||||
});
|
||||
|
||||
function delete_precio(dataId, row){
|
||||
if ($.isNumeric(dataId)) {
|
||||
editorPrecios
|
||||
.create( false )
|
||||
.edit( theTablePrecios.rows(row), false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
$('#confirm2delete').modal('toggle');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#plantillas').on('change.select2', function(){
|
||||
const data = $('#plantillas').select2('data');
|
||||
if(data.length>0){
|
||||
const domain = window.location.origin
|
||||
fetch(domain + "/clientes/clienteprecios/update/" + id , {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
plantilla_id: data[0].id,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
||||
}),
|
||||
headers: {
|
||||
"Content-type": "application/json; charset=UTF-8"
|
||||
}
|
||||
}).then(function(){
|
||||
theTablePrecios.clearPipeline();
|
||||
theTablePrecios.draw();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#convert2template').on('click', function(){
|
||||
var newAddDialog = $('#convert2Template')
|
||||
newAddDialog.modal("show");
|
||||
|
||||
})
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/****************************************
|
||||
Direcciones cliente
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
<div id="convert2Template" 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('ClientePrecios.convertir2plantilla') ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id='error-nombre'></div>
|
||||
|
||||
<div class="mb-3">
|
||||
<p><?= lang('ClientePrecios.convertir2plantillaText') ?></p>
|
||||
<p><?= lang('ClientePrecios.convertir2plantillaText2') ?></p>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="nombre_plantilla" class="form-label">
|
||||
<?= lang('ClientePrecios.nombrePlantilla') ?>
|
||||
</label>
|
||||
<input type="text" id="nombre_plantilla" maxLength="100" class="form-control new-address">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="saveTemplate"
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
><?= lang('App.global_save') ?></button>
|
||||
<button id="cancelTemplate"
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
><?= lang('App.user_delete_btn_cancel') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
$('#saveTemplate').on('click', function(){
|
||||
if($('#nombre_plantilla').val().length == 0){
|
||||
popErrorAlert('<?= lang('ClientePrecios.errors.error_nombre_template') ?>', 'error-nombre')
|
||||
}
|
||||
else{
|
||||
data = new FormData();
|
||||
data.append('cliente_id', id)
|
||||
data.append('nombre', $('#nombre_plantilla').val())
|
||||
data.append('<?= csrf_token() ?? "token" ?>', <?= csrf_token() ?>v)
|
||||
fetch('<?= route_to("createClienteplantillaprecios");?>' , {
|
||||
method: "POST",
|
||||
body: data,
|
||||
})
|
||||
.then(data => {
|
||||
$('#convert2Template').modal("hide");
|
||||
var newOption = new Option($('#nombre_plantilla').val(), "", false, false);
|
||||
$('#plantillas').append(newOption);
|
||||
$('#nombre_plantilla').val("");
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#cancelTemplate').on('click', function(){
|
||||
$('#convert2Template').modal("hide");
|
||||
})
|
||||
<?=$this->endSection() ?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user