282 Commits

Author SHA1 Message Date
ed587f1cd0 Merge branch 'main' into 'dev/import_users'
Main

See merge request jjimenez/safekat!401
2024-11-26 13:03:28 +00:00
04dde010f4 Añadidos archivos para utilidades de importar usuarios del ERP antiguo 2024-11-26 14:02:13 +01:00
3400c5f77c Merge branch 'fix/busqueda_papeles_interior_cliente' into 'main'
añadido tick a papeles interior. ese tick se usa en la busqueda

See merge request jjimenez/safekat!400
2024-11-25 17:50:22 +00:00
fd0989f764 añadido tick a papeles interior. ese tick se usa en la busqueda 2024-11-25 18:49:46 +01:00
108af267e7 Merge branch 'fix/texto_imp_color' into 'main'
arreglado updatePapeles

See merge request jjimenez/safekat!399
2024-11-24 19:13:00 +00:00
649a19fd45 arreglado updatePapeles 2024-11-24 20:12:40 +01:00
f1654ace80 Merge branch 'dev/papeles_from_bd_presu_cliente' into 'main'
Dev/papeles from bd presu cliente

See merge request jjimenez/safekat!398
2024-11-24 19:04:26 +00:00
bcbf14c41f diseño interior con selector de papeles 2024-11-24 20:03:42 +01:00
b42b34f350 generando papeles especiales 2024-11-22 14:04:53 +01:00
e070edc10c Merge branch 'main' into 'dev/papeles_from_bd_presu_cliente'
Main

See merge request jjimenez/safekat!397
2024-11-22 10:44:55 +00:00
ffc976683f Merge branch 'fix/solapas_preview_cliente' into 'main'
arreglada cota en solapas tapa blanda

See merge request jjimenez/safekat!396
2024-11-22 10:44:12 +00:00
3548be722e arreglada cota en solapas tapa blanda 2024-11-22 11:43:37 +01:00
19bd409efa selectores de papel y gramaje. falta validacion 2024-11-21 21:57:06 +01:00
1a51d2ef99 Merge branch 'fix/permisos_menus' into 'main'
Arreglado bug archivo borrado en presupuesto_cliente_menu

See merge request jjimenez/safekat!395
2024-11-21 20:51:07 +00:00
63aab4a27b Arreglado bug archivo borrado en presupuesto_cliente_menu 2024-11-21 21:48:26 +01:00
881109620a Merge branch 'bug/permisos_pedidos' into 'main'
Añadido control de permisos en Pedidos

See merge request jjimenez/safekat!394
2024-11-21 20:19:40 +00:00
90bfb08dc5 Añadido control de permisos en Pedidos 2024-11-21 21:19:17 +01:00
9a19c67cd9 Merge branch 'main' into 'dev/papeles_from_bd_presu_cliente'
Main

See merge request jjimenez/safekat!393
2024-11-21 19:20:44 +00:00
a529f88edf Merge branch 'mod/papelesImpresionTick' into 'main'
Mod/papeles impresion tick

See merge request jjimenez/safekat!392
2024-11-21 19:19:56 +00:00
3af5851af7 problema muestra genericos que no 2024-11-21 20:16:50 +01:00
5d0f212040 problema edit delete vista 2024-11-20 17:33:06 +01:00
791a17d3da modificado el papel impresion tick 2024-11-20 17:29:07 +01:00
80b4d3aaf4 Merge branch 'add/migrations_papeles' into 'main'
añadido fichero de migracion

See merge request jjimenez/safekat!390
2024-11-20 15:40:17 +00:00
9dee74e2cb añadido fichero de migracion 2024-11-20 16:39:57 +01:00
c15970a9cc Merge branch 'mod/add_check_papeles' into 'main'
Mod/add check papeles

See merge request jjimenez/safekat!389
2024-11-20 15:36:22 +00:00
e5159abf58 añadido los checks de web cliente en papeles 2024-11-20 16:35:48 +01:00
8be0e3d16c modificado form papel generico 2024-11-19 20:51:11 +01:00
9e4cd024bd Merge branch 'bug/add_user' into 'main'
Bug/add user

See merge request jjimenez/safekat!388
2024-11-18 21:01:18 +00:00
cb2ca522c6 Arreglado bug añadir usuarios con email repetido 2024-11-18 22:00:37 +01:00
006a9a1413 Actualizacion automatica: 2024-11-18 16:05:01 2024-11-18 16:05:01 +01:00
5fbfe97a59 Merge branch 'add/nullableEnClientes' into 'main'
añadido el fichero de nullable para la tabla clientes

See merge request jjimenez/safekat!387
2024-11-17 20:06:05 +00:00
0862128f60 añadido el fichero de nullable para la tabla clientes 2024-11-17 21:05:37 +01:00
9f46f7c8e5 Merge branch 'fix/añadir_cliente' into 'main'
modificado formulario cliente. Añadida migracion para la bbdd

See merge request jjimenez/safekat!386
2024-11-17 19:58:12 +00:00
2a73d29546 modificado formulario cliente. Añadida migracion para la bbdd 2024-11-17 20:54:11 +01:00
64efc15b3f Merge branch 'mod/rename_cosidotapablanda' into 'main'
Mod/rename cosidotapablanda

See merge request jjimenez/safekat!385
2024-11-16 08:08:44 +00:00
df3ab47526 Cambiado la url de presupuestos adminstrador de cosidotapablanda a presupuestosadmin 2024-11-16 09:06:43 +01:00
9c14e77b10 Cambiando referencias a cosidotapablanca por presupuestoadmin 2024-11-14 21:31:22 +01:00
b512875739 Merge branch 'mod/papeles_cliente_bbdd' into 'main'
Mod/papeles cliente bbdd

See merge request jjimenez/safekat!384
2024-11-14 19:44:01 +00:00
c19d1ffae8 muchos cambios (y no los papeles) 2024-11-14 20:43:13 +01:00
923c283c22 arreglados algunos fallos. Añadido boton imprimir2 2024-11-13 23:05:14 +01:00
1b453961e1 arreglados algunos fallos. Añadido boton imprimir 2024-11-13 23:04:52 +01:00
33db277af2 añadida migracion 2024-11-13 22:16:31 +01:00
d9e5f1c6df añadido menu cliente para moviles 2024-11-13 21:18:44 +01:00
72a7010eee corregido error en presupuestosencuadernaciones para saber si es pod 2024-11-13 18:03:13 +01:00
b6e9ee5f3e Merge branch 'mod/click_edit_list_presu' into 'main'
al clickar en una linea se edita

See merge request jjimenez/safekat!382
2024-11-13 16:02:24 +00:00
4a792464b4 al clickar en una linea se edita 2024-11-13 17:02:00 +01:00
88728c947a Merge branch 'mod/export_tarifas_manipulado' into 'main'
añadido el exportar de las tarifas de manipulado lineas

See merge request jjimenez/safekat!381
2024-11-13 15:47:54 +00:00
ba36ba001f añadido el exportar de las tarifas de manipulado lineas 2024-11-13 16:47:34 +01:00
da463318c7 Merge branch 'mod/resumen_lateral_posicion' into 'main'
modificado el sitio donde aparece el resumen lateral y el total del resumen

See merge request jjimenez/safekat!380
2024-11-13 15:45:07 +00:00
9b62d62941 modificado el sitio donde aparece el resumen lateral y el total del resumen 2024-11-13 16:44:44 +01:00
9561fc16e7 Merge branch 'mod/campos_no_editables' into 'main'
paginas totales a campo no editable

See merge request jjimenez/safekat!379
2024-11-13 15:41:42 +00:00
8dfa8ad3e9 paginas totales a campo no editable 2024-11-13 16:40:25 +01:00
262886a6b9 Merge branch 'mod/tamanio_inputs' into 'main'
realizados cambios

See merge request jjimenez/safekat!378
2024-11-13 09:20:42 +00:00
5a6dbe5ca8 realizados cambios 2024-11-13 10:20:15 +01:00
e5b892480b Merge branch 'bug/iva_reducido_resumen' into 'main'
arreglado seleccion iva reducido para resumen

See merge request jjimenez/safekat!377
2024-11-13 08:18:20 +00:00
d2050ca44d arreglado seleccion iva reducido para resumen 2024-11-13 09:17:44 +01:00
f92725b6e6 Merge branch 'fix/change_save_btn_presu_cliente' into 'main'
quitado el boton de guardar de datos generales

See merge request jjimenez/safekat!376
2024-11-13 08:09:51 +00:00
d43851647b quitado el boton de guardar de datos generales 2024-11-13 09:09:20 +01:00
4a1d87542a Merge branch 'fix/mensajes' into 'main'
Fix/mensajes

See merge request jjimenez/safekat!375
2024-11-13 08:03:33 +00:00
d7c42b350d Merge branch 'main' into fix/mensajes
Fix : arreglo mensajes departamentos numero total mensajes. No se mostraba bien en el JS
2024-11-13 09:02:00 +01:00
2d130fa1cc Merge branch 'dev/resumen_lateral' into 'main'
Dev/resumen lateral

See merge request jjimenez/safekat!374
2024-11-13 07:45:23 +00:00
a6bff58793 resumen lateral terminado 2024-11-13 08:44:31 +01:00
a285764c2c fix chat department message total count 2024-11-13 08:31:27 +01:00
a53f85f35c Merge branch 'main' into 'dev/resumen_lateral'
Main

See merge request jjimenez/safekat!373
2024-11-13 06:05:53 +00:00
d20ceaa161 Merge branch 'fix/mensajes' into 'main'
Fix/mensajes

See merge request jjimenez/safekat!372
2024-11-12 23:50:12 +00:00
e21e790309 Merge branch 'main' into fix/mensajes
Merge main into fix/messages
2024-11-13 00:48:58 +01:00
eb604f3293 fix : mensajes internos, arreglar total numero mensajes 2024-11-13 00:47:47 +01:00
6b8ebba4e2 Merge branch 'main' into 'dev/resumen_lateral'
Main

See merge request jjimenez/safekat!371
2024-11-12 18:49:14 +00:00
66cf7ec99e Merge branch 'bug/direcciones_total_error' into 'main'
modificado cómo se calcula el coste de las direcciones

See merge request jjimenez/safekat!370
2024-11-12 18:47:19 +00:00
71e95fe441 modificado cómo se calcula el coste de las direcciones 2024-11-12 19:46:57 +01:00
b0765fbe64 Merge branch 'bug/direcciones_total_error' into 'main'
comprueba ahora que son iguales

See merge request jjimenez/safekat!369
2024-11-12 18:15:08 +00:00
1a3fc3eb58 comprueba ahora que son iguales 2024-11-12 19:14:44 +01:00
17c117432a Merge branch 'fix/no_mostrar_cliente_presu_cliente' into 'main'
ocultado el cliente

See merge request jjimenez/safekat!368
2024-11-12 18:10:38 +00:00
fd693fbb53 ocultado el cliente 2024-11-12 19:09:47 +01:00
c32ebc153f Merge branch 'main' into 'dev/resumen_lateral'
Main

See merge request jjimenez/safekat!367
2024-11-12 17:58:26 +00:00
4400695dd7 borrado xdebug y cambiado gitignore 2024-11-12 18:58:11 +01:00
ceb733e28b borrado xdebug 2024-11-12 18:53:23 +01:00
da2d63ef78 Merge branch 'bug/direcciones_presu_cliente' into 'main'
arreglado bug en direcciones de envio. tarifas envio ordenables por 3 columnas

See merge request jjimenez/safekat!366
2024-11-12 17:47:33 +00:00
e159ac8762 arreglado bug en direcciones de envio. tarifas envio ordenables por 3 columnas 2024-11-12 18:46:16 +01:00
b97e027920 feat: mensajes directos cliente 2024-11-12 18:26:22 +01:00
7223b56db6 menu lateral datos generales 2024-11-12 01:08:53 +01:00
cc9eba99fb Merge branch 'bug/cargar_presupuesto_cliente' into 'main'
Bug/cargar presupuesto cliente

See merge request jjimenez/safekat!365
2024-11-09 11:16:07 +00:00
873adc5bf5 boton guardar en todas pags, resuelto preview cosido 2024-11-09 12:15:32 +01:00
11b14ccf76 resuelto problema cuando se crea el presupuesto desde administrador con las tiradas alternativas 2024-11-09 10:13:15 +01:00
2f95c0bc9a Merge branch 'bug/nuevas_dim_tarifa_enc' into 'main'
las tarifas estaban bien. arreglado bug de guardar en presupuesto administrador

See merge request jjimenez/safekat!364
2024-11-08 16:25:55 +00:00
dd46b7f978 las tarifas estaban bien. arreglado bug de guardar en presupuesto administrador 2024-11-08 17:25:04 +01:00
6fd0351f3e Merge branch 'bug/add_presu_cliente' into 'main'
añadido state a add de presupuesto cliente

See merge request jjimenez/safekat!363
2024-11-08 07:02:39 +00:00
3a6287f5d9 añadido state a add de presupuesto cliente 2024-11-08 08:01:52 +01:00
41cecedee8 Merge branch 'bug/arreglar_httpdocs' into 'main'
Bug/arreglar httpdocs

See merge request jjimenez/safekat!362
2024-11-07 19:25:22 +00:00
1b637cd5a4 arreglado todo 2024-11-07 20:24:40 +01:00
b251e0e56c añadidos assets y js 2024-11-07 20:17:58 +01:00
2f01f41599 Merge branch 'dev/presu_cliente_v2_problema_merge' into 'main'
copiada la rama presu_cliente_v2 en esta para poder hacer el merge al main

See merge request jjimenez/safekat!361
2024-11-07 18:21:10 +00:00
a880355012 copiada la rama presu_cliente_v2 en esta para poder hacer el merge al main 2024-11-07 19:20:12 +01:00
aeb5f9106f Merge branch 'revert-47e6cbb5' into 'main'
Revert "Merge branch 'feat/add-chat-presupuesto-cliente' into 'main'"

See merge request jjimenez/safekat!353
2024-10-23 05:18:14 +00:00
7ce2723a09 Revert "Merge branch 'feat/add-chat-presupuesto-cliente' into 'main'"
This reverts merge request !352
2024-10-23 05:18:00 +00:00
47e6cbb5f7 Merge branch 'feat/add-chat-presupuesto-cliente' into 'main'
Feat/add chat presupuesto cliente

See merge request jjimenez/safekat!352
2024-10-23 05:17:38 +00:00
8f2f19df1b fix mensajes internos 2024-10-23 05:14:31 +00:00
a3561d7623 add mensajeria module to presupuesto cliente edit 2024-10-23 05:14:04 +00:00
5e2d37ed26 add xdeubg 2024-10-23 05:10:33 +00:00
72b6845625 fix app.come_back button 2024-10-23 05:01:58 +00:00
9919496397 finalizado nuevo presupuesto cliente a falta de confirmar 2024-10-22 23:34:21 +02:00
33496d81ee Merge branch 'feat/tarifa-code' into 'dev/presu_cliente_v2'
Feat/tarifa code

See merge request jjimenez/safekat!351
2024-10-22 12:29:26 +00:00
a1f1151c1b error-presupuesto 2024-10-22 14:28:22 +02:00
b28b383136 Merge branch 'dev/presu_cliente_v2' into feat/tarifa-code 2024-10-22 14:22:07 +02:00
0a5f8dee68 espiral y wireo 2024-10-22 14:14:52 +02:00
7a3c11c343 Merge branch 'fix/visto-datatable-errores-presupuesto' into 'dev/presu_cliente_v2'
Fix/visto datatable errores presupuesto

See merge request jjimenez/safekat!350
2024-10-22 08:33:34 +00:00
4afb977577 Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2 2024-10-22 10:31:43 +02:00
262aa4a88f fix visto datatable errores-presupuesto 2024-10-22 10:30:47 +02:00
9f61faf67a preview casi 2024-10-22 10:29:34 +02:00
2f83526d7e comprobando presupuestos 2024-10-22 08:43:21 +02:00
e64788ddb5 remove * from label comment input form 2024-10-21 18:08:56 +00:00
1ed5c868b5 add comment and code to tarifas extra 2024-10-21 18:07:22 +00:00
ecb5abaa6d remove required from code field 2024-10-21 18:07:12 +00:00
b74495117f add code and comment to tarifas envios 2024-10-21 18:00:33 +00:00
db67b1946f add code and comment to tarifas encuadernacion 2024-10-21 17:56:39 +00:00
66a5651a30 add code and comment to tarifaacabado 2024-10-21 17:52:09 +00:00
2ff86a7743 add comment field 2024-10-21 17:46:46 +00:00
c7c9b54556 add code and comment tarifapreimpresion 2024-10-21 17:20:02 +00:00
9b964a89f6 add comment field 2024-10-21 17:06:03 +00:00
c6b1bd9292 add comment field 2024-10-21 17:05:50 +00:00
73a60466d3 add code field to models and entities 2024-10-21 16:51:19 +00:00
49e03fb7e9 fix : add breadcumbs and fix button save 2024-10-20 17:50:49 +00:00
62a3706049 cargando presu 2024-10-19 20:26:52 +02:00
1914cb01fe a punto de guardar 2024-10-19 14:32:49 +02:00
09e5149090 Mergeado
Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2
2024-10-19 13:04:05 +02:00
ac3a93370c fix : update visto errorPresupuestoForm 2024-10-19 10:00:31 +00:00
859f2a99be merge errores_presupuestos 2024-10-19 08:56:31 +00:00
4d20b4ac1c fix : contemplat que presupuesto_id es null 2024-10-19 08:54:53 +00:00
8135e635ab errores presupuesto 2024-10-19 10:38:13 +02:00
643e325e59 Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2 2024-10-19 09:42:06 +02:00
3c48d88357 cargando presu 2024-10-19 09:36:48 +02:00
15642d6e47 Merge branch 'feat/errores_presupuestos' into 'dev/presu_cliente_v2'
Feat/errores presupuestos

See merge request jjimenez/safekat!348
2024-10-19 07:34:00 +00:00
035d695780 merge changes from dev/presu_cliente_v2 2024-10-19 07:33:41 +00:00
f9b12cbcdd feat:errores presupuesto 2024-10-19 07:29:47 +00:00
f1df4559f7 error presupuestos 2024-10-18 16:00:10 +02:00
464e136025 cargando presupuesto datos generales 2024-10-18 14:33:27 +02:00
23491b2e1a add errores presupuesto 2024-10-17 23:48:16 +00:00
8a044d41fe cargando datos 2024-10-18 01:43:41 +02:00
7c9b8a0b6d guardar terminado 2024-10-17 22:22:43 +02:00
a0128d8f1e arreglado la comprobación del papelformato 2024-10-17 11:43:16 +02:00
fdf838c909 quitado rellenar presupuesto 2024-10-16 03:46:35 +02:00
b5924dceb5 falta preview resumen 2024-10-16 03:45:10 +02:00
2c5ea4d7ba Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2 2024-10-15 15:42:19 +02:00
19be8591f3 trabajando en el backend para papeles diferentes 2024-10-15 15:41:38 +02:00
a8a741f0bf trabajando en añadir las tiradas a las direcciones 2024-10-15 11:43:44 +02:00
6865d810da change title message notification dropdown 2024-10-15 05:20:35 +00:00
de9cf30aac solucionados todos los select2 en conflicto 2024-10-14 18:29:50 +02:00
29eeecb905 fix : mensaje-internos only users in group admin and beta 2024-10-14 16:20:59 +00:00
668d0d79e6 problema ruta papelformato 2024-10-14 18:19:41 +02:00
52303e9185 trabajando en el selector de cliente 2024-10-14 14:45:40 +02:00
7857e5992a test 2024-10-14 14:33:49 +02:00
f9b7de63fd Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2 2024-10-14 14:33:06 +02:00
9c3a7848f3 arreglado los select2 para que funcionen con el select2 de alvaro 2024-10-14 14:29:43 +02:00
6b49984c28 Merge branch 'main' into 'dev/presu_cliente_v2'
Main

See merge request jjimenez/safekat!347
2024-10-14 12:04:48 +00:00
44fc60372b Cogido el select2 de alvaro para problema del merge. 2024-10-14 14:03:24 +02:00
287335dc6b cogido select2 de alvaro 2024-10-14 13:58:50 +02:00
cb1d280b35 Merge branch 'bug/save_tarifas_extra' into 'main'
arreglado bug de tarifas extra importe fijo

See merge request jjimenez/safekat!345
2024-10-14 11:55:14 +00:00
c5c4a31521 arreglado bug de tarifas extra importe fijo 2024-10-14 13:54:08 +02:00
612b67883c Merge branch 'feat/mensajes-internos' into 'main'
feat : mensajes internos module

See merge request jjimenez/safekat!344
2024-10-13 23:13:14 +00:00
2012ada27f feat : mensajes internos module 2024-10-13 23:10:17 +00:00
7ad3133a15 acabando el tema de las direcciones 2024-10-14 00:50:15 +02:00
0eaac5af28 trabajando en el backend 2024-10-13 21:10:02 +02:00
e64022a7b7 falta boton add direcciones 2024-10-09 20:04:58 +02:00
a069b4109c trabajando en el componente direccion 2024-10-09 13:02:49 +02:00
92389bb5f5 Merge branch 'dev/presu_cliente_v2' of https://git.imnavajas.es/jjimenez/safekat into dev/presu_cliente_v2
mergeo de main
2024-10-08 15:15:25 +02:00
032b09f0a3 añadido direcciones 2024-10-08 15:14:12 +02:00
91f26520cb Merge branch 'main' into 'dev/presu_cliente_v2'
Main

See merge request jjimenez/safekat!343
2024-10-08 13:13:52 +00:00
dfd915e47f corregidos errores en logica 2024-10-08 14:07:29 +02:00
4045771c2d paginas para cosido multiplo de 4 2024-10-08 13:49:53 +02:00
1d3f817709 terminada la vista cubierta 2024-10-08 13:20:22 +02:00
2e2888ec26 solucionado el click de los gramajes 2024-10-07 11:31:01 +02:00
78b255fa0d problema con los custom radiobutons 2024-10-06 19:52:24 +02:00
cece606bb1 trbajando en los custom checks 2024-10-05 19:17:52 +02:00
ba3ec185ef Merge branch 'feat/config-variables-app' into 'main'
feat: add config variable menu

See merge request jjimenez/safekat!342
2024-10-02 18:37:49 +00:00
8b10aa655a feat: add config variable menu 2024-10-02 18:32:52 +00:00
13e3a69cd6 añadido coger el idioma 2024-09-30 11:06:00 +02:00
f09d5aeceb modificado calssselect.js 2024-09-30 08:53:37 +02:00
daca044cf3 modificado datosgenerales.js 2024-09-30 08:52:14 +02:00
cb982bd38a añadidos los ficheros 2024-09-30 08:38:22 +02:00
69b27f0cd8 cambiando presupuesto cliente 2024-09-29 18:07:54 +02:00
8617553dea Merge branch 'dev/chat' into 'main'
Dev/chat

See merge request jjimenez/safekat!341
2024-09-26 13:14:14 +00:00
2049cb1e02 fix:conflicts 2024-09-26 13:13:58 +00:00
bdc5b0c442 feat:chat 2024-09-26 13:11:01 +00:00
c5a5f01fa0 fix : chat modules, notifications 2024-09-26 13:10:12 +00:00
c0e90a723b Merge branch 'dev/tokens' into 'main'
Configuracion inicial para usar atentificacion via JWT (requerido tocar el...

See merge request jjimenez/safekat!340
2024-09-26 12:03:47 +00:00
130c5dad88 Configuracion inicial para usar atentificacion via JWT (requerido tocar el composer para firebase/jwt 2024-09-26 14:01:58 +02:00
bd22e89a28 Merge branch 'dev/chat' into 'main'
Dev/chat

See merge request jjimenez/safekat!339
2024-09-26 07:53:15 +00:00
d3722440c3 fix chat 2024-09-26 07:51:53 +00:00
21c1bd9bd2 fix : add chat presupuesto cliente 2024-09-26 07:50:53 +00:00
a6dbe6de07 fix : cliente show departments chats 2024-09-26 07:33:34 +00:00
68d5a7157e Merge branch 'fix/porcentaje_total_presupuesto' into 'main'
corregida division por cero

See merge request jjimenez/safekat!338
2024-09-26 07:07:14 +00:00
bf568fec92 corregida division por cero 2024-09-26 09:06:34 +02:00
5aa1aa6222 Merge branch 'dev/chat' into 'main'
feat:chat modules

See merge request jjimenez/safekat!337
2024-09-25 17:44:02 +00:00
c651db61ff feat:chat modules 2024-09-25 17:42:55 +00:00
a2f91866f7 Merge branch 'dev/chat' into 'main'
Dev/chat

See merge request jjimenez/safekat!336
2024-09-23 08:10:57 +00:00
2fc9af9db4 Merge branch 'main' into dev/chat 2024-09-23 10:04:55 +02:00
d6a95f78ee feat : add chat in facturas,presupuestos y pedidos 2024-09-23 10:00:47 +02:00
766347ad81 feat: chat module 2024-09-23 09:19:45 +02:00
70fa74333d Merge branch 'fix/porcentaje_margen_total' into 'main'
añadido porcentaje al margen total

See merge request jjimenez/safekat!334
2024-09-22 10:13:04 +00:00
0b0b928619 añadido porcentaje al margen total 2024-09-22 12:12:40 +02:00
b1eeddc5bc Merge branch 'dev/add_precio_coste_servicios' into 'main'
añadido el coste en las tablas de los servicios

See merge request jjimenez/safekat!333
2024-09-22 09:56:47 +00:00
74041042c5 añadido el coste en las tablas de los servicios 2024-09-22 11:55:52 +02:00
bfea4aa67c feat : migration and chat models 2024-09-20 11:25:34 +02:00
b25abc19d9 feat : chat migrations 2024-09-20 08:54:43 +02:00
b7cfdf87b9 Merge branch 'fix/resumen_presupuesto2' into 'main'
cogerrido error margen

See merge request jjimenez/safekat!332
2024-09-19 07:18:56 +00:00
7d26975ac3 cogerrido error margen 2024-09-19 09:18:39 +02:00
0177ca0f73 Merge branch 'fix/resumen_presupuesto' into 'main'
cambiado el margen de servicios para que coincida con las tarifas. Las horas...

See merge request jjimenez/safekat!331
2024-09-19 07:13:47 +00:00
19e3e6ce0e cambiado el margen de servicios para que coincida con las tarifas. Las horas se meten como margen impresion 2024-09-19 09:13:25 +02:00
2f93a8a02c Merge branch 'fix/importe_minimo_presu' into 'main'
modificadas tarifas en las que import minimo y precio minimo no tenian...

See merge request jjimenez/safekat!330
2024-09-19 06:58:35 +00:00
1862d4ccf9 modificadas tarifas en las que import minimo y precio minimo no tenian sentido. Revision de Presupuestos* para calcular la tarifa 2024-09-19 08:58:15 +02:00
5c72771fbe trabajando en los errores de calculo de tarifas 2024-09-18 21:01:13 +02:00
8777ce19c1 Merge branch 'fix/importe_minimo_tarifas_presu' into 'main'
solucionado el problema del precio mínimo en los presupuestosencuadernacion....

See merge request jjimenez/safekat!329
2024-09-18 12:59:48 +00:00
64288baf54 solucionado el problema del precio mínimo en los presupuestosencuadernacion. Falta el resto de presupuestos 2024-09-18 14:59:06 +02:00
f8dd56b74c feat: add chat related models 2024-09-17 23:36:31 +02:00
db3f79da29 feat: add timestamp fields 2024-09-17 23:36:10 +02:00
51dc0ca676 feat: add chat migrations 2024-09-17 23:11:35 +02:00
639230f780 Merge branch 'mod/textos_color_impresion' into 'main'
Arreglo estetico de las opciones de impresion en presupuestos de clientes

See merge request jjimenez/safekat!328
2024-09-16 20:03:21 +00:00
d3ae73a82d Arreglo estetico de las opciones de impresion en presupuestos de clientes 2024-09-16 22:02:54 +02:00
cf3cebfcfb Merge branch 'main' into dev/chat 2024-09-16 20:45:58 +02:00
9ad062ed27 Merge branch 'fix/resumen_presupuesto_admin_servicios_margen' into 'main'
cambio en como se calcula el margen de servicios en presupuestos

See merge request jjimenez/safekat!327
2024-09-16 15:50:57 +00:00
2469101541 cambio en como se calcula el margen de servicios en presupuestos 2024-09-16 17:50:20 +02:00
4a3d594347 Merge branch 'fix/id_cliente_pedidos-facturas' into 'main'
customizada vista de peiddos y facturas cliente

See merge request jjimenez/safekat!326
2024-09-16 11:59:14 +00:00
4ce8b22c5a customizada vista de peiddos y facturas cliente 2024-09-16 13:58:53 +02:00
d860d6426c Merge branch 'fix/acabados_cubierta_p_cliente' into 'main'
corregido error en pasar acabados cubierta en presupuesto cliente

See merge request jjimenez/safekat!325
2024-09-16 10:09:46 +00:00
4b2b4dfade corregido error en pasar acabados cubierta en presupuesto cliente 2024-09-16 12:09:27 +02:00
dd9b49026b Merge branch 'feat/direcciones_cliente' into 'main'
añadida la vista para modificar las direcciones de cliente

See merge request jjimenez/safekat!324
2024-09-16 08:58:02 +00:00
07cd952532 añadida la vista para modificar las direcciones de cliente 2024-09-16 10:57:38 +02:00
ca5d70b37c Merge branch 'bug/ancho_libro_solapas' into 'main'
Modificado calculo del ancho de esquema de cubierta en admin y cliente para...

See merge request jjimenez/safekat!323
2024-09-14 19:57:57 +00:00
f8497e4388 Modificado calculo del ancho de esquema de cubierta en admin y cliente para tener en cuenta los 3mm de offset de solapas 2024-09-14 21:57:33 +02:00
150a7aa158 Merge branch 'bug/boton_imprimir_presu_cliente' into 'main'
Añadido boton imprimir en presupuesto cliente, tanto en presupuestos confirmados como no

See merge request jjimenez/safekat!322
2024-09-14 07:27:11 +00:00
19e81a6c25 Añadido boton imprimir en presupuesto cliente, tanto en presupuestos confirmados como no 2024-09-14 09:26:46 +02:00
6e0c22d981 Merge branch 'bugs/varios' into 'main'
Bugs/varios

See merge request jjimenez/safekat!321
2024-09-13 19:09:29 +00:00
2239d39919 Quitado menu vistas de impresion, maquetacion etc a clientes, solo ADMIN 2024-09-13 21:09:08 +02:00
d01fbbfe4b Añadida visualizacion de menus en roles cliente (admin/editor 2024-09-13 20:55:25 +02:00
9e57aef8bc Merge branch 'fix/servicios_defecto' into 'main'
solucionado el problema de calcular serv defecto en presupuestador admin....

See merge request jjimenez/safekat!320
2024-09-13 17:53:29 +00:00
6a307e9fe3 solucionado el problema de calcular serv defecto en presupuestador admin. Quitada merma para calcular precio servicios en presupuestador admin 2024-09-13 19:52:36 +02:00
26056082fa Merge branch 'bug/arreglar_vistas' into 'main'
Arreglado bug del direccionamiento en vista de clientes al listados de...

See merge request jjimenez/safekat!319
2024-09-13 13:11:15 +00:00
9cc8c40434 Añadido menu --Direcciones-- dentro de perfil clientes (admin y editor 2024-09-13 15:10:10 +02:00
99bdaf7a24 Arreglado bug del direccionamiento en vista de clientes al listados de clientes en lugar de al perfil 2024-09-13 14:54:55 +02:00
4614db53cf Merge branch 'main' into dev/chat 2024-09-07 20:30:51 +02:00
36a627b737 Merge branch 'fix/xml-upload' into 'main'
fix:pedido xml folder

See merge request jjimenez/safekat!318
2024-09-05 12:23:34 +00:00
6bddf1b997 fix:pedido xml folder 2024-09-05 12:38:25 +02:00
54731f65b2 Merge branch 'fix/error-pedido-xml' into 'main'
fix : remote dir for pedido files

See merge request jjimenez/safekat!317
2024-09-04 13:31:40 +00:00
333d9a8c09 fix : remote dir for pedido files 2024-09-04 15:30:08 +02:00
69917caed3 Merge branch 'fix/error-pedido-xml' into 'main'
fix : error naming HIDRIVE PORT

See merge request jjimenez/safekat!316
2024-09-03 10:50:13 +00:00
adb1335c17 fix : error naming HIDRIVE PORT 2024-09-03 12:48:58 +02:00
357966cf69 Merge branch 'feat/xml-pedido' into 'main'
Feat/xml pedido

See merge request jjimenez/safekat!315
2024-09-03 10:16:53 +00:00
7097ef72cc Merge branch 'main' into feat/xml-pedido 2024-09-02 23:36:42 +02:00
93714ac955 feat : add generate XML functionality in crearPedido 2024-09-02 23:33:48 +02:00
fe4fdb8607 feat: generateXML finished 2024-09-02 23:33:05 +02:00
6e41e73997 feat : add method getPedidoPresupuestoTipoImpresion 2024-09-02 23:32:11 +02:00
ebe649c7d8 feat : add method findByPresupuesto 2024-09-02 23:31:50 +02:00
68f2ccb1c5 feat : add class library for sftp 2024-09-02 23:31:20 +02:00
1d7f06b018 feat : after upload presupuesto file send to sftp server 2024-09-02 23:30:59 +02:00
295fd88201 feat: add class config for SFTP xml export 2024-09-02 23:29:14 +02:00
173b6d5a5d feat: add config class for XML export to sftp 2024-09-02 23:28:54 +02:00
23a34d10b0 delete 2024-09-02 23:28:03 +02:00
121708b71c add package phpseclib/phpseclib for stfp 2024-09-02 23:27:54 +02:00
403c742bf3 Merge branch 'mod/albaranes_del_confirmacion' into 'main'
añadida confirmación para borrar albaranes

See merge request jjimenez/safekat!313
2024-08-29 12:06:42 +00:00
8653971dd2 añadida confirmación para borrar albaranes 2024-08-29 14:05:17 +02:00
43fdafc099 upload xml to server by ftp 2024-08-29 01:04:44 +02:00
3a0011b49a delete FTPService, moved to Libraries 2024-08-29 01:04:10 +02:00
c8335b5740 add SafekatFtpClient Library 2024-08-29 01:03:50 +02:00
8e5d208bbf add general_helper, deleted by error 2024-08-29 01:03:29 +02:00
01cc74ed60 delete ftp method 2024-08-29 01:03:00 +02:00
c3248cd3ec add FTP Config file 2024-08-29 01:02:33 +02:00
251268fb24 add Libraries path 2024-08-29 01:02:15 +02:00
eb4ea31cef add php ftp lib 2024-08-28 22:28:49 +02:00
da379a7af9 ftp service 2024-08-28 22:28:34 +02:00
c8106eafa1 Merge branch 'main' into feat/xml-pedido 2024-08-28 07:56:12 +02:00
ee45baec3b xml file generation 2024-08-19 08:23:39 +02:00
144faa9363 Merge branch 'main' into 'dev/chat'
Main

See merge request jjimenez/safekat!305
2024-08-16 08:51:39 +00:00
5169174e57 git push 2024-08-12 12:16:04 +02:00
070ffb934d xml envios 2024-08-12 10:59:53 +02:00
5648f43413 xml service 2024-08-12 08:02:14 +02:00
a91685747c Merge branch 'main' into feat/pedidos-export 2024-08-10 21:11:10 +02:00
665dc2d86d xml service 2024-08-10 21:09:56 +02:00
f3ad5d8b06 Merge branch 'main' into 'dev/chat'
Main

See merge request jjimenez/safekat!296
2024-07-31 18:41:45 +00:00
c5e4a70ec0 Actualizacion automatica: 2024-07-31 20:40:31 2024-07-31 20:40:33 +02:00
f46a03e66d avances de hoy 2024-07-06 22:44:29 +02:00
26f3057bbe Merge branch 'main' into 'dev/chat'
Main

See merge request jjimenez/safekat!284
2024-07-06 15:54:04 +00:00
35e4e8ef95 Configuraciones iniciales del sistema de mensajeria 2024-07-02 21:45:32 +02:00
1883 changed files with 20894 additions and 4740 deletions

2
.gitignore vendored
View File

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

15
.idea/codeception.xml generated Normal file
View File

@ -0,0 +1,15 @@
<?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
View File

@ -55,6 +55,13 @@
<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 Normal file
View File

@ -0,0 +1,16 @@
<?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
View File

@ -7,6 +7,13 @@
<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" />

View File

@ -15,6 +15,7 @@ namespace Config;
use App\Entities\Usuarios\UsersEntity;
use App\Models\UserModel;
use CodeIgniter\Shield\Authentication\Authenticators\JWT;
use CodeIgniter\Shield\Authentication\Passwords\ValidationRules;
use CodeIgniter\Shield\Config\Auth as ShieldAuth;
use CodeIgniter\Shield\Authentication\Actions\ActionInterface;
@ -118,7 +119,7 @@ class Auth extends ShieldAuth
'tokens' => AccessTokens::class,
'session' => Session::class,
'hmac' => HmacSha256::class,
// 'jwt' => JWT::class,
'jwt' => JWT::class,
];
/**
@ -145,7 +146,7 @@ class Auth extends ShieldAuth
'session',
'tokens',
'hmac',
// 'jwt',
'jwt',
];
/**

View File

@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter Shield.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Shield\Config\AuthJWT as ShieldAuthJWT;
/**
* JWT Authenticator Configuration
*/
class AuthJWT extends ShieldAuthJWT
{
/**
* --------------------------------------------------------------------
* Name of Authenticator Header
* --------------------------------------------------------------------
* The name of Header that the Authorization token should be found.
* According to the specs, this should be `Authorization`, but rare
* circumstances might need a different header.
*/
public string $authenticatorHeader = 'Authorization';
/**
* --------------------------------------------------------------------
* The Default Payload Items
* --------------------------------------------------------------------
* All JWTs will have these claims in the payload.
*
* @var array<string, string>
*/
public array $defaultClaims = [
'iss' => 'https://safekat.com',
];
/**
* --------------------------------------------------------------------
* The Keys
* --------------------------------------------------------------------
* The key of the array is the key group name.
* The first key of the group is used for signing.
*
* @var array<string, array<int, array<string, string>>>
* @phpstan-var array<string, list<array<string, string>>>
*/
public array $keys = [
'default' => [
// Symmetric Key
[
'kid' => '', // Key ID. Optional if you have only one key.
'alg' => 'HS256', // algorithm.
// Set secret random string. Needs at least 256 bits for HS256 algorithm.
// E.g., $ php -r 'echo base64_encode(random_bytes(32));'
'secret' => 'ZAfosrIVWDaKEhBhicTKCpW8T5ZxC3GYAxFgCkUQjlU=',
],
// Asymmetric Key
// [
// 'kid' => '', // Key ID. Optional if you have only one key.
// 'alg' => 'RS256', // algorithm.
// 'public' => '', // Public Key
// 'private' => '', // Private Key
// 'passphrase' => '' // Passphrase
// ],
],
];
/**
* --------------------------------------------------------------------
* Time To Live (in seconds)
* --------------------------------------------------------------------
* Specifies the amount of time, in seconds, that a token is valid.
*/
public int $timeToLive = HOUR;
/**
* --------------------------------------------------------------------
* Record Login Attempts
* --------------------------------------------------------------------
* Whether login attempts are recorded in the database.
*
* Valid values are:
* - Auth::RECORD_LOGIN_ATTEMPT_NONE
* - Auth::RECORD_LOGIN_ATTEMPT_FAILURE
* - Auth::RECORD_LOGIN_ATTEMPT_ALL
*/
public int $recordLoginAttempt = Auth::RECORD_LOGIN_ATTEMPT_FAILURE;
}

View File

@ -46,6 +46,7 @@ class Autoload extends AutoloadConfig
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
'Libraries' => APPPATH . 'Libraries',
'Dompdf' => APPPATH . 'ThirdParty/dompdf/src',
];

View File

@ -8,6 +8,7 @@ use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;
use CodeIgniter\Shield\Authentication\Authenticators\JWT;
class Filters extends BaseConfig
@ -43,6 +44,8 @@ class Filters extends BaseConfig
'login*',
'register',
'auth/a/*',
'auth/jwt',
'api/*',
'logout']
],
],
@ -73,5 +76,9 @@ class Filters extends BaseConfig
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*/
public array $filters = [];
public array $filters = [
/*'jwt' => [
'before' => ['api', 'api/*']
],*/
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class PedidoXML extends BaseConfig
{
public string $host;
public int $port;
public string $username;
public string $password;
public string $base_dir; # FTP server directory
public bool $xml_enabled;
public function __construct() {
parent::__construct();
$this->host = env("HIDRIVE_HOST","10.5.0.6");
$this->port = env("HIDRIVE_PORT",21);
$this->username = env("HIDRIVE_USER","admin");
$this->password = env("HIDRIVE_PASS","A77h3b0X4OA2rOYAf4w2");
$this->base_dir = env("HIDRIVE_PATH_ROOT","/home/admin/safekat"); # FTP server directory
$this->xml_enabled = env("FTP_XML_ENABLED",false);
}
}

View File

@ -21,6 +21,164 @@ const SK_PERMISSION_MATRIX = [
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
"tarifa-preimpresion.create",
"tarifa-preimpresion.edit",
"tarifa-preimpresion.delete",
"tarifa-preimpresion.menu",
"tarifa-manipulado.create",
"tarifa-manipulado.edit",
"tarifa-manipulado.delete",
"tarifa-manipulado.menu",
"tarifa-acabado.create",
"tarifa-acabado.edit",
"tarifa-acabado.delete",
"tarifa-acabado.menu",
"tarifa-encuadernacion.create",
"tarifa-encuadernacion.edit",
"tarifa-encuadernacion.delete",
"tarifa-encuadernacion.menu",
"tarifa-envio.create",
"tarifa-envio.edit",
"tarifa-envio.delete",
"tarifa-envio.menu",
"tarifa-extra.create",
"tarifa-extra.edit",
"tarifa-extra.delete",
"tarifa-extra.menu",
"proveedores.create",
"proveedores.edit",
"proveedores.delete",
"proveedores.menu",
"ajustes.create",
"ajustes.edit",
"ajustes.delete",
"ajustes.menu",
"actividad.create",
"actividad.edit",
"actividad.delete",
"actividad.menu",
"paises.create",
"paises.edit",
"paises.delete",
"paises.menu",
"formas-pago.create",
"formas-pago.edit",
"formas-pago.delete",
"formas-pago.menu",
"maquinas.create",
"maquinas.edit",
"maquinas.delete",
"maquinas.menu",
"maquinas-defecto.create",
"maquinas-defecto.edit",
"maquinas-defecto.delete",
"maquinas-defecto.menu",
"papel-generico.create",
"papel-generico.edit",
"papel-generico.delete",
"papel-generico.menu",
"papel-impresion.create",
"papel-impresion.edit",
"papel-impresion.delete",
"papel-impresion.menu",
"usuarios.create",
"usuarios.edit",
"usuarios.delete",
"usuarios.menu",
"roles-permisos.create",
"roles-permisos.edit",
"roles-permisos.delete",
"roles-permisos.menu",
"ubicaciones.create",
"ubicaciones.edit",
"ubicaciones.delete",
"ubicaciones.menu",
"series-facturas.create",
"series-facturas.edit",
"series-facturas.delete",
"series-facturas.menu",
],
"cliente-admin" => [
"perfil.edit",
"perfil.menu",
"direcciones.create",
"direcciones.edit",
"direcciones.delete",
"direcciones.menu",
"presupuesto-cliente.create",
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
],
"cliente-editor" => [
"perfil.create",
"perfil.edit",
"perfil.delete",
"perfil.menu",
"direcciones.create",
"direcciones.edit",
"direcciones.delete",
"direcciones.menu",
"presupuesto-cliente.create",
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
],
"comercial" => [
"token.token",
"token.menu",
],
"produccion" => [
"token.token",
"token.menu",
],
"maquina" => [
"token.token",
"token.menu",
],
"maquetador" => [
"token.token",
"token.menu",
],
"director" => [
"token.token",
"token.menu",
],
"contabilidad" => [
"token.token",
"token.menu",
],
"editor" => [
"token.token",
"token.menu",
"Profile.index",
"Profile.menu",
],
"beta" => [
"clientes.create",
"clientes.edit",
"clientes.delete",
"clientes.menu",
"plantilla-tarifa.create",
"plantilla-tarifa.edit",
"plantilla-tarifa.delete",
"plantilla-tarifa.menu",
"perfil.create",
"perfil.edit",
"perfil.delete",
"perfil.menu",
"presupuesto.create",
"presupuesto.edit",
"presupuesto.delete",
"presupuesto.menu",
"presupuesto-cliente.create",
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
"tarifa-preimpresion.create",
"tarifa-preimpresion.edit",
"tarifa-preimpresion.delete",
"tarifa-preimpresion.menu",
"tarifa-manipulado.create",
"tarifa-manipulado.edit",
"tarifa-manipulado.delete",
@ -90,94 +248,4 @@ const SK_PERMISSION_MATRIX = [
"series-facturas.delete",
"series-facturas.menu",
],
"cliente-admin" => [
"perfil.edit",
"perfil.menu",
"presupuesto-cliente.create",
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
],
"cliente-editor" => [
"presupuesto-cliente.create",
"presupuesto-cliente.edit",
"presupuesto-cliente.delete",
"presupuesto-cliente.menu",
],
"comercial" => [
"token.token",
"token.menu",
],
"produccion" => [
"token.token",
"token.menu",
],
"maquina" => [
"token.token",
"token.menu",
],
"maquetador" => [
"token.token",
"token.menu",
],
"director" => [
"token.token",
"token.menu",
],
"contabilidad" => [
"token.token",
"token.menu",
],
"editor" => [
"token.token",
"token.menu",
"Profile.index",
"Profile.menu",
],
"beta" => [
"clientes.create",
"clientes.edit",
"clientes.delete",
"clientes.menu",
"plantilla-tarifa.create",
"plantilla-tarifa.edit",
"plantilla-tarifa.delete",
"plantilla-tarifa.menu",
"presupuesto.create",
"presupuesto.edit",
"presupuesto.delete",
"presupuesto.menu",
"tarifa-preimpresion.create",
"tarifa-preimpresion.edit",
"tarifa-preimpresion.delete",
"tarifa-preimpresion.menu",
"tarifa-manipulado.create",
"tarifa-manipulado.edit",
"tarifa-manipulado.delete",
"tarifa-manipulado.menu",
"tarifa-acabado.create",
"tarifa-acabado.edit",
"tarifa-acabado.delete",
"tarifa-acabado.menu",
"tarifa-encuadernacion.create",
"tarifa-encuadernacion.edit",
"tarifa-encuadernacion.delete",
"tarifa-encuadernacion.menu",
"tarifa-envio.create",
"tarifa-envio.edit",
"tarifa-envio.delete",
"tarifa-envio.menu",
"proveedores.create",
"proveedores.edit",
"proveedores.delete",
"proveedores.menu",
"ajustes.create",
"ajustes.edit",
"ajustes.delete",
"ajustes.menu",
"actividad.create",
"actividad.edit",
"actividad.delete",
"actividad.menu",
],
];

View File

@ -13,6 +13,10 @@ const SK_PERMISSIONS = [
'perfil.edit' => 'Can edit',
'perfil.delete' => 'Can delete',
'perfil.menu' => 'Menu shall be visualize',
'direcciones.create' => 'Can create',
'direcciones.edit' => 'Can edit',
'direcciones.delete' => 'Can delete',
'direcciones.menu' => 'Menu shall be visualize',
'presupuesto.create' => 'Can create',
'presupuesto.edit' => 'Can edit',
'presupuesto.delete' => 'Can delete',
@ -61,6 +65,10 @@ const SK_PERMISSIONS = [
'paises.edit' => 'Can edit',
'paises.delete' => 'Can delete',
'paises.menu' => 'Menu shall be visualize',
'formas-pago.create' => 'Can create',
'formas-pago.edit' => 'Can edit',
'formas-pago.delete' => 'Can delete',
'formas-pago.menu' => 'Menu shall be visualize',
'maquinas.create' => 'Can create',
'maquinas.edit' => 'Can edit',
'maquinas.delete' => 'Can delete',

View File

@ -3,7 +3,7 @@
const SK_ROLES = [
'admin' => [
'title' => 'Administrador',
'description' => '',
'description' => 'Administrador del ERP',
],
'cliente-admin' => [
'title' => 'Cliente administrador',

View File

@ -9,6 +9,7 @@ use CodeIgniter\Router\RouteCollection;
//service('auth')->routes($routes, ['except' => ['login', 'register']]);
service('auth')->routes($routes);
//WEB ROUTER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('/', 'Home::index', ['as' => 'home']);
@ -51,7 +52,6 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
});
});
});
/* Rutas para configuraciones */
@ -65,7 +65,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
});
/* Series Factura */
@ -78,21 +77,26 @@ $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']);
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
});
$routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
$routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
$routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
});
});
$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']);
@ -101,8 +105,10 @@ $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->post('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
$routes->get('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']);
@ -209,6 +215,8 @@ $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']);
@ -320,10 +328,22 @@ $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']);
@ -334,6 +354,7 @@ $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']);
@ -348,6 +369,7 @@ $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']);
@ -364,32 +386,11 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'clienteDelete']);
$routes->post('datatable', 'Cliente::datatable', ['as' => 'clienteDT']);
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
});
/* Precios */
/*$routes->group('precios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
$routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'clientePreciosDT']);
$routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'clientePreciosDTE']);
});*/
});
/*$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
$routes->get('', 'Cliente::index', ['as' => 'clienteList']);
$routes->get('add', 'Cliente::add', ['as' => 'newCliente']);
$routes->post('add', 'Cliente::add', ['as' => 'createCliente']);
$routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']);
$routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']);
$routes->post('edit/(:num)', 'Cliente::edit/$1', ['as' => 'updateCliente']);
$routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'deleteCliente']);
$routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']);
$routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']);
});
$routes->resource('cliente', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Cliente', 'except' => 'show,new,create,update']);*/
$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']);
@ -420,18 +421,15 @@ $routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], f
});
$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->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
$routes->get('', 'Clientedirecciones::index', ['as' => 'clientedireccionesIndex']);
$routes->get('get/(:num)', 'Clientedirecciones::get/$1', ['as' => 'get']);
$routes->get('getDireccionPresupuesto/(:num)', 'Clientedirecciones::getDireccionPresupuesto/$1', ['as' => 'getDireccionPresupuesto']);
$routes->post('add', 'Clientedirecciones::add', ['as' => 'newClientedirecciones']);
$routes->get('getSelect2', 'Clientedirecciones::getSelect2', ['as' => 'listaClientedirecciones']);
});
$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']);
@ -556,23 +554,23 @@ $routes->group('clientedirecciones', ['namespace' => 'App\Controllers\Clientes']
$routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clientedirecciones', 'except' => 'show,new,create,update']);
$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->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->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->resource('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestoadmin', 'except' => 'show,new,create,update']);
$routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->post('datatable', 'Presupuestocliente::datatable', ['as' => 'datatableOfPresupuestos']);
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
@ -581,10 +579,11 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest
$routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']);
$routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']);
$routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']);
$routes->post('getDatosDireccion', 'Presupuestocliente::getDatosDireccion', ['as' => 'getDatosDireccion']);
$routes->post('getNuevaDireccion', 'Presupuestocliente::getNuevaDireccion', ['as' => 'nuevaDireccion']);
$routes->post('guardarPresupuesto', 'Presupuestocliente::guardarPresupuesto', ['as' => 'guardarPresupuesto']);
$routes->post('guardar', 'Presupuestocliente::guardar', ['as' => 'guardar']);
$routes->get('cargar/(:num)', 'Presupuestocliente::cargar/$1', ['as' => 'cargarPresupuesto']);
$routes->post('duplicarPresupuesto', 'Presupuestocliente::duplicarPresupuesto', ['as' => 'duplicarPresupuesto']);
$routes->post('calcular', 'Presupuestocliente::calcular', ['as' => 'calcularPresupuesto']);
});
$routes->resource('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestocliente', 'except' => 'show,new,create,update']);
@ -599,7 +598,6 @@ $routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Pre
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
});
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
@ -625,13 +623,13 @@ $routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presup
$routes->group('presupuestotiradasalternativas', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'Presupuestotiradasalternativas::datatable', ['as' => 'dataTableOfPresupuestoTiradasAlternativas']);
$routes->post('datatable_2', 'Presupuestotiradasalternativas::datatable_2', ['as' => 'getTiradaData']);
});
});
$routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ($routes) {
$routes->get('list', 'Pedido::todos', ['as' => 'listaPresupuestos']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->post('datatable', 'Pedido::datatable', ['as' => 'dataTableOfPedidos']);
$routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']);
$routes->post('add', 'Pedido::add', ['as' => 'crearPedido']);
@ -639,7 +637,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
});
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
@ -737,6 +735,83 @@ $routes->group(
$routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Buscador', 'except' => 'show,new,create,update']);
$routes->group(
'papel-formato',
['namespace' => 'App\Controllers\Configuracion'],
function ($routes) {
$routes->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']);
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
}
);
$routes->resource('papel-formato', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelformato', 'except' => 'show,new,create,update']);
/* Rutas para mensajeria */
$routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], function ($routes) {
/* Interna */
$routes->group('internos', ['namespace' => 'App\Controllers\Mensajeria'], function ($routes) {
$routes->get('', 'MensajesDirectos::index', ['as' => 'mensajeriaView']);
$routes->get('chat/(:num)', 'MensajesDirectos::getChatInfo/$1', ['as' => 'getChatInfo']);
/*$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->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
$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']);
$routes->get('department/(:num)/users', 'ChatController::get_chat_department_users/$1', ['as' => 'getChatDepartmentUsers']);
$routes->get('(:num)', 'ChatController::get_chat/$1', ['as' => 'getChat']);
$routes->post('message/presupuesto', 'ChatController::store_chat_message_presupuesto', ['as' => 'storeChatMessagePresupuesto']);
$routes->post('message/pedido', 'ChatController::store_chat_message_pedido', ['as' => 'storeChatMessagePedido']);
$routes->post('message/factura', 'ChatController::store_chat_message_factura', ['as' => 'storeChatMessageFactura']);
$routes->post('message/internal', 'ChatController::store_chat_message_single', ['as' => 'storeChatMessageSingle']);
$routes->get('contacts', 'ChatController::get_chat_internal_contacts', ['as' => 'getChatInternalContacts']);
$routes->get('contacts/(:num)', 'ChatController::get_chat_internal_contact/$1', ['as' => 'getChatInternalContact']);
$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->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']);
$routes->post('hebra/(:num)', 'ChatController::update_hebra/$1', ['as' => 'updateHebra']);
$routes->get('hebra/presupuesto/(:num)', "ChatController::get_hebra_presupuesto/$1", ["as" => "getHebraPresupuesto"]);
$routes->get('hebra/pedido/(:num)', "ChatController::get_hebra_pedido/$1", ["as" => "getHebraPedido"]);
$routes->get('hebra/factura/(:num)', "ChatController::get_hebra_factura/$1", ["as" => "getHebraFactura"]);
});
/*
* --------------------------------------------------------------------
* APIs Route Definitions
* --------------------------------------------------------------------
*/
$routes->post('auth/jwt', '\App\Controllers\Sistema\AuthAPIController::jwtLogin');
$routes->group('api', ['filter' => 'jwt'], static function ($routes) {
$routes->get('test', 'Test::echo');
// ...
});
/*
* --------------------------------------------------------------------
* Translation
* --------------------------------------------------------------------
*/
$routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) {
$routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']);
});
$routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']);
/*
* --------------------------------------------------------------------
* Additional Routing
@ -752,4 +827,4 @@ $routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presu
*/
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
}

View File

@ -2,6 +2,7 @@
namespace Config;
use App\Services\FTPService;
use CodeIgniter\Config\BaseService;
/**

View File

@ -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,4 +42,6 @@ class Validation extends BaseConfig
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

View File

@ -0,0 +1,432 @@
<?php
namespace App\Controllers\Chat;
use App\Controllers\BaseController;
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 App\Models\ChatUser;
use App\Models\Clientes\ClienteModel;
use App\Models\Usuarios\UserModel;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\Log\Logger;
use Psr\Log\LoggerInterface;
class ChatController extends BaseController
{
protected ChatDeparmentModel $chatDeparmentModel;
protected ChatDeparmentUserModel $chatDeparmentUserModel;
protected ChatModel $chatModel;
protected ChatMessageModel $chatMessageModel;
protected UserModel $userModel;
protected ClienteModel $clienteModel;
protected ChatUser $chatUserModel;
protected ChatNotification $chatNotificationModel;
public function initController(
RequestInterface $request,
ResponseInterface $response,
LoggerInterface $logger
) {
parent::initController($request, $response, $logger);
// Add your code here.
$this->chatDeparmentModel = model(ChatDeparmentModel::class);
$this->chatDeparmentUserModel = model(ChatDeparmentUserModel::class);
$this->chatModel = model(ChatModel::class);
$this->chatMessageModel = model(ChatMessageModel::class);
$this->userModel = model(UserModel::class);
$this->clienteModel = model(ClienteModel::class);
$this->chatUserModel = model(ChatUser::class);
$this->chatNotificationModel = model(ChatNotification::class);
}
public function index() {}
public function get_chat_departments()
{
$data = $this->chatDeparmentModel->getChatDepartments();
return $this->response->setJSON($data);
}
public function get_chat_presupuesto(int $chat_department_id, int $presupuesto_id)
{
$data = [
"chat" => null,
"messages" => null,
"count" => 0,
];
$chat = $this->chatModel->getChatPresupuesto($chat_department_id, $presupuesto_id);
if ($chat) {
$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);
}
public function get_chat_pedido(int $chat_department_id, int $pedido_id)
{
$data = [
"chat" => null,
"messages" => null,
"count" => 0,
];
$chat = $this->chatModel->getChatPedido($chat_department_id, $pedido_id);
if ($chat) {
$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);
}
public function get_chat_factura(int $chat_department_id, int $factura_id)
{
$data = [
"chat" => null,
"messages" => null,
"count" => 0,
];
$chat = $this->chatModel->getChatFactura($chat_department_id, $factura_id);
if ($chat) {
$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);
}
public function get_chat(int $chat_id)
{
$data = $this->chatModel->getChat($chat_id);
return $this->response->setJSON($data);
}
public function store_chat_message_presupuesto()
{
$data = $this->request->getPost();
// $data = $this->chatModel->createChatPresupuesto();
$existChat = $this->chatModel->existChatPresupuesto($data["chat_department_id"], $data["model_id"]);
if ($existChat == false) {
$chatId = $this->chatModel->createChatPresupuesto($data["chat_department_id"], $data["model_id"]);
} else {
$chat = $this->chatModel->getChatPresupuesto($data["chat_department_id"], $data["model_id"]);
$chatId = $chat->id;
}
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
$dataResponse = $this->chatMessageModel->find($chat_message_id);
return $this->response->setJSON($dataResponse);
}
public function store_chat_message_pedido()
{
$data = $this->request->getPost();
$existChat = $this->chatModel->existChatPedido($data["chat_department_id"], $data["model_id"]);
if ($existChat == false) {
$chatId = $this->chatModel->createChatPedido($data["chat_department_id"], $data["model_id"]);
} else {
$chat = $this->chatModel->getChatPedido($data["chat_department_id"], $data["model_id"]);
$chatId = $chat->id;
}
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
$dataResponse = $this->chatMessageModel->find($chat_message_id);
return $this->response->setJSON($dataResponse);
}
public function store_chat_message_factura()
{
$data = $this->request->getPost();
$existChat = $this->chatModel->existChatFactura($data["chat_department_id"], $data["model_id"]);
if ($existChat == false) {
$chatId = $this->chatModel->createChatFactura($data["chat_department_id"], $data["model_id"]);
} else {
$chat = $this->chatModel->getChatFactura($data["chat_department_id"], $data["model_id"]);
$chatId = $chat->id;
}
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $data["message"]]);
$dataResponse = $this->chatMessageModel->find($chat_message_id);
return $this->response->setJSON($dataResponse);
}
public function store_chat_message_single()
{
$data = $this->request->getPost();
$existChat = $this->chatMessageModel->get_chat_contact_messages($data["receiver_id"]);
if (count($existChat) > 0) {
$chatId = $existChat[0]->chat_id;
} else {
$chatId = $this->chatModel->createChatSingle();
}
$chat_message_id = $this->chatMessageModel->insert(
[
"chat_id" => $chatId,
"sender_id" => auth()->user()->id,
"message" => $data["message"],
"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();
}
foreach ($users as $user) {
$user->unreadMessages = $this->chatMessageModel->get_chat_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([]);
// }
$users = $this->userModel->builder()
->where("deleted_at", null)
->where("id", $user_id)
->get()->getFirstRow();
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()
{
$cliente_id = auth()->user()->cliente_id;
$response = [];
if ($cliente_id) {
$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;
}
$response["chatPresupuestos"] = $this->chatModel->getClienteChatPresupuestos($data["presupuestos"]);
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;
}
$response["data"] = $data;
} 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;
}
}
return $this->response->setJSON($response);
}
public function get_chat_department_users(int $chat_department_id)
{
$data = $this->chatDeparmentModel->getChatDepartmentUsers($chat_department_id);
return $this->response->setJSON($data);
}
public function get_chat_users_internal()
{
$query = $this->userModel->builder()->select(
[
"id",
"CONCAT(first_name,' ',last_name,'(',username,')') as name"
]
)->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 store_hebra_presupuesto()
{
$bodyData = $this->request->getPost();
$chat_id = $this->chatModel->insert([
"presupuesto_id" => $bodyData["modelId"],
"title" => $bodyData["title"]
]);
$chatMessageId = $this->chatMessageModel->insert([
"chat_id" => $chat_id,
"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"]);
$this->chatUserModel->insertBatch($chatUserData);
foreach ($bodyData["users"] as $userId) {
$this->chatNotificationModel->insert(
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
}
}
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
}
public function store_hebra_pedido()
{
$bodyData = $this->request->getPost();
$chat_id = $this->chatModel->insert([
"pedido_id" => $bodyData["modelId"],
"title" => $bodyData["title"]
]);
$chatMessageId = $this->chatMessageModel->insert([
"chat_id" => $chat_id,
"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"]);
$this->chatUserModel->insertBatch($chatUserData);
foreach ($bodyData["users"] as $userId) {
$this->chatNotificationModel->insert(
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
}
}
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
}
public function store_hebra_factura()
{
$bodyData = $this->request->getPost();
$chat_id = $this->chatModel->insert([
"factura_id" => $bodyData["modelId"],
"title" => $bodyData["title"]
]);
$chatMessageId = $this->chatMessageModel->insert([
"chat_id" => $chat_id,
"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"]);
$this->chatUserModel->insertBatch($chatUserData);
foreach ($bodyData["users"] as $userId) {
$this->chatNotificationModel->insert(
["chat_message_id" => $chatMessageId,"user_id" => $userId]);
}
}
return $this->response->setJSON(["message" => "Hebra creada correctamente","status" => true]);
}
public function update_hebra($chat_id)
{
$bodyData = $this->request->getPost();
$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);
foreach ($actualUsersArray as $key => $user_id) {
$this->chatNotificationModel->insert(
["chat_message_id" => $chatMessageId,"user_id" => $user_id]);
}
if(isset($bodyData["users"])){
foreach ($bodyData["users"] as $userId) {
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]);
}
}
return $this->response->setJSON(["message" => "Hebra actualizada correctamente","status" => true]);
}
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();
foreach ($notifications as $notification) {
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
}
return $this->response->setJSON($data);
}
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();
foreach ($notifications as $notification) {
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
}
return $this->response->setJSON($data);
}
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();
foreach ($notifications as $notification) {
$this->chatNotificationModel->update($notification["id"],["viewed" => true]);
}
return $this->response->setJSON($data);
}
}

View File

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

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Clientes;
<?php
namespace App\Controllers\Clientes;
use App\Models\Collection;
@ -6,6 +8,8 @@ use App\Entities\Clientes\ClienteDireccionesEntity;
use App\Models\Clientes\ClienteDireccionesModel;
use App\Models\Usuarios\UserModel;
use DataTables\Editor;
use DataTables\Editor\Field;
use DataTables\Editor\Validate;
@ -22,21 +26,69 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
protected static $controllerSlug = 'clientedirecciones';
public function add(){
protected static $viewPath = 'themes/vuexy/form/clientes/direcciones/';
protected $indexRoute = 'clienteDireccionesList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Clientes.direccionesEnvio');
$this->viewData['usingSweetAlert'] = true;
$this->viewData = ['usingServerSideDataTable' => true]; // JJO
// Breadcrumbs (IMN)
$this->viewData['breadcrumb'] = [
['title' => lang("Clientes.direccionesEnvio"), 'route' => "javascript:void(0);", 'active' => false],
];
$this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null);
$this->viewData['provinciaList'] = $this->getProvinciaListItems($clienteEntity->provincia_id ?? null);
$this->viewData['paisList'] = $this->getPaisListItems($clienteEntity->pais_id ?? null);
parent::initController($request, $response, $logger);
}
public function index()
{
$id = auth()->user()->id;
$user_model = new UserModel();
$user = $user_model->find($id);
$cliente_id = $user->cliente_id;
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Clientes.cliente')]),
'cliente_id' => $cliente_id,
"user_id" => $id,
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewClienteDireccionesList', $viewData);
}
public function add()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cliente_id = $reqData['cliente_id'] ?? -1;
$att = $reqData['att'] ?? "";
$email = $reqData['email'] ?? "";
$direccion = $reqData['direccion'] ?? "";
$pais_id = $reqData['paisId'] ?? -1;
$pais_id = $reqData['pais_id'] ?? -1;
$provincia = $reqData['provincia'] ?? "";
$municipio = $reqData['municipio'] ?? "";
$cp = $reqData['cp'] ?? "";
$telefono = $reqData['telefono'] ?? "";
$alias = $reqData['alias'] ?? "";
$data = [
"cliente_id" => $cliente_id,
"att" => $att,
@ -50,15 +102,11 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
"alias" => $alias,
];
$response = $this->model->insert($data);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data_ret = [
'data' => $response,
$csrfTokenName => $newTokenHash
];
return $this->respond($data_ret);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
@ -68,14 +116,14 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
public function menuItems()
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cliente_id = $reqData['cliente_id'] ?? -1;
$clienteDireccionesModel = model('App\Models\Clientes\ClienteDireccionesModel');
$menu = $clienteDireccionesModel->getMenuDirecciones($cliente_id);
//$menu = $this->model->getMenuItems($cliente_id);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
@ -89,6 +137,34 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$cliente_id = $this->request->getGet('cliente_id');
$query = $this->model->builder()->select(
[
"id",
"alias as name"
]
)
->where("cliente_id", $cliente_id)
->orderBy("alias", "asc");
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("clientes.nombre", $this->request->getGet("q"))
->groupEnd();
}
return $this->response->setJSON($query->get()->getResultObject());
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable()
{
if ($this->request->isAJAX()) {
@ -96,7 +172,7 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$tipo = $reqData['tipo'] ?? null;
if(is_null($tipo)){
if (is_null($tipo)) {
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
@ -111,22 +187,21 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$id_C = $reqData['cliente_id'] ?? -1;
$resourceData = $this->model->getResource($search, $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource("", $id_C)->countAllResults()
));
}
else{
} else {
$id = $reqData['id'] ?? -1;
$resourceData = $this->model->getDireccion($id);
return $this->respond($resourceData);
}
@ -135,6 +210,48 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
}
}
public function get($id)
{
try {
$resourceData = $this->model->getDireccion($id);
$response = (object)[
'error' => false,
'data' => $resourceData
];
return $this->respond($response);
} catch (\Exception $e) {
$response = (object)[
'error' => true,
'message' => $e->getMessage()
];
return $this->fail($response);
}
}
public function getDireccionPresupuesto($id)
{
try {
$model = model('App\Models\Presupuestos\PresupuestoDireccionesModel');
$resourceData = $model->getDireccion($id);
if(count($resourceData) > 0){
$resourceData[0]->direccionId = $id;
}
$response = (object)[
'error' => false,
'data' => $resourceData
];
return $this->respond($response);
} catch (\Exception $e) {
$response = (object)[
'error' => true,
'message' => $e->getMessage()
];
return $this->fail($response);
}
}
public function datatable_editor()
{
if ($this->request->isAJAX()) {
@ -145,72 +262,116 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$response = Editor::inst($db, 'cliente_direcciones')
->fields(
Field::inst('att')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('alias')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('email')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('direccion')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 255 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(255),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('municipio')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 100 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(100),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('cp')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 20 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(20),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('telefono')
->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('ClienteDirecciones.validation.required')
)
)
->validator( Validate::maxLen( 40 ) , array(
'message' => lang('ClienteDirecciones.validation.max_length'))
),
->validator(
Validate::maxLen(40),
array(
'message' => lang('ClienteDirecciones.validation.max_length')
)
),
Field::inst('provincia')
->validator( function ( $val, $data, $field, $host ) {
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
if (strlen( $val ) > 100)
return lang('ClienteDirecciones.validation.max_length');
else if (strlen( $val ) == 0)
lang('ClienteDirecciones.validation.required');
else
return true;
->validator(
function ($val, $data, $field, $host) {
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
if (strlen($val) > 100)
return lang('ClienteDirecciones.validation.max_length');
else if (strlen($val) == 0)
lang('ClienteDirecciones.validation.required');
else
return true;
}
return true;
}
return true;
}
),
),
Field::inst('pais_id')->validator('Validate::notEmpty', array(
'message' => lang('ClienteDirecciones.validation.required'))),
'message' => lang('ClienteDirecciones.validation.required')
)),
Field::inst('cliente_id'),
)
->debug(true)
->process($_POST)
->data();
@ -221,9 +382,46 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getPaisListItems($selId = null)
{
$paisModel = model('App\Models\Configuracion\PaisModel');
$onlyActiveOnes = true;
$data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
return $data;
}
protected function getComunidadAutonomaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])];
if (!is_null($selId)) :
$comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel');
$selOption = $comunidadAutonomaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
protected function getProvinciaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])];
if (!empty($selId)) :
$provinciaModel = model('App\Models\Configuracion\ProvinciaModel');
$selOption = $provinciaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
}

View File

@ -271,6 +271,27 @@ 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)
{

View File

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

View File

@ -0,0 +1,92 @@
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseResourceController;
use App\Models\Collection;
use App\Models\Configuracion\ConfigVariableModel;
use CodeIgniter\HTTP\Response;
use Hermawan\DataTables\DataTable;
class ConfigVariables extends BaseResourceController
{
protected $modelName = ConfigVariableModel::class;
protected ConfigVariableModel $configVariableModel;
protected $format = 'json';
protected static $singularObjectName = 'Variables';
protected static $singularObjectNameCc = 'variables';
protected static $pluralObjectName = 'Variables';
protected static $pluralObjectNameCc = 'variables';
protected static $controllerSlug = 'variables';
protected static $viewPath = 'themes/vuexy/form/configuracion/variables/';
protected $indexRoute = 'viewVariablesList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->configVariableModel = model(ConfigVariableModel::class);
}
public function index()
{
$viewData = [
'currentModule' => static::$controllerSlug,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . $this->indexRoute, $viewData);
}
public function store()
{
$data = [];
$variableCreated = $this->configVariableModel->store($data);
return $this->response->setJSON($variableCreated);
}
public function get(int $config_variable_id)
{
$data = $this->configVariableModel->find($config_variable_id);
return $this->response->setJSON($data);
}
public function updateVariable(int $config_variable_id)
{
$reqData = [];
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$status = $this->configVariableModel->update($config_variable_id, $reqData);
return $this->response->setJSON([
"message" => "Variable actualizada correctamente",
"status" => $status
]);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function deleteVariable(int $config_variable_id): Response
{
return $this->response->setJSON([]);
}
public function datatable()
{
$query = $this->configVariableModel->builder()->select([
"id",
"name",
"value",
"description"
])->orderBy("name", "asc");
return DataTable::of($query)
->add("action", fn($q) => $q->id)
->toJson(true);
}
}

View File

@ -230,25 +230,19 @@ class FormasPago extends \App\Controllers\BaseResourceController
public function menuItems()
{
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? '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);
$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();
}
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
return $this->response->setJSON($query->get()->getResultObject());
} else {
return $this->failUnauthorized('Invalid request', 403);
}

View File

@ -1,4 +1,5 @@
<?php namespace App\Controllers\Configuracion;
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseResourceController;
@ -12,8 +13,8 @@ use App\Models\Configuracion\MaquinasTarifasImpresionModel;
use App\Models\Configuracion\MaquinaModel;
use
DataTables\Editor,
DataTables\Editor\Field;
DataTables\Editor,
DataTables\Editor\Field;
class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
{
@ -69,9 +70,9 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
{
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -81,10 +82,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
$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) {
@ -98,14 +99,14 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
$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 ($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);
@ -129,25 +130,25 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null)
{
if ($requestedId == null) :
if ($requestedId == null):
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$maquinasTarifasImpresion = $this->model->find($id);
if ($maquinasTarifasImpresion == false) :
if ($maquinasTarifasImpresion == false):
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('MaquinasTarifasImpresions.maquinasTarifaImpresion')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -160,10 +161,10 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
$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) {
@ -180,12 +181,12 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
if ($noException && $successfulResult):
$id = $maquinasTarifasImpresion->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);
@ -220,30 +221,48 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
$response = Editor::inst($db, 'lg_maquinas_tarifas_impresion')
->fields(
Field::inst('uso')
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasTarifasImpresions.validation.uso.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('MaquinasTarifasImpresions.validation.uso.required')
)
),
Field::inst('tipo')
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
)
),
Field::inst('precio')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
)
),
Field::inst('margen')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal'))
'message' => lang('MaquinasTarifasImpresions.validation.precio.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('MaquinasTarifasImpresions.validation.tipo.required')
)
),
Field::inst('maquina_id'),
Field::inst('user_created_id'),
@ -269,16 +288,21 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
'maquina_id' => $values['maquina_id'],
'tipo' => $values['tipo'],
'uso' => $values['uso'],
'is_deleted' => 0));
'is_deleted' => 0
));
$id = $builder->get()->getFirstRow()->id;
$id = $builder->get()->getFirstRow();
if ($id) {
$id = $id->id;
// No se pueden duplicar valores al crear o al editar
if ($builder->countAllResults() >= 1) {
if (
($action === Editor::ACTION_EDIT && $id != $pkey)
|| $action === Editor::ACTION_CREATE
) {
// No se pueden duplicar valores al crear o al editar
if ($builder->countAllResults() >= 1) {
if (($action === Editor::ACTION_EDIT && $id != $pkey)
|| $action === Editor::ACTION_CREATE) {
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
return lang('MaquinasTarifasImpresions.validation.duplicated_uso_tipo');
}
}
}
}
@ -413,11 +437,11 @@ class Maquinastarifasimpresion extends \App\Controllers\BaseResourceController
protected function getMaquinaListItems($selId = null)
{
$data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Maquinas.maquina'))])];
if (!empty($selId)) :
if (!empty($selId)):
$maquinaModel = model('App\Models\Configuracion\MaquinaModel');
$selOption = $maquinaModel->where('id', $selId)->findColumn('nombre');
if (!empty($selOption)) :
if (!empty($selOption)):
$data[$selId] = $selOption[0];
endif;
endif;

View File

@ -269,4 +269,25 @@ 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);
}
}
}

View File

@ -156,8 +156,13 @@ 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) ) :
@ -288,4 +293,50 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
return $this->failUnauthorized('Invalid request', 403);
}
}
public function getPapelCliente()
{
if ($this->request->isAJAX()) {
$tipo = goSanitize($this->request->getGet('tipo'))[0];
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$menu = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, false);
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $selected_papel, true);
$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()) {
$tipo = goSanitize($this->request->getGet('tipo'))[0];
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
$items = $this->model->getPapelCliente($tipo, $cubierta, null, true);
$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);
}
}
}

View File

@ -188,6 +188,9 @@ 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;
}
@ -209,6 +212,12 @@ 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

View File

@ -244,23 +244,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
public function menuItems() {
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'ancho'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
$searchStr = goSanitize($this->request->getPfgost('searchTerm'))[0];
$menu = $papelFormatoModel->getElementsForMenu2($searchStr);
if(empty(($searchStr)))
array_shift($menu);
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
@ -268,4 +260,15 @@ class Papelformato extends \App\Controllers\BaseResourceController {
}
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$data = $this->model->getElementsForMenu2($this->request->getGet("q"));
return $this->response->setJSON($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -271,6 +271,27 @@ 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)
{

View File

@ -1,8 +1,8 @@
<?php namespace App\Controllers\Configuracion;
use App\Entities\Usuarios\UserEntity;
use App\Models\Chat\ChatDeparmentModel;
use App\Models\Chat\ChatDeparmentUserModel;
use App\Models\Usuarios\GroupModel;
use App\Models\UserModel;
@ -16,6 +16,8 @@ class Users extends \App\Controllers\GoBaseController
private $group_model;
private $group_user_model;
private $user_model;
private ChatDeparmentModel $chat_department_model;
private ChatDeparmentUserModel $chat_department_user_model;
use \CodeIgniter\API\ResponseTrait;
@ -38,6 +40,9 @@ class Users extends \App\Controllers\GoBaseController
$this->group_model = new GroupModel();
$this->group_user_model = new GroupsUsersModel();
$this->user_model = new UserModel();
$this->chat_department_model = model(ChatDeparmentModel::class);
$this->chat_department_user_model = model(ChatDeparmentUserModel::class);
$this->viewData['pageTitle'] = lang('Users.moduleTitle');
@ -56,7 +61,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();
}
@ -71,14 +76,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']);
// Generar el nombre de usuario
$postData['username'] = strstr($postData['email'], '@', true);
unset($postData['chatDepartments']);
// Marcar el username como NULL
$sanitizedData = $this->sanitized($postData, true);
$noException = true;
@ -90,33 +98,43 @@ class Users extends \App\Controllers\GoBaseController
if ($this->canValidate()) :
try {
$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->dealWithException($e);
if (strpos($e->getMessage(), 'correo duplicado') !== false) {
$this->viewData['errorMessage'] = "El correo electrónico ya está registrado en el sistema";
// 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
}
} catch (\Exception $e) {
$noException = false;
$this->viewData['errorMessage'] = $e->getMessage();
}
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();
@ -128,6 +146,13 @@ 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->insert([
"user_id" => $id,
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()["id"]
]);
}
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
$message = ucfirst(str_replace("'", "\'", $message));
@ -150,6 +175,7 @@ class Users extends \App\Controllers\GoBaseController
$this->viewData['clienteList'] = $this->getClienteListItems();
$this->viewData['formAction'] = route_to('createUser');
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
$this->viewData['chatDepartments'] = $this->chat_department_model->findAll();
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.addNewSuffix');
@ -176,9 +202,11 @@ class Users extends \App\Controllers\GoBaseController
$postData = $this->request->getPost();
$currentGroups = $postData['group'] ?? [];
unset($postData['group']);
$chatDepartments = $postData['chatDepartments'] ?? [];
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'];
@ -233,7 +261,13 @@ 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->insert([
"user_id" => $id,
"chat_department_id" => $this->chat_department_model->where("name", $chatDepartment)->first()["id"]
]);
}
$id = $user->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Users.user'))]) . '.';
$message = ucfirst(str_replace("'", "\'", $message));
@ -256,6 +290,8 @@ 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['chatDepartmentUser'] = $this->chat_department_user_model->getChatDepartmentUser($user->id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
@ -278,7 +314,7 @@ class Users extends \App\Controllers\GoBaseController
endif;
$users = auth()->getProvider();
$users->delete($user->id);
$users->delete($user->id, true);
$message = "Usuario eliminado correctamente";
return $this->redirect2listView('successMessage', $message);
@ -342,13 +378,7 @@ class Users extends \App\Controllers\GoBaseController
if ($this->request->isAJAX()) {
$comerciales = $this->model->getComerciales();
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $comerciales,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
return $this->respond($comerciales);
} else {
return $this->failUnauthorized('Invalid request', 403);
}

View File

@ -41,6 +41,17 @@ class Facturas extends \App\Controllers\BaseResourceController
public function index()
{
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = 0;
}
$this->viewData['cliente_id'] = $clienteId;
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
@ -64,6 +75,17 @@ class Facturas extends \App\Controllers\BaseResourceController
['title' => lang("Facturas.facturaList"), 'route' => "javascript:void(0);", 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = 0;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewFacturasList', $viewData);
}
@ -105,6 +127,10 @@ class Facturas extends \App\Controllers\BaseResourceController
$sanitizedData['user_updated_id'] = auth()->user()->id;
$sanitizedData['user_created_id'] = auth()->user()->id;
if(!$sanitizedData['creditoAsegurado']){
$sanitizedData['creditoAsegurado'] = 0;
}
if ($allData && $successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -205,13 +231,14 @@ class Facturas extends \App\Controllers\BaseResourceController
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$cliente_id = $reqData['cliente_id'] ?? -1;
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource($search, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource("")->countAllResults(),
$this->model->getResource($search)->countAllResults()
$this->model->getResource("", $cliente_id)->countAllResults(),
$this->model->getResource($search, $cliente_id)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);

View File

@ -14,10 +14,10 @@ class Js_loader extends BaseController
function comparadorCosidoTapaBlanda_js()
function comparadorPresupuestoAdmin_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/comparador.js');
return view('themes/vuexy/form/presupuestos/admin/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/cosidotapablanda/_datosLibroItems.js');
return view('themes/vuexy/form/presupuestos/admin/_datosLibroItems.js');
}
function previsualizador_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/previews.js');
return view('themes/vuexy/form/presupuestos/admin/previews.js');
}
function lineasPresupuesto_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.js');
return view('themes/vuexy/form/presupuestos/admin/_lineasPresupuestoItems.js');
}
function tiradasAlternativas_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js');
return view('themes/vuexy/form/presupuestos/admin/_tiradasAlternativasItems.js');
}
function datosServicios_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js');
return view('themes/vuexy/form/presupuestos/admin/_datosServiciosItems.js');
}
function datosEnvios_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.js');
return view('themes/vuexy/form/presupuestos/admin/_datosEnvios.js');
}
function resumenPresupuestos_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js');
return view('themes/vuexy/form/presupuestos/admin/_resumenPresupuestos.js');
}
function presupuestos_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cosidotapablanda/_presupuestos.js');
return view('themes/vuexy/form/presupuestos/admin/_presupuestos.js');
}
function presupuestoCliente_js()
@ -117,5 +117,13 @@ class Js_loader extends BaseController
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/presupuestos/cliente/previews.js');
}
function chat_js()
{
$this->response->setHeader('Content-Type', 'text/javascript');
return view('themes/vuexy/form/mensajes/mensajeria.js');
}
}

View File

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

View File

@ -0,0 +1,64 @@
<?php namespace App\Controllers\Mensajeria;
use App\Controllers\BaseResourceController;
use App\Entities\Mensajeria\ConversacionEntity;
use App\Entities\Sistema\ActivityEntity;
use App\Models\CollectionModel;
use App\Models\Mensajeria\ConversacionModel;
use App\Models\Sistema\ActivityModel;
class MensajesDirectos extends BaseResourceController
{
protected $modelName = ConversacionModel::class;
protected $format = 'json';
protected static $controllerSlug = 'mensajes-internos';
protected static $viewPath = 'themes/vuexy/form/mensajes/';
protected static $indexRoute = 'mensajesView';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = "Mensajeria interna";
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => "Home", 'route' => "javascript:void(0);", 'active' => false],
['title' => lang("App.menu_mensajes"), 'route' => route_to('mensajeriaView'), 'active' => true]
];
parent::initController($request, $response, $logger);
}
public function index()
{
return view(static::$viewPath . static::$indexRoute);
}
public function getChatInfo($conversacionId)
{
// Modelos
$conversacionModel = model('App\Models\Mensajeria\ConversacionModel');
// Verificar si es una solicitud AJAX
if ($this->request->isAJAX()) {
// Obtener los datos
$data = [
'people' => $conversacionModel->getChatParticipants($conversacionId),
'messages' => $conversacionModel->getChatMessages($conversacionId)
];
// Devolver respuesta JSON
return $this->respond($data, 200, 'Chat information retrieved successfully');
} else {
return $this->failForbidden('Only AJAX requests are allowed');
}
}
}

View File

@ -56,8 +56,13 @@ class PrintPresupuestos extends BaseController
$options->set('isRemoteEnabled', true);
$dompdf = new \Dompdf\Dompdf($options);
// Contenido HTML del documento
$dompdf->loadHtml(view(getenv('theme.path').'pdfs/presupuesto', $data));
// 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));
// Establecer el tamaño del papel
$dompdf->setPaper('A4', 'portrait');

View File

@ -5,7 +5,7 @@ use App\Controllers\BaseController;
use App\Entities\Pedidos\PedidoEntity;
use App\Models\Collection;
use App\Models\Pedidos\PedidoModel;
use App\Services\PedidoXMLService;
class Pedido extends \App\Controllers\BaseResourceController
{
@ -21,7 +21,6 @@ class Pedido extends \App\Controllers\BaseResourceController
protected $indexRoute = 'pedidoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Pedidos.moduleTitle');
@ -41,6 +40,17 @@ class Pedido extends \App\Controllers\BaseResourceController
public function index()
{
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$this->viewData['cliente_id'] = $clienteId;
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
@ -53,13 +63,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'activo',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -68,13 +89,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'finalizado',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -83,13 +115,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'cancelado',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -99,13 +142,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'todos',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -243,6 +297,7 @@ class Pedido extends \App\Controllers\BaseResourceController
$order = PedidoModel::SORTABLE_TODOS[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$estado = $reqData['estado'] ?? 'todos';
$cliente_id = $reqData['cliente_id'] ?? -1;
if($estado == 'todos') $estado = '';
$showTotal = $reqData['showTotal'] ?? false;
@ -250,9 +305,9 @@ class Pedido extends \App\Controllers\BaseResourceController
$searchValues = get_filter_datatables_columns($reqData);
$model_linea = model('\App\Models\Pedidos\PedidoLineaModel');
$resourceData = $model_linea->getResource($searchValues, $estado)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $start, $length);
$total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $start, $length);
$resourceData = $model_linea->getResource($searchValues, $estado, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $cliente_id, $start, $length);
$total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $cliente_id, $start, $length);
$total2 = 0;
if($showTotal){
$total2 = $model_linea->getTotalOfTotalAceptado();
@ -327,5 +382,11 @@ class Pedido extends \App\Controllers\BaseResourceController
$pedidoEntity->fecha_encuadernado_text = $pedidoEntity->fecha_encuadernado ? date('d/m/Y', strtotime($pedidoEntity->fecha_encuadernado)) : '';
$pedidoEntity->fecha_entrega_externo_text = $pedidoEntity->fecha_entrega_externo ? date('d/m/Y', strtotime($pedidoEntity->fecha_entrega_externo)) : '';
}
public function get_xml_pedido($pedido_id)
{
$data = PedidoXMLService::generate_xml($pedido_id);
// $xml_service = new PedidoXMLService($this->model);
return $this->respond($data);
}
}

View File

@ -19,22 +19,22 @@ use App\Models\Presupuestos\PresupuestoServiciosExtraModel;
use App\Services\PresupuestoService;
use Exception;
class Cosidotapablanda extends \App\Controllers\BaseResourceController
class Presupuestoadmin extends \App\Controllers\BaseResourceController
{
protected $modelName = "PresupuestoModel";
protected $format = 'json';
protected static $singularObjectName = 'Cosido Tapa Blanda';
protected static $singularObjectNameCc = 'Cosidotapablanda';
protected static $pluralObjectName = 'Cosidos Tapa Blanda';
protected static $pluralObjectNameCc = 'cosidosTapaBlanda';
protected static $singularObjectName = 'Presupuesto Admin';
protected static $singularObjectNameCc = 'Presupuestoadmin';
protected static $pluralObjectName = 'Presupuestos Admin';
protected static $pluralObjectNameCc = 'PresupuestosAdmin';
protected static $controllerSlug = 'cosidotapablanda';
protected static $controllerSlug = 'presupuestoadmin';
protected static $viewPath = 'themes/vuexy/form/presupuestos/cosidotapablanda/';
protected static $viewPath = 'themes/vuexy/form/presupuestos/admin/';
protected $indexRoute = 'cosidotapablandaList';
protected $indexRoute = 'presupuestoadminList';
@ -71,7 +71,7 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewCosidotapablandaList', $viewData);
return view(static::$viewPath . 'viewPresupuestoAdminList', $viewData);
}
@ -126,7 +126,7 @@ class Cosidotapablanda 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('presupuestos/cosidotapablanda/edit/' . $id))->with('sweet-success', $message);
return redirect()->to(site_url('presupuestoadmin/edit/' . $id))->with('sweet-success', $message);
else :
return $this->redirect2listView('sweet-success', $message);
endif;
@ -151,7 +151,7 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
$this->viewData['POD'] = $this->getPOD();
$this->viewData['formAction'] = route_to('createCosidotapablanda', $tipo_impresion_id);
$this->viewData['formAction'] = route_to('createPresupuestoAdmin', $tipo_impresion_id);
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($tipo_impresion_id));
@ -387,7 +387,7 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
$this->viewData = array_merge($this->viewData, $this->getStringsFromTipoImpresion($presupuestoEntity->tipo_impresion_id));
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
$this->viewData['formAction'] = route_to('updatePresupuestoAdmin', $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 Cosidotapablanda extends \App\Controllers\BaseResourceController
// Breadcrumbs
$viewData['breadcrumb'] = [
['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false],
['title' => $breadcrumbTitle, 'route' => site_url('presupuestos/cosidotapablanda/list/' . $tipo_impresion_id), 'active' => true]
['title' => $breadcrumbTitle, 'route' => site_url('presupuestoadmin/list/' . $tipo_impresion_id), 'active' => true]
];
return $viewData;
@ -1278,8 +1278,8 @@ class Cosidotapablanda extends \App\Controllers\BaseResourceController
$input_data['is_duplicado'] = $presupuestoEntity->is_duplicado;
if($presupuestoEntity->papel_formato_personalizado){
$input_data['ancho'] = $presupuestoEntity->ancho;
$input_data['alto'] = $presupuestoEntity->alto;
$input_data['ancho'] = $presupuestoEntity->papel_formato_ancho ;
$input_data['alto'] = $presupuestoEntity->papel_formato_alto ;
}
else{
$model = model("App\Models\Configuracion\PapelFormatoModel");

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,7 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle
$proveedor_id = $reqData['proveedor_id'] ?? 0;
}
else{
$solapas = $reqData['solapas'] ?? -1;
$solapas = $reqData['solapas'] ?? 0;
}
$paginas = $reqData['paginas'] ?? 0;
$tirada = $reqData['tirada'] ?? 0;

View File

@ -0,0 +1,78 @@
<?php
namespace App\Controllers\Sistema;
use App\Controllers\BaseController;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Shield\Authentication\Authenticators\Session;
use CodeIgniter\Shield\Authentication\JWTManager;
use CodeIgniter\Shield\Validation\ValidationRules;
class AuthAPIController extends BaseController
{
use ResponseTrait;
/**
* Authenticate Existing User and Issue JWT.
*/
public function jwtLogin(): ResponseInterface
{
// Get the validation rules
$rules = $this->getValidationRules();
// Validate credentials
if (! $this->validateData($this->request->getJSON(true), $rules, [], config('Auth')->DBGroup)) {
return $this->fail(
['errors' => $this->validator->getErrors()],
$this->codes['unauthorized']
);
}
// Get the credentials for login
$credentials = $this->request->getJsonVar(setting('Auth.validFields'));
$credentials = array_filter($credentials);
$credentials['password'] = $this->request->getJsonVar('password');
/** @var Session $authenticator */
$authenticator = auth('session')->getAuthenticator();
// Check the credentials
$result = $authenticator->check($credentials);
// Credentials mismatch.
if (! $result->isOK()) {
// @TODO Record a failed login attempt
return $this->failUnauthorized($result->reason());
}
// Credentials match.
// @TODO Record a successful login attempt
$user = $result->extraInfo();
/** @var JWTManager $manager */
$manager = service('jwtmanager');
// Generate JWT and return to client
$jwt = $manager->generateToken($user);
return $this->respond([
'access_token' => $jwt,
]);
}
/**
* Returns the rules that should be used for validation.
*
* @return array<string, array<string, array<string>|string>>
* @phpstan-return array<string, array<string, string|list<string>>>
*/
protected function getValidationRules(): array
{
$rules = new ValidationRules();
return $rules->getLoginRules();
}
}

View File

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

View File

@ -1,4 +1,5 @@
<?php namespace App\Controllers\Tarifas;
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseResourceController;
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
use
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
@ -73,9 +74,9 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
{
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -84,10 +85,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$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()) :
if ($this->canValidate()):
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
@ -101,14 +102,14 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$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 ($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);
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
public function edit($requestedId = null)
{
if ($requestedId == null) :
if ($requestedId == null):
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$tarifaEncuadernacionLinea = $this->model->find($id);
if ($tarifaEncuadernacionLinea == false) :
if ($tarifaEncuadernacionLinea == false):
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$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()) :
if ($this->canValidate()):
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
if ($noException && $successfulResult):
$id = $tarifaEncuadernacionLinea->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);
@ -214,45 +215,90 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
->fields(
Field::inst('paginas_libro_min')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
->validator(
'Validate::numeric',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
)
),
Field::inst('paginas_libro_max')
->validator('Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
->validator(
'Validate::numeric',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
)
),
Field::inst('precio_min')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required')
)
),
Field::inst('precio_max')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required')
)
),
Field::inst('total_min')
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal')
)
)
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required')
)
),
Field::inst('margen')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
)
),
Field::inst('tirada_encuadernacion_id'),
Field::inst('user_created_id'),
@ -322,10 +368,10 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cleandatatable = $reqData['cleandatatable'] ?? 0;
if($cleandatatable){
if ($cleandatatable) {
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
@ -338,11 +384,9 @@ class Tarifaencuadernacionlineas extends \App\Controllers\BaseResourceController
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
}
else{
} else {
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);

View File

@ -1,4 +1,5 @@
<?php namespace App\Controllers\Tarifas;
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseResourceController;
@ -10,15 +11,15 @@ use App\Entities\Tarifas\TarifaEncuadernacionLinea;
use App\Models\Tarifas\TarifaEncuadernacionLineaHorasModel;
use
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceController
@ -71,9 +72,9 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
public function add()
{
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -82,10 +83,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$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()) :
if ($this->canValidate()):
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
@ -99,14 +100,14 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$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 ($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);
@ -134,20 +135,20 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
public function edit($requestedId = null)
{
if ($requestedId == null) :
if ($requestedId == null):
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$tarifaEncuadernacionLinea = $this->model->find($id);
if ($tarifaEncuadernacionLinea == false) :
if ($tarifaEncuadernacionLinea == false):
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaEncuadernacionLineas.tarifaencuadernacionLinea')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
if ($this->request->getPost()):
$nullIfEmpty = true; // !(phpversion() >= '8.1');
@ -156,10 +157,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$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()) :
if ($this->canValidate()):
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
@ -176,12 +177,12 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
if ($noException && $successfulResult):
$id = $tarifaEncuadernacionLinea->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);
@ -214,40 +215,79 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas_horas')
->fields(
Field::inst('tiempo_min')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required')
)
),
Field::inst('tiempo_max')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required')
)
),
Field::inst('precio_hora')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required')
)
),
Field::inst('total_min')
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal')
)
)
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required')
)
),
Field::inst('margen')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
->getFormatter('Format::toDecimalChar')->setFormatter('Format::fromDecimalChar')
->validator(
'Validate::numeric',
array(
"decimal" => ',',
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal'))
'message' => lang('TarifaAcabadoLineas.validation.margen.decimal')
)
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaAcabadoLineas.validation.margen.required'))
->validator(
'Validate::notEmpty',
array(
'message' => lang('TarifaAcabadoLineas.validation.margen.required')
)
),
Field::inst('tirada_encuadernacion_id'),
Field::inst('user_created_id'),
@ -314,10 +354,10 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
{
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$cleandatatable = $reqData['cleandatatable'] ?? 0;
if($cleandatatable){
if ($cleandatatable) {
$tarifa_encuadernacion_id = $reqData['tarifa_encuadernacion_id'] ?? -1;
@ -330,9 +370,8 @@ class Tarifaencuadernacionlineashoras extends \App\Controllers\BaseResourceContr
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
}
else{
} else {
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);

View File

@ -126,15 +126,6 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\BaseResourceControlle
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
),
Field::inst('precio_min')
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
->validator('Validate::numeric', array(
"decimal" => ',',
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal'))
)
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
),
Field::inst('proveedor_id')
->validator('Validate::notEmpty', array(
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))

View File

@ -1,4 +1,6 @@
<?php namespace App\Controllers\Tarifas;
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseResourceController;
@ -100,7 +102,7 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
if ($this->request->getPost('servicio_encuadernacion') == null) {
$sanitizedData['servicio_encuadernacion'] = false;
}
if ($this->request->getPost('por_horas') == null) {
$sanitizedData['por_horas'] = false;
}
@ -146,7 +148,7 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
$this->viewData['tarifaEncuadernacionEntity'] = isset($sanitizedData) ? new TarifaEncuadernacionEntity($sanitizedData) : new TarifaEncuadernacionEntity();
$this->viewData['formAction'] = site_url('tarifas/tarifasencuadernacion/add');//route_to('createTarifaEncuadernacion');
$this->viewData['formAction'] = site_url('tarifas/tarifasencuadernacion/add'); //route_to('createTarifaEncuadernacion');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaencuadernacion.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
@ -171,7 +173,7 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
return $this->redirect2listView('sweet-error', $message);
endif;
if ($this->request->getPost()) :
@ -188,7 +190,7 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
$sanitizedData['mostrar_en_presupuesto'] = false;
}
if ($this->request->getPost('tipo_encuadernacion') == null) {
$sanitizedData['tipo_encuadernacion'] = false;
}
@ -335,7 +337,8 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
}
}
private function getProveedores(){
private function getProveedores()
{
$provTipoModel = new ProveedorTipoModel();
$provModel = new ProveedorModel();
@ -343,12 +346,13 @@ class Tarifasencuadernacion extends \App\Controllers\BaseResourceController
return $provModel->getProvList($tipoId);
}
private function getDimensiones(){
private function getDimensiones()
{
$dimensionModel = new TarifaEncuadernacionDimensionesModel();
$dimensiones = $dimensionModel->getDimensiones();
foreach($dimensiones as $dim){
$dim->label= lang("TarifaEncuadernacionLineas." . $dim->label);
foreach ($dimensiones as $dim) {
$dim->label = lang("TarifaEncuadernacionLineas." . $dim->label);
}
return $dimensiones;
}

View File

@ -1,4 +1,5 @@
<?php namespace App\Controllers\Tarifas;
<?php
namespace App\Controllers\Tarifas;
use App\Controllers\BaseResourceController;
@ -14,10 +15,11 @@ 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';
@ -33,9 +35,10 @@ 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;
@ -48,66 +51,68 @@ 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;
@ -120,97 +125,98 @@ 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);
$thenRedirect = true;
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;
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['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['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()
{
@ -222,62 +228,101 @@ 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'),
@ -344,24 +389,35 @@ 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)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource($search, $tarifa_envio_id)
->orderBy($order, $dir)->orderBy($order2, $dir2)->orderBy($order3, $dir3)
->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
@ -373,15 +429,16 @@ 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();
@ -395,7 +452,8 @@ 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];
@ -406,8 +464,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();
@ -422,42 +480,45 @@ 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;
}
}

View File

@ -18,31 +18,72 @@ class Test extends BaseController
{
}
public function index()
public function echo()
{
/*
$model = model("\App\Models\Pedidos\PedidoLineaModel");
$data = $model->obtenerLineasPedidoSinFacturar(999);
*/
xdebug_info();
echo "echo";
}
private function clonar_tarifa_encuadernacion($teOrigen, $teDestino){
public function index()
{
echo "index_test";
}
public function import_users()
{
$users = auth()->getProvider();
$oldUsersModel = model("\\App\\Models\\UsersImportModel");
// Definir el ID inicial y el ID final
$startId = 601; // Cambia esto por tu ID inicial
$endId = 700; // Cambia esto por tu ID final
// Obtener usuarios en el rango actual
$oldUsers = $oldUsersModel
->where('id >=', $startId)
->where('id <=', $endId)
->findAll();
foreach ($oldUsers as $user) {
echo '<pre>' . json_encode($user, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . '</pre>';
// Crear el usuario si pasa la validación
$user_tmp = new \CodeIgniter\Shield\Entities\User([
'username' => $user->email,
'first_name' => $user->name,
'last_name' => $user->lastname,
'cliente_id' => $user->customer_id,
'comments' => $user->description,
'email' => $user->email,
'password' => 'Safekat2024',
'status' => 0,
'active' => $user->active,
]);
// Agregar el usuario al sistema
$users->save($user_tmp);
}
}
private function clonar_tarifa_encuadernacion($teOrigen, $teDestino)
{
$tet_model = model('App\Models\Tarifas\TarifaEncuadernacionTiradaModel');
$tel_model = model('App\Models\Tarifas\TarifaEncuadernacionLineaModel');
$tarifasTiradas = $tet_model->asObject()->where('tarifa_encuadernacion_id',$teOrigen)->findAll();
$tarifasTiradas = $tet_model->asObject()->where('tarifa_encuadernacion_id', $teOrigen)->findAll();
foreach ($tarifasTiradas as $tarifasTirada){
foreach ($tarifasTiradas as $tarifasTirada) {
echo "--->" . $tarifasTirada->id . "<br>";
$tarifasLineas = $tel_model->asObject()->where('tirada_encuadernacion_id',$tarifasTirada->id)->findAll();
$tarifasLineas = $tel_model->asObject()->where('tirada_encuadernacion_id', $tarifasTirada->id)->findAll();
// Prepare the data
unset($tarifasTirada->id);
@ -55,7 +96,7 @@ class Test extends BaseController
$tet_model->insert($tarifasTirada);
$inserted_id = $tet_model->insertID();
foreach ($tarifasLineas as $tarifasLinea){
foreach ($tarifasLineas as $tarifasLinea) {
echo "------>" . $tarifasLinea->id . "<br>";
@ -75,11 +116,10 @@ class Test extends BaseController
}
private function test_get_tirada_alt($tirada, $merma, $tipo_impresion_id,
$json_data, $cliente_id, $ancho, $alto,
$solapas_cubierta, $solapas_ancho_cubierta, $solapas_sobrecubierta, $solapas_ancho_sobrecubierta, $lomo)
{
private function test_get_tirada_alt($tirada, $merma, $tipo_impresion_id,
$json_data, $cliente_id, $ancho, $alto,
$solapas_cubierta, $solapas_ancho_cubierta, $solapas_sobrecubierta, $solapas_ancho_sobrecubierta, $lomo)
{
$values = [];
if ($json_data) {
@ -162,7 +202,6 @@ class Test extends BaseController
}
$opciones_papel = PresupuestoService::get_opciones_papel($uso, $isColor);
$datosTipolog = $linea['gotaNegro'] ?? null;
@ -216,7 +255,7 @@ class Test extends BaseController
// Previo a ejecutar, vaciar la tabla clientes_precios (ojo si hay customizaciones)
$db = \Config\Database::connect();
$db = \Config\Database::connect();
$builder = $db->table('cliente_precios');
$plantillaDefectoId = 5;
@ -527,7 +566,6 @@ class Test extends BaseController
}
public static function testLineasIntRotativa()
{
@ -535,7 +573,6 @@ class Test extends BaseController
$tipo = 'negro';
$datosPedido = (object)array(
'paginas' => 240,
'tirada' => 100,
@ -548,8 +585,8 @@ class Test extends BaseController
$parametrosRotativa = (object)array(
'a_favor_fibra' => 0,
'bnPages' => 240,
'colorPages' => 0,
'bnPages' => 240,
'colorPages' => 0,
'rotativa_gota_negro' => 0,
'rotativa_gota_color' => 0,
);
@ -581,12 +618,12 @@ class Test extends BaseController
var_dump($datosTipologias);
echo '</pre>';
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
$parametrosRotativa->rotativa_gota_color = $datosTipologias[0]->gota_color;
$parametrosRotativa->rotativa_negro = $datosTipologias[0]->negro;
$parametrosRotativa->rotativa_cyan = $datosTipologias[0]->cyan;
$parametrosRotativa->rotativa_magenta = $datosTipologias[0]->magenta;
$parametrosRotativa->rotativa_amarillo = $datosTipologias[0]->amarillo;
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
$parametrosRotativa->rotativa_gota_color = $datosTipologias[0]->gota_color;
$parametrosRotativa->rotativa_negro = $datosTipologias[0]->negro;
$parametrosRotativa->rotativa_cyan = $datosTipologias[0]->cyan;
$parametrosRotativa->rotativa_magenta = $datosTipologias[0]->magenta;
$parametrosRotativa->rotativa_amarillo = $datosTipologias[0]->amarillo;
echo '-------------------------------';
$maquinas = $maquina_model->getMaquinaImpresionForPresupuesto(
@ -598,7 +635,6 @@ class Test extends BaseController
);
foreach ($maquinas as $maquina) {
echo '----------------------------<br>';

View File

@ -0,0 +1,66 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ChatDepartments extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"name" => [
"type" => "VARCHAR",
"constraint" => '45',
"unique" => true,
],
"display" => [
"type" => "VARCHAR",
"constraint" => '255',
],
"description" => [
"type" => "TEXT",
"null" => true,
],
"type" => [
"type" => "ENUM",
'constraint' => ['general', 'presupuesto', 'pedido'],
'default' => 'general',
],
];
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("chat_departments", true);
}
public function down()
{
//
$this->forge->dropTable("chat_departments");
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\RawSql;
use CodeIgniter\Database\Migration;
class ChatsTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"chat_department_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true
],
"pedido_id" => [
"type" => "INT",
"constraint" => 16,
"unsigned" => true,
"null" => true
],
"presupuesto_id" => [
"type" => "INT",
"constraint" => 10,
"unsigned" => true,
"null" => true
],
"factura_id" => [
"type" => "INT",
"constraint" => 10,
"unsigned" => true,
"null" => true
],
];
public function up()
{
$this->forge->dropTable("chat_conversaciones", true);
$this->forge->dropTable("chat_mensajes", true);
$this->forge->dropTable("chat_participantes", true);
$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('pedido_id', 'pedidos', 'id');
$this->forge->addForeignKey('chat_department_id', 'chat_departments', 'id');
$this->forge->addForeignKey('factura_id', 'facturas', 'id');
$this->forge->addForeignKey('presupuesto_id', 'presupuestos', 'id');
$this->forge->createTable("chats", true);
}
public function down()
{
//
$this->forge->dropTable("chats", true);
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ChatMessages extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"auto_increment" => true,
],
"chat_id" => [
"type" => "INT",
"unsigned" => true
],
"sender_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true,
],
"receiver_id" => [
"type" => "INT",
"unsigned" => true,
"null" => true,
],
"message" => [
"type" => "TEXT",
],
"viewed" => [
"type" => "TEXT",
"type" => "boolean",
"default" => false,
],
];
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(['receiver_id'], 'users', ['id']);
$this->forge->addForeignKey(['sender_id'], 'users', ['id']);
$this->forge->addForeignKey(['chat_id'], 'chats', ['id']);
$this->forge->createTable("chat_messages", true);
}
public function down()
{
$this->forge->dropTable("chat_messages", true);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ChatDepartmentUsers extends Migration
{
protected array $COLUMNS = [
"chat_department_id" => [
"type" => "INT",
"unsigned" => true,
],
"user_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->addForeignKey(["user_id"], "users", ["id"]);
$this->forge->addForeignKey(["chat_department_id"], "chat_departments", ["id"]);
$this->forge->createTable("chat_department_users", true);
}
public function down()
{
$this->forge->dropTable("chat_department_users");
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ConfigVariablesApp extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"name" => [
"type" => "VARCHAR",
"constraint" => '45',
"unique" => true,
],
"value" => [
"type" => "VARCHAR",
"constraint" => '255',
"null" => true
],
"description" => [
"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->createTable("config_variables_app", true);
}
public function down()
{
$this->forge->dropTable("config_variables_app");
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ChatUsers extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"chat_id" => [
"type" => "INT",
"unsigned" => true,
],
"user_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(["user_id"], "users", ["id"]);
$this->forge->addForeignKey(["chat_id"], "chats", ["id"]);
$this->forge->createTable("chat_users", true);
}
public function down()
{
$this->forge->dropTable("chat_users");
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\RawSql;
use CodeIgniter\Database\Migration;
class AlterChatTableAddTitleColumn extends Migration
{
protected array $COLUMNS = [
"title" => [
"type" => "VARCHAR",
"constraint" => 255,
"null" => true
],
];
public function up()
{
$this->forge->addColumn("chats",$this->COLUMNS);
}
public function down()
{
//
$this->forge->dropColumn("chats","title");
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class ChatNotifications extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"chat_message_id" => [
"type" => "INT",
],
"user_id" => [
"type" => "INT",
"unsigned" => true,
],
"viewed" => [
"type" => "BOOLEAN",
"default" => false
],
];
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(["chat_message_id"], "chat_messages", ["id"]);
$this->forge->addForeignKey(["user_id"], "users", ["id"]);
$this->forge->createTable("chat_notifications", true);
}
public function down()
{
$this->forge->dropTable("chat_notifications");
}
}

View File

@ -0,0 +1,27 @@
<?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');
}
}

View File

@ -0,0 +1,37 @@
<?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,
],
]);
}
}

View File

@ -0,0 +1,40 @@
<?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');
}
}

View File

@ -0,0 +1,46 @@
<?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');
}
}

View File

@ -0,0 +1,26 @@
<?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');
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace App\Database\Seeds;
use App\Models\Chat\ChatDeparmentModel;
use App\Models\Chat\ChatDeparmentUserModel;
use CodeIgniter\Database\Seeder;
use App\Models\Usuarios\UserModel;
class ChatSeeder extends Seeder
{
public function run()
{
$data = [
[
"name" => "_produccion",
"display" => "Producción",
"users" => [
"mbalbaci@safekat.com",
"mari.cano@safekat.com",
"beatriz@safekat.com",
"imnavajas@coit.es",
],
],
[
"name" => "_pod",
"display" => "POD",
"users" => [
"pod@safekat.com",
"imnavajas@coit.es",
],
],
[
"name" => "_maquetacion",
"display" => "Maquetación",
"users" => [
"maquetacion@safekat.com",
"imnavajas@coit.es",
],
],
// [
// "name" => "_comercial",
// "display" => "Comercial",
// "users" => [
// "incidencias@safekat.com",
// ],
// ],
[
"name" => "_incidencias",
"display" => "Incidencias",
"users" => [
"incidencias@safekat.com",
],
],
[
"name" => "_logistica",
"display" => "Logística",
"users" => [
"logistica@safekat.com",
"imnavajas@coit.es",
],
],
[
"name" => "_admin",
"display" => "Administración",
"users" => [
"contabilidad@safekat.com",
"imnavajas@coit.es",
],
],
];
$chatDeparmentModel = model(ChatDeparmentModel::class);
$chatDeparmentUsersModel = model(ChatDeparmentUserModel::class);
$userModel = model(UserModel::class);
foreach ($data as $row) {
$chatDeparmentId = $chatDeparmentModel->insert(["name" => $row["name"], "display" => $row["display"]]);
if (count($row["users"]) > 0) {
foreach ($row["users"] as $mail) {
$user = $userModel->like("username", explode("@",$mail)[0])->first();
if ($user) {
echo $user->id."\r\n";
$chatDeparmentUsersModel->insert(['user_id' => $user->id, "chat_department_id" => $chatDeparmentId]);
}
}
}
};
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Database\Seeds;
use App\Models\Configuracion\ConfigVariableModel;
use CodeIgniter\Database\Seeder;
class DefaultConfigVariablesSeeder extends Seeder
{
protected array $data = [
[
"name" => "tamanio_solapas_min",
"value" => 50,
"description" => "Mínimo tamaño solapas"
],
[
"name" => "tamanio_solapas_max",
"value" => 150,
"description" => "Máximo tamaño solapas"
],
[
"name" => "limite_produccion_diaria",
"value" => 6000,
"description" => "Número de libros máximos que se puede producir al día"
],
];
public function run()
{
$variableModel = model(ConfigVariableModel::class);
foreach ($this->data as $row) {
if($variableModel->where("name",$row["name"])->first() == null){
$variableModel->insert($row);
}
}
}
}

View File

@ -10,13 +10,15 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
"nombre" => null,
"code" => null,
"code_ot" => null,
"show_in_client" => true,
"show_in_client" => false,
"show_in_client_special" => false,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"show_in_client" => "boolean",
"show_in_client_special" => "boolean",
"is_deleted" => "int",
];
}

View File

@ -15,6 +15,7 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
"espesor" => 0.0,
"gramaje" => null,
"precio_tonelada" => null,
"interior" => true,
"bn" => true,
"color" => true,
"cubierta" => false,
@ -22,6 +23,8 @@ class PapelImpresion extends \CodeIgniter\Entity\Entity
"guardas" => false,
"inkjet" => false,
"rotativa" => false,
"isActivo" => true,
"use_in_client" => false,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
@ -33,12 +36,15 @@ 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",
"is_deleted" => "int",
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Entities\Mensajeria;
use CodeIgniter\Entity\Entity;
class ConversacionEntity extends Entity
{
protected $attributes = [
'id' => null,
'pedido_libro_id' => null,
'pedido_maquetacion_id' => null,
'factura_id' => null,
'departamento' => null,
'asunto' => null,
'created_at' => null,
'updated_at' => null,
'deleted_at' => null,
];
protected $casts = [
"pedido_libro_id" => "?int",
"pedido_maquetacion_id" => "?int",
"factura_id" => "?int"
];
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Entities\Mensajeria;
use CodeIgniter\Entity\Entity;
class ParticipanteEntity extends Entity
{
protected $attributes = [
'id' => null,
'conversacion_id' => null,
'usuario_id' => null,
'cliente_id' => null,
'email' => null,
'last_read' => null,
'created_at' => null,
'updated_at' => null,
'deleted_at' => null,
];
protected $casts = [
"conversacion_id" => "?int",
"usuario_id" => "?int",
"cliente_id" => "?int"
];
}

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
"precio_max" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"total_min" => 0,
"margen" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
@ -31,6 +32,7 @@ class TarifaEncuadernacionLinea extends \CodeIgniter\Entity\Entity
"precio_max" => "float",
"tirada_min" => "float",
"tirada_max" => "float",
"total_min" => "float",
"margen" => "float",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

@ -11,6 +11,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
"tiempo_min" => 0,
"tiempo_max" => 0,
"precio_hora" => 0,
"total_min" => 0,
"margen" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
@ -22,6 +23,7 @@ class TarifaEncuadernacionLineaHoras extends \CodeIgniter\Entity\Entity
"tirada_encuadernacion_id" => "int",
"tiempo_min" => "float",
"tiempo_max" => "float",
"total_min" => "float",
"precio_hora" => "float",
"margen" => "float",
"user_created_id" => "int",

View File

@ -11,7 +11,6 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
"tirada_min" => 0,
"tirada_max" => 0,
"proveedor_id" => 0,
"precio_min" => 0,
"importe_fijo" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
@ -24,7 +23,6 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
"tirada_min" => "float",
"tirada_max" => "float",
"proveedor_id" => "int",
"precio_min" => "float",
"importe_fijo" => "float",
"user_created_id" => "int",
"user_updated_id" => "int",

View File

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

View File

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

View File

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

View File

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

0
ci4/app/Helpers/general_helper.php Executable file → Normal file
View File

View File

@ -54,6 +54,9 @@ return [
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',
'vencimiento' => 'Vencimiento',
'direccionesEnvio' => 'Shipping Addresses',
'validation' => [
'ccc' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',

View File

@ -6,7 +6,7 @@ return [
'moduleTitleCosidoTB' => 'Budget for Softcover Stitched Book',
'moduleTitleFresadoTB' => 'Budget for Softcover Milling Book',
'presupuestoCosidotapablandaList' => 'List of budgets for Softcover Stitched Books',
'presupuestoPresupuestoAdminList' => 'List of budgets for Softcover Stitched Books',
'presupuestoFresadotapablandaList' => 'List of budgets for Milling Stitched Books',
'presupuesto' => 'Budget',
@ -31,12 +31,12 @@ return [
'presupuestoEstadoAceptado' => 'Acepted',
'incidencia' => 'Incident',
'reimpresion' => 'Reprint',
'reimpresion' => 'Free of charge',
'autor' => 'Author',
'coleccion' => 'Collection',
'numeroEdicion' => 'Edition number',
'isbn' => 'ISBN',
'referenciaCliente' => 'Customer reference',
'formatoLibro' => "Book format",
'papelFormatoId' => "Size",
'papelFormatoPersonalizado' => 'Custom size',
'papelFormatoAncho' => 'Width',
@ -51,7 +51,7 @@ return [
'merma' => 'Weakening',
'mermacubierta' => 'Cover weakening',
'tipoImpresion' => 'Printing type',
'papelesComparadorCosidoTapaBlanda' => 'Interior and cover papers',
'papelesComparadorPresupuestoAdmin' => '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',

View File

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

View File

@ -13,7 +13,7 @@ return [
'nombre' => 'Name',
'precioMax' => 'Price Max',
'precioMin' => 'Price Min',
'precioMin' => 'Min Price',
'importeMinimo' => 'Min Price',
'importeFijo' => 'Fixed amount',
'mostrar_en_presupuesto' => 'Show in budget',
'margen' => 'Margin',

View File

@ -19,6 +19,7 @@ return [
'updatedAt' => 'Updated At',
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',
'coste' => 'Cost',
'validation' => [
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',

View File

@ -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',

View File

@ -26,8 +26,12 @@ return [
"global_inactive" => "Inactivo",
"global_copy" => "Dupdo",
"global_print" => "Impresión",
"global_print2" => "Imprimir",
"global_confirm" => "Confirmar",
"global_excel" => "Excel",
"global_pdf" => "PDF",
"global_prev" => "Anterior",
"global_next" => "Siguiente",
// LOGIN - Index
"login_title" => "Iniciar sesión en su cuenta",
@ -670,15 +674,17 @@ return [
// MENUS
"menu_dashboard" => "Panel de control",
"menu_clientes" => "Clientes",
"menu_plantillas_tarifas_clientes" => "Plantillas Tarifas",
"menu_perfil_clientes" => "Perfil",
"menu_direcciones_clientes" => "Direcciones",
"menu_cliente" => "Cliente",
"menu_clientes_nuevo" => "Nuevo",
"menu_tarifacliente" => "Tarifas",
"menu_configuration" => "Configuración",
"menu_variables" => "Variables sistema",
"menu_error_presupuesto" => "Errores presupuesto",
"menu_calendario" => "Calendario",
"menu_paises" => "Paises",
"menu_correo" => "Correo",

View File

@ -0,0 +1,14 @@
<?php
return [
"chat" => "Mensajería",
"messages" => "Mensajes",
"modal" => [
"new_hebra" => "Nuevo hilo",
"title" => "Título",
"new_message" => "Nuevo mensaje",
"new_receivers" => "Nuevos participantes",
"btn_send" => "Enviar",
"btn_send_update" => "Enviar"
]
];

View File

@ -46,6 +46,9 @@ return [
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',
'vencimiento' => 'Vencimiento',
'direccionesEnvio' => 'Direcciones de Envío',
'validation' => [
'ccc' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',

View File

@ -0,0 +1,22 @@
<?php
return [
"cardTitle" => "Variables del sistema",
"modal" => [
"title" => "Editar variable"
],
"datatable" =>
[
"columns" => [
"name" => "Nombre",
"value" => "Valor",
"description" => "Descripción",
]
],
"form" =>
[
"name" => "Nombre",
"value" => "Valor",
"description" => "Descripción",
]
];

View File

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

View File

@ -16,6 +16,7 @@ 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',

View File

@ -5,6 +5,7 @@
return [
'alto' => 'Alto',
'ancho' => 'Ancho',
'interior' => 'Interior',
'bn' => 'B/N',
'color' => 'Color',
'createdAt' => 'Creado en',
@ -35,6 +36,7 @@ return [
'rotativa' => 'Rotativa',
'updatedAt' => 'Actualizado en',
'activo' => 'Activo?',
'useInClient' => 'Usar en presup. cliente',
'userUpdateId' => 'ID usuario actualización',
'consumo_tintas_rotativas' => 'Consumo tintas',

View File

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

View File

@ -19,6 +19,7 @@ return [
'adminRolTooltip' => 'Permitir acceso completo al sistema',
// System permissions
'viewPermission' => 'Visualizar',
'createPermission' => 'Crear',
'editPermission' => 'Editar',
'deletePermission' => 'Eliminar',
@ -27,8 +28,13 @@ return [
'clientesSection' => 'Clientes',
'plantillaTarifaSection' => 'Plantilla de tarifas',
'perfilSection' => 'Perfil',
'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',

View File

@ -20,6 +20,10 @@ return [
'menor_a5' =>'Hasta A5',
'entre_a5_a4' =>'Entre A5 y A4',
'mayor_a4' =>'Desde A4',
'menor_a5_apaisado' =>'Hasta A5 apaisado',
'entre_a5_a4_apaisado' =>'Entre A5 y A4 apaisado',
'mayor_a4_apaisado' =>'Desde A4 apaisado',
'210x210' =>'210x210',
'por_defecto' =>'Genérico',
'moduleExplanation' => 'El número de páginas reflejado en este apartado se refiere por ejemplar, no al total del pedido',
'margen' => 'Margen',

View File

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

View File

@ -7,6 +7,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Servicios Extra',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precio' => 'Precio',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
@ -18,6 +21,7 @@ return [
'updatedAt' => 'Actualizado en',
'userCreatedId' => 'ID Usuario \"Creado en\"',
'userUpdateId' => 'ID Usuario \"Actualizado en\"',
'coste' => 'Coste',
'validation' => [
'nombre' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',

View File

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

View File

@ -7,6 +7,9 @@ return [
'id' => 'ID',
'moduleTitle' => 'Tarifas Preimpresión',
'nombre' => 'Nombre',
'code' => 'Código',
'comment' => 'Comentario',
'comment_placeholder' => 'Inserte un comentario',
'precio' => 'Precio',
'precioMin' => 'Precio Mínimo',
'importeFijo' => 'Importe Fijo',
@ -18,13 +21,23 @@ return [
'updatedAt' => 'Actualizado en',
'userCreatedId' => 'ID Usuario \"Creado en\"',
'userUpdateId' => 'ID Usuario \"Actualizado en\"',
'coste' => 'Coste',
'validation' => [
'nombre' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'code' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'comment' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
'required' => 'El campo {field} es obligatorio.',
],
'precio' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',

View File

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

View File

@ -18,6 +18,7 @@ return [
'emailConfirmed' => 'Email Confirmado',
'firstName' => 'Nombre',
'group' => 'Rol',
'chatDepartments' => 'Chat departamento',
'idUser' => 'ID Usuario',
'language' => 'Idioma',
'lastAccess' => 'Último acceso',

View File

@ -0,0 +1,81 @@
<?php
namespace App\Libraries;
use App\Models\Pedidos\PedidoLineaModel;
use App\Models\Presupuestos\PresupuestoFicheroModel;
use Exception;
use phpseclib3\Net\SFTP;
class SafekatFtpClient
{
protected SFTP $ftp;
protected string $host;
protected int $port;
protected string $username;
protected string $password;
protected string $base_dir;
protected bool $xml_enabled;
protected object $pedido_xml_config;
public function __construct()
{
$this->pedido_xml_config = config("PedidoXML");
$this->host = $this->pedido_xml_config->host;
$this->username = $this->pedido_xml_config->username;
$this->password = $this->pedido_xml_config->password;
$this->port = $this->pedido_xml_config->port;
$this->base_dir = $this->pedido_xml_config->base_dir;
$this->xml_enabled = $this->pedido_xml_config->xml_enabled;
$this->ftp = new SFTP($this->host);
}
/**
* Upload the content of $filename to the base directory declared in App\Config\FTP.php
*
* @param string $content
* @param string $filename
* @return boolean
*/
public function uploadXML(string $content, string $filename): bool
{
try {
if ($this->xml_enabled == false) return false;
$remotePath = implode("/", [$this->base_dir,'pedidos','xml_nuevos']);
$this->ftp->login(username: $this->username, password: $this->password);
if(!$this->ftp->is_dir($remotePath)){
$this->ftp->mkdir($remotePath,recursive:true);
}
$this->ftp->put($remotePath.'/'.$filename, $content);
return true;
} catch (\Throwable $th) {
throw $th;
log_message('error', $th->getMessage());
return false;
}
}
public function uploadFilePresupuesto(int $presupuesto_id)
{
try {
$model = model(PresupuestoFicheroModel::class);
$modelPedidoLinea = model(PedidoLineaModel::class);
$pedidoLinea = $modelPedidoLinea->findByPresupuesto($presupuesto_id);
$rootIdExtern = 1e6 + $pedidoLinea->pedido_id;
$presupuestoFiles = $model->getFiles($presupuesto_id);
$this->ftp->login(username: $this->username, password: $this->password);
foreach ($presupuestoFiles as $key => $value) {
$filename = array_reverse(explode("/", $value->file_path))[0];
$remoteDir = implode("/", [$this->base_dir,"pedidos_files",$rootIdExtern]);
$remoteFile = implode("/", [$this->base_dir,"pedidos_files",$rootIdExtern,$filename]);
if(!$this->ftp->is_dir($remoteDir)){
$this->ftp->mkdir($remoteDir,recursive:true);
}
$this->ftp->put($remoteFile,$value->file_path,mode:$this->ftp::SOURCE_LOCAL_FILE);
}
} catch (Exception $e) {
log_message('error', $e->getMessage());
throw $e;
}
}
}

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