utn-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/commands/backend.js +282 -0
  2. package/commands/db.js +49 -0
  3. package/commands/frontend.js +225 -0
  4. package/index.js +98 -0
  5. package/package.json +27 -0
  6. package/templates/backend/InformacionDelModulo.json +21 -0
  7. package/templates/backend/NOMBRE_DEL_CANONICO_DEL_PROYECTO.rest +74 -0
  8. package/templates/backend/README.md +0 -0
  9. package/templates/backend/gitignore +3 -0
  10. package/templates/backend/index.rest +288 -0
  11. package/templates/backend/package.json +30 -0
  12. package/templates/backend/reporte.pdf +0 -0
  13. package/templates/backend/rutas/API.js +49 -0
  14. package/templates/backend/rutas/Servicio1.js +184 -0
  15. package/templates/backend/rutas/misc.js +671 -0
  16. package/templates/backend/rutas/rutas.js +11 -0
  17. package/templates/backend/server.js +79 -0
  18. package/templates/backend/servicios/API.js +101 -0
  19. package/templates/backend/servicios/InformacionDelModulo.js +70 -0
  20. package/templates/backend/servicios/Nucleo/EnvioDeCorreos.js +45 -0
  21. package/templates/backend/servicios/Nucleo/ManejadorDeErrores.js +54 -0
  22. package/templates/backend/servicios/Nucleo/Miscelaneas.js +1901 -0
  23. package/templates/backend/servicios/Nucleo/Monitoreo.js +65 -0
  24. package/templates/backend/servicios/Nucleo/db.js +78 -0
  25. package/templates/backend/servicios/Servicio1.js +118 -0
  26. package/templates/backend/variables-calidad.env +6 -0
  27. package/templates/backend/variables-desarrollo.env +6 -0
  28. package/templates/backend/variables-pruebas.env +6 -0
  29. package/templates/bd/README.md +78 -0
  30. package/templates/bd/cumulodb-scripts/gitignore +1 -0
  31. package/templates/bd/docker-compose.yml +28 -0
  32. package/templates/bd/docker-scripts/1-crear estructura.sql +29 -0
  33. package/templates/bd/docker-scripts/2-cambios estructura original.sql +1 -0
  34. package/templates/bd/docker-scripts/3-insertar datos de prueba.sql +1 -0
  35. package/templates/bd/docker-scripts/4-crear eventos y rutinas.sql +1 -0
  36. package/templates/bd/docker-scripts/5-crear vistas.sql +1 -0
  37. package/templates/bd/docker-scripts/6-calidad.sql +1 -0
  38. package/templates/bd/docker-scripts/7-pruebas.sql +1 -0
  39. package/templates/bd/docker-scripts/8-local.sql +1 -0
  40. package/templates/bd/servidores-scripts/calidad.sql +1 -0
  41. package/templates/bd/servidores-scripts/datos_iniciales_produccion.sql +1 -0
  42. package/templates/bd/servidores-scripts/produccion.sql +1 -0
  43. package/templates/bd/servidores-scripts/pruebas.sql +1 -0
  44. package/templates/frontend/.vscode/extensions.json +4 -0
  45. package/templates/frontend/.vscode/launch.json +20 -0
  46. package/templates/frontend/.vscode/tasks.json +42 -0
  47. package/templates/frontend/Dockerfile +5 -0
  48. package/templates/frontend/README.md +59 -0
  49. package/templates/frontend/angular.json +101 -0
  50. package/templates/frontend/dist/frontend/3rdpartylicenses.txt +459 -0
  51. package/templates/frontend/dist/frontend/prerendered-routes.json +3 -0
  52. package/templates/frontend/docker-compose.yml +5 -0
  53. package/templates/frontend/editorconfig +17 -0
  54. package/templates/frontend/gitignore +45 -0
  55. package/templates/frontend/nginx.conf +12 -0
  56. package/templates/frontend/package.json +46 -0
  57. package/templates/frontend/public/favicon.ico +0 -0
  58. package/templates/frontend/src/app/Componentes/Nucleo/graficos/graficos.component.css +15 -0
  59. package/templates/frontend/src/app/Componentes/Nucleo/graficos/graficos.component.html +25 -0
  60. package/templates/frontend/src/app/Componentes/Nucleo/graficos/graficos.component.ts +80 -0
  61. package/templates/frontend/src/app/Componentes/Nucleo/iframe/iframe.ts +37 -0
  62. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion/mensaje-confirmacion.component.css +5 -0
  63. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion/mensaje-confirmacion.component.html +22 -0
  64. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion/mensaje-confirmacion.ts +64 -0
  65. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion-html/mensaje-confirmacion-html.component.css +5 -0
  66. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion-html/mensaje-confirmacion-html.component.html +22 -0
  67. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-confirmacion-html/mensaje-confirmacion-html.ts +64 -0
  68. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-informacion/mensaje-informacion.component.css +5 -0
  69. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-informacion/mensaje-informacion.component.html +11 -0
  70. package/templates/frontend/src/app/Componentes/Nucleo/mensaje-informacion/mensaje-informacion.ts +46 -0
  71. package/templates/frontend/src/app/Componentes/Nucleo/mensajes/mensajes.component.css +11 -0
  72. package/templates/frontend/src/app/Componentes/Nucleo/mensajes/mensajes.component.html +17 -0
  73. package/templates/frontend/src/app/Componentes/Nucleo/mensajes/mensajes.component.ts +43 -0
  74. package/templates/frontend/src/app/Componentes/Nucleo/reporte-de-incidencias/reporte-de-incidencias.component.css +37 -0
  75. package/templates/frontend/src/app/Componentes/Nucleo/reporte-de-incidencias/reporte-de-incidencias.component.html +35 -0
  76. package/templates/frontend/src/app/Componentes/Nucleo/reporte-de-incidencias/reporte-de-incidencias.component.ts +103 -0
  77. package/templates/frontend/src/app/Componentes/Nucleo/subir-archivo/subir-archivo.component.css +90 -0
  78. package/templates/frontend/src/app/Componentes/Nucleo/subir-archivo/subir-archivo.component.html +39 -0
  79. package/templates/frontend/src/app/Componentes/Nucleo/subir-archivo/subir-archivo.component.ts +132 -0
  80. package/templates/frontend/src/app/Componentes/Nucleo/tabla/paginador-personalizado.ts +17 -0
  81. package/templates/frontend/src/app/Componentes/Nucleo/tabla/tabla.component.css +332 -0
  82. package/templates/frontend/src/app/Componentes/Nucleo/tabla/tabla.component.html +166 -0
  83. package/templates/frontend/src/app/Componentes/Nucleo/tabla/tabla.component.ts +228 -0
  84. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta/tarjeta.component.css +129 -0
  85. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta/tarjeta.component.html +35 -0
  86. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta/tarjeta.component.ts +46 -0
  87. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-modulo/tarjeta-modulo.component.css +92 -0
  88. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-modulo/tarjeta-modulo.component.html +17 -0
  89. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-modulo/tarjeta-modulo.component.ts +42 -0
  90. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-multiple/tarjeta-multiple.component.css +90 -0
  91. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-multiple/tarjeta-multiple.component.html +22 -0
  92. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-multiple/tarjeta-multiple.component.ts +46 -0
  93. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-reporte/tarjeta-reporte.component.css +129 -0
  94. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-reporte/tarjeta-reporte.component.html +20 -0
  95. package/templates/frontend/src/app/Componentes/Nucleo/tarjeta-reporte/tarjeta-reporte.component.ts +25 -0
  96. package/templates/frontend/src/app/Componentes/guardar-incapacidad/guardar-incapacidad.component.css +20 -0
  97. package/templates/frontend/src/app/Componentes/guardar-incapacidad/guardar-incapacidad.component.html +46 -0
  98. package/templates/frontend/src/app/Componentes/guardar-incapacidad/guardar-incapacidad.component.ts +64 -0
  99. package/templates/frontend/src/app/Paginas/Nucleo/contenedor-componentes/contenedor-componentes.component.css +142 -0
  100. package/templates/frontend/src/app/Paginas/Nucleo/contenedor-componentes/contenedor-componentes.component.html +90 -0
  101. package/templates/frontend/src/app/Paginas/Nucleo/contenedor-componentes/contenedor-componentes.component.ts +139 -0
  102. package/templates/frontend/src/app/Paginas/contenedor-principal/contenedor-principal.component.css +4 -0
  103. package/templates/frontend/src/app/Paginas/contenedor-principal/contenedor-principal.component.html +17 -0
  104. package/templates/frontend/src/app/Paginas/contenedor-principal/contenedor-principal.component.ts +36 -0
  105. package/templates/frontend/src/app/Paginas/gestion-de-reportes/gestion-de-reportes.component.css +4 -0
  106. package/templates/frontend/src/app/Paginas/gestion-de-reportes/gestion-de-reportes.component.html +6 -0
  107. package/templates/frontend/src/app/Paginas/gestion-de-reportes/gestion-de-reportes.component.ts +36 -0
  108. package/templates/frontend/src/app/Paginas/gestion-graficos/gestion-graficos.component.css +13 -0
  109. package/templates/frontend/src/app/Paginas/gestion-graficos/gestion-graficos.component.html +13 -0
  110. package/templates/frontend/src/app/Paginas/gestion-graficos/gestion-graficos.component.ts +75 -0
  111. package/templates/frontend/src/app/Paginas/gestion-iframe1/gestion-iframe1.component.css +13 -0
  112. package/templates/frontend/src/app/Paginas/gestion-iframe1/gestion-iframe1.component.html +3 -0
  113. package/templates/frontend/src/app/Paginas/gestion-iframe1/gestion-iframe1.component.ts +14 -0
  114. package/templates/frontend/src/app/Paginas/gestion-tabla/gestion-tabla.component.css +13 -0
  115. package/templates/frontend/src/app/Paginas/gestion-tabla/gestion-tabla.component.html +24 -0
  116. package/templates/frontend/src/app/Paginas/gestion-tabla/gestion-tabla.component.ts +300 -0
  117. package/templates/frontend/src/app/Paginas/gestion-tabla-XYZ/gestion-tabla-XYZ.component.css +13 -0
  118. package/templates/frontend/src/app/Paginas/gestion-tabla-XYZ/gestion-tabla-XYZ.component.html +43 -0
  119. package/templates/frontend/src/app/Paginas/gestion-tabla-XYZ/gestion-tabla-XYZ.component.ts +305 -0
  120. package/templates/frontend/src/app/Paginas/gestion-tabla-jefe/gestion-tabla-jefe.component.css +13 -0
  121. package/templates/frontend/src/app/Paginas/gestion-tabla-jefe/gestion-tabla-jefe.component.html +25 -0
  122. package/templates/frontend/src/app/Paginas/gestion-tabla-jefe/gestion-tabla-jefe.component.ts +245 -0
  123. package/templates/frontend/src/app/analytics.module.ts +45 -0
  124. package/templates/frontend/src/app/app.component.css +0 -0
  125. package/templates/frontend/src/app/app.component.html +1 -0
  126. package/templates/frontend/src/app/app.component.ts +10 -0
  127. package/templates/frontend/src/app/app.config.server.ts +14 -0
  128. package/templates/frontend/src/app/app.config.ts +27 -0
  129. package/templates/frontend/src/app/app.routes.ts +16 -0
  130. package/templates/frontend/src/app/auth.interceptor.ts +26 -0
  131. package/templates/frontend/src/app/datos-globales.service.ts +45 -0
  132. package/templates/frontend/src/assets/Puntos.svg +94 -0
  133. package/templates/frontend/src/index.html +36 -0
  134. package/templates/frontend/src/main.server.ts +7 -0
  135. package/templates/frontend/src/main.ts +6 -0
  136. package/templates/frontend/src/styles.css +14 -0
  137. package/templates/frontend/tsconfig.app.json +15 -0
  138. package/templates/frontend/tsconfig.json +27 -0
  139. package/templates/frontend/tsconfig.spec.json +15 -0
  140. package/utils/index.js +105 -0
@@ -0,0 +1,300 @@
1
+ import { Component } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { MatSelectModule } from '@angular/material/select';
4
+ import { MatFormFieldModule } from '@angular/material/form-field';
5
+ import { MatRadioModule } from '@angular/material/radio';
6
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
7
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
8
+ import { DatosGlobalesService } from '../../datos-globales.service';
9
+ import { MatDialog } from '@angular/material/dialog';
10
+ import { TablaComponent } from '../../Componentes/Nucleo/tabla/tabla.component';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import { GuardarIncapacidadComponent } from '../../Componentes/guardar-incapacidad/guardar-incapacidad.component';
13
+ import { MensajeConfirmacionComponent } from '../../Componentes/Nucleo/mensaje-confirmacion/mensaje-confirmacion';
14
+ import { SubirArchivoComponent } from '../../Componentes/Nucleo/subir-archivo/subir-archivo.component';
15
+ import { MensajeInformacionComponent } from '../../Componentes/Nucleo/mensaje-informacion/mensaje-informacion';
16
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
17
+
18
+ @Component({
19
+ selector: 'app-gestion-tabla',
20
+ imports: [
21
+ TablaComponent,
22
+ MatFormFieldModule,
23
+ MatSelectModule,
24
+ FormsModule,
25
+ MatRadioModule,
26
+ MatProgressBarModule,
27
+ MatButtonModule,
28
+ MatProgressSpinnerModule
29
+ ],
30
+ templateUrl: './gestion-tabla.component.html',
31
+ styleUrls: ['./gestion-tabla.component.css'],
32
+ })
33
+ export class GestionTablaComponent {
34
+ // public DatosParaPoblarLaTabla: any[] = [];
35
+ // Si NO se inicializa muestra la barra de "cargando" y se queda "pegado" en "cargando", esto pasa con más de 15.000 registros
36
+ public DatosParaPoblarLaTabla: any[] = [];
37
+ public tiposDeLicencias: any[] = [];
38
+ public cargando = false;
39
+
40
+ // TipoDeFiltro: Ninguno,BaseDeDatos,Tabla
41
+ // Ninguno: la columna no aparecerá en la lista desplegable
42
+ // BaseDeDatos: para las tablas paginadas se usará en la cláusa WHERE
43
+ // Tabla: para las NO tablas paginadas se usará predeterminadamente
44
+ // Si la tabla no pagina los resultados, TipoDeFiltro puede ser siempre 'Tabla'
45
+ public columnas = [
46
+ { Llave: 'NumeroBoleta', Alias: 'N° de boleta', TipoDeFiltro: 'Tabla' },
47
+ { Llave: 'Descripcion', Alias: 'Tipo de ausencia', TipoDeFiltro: 'Tabla' },
48
+ { Llave: 'FechaDeInicio', Alias: 'Fecha de inicio', TipoDeFiltro: 'Tabla' },
49
+ { Llave: 'FechaDeFinal', Alias: 'Fecha final', TipoDeFiltro: 'Tabla' },
50
+ { Llave: 'TotalDeDias', Alias: 'Total de días', TipoDeFiltro: 'Tabla' },
51
+ { Llave: 'CodigoDeDoctor', Alias: 'Código y nombre del doctor', TipoDeFiltro: 'Tabla' },
52
+ { Llave: 'AreaDeSalud', Alias: 'Área de salud', TipoDeFiltro: 'Tabla' },
53
+ { Llave: 'Estado', Alias: 'Estado', TipoDeFiltro: 'Tabla' }
54
+ ];
55
+
56
+ public estadosQuePermitenEdicion = ['Pendiente'];
57
+ // https://fonts.google.com/icons
58
+ acciones = [
59
+ { icono: 'edit', color: 'azul', textoAyuda: 'Editar', ejecutar: (fila: any) => this.AbrirModal(fila), },
60
+ { icono: 'draw', color: 'marino', textoAyuda: 'Firmar', ejecutar: (fila: any) => this.confirmacionFirmaDelUsuario(fila), },
61
+ { icono: 'delete', color: 'rojo', textoAyuda: 'Eliminar', ejecutar: (fila: any) => this.confirmacionEliminar(fila), },
62
+ ];
63
+ public accionesSiempreClickeable = [
64
+ { icono: 'upload_file', color: 'verde', textoAyuda: 'Subir adjuntos', ejecutar: (fila: any) => this.AbrirModalArchivo(fila), },
65
+ { icono: 'info', color: 'verdeoscuro', textoAyuda: 'Información', ejecutar: (fila: any) => this.mostrarDetalleDelRegistro(fila.LicenciaId), }
66
+ ];
67
+ constructor(private http: HttpClient, private dialog: MatDialog, private datosGlobalesService: DatosGlobalesService) {
68
+ this.obtenerDatosParaPoblarLaTabla();
69
+ this.obtenerTiposLicencias();
70
+ }
71
+
72
+ // PuntosPorColegioEnCantonConMIDH(fila: any): void {
73
+ // this.dialog.open(MensajeConfirmacionComponent, {
74
+ // data: {
75
+ // titulo: 'Confirmación',
76
+ // mensaje: `¿Confirma que desea actualizar las los púntos por colegio en cantón con MIDH?`,
77
+ // textoCerrar: 'Cancelar',
78
+ // textoAceptar: 'Actualizar',
79
+ // onClose: () => { },
80
+ // onAccept: () => {
81
+ // this.cargando = true;
82
+ // this.http.post(`${this.datosGlobalesService.ObtenerURL()}ParametrosAcciones/PuntosPorColegioEnCantonConMIDH`, { Periodo: fila.Periodo }).subscribe({
83
+ // next: (datos: any) => {
84
+ // this.dialog.open(MensajeConfirmacionComponent, {
85
+ // data: {
86
+ // titulo: 'Confirmación',
87
+ // mensaje: datos.body,
88
+ // textoCerrar: 'Cancelar',
89
+ // textoAceptar: 'Cerrar',
90
+ // onClose: () => { },
91
+ // onAccept: () => { },
92
+ // },
93
+ // });
94
+ // this.obtenerDatosParaPoblarLaTabla();
95
+ // },
96
+ // error: (error) => {
97
+ // this.obtenerDatosParaPoblarLaTabla();
98
+ // },
99
+ // complete: () => {
100
+ // this.cargando = false; // Ocultar spinner
101
+ // }
102
+ // });
103
+ // },
104
+ // },
105
+ // });
106
+ // }
107
+
108
+ mostrarDetalleDelRegistro(LicenciaId: any): void {
109
+ let data = {};
110
+ this.http
111
+ .get(`${this.datosGlobalesService.ObtenerURL()}licencias/datosDeUnaLicencia/${LicenciaId}`)
112
+ .subscribe({
113
+ next: (datos: any) => {
114
+ let data = datos.body[0];
115
+ this.dialog.open(MensajeInformacionComponent, { data });
116
+ },
117
+ });
118
+ }
119
+
120
+ confirmacionFirmaDelUsuario(fila: any): void {
121
+ this.dialog.open(MensajeConfirmacionComponent, {
122
+ data: {
123
+ titulo: 'Confirmación',
124
+ mensaje: `¿Realmente desea hacer la confirmación de este registro?`,
125
+ textoCerrar: 'Cancelar',
126
+ textoAceptar: 'Firmar',
127
+ onClose: () => { },
128
+ onAccept: () => { this.firmaFuncionario(fila.LicenciaId) },
129
+ },
130
+ });
131
+ }
132
+ firmaFuncionario(LicenciaId: any): void {
133
+ this.http
134
+ .post(`${this.datosGlobalesService.ObtenerURL()}licencias/firmaFuncionario`, { LicenciaId })
135
+ .subscribe({
136
+ next: (datos: any) => {
137
+ this.obtenerDatosParaPoblarLaTabla();
138
+ },
139
+ error: (error) => {
140
+ this.obtenerDatosParaPoblarLaTabla();
141
+ },
142
+ });
143
+ }
144
+ confirmacionEliminar(fila: any): void {
145
+ this.dialog.open(MensajeConfirmacionComponent, {
146
+ data: {
147
+ titulo: 'Confirmación',
148
+ mensaje: `¿Confirma que desea eliminar este registro?`,
149
+ textoCerrar: 'Cancelar',
150
+ textoAceptar: 'Eliminar',
151
+ onClose: () => { },
152
+ onAccept: () => { this.eliminar(fila.LicenciaId) },
153
+ },
154
+ });
155
+ }
156
+ eliminar(LicenciaId: any): void {
157
+ this.http
158
+ .post(`${this.datosGlobalesService.ObtenerURL()}licencias/borrar`, { LicenciaId })
159
+ .subscribe({
160
+ next: (datos: any) => {
161
+ this.obtenerDatosParaPoblarLaTabla();
162
+ },
163
+ error: (error) => {
164
+ this.obtenerDatosParaPoblarLaTabla();
165
+ },
166
+ });
167
+ }
168
+
169
+ public PaginarResultados: boolean = false;
170
+ public TotalDeRegistros: number = 0;
171
+ public PaginadorAccion: string = '-';
172
+ public PaginadorIndice: number = 0;
173
+ public PaginadorTamanio: number = 0;
174
+ public PaginadorFiltro: string = '&&&&';
175
+ public PaginadorColumnaParaFiltrar: string = '-';
176
+ public PaginadorColumnasParaFiltrar: string = '-';
177
+ public ColumnaParaOrdenar: string = '-';
178
+ public TipoDeOrden: string = '-';
179
+ onCambioDePagina(event: { accion: string, pageIndex: number, pageSize: number, valorParaFiltrar: string, columnaParaFiltrar: string, columnasParaFiltrar: string, ordenColumna: string, ordenDireccion: string }) {
180
+ this.PaginadorAccion = event.accion;
181
+ this.PaginadorIndice = event.pageIndex;
182
+ this.PaginadorTamanio = event.pageSize;
183
+ this.PaginadorFiltro = event.valorParaFiltrar || '&&&&';
184
+ this.PaginadorColumnaParaFiltrar = event.columnaParaFiltrar || '-';
185
+ this.PaginadorColumnasParaFiltrar = event.columnasParaFiltrar || '-';
186
+ this.ColumnaParaOrdenar = event.ordenColumna || '-';
187
+ this.TipoDeOrden = event.ordenDireccion || '-';
188
+ if (this.PaginarResultados) {
189
+ this.obtenerDatosParaPoblarLaTabla();
190
+ }
191
+ }
192
+
193
+ obtenerDatosParaPoblarLaTabla() {
194
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/listar`).subscribe({
195
+ next: (datos: any) => {
196
+ if (datos.error) {
197
+ console.error('Problemas al obtener los registros:', datos.error);
198
+ return;
199
+ }
200
+ if (this.PaginarResultados) {
201
+ this.DatosParaPoblarLaTabla = datos.body.Registros || [];
202
+ this.TotalDeRegistros = datos.body.TotalDeRegistros || 0;
203
+ } else {
204
+ this.DatosParaPoblarLaTabla = datos.body || [];
205
+ this.TotalDeRegistros = datos.body.length || 0;
206
+ }
207
+ },
208
+ error: (error) => {
209
+ console.error('Problemas al intentar obtener los registros: ', error);
210
+ },
211
+ });
212
+ }
213
+ obtenerTiposLicencias() {
214
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/tipos`).subscribe({
215
+ next: (datos: any) => {
216
+ if (datos.error) {
217
+ console.error('Problemas al intentar obtener los registros:', datos.error);
218
+ return;
219
+ }
220
+ this.tiposDeLicencias = datos.body || [];
221
+
222
+ },
223
+ error: (error) => {
224
+ console.error('Problemas al intentar obtener los registros: ', error);
225
+ },
226
+ });
227
+ }
228
+ Agregar(incapacidad: any) {
229
+ this.http.post(`${this.datosGlobalesService.ObtenerURL()}licencias/agregar`, incapacidad).subscribe({
230
+ next: (datos: any) => {
231
+ if (datos.error) {
232
+ console.log('Problemas al intentar obtener los registros:', datos.error);
233
+ return;
234
+ }
235
+ this.obtenerDatosParaPoblarLaTabla();
236
+ },
237
+ error: (error) => {
238
+ console.log('Problemas al intentar obtener los registros', error);
239
+ },
240
+ });
241
+ }
242
+ Actualizar(incapacidad: any) {
243
+ this.http.post(`${this.datosGlobalesService.ObtenerURL()}licencias/actualizar`, incapacidad).subscribe({
244
+ next: (datos: any) => {
245
+ if (datos.error) {
246
+ console.log('Problemas al intentar obtener los registros:', datos.error);
247
+ return;
248
+ }
249
+ this.obtenerDatosParaPoblarLaTabla();
250
+ },
251
+ error: (error) => {
252
+ console.log('Problemas al intentar obtener los registros', error);
253
+ },
254
+ });
255
+ }
256
+ DescargarReporte() {
257
+ this.cargando = true;
258
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/reporte`, {
259
+ responseType: 'text'
260
+ }).subscribe({
261
+ next: (datos: any) => {
262
+ const blob = new Blob([decodeURIComponent(datos)], { type: 'text/csv;charset=utf-8;' });
263
+ const enlace = document.createElement('a');
264
+ enlace.href = URL.createObjectURL(blob);
265
+ enlace.download = 'datos.csv';
266
+ enlace.click();
267
+ },
268
+ error: (error) => {
269
+ console.error('Problemas al intentar descargar el reporte: ', error);
270
+ },
271
+ complete: () => {
272
+ this.cargando = false;
273
+ }
274
+ });
275
+ }
276
+ AbrirModal(incapacidad?: any): void {
277
+ const dialogRef = this.dialog.open(GuardarIncapacidadComponent, {
278
+ data: { Incapacidad: incapacidad, TiposDeLicencias: this.tiposDeLicencias },
279
+ });
280
+ dialogRef.afterClosed().subscribe(result => {
281
+ if (result !== undefined) {
282
+ if (incapacidad) {
283
+ this.Actualizar(result);
284
+ }
285
+ else {
286
+ this.Agregar(result);
287
+ }
288
+ }
289
+ });
290
+ }
291
+ async AbrirModalArchivo(incapacidad?: any): Promise<void> {
292
+ const dialogRef = this.dialog.open(SubirArchivoComponent, {
293
+ data: {
294
+ Etiqueta: incapacidad.LicenciaId
295
+ , EsEditable: incapacidad.Estado == 'Pendiente'
296
+ , Permiso: 'Usuario'
297
+ },
298
+ });
299
+ }
300
+ }
@@ -0,0 +1,13 @@
1
+ .cargando-overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background: rgba(255,255,255,0.8);
8
+ display: flex;
9
+ flex-direction: column;
10
+ justify-content: center;
11
+ align-items: center;
12
+ z-index: 2000;
13
+ }
@@ -0,0 +1,43 @@
1
+ <div>
2
+ <h3>Listado de incapacidades, licencias y permisos por persona</h3>
3
+ @if(cargando) {
4
+ <div class="cargando-overlay">
5
+ <mat-spinner diameter="50"></mat-spinner>
6
+ <p>Procesando, por favor espere...</p>
7
+ </div>
8
+ }
9
+ @if(DatosParaPoblarLaTabla){
10
+ <div class="borde">
11
+ <app-tabla
12
+ [columnas] = "columnas"
13
+ [subColumnas] = "subColumnas"
14
+ [datos] = "DatosParaPoblarLaTabla"
15
+ [acciones] = "acciones"
16
+ [accionesDinamicas] = "accionesDinamicas"
17
+ [accionesSiempreClickeable] = "accionesSiempreClickeable"
18
+ [subAcciones] = "subAcciones"
19
+ [subAccionesSiempreClickeable] = "subAccionesSiempreClickeable"
20
+ [subAccionesDinamicas] = "subAccionesDinamicas"
21
+ [desplegable] = "false"
22
+ [atributoDesplegable] = ""
23
+ [mostrarElBotonDeGuardado] = "true"
24
+ [mostrarElBotonDeDescargar] = "true"
25
+ [mostrarElBotonDeFiltro] = "true"
26
+ [mostrarPaginador] = "true"
27
+ [estadosQuePermitenEdicion] = "accionesSiempreClickeable"
28
+ [subEstadosQuePermitenEdicion] = "subEstadosQuePermitenEdicion"
29
+ [paginarResultados] = "PaginarResultados"
30
+ [TotalDeRegistros] = "TotalDeRegistros"
31
+ (GuardarAccion)="AbrirModal()"
32
+ (DescargarInformacion)="DescargarReporte()"
33
+ (CambioDePagina)="onCambioDePagina($event)"
34
+ ></app-tabla>
35
+ </div>
36
+ <div class="pie">
37
+ </div>
38
+ } @else {
39
+ <div>
40
+ <mat-progress-bar mode="indeterminate"></mat-progress-bar>Cargando...
41
+ </div>
42
+ }
43
+ </div>
@@ -0,0 +1,305 @@
1
+ import { Component } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { MatSelectModule } from '@angular/material/select';
4
+ import { MatFormFieldModule } from '@angular/material/form-field';
5
+ import { MatRadioModule } from '@angular/material/radio';
6
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
7
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
8
+ import { DatosGlobalesService } from '../../datos-globales.service';
9
+ import { MatDialog } from '@angular/material/dialog';
10
+ import { TablaComponent } from '../../Componentes/Nucleo/tabla/tabla.component';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import { GuardarIncapacidadComponent } from '../../Componentes/guardar-incapacidad/guardar-incapacidad.component';
13
+ import { MensajeConfirmacionComponent } from '../../Componentes/Nucleo/mensaje-confirmacion/mensaje-confirmacion';
14
+ import { SubirArchivoComponent } from '../../Componentes/Nucleo/subir-archivo/subir-archivo.component';
15
+ import { MensajeInformacionComponent } from '../../Componentes/Nucleo/mensaje-informacion/mensaje-informacion';
16
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
17
+
18
+ @Component({
19
+ selector: 'app-gestion-tabla-XYZ',
20
+ imports: [
21
+ TablaComponent,
22
+ MatFormFieldModule,
23
+ MatSelectModule,
24
+ FormsModule,
25
+ MatRadioModule,
26
+ MatProgressBarModule,
27
+ MatButtonModule,
28
+ MatProgressSpinnerModule
29
+ ],
30
+ templateUrl: './gestion-tabla-XYZ.component.html',
31
+ styleUrls: ['./gestion-tabla-XYZ.component.css'],
32
+ })
33
+ export class GestionTablaXYZComponent {
34
+ // public DatosParaPoblarLaTabla: any[] = [];
35
+ // Si NO se inicializa muestra la barra de "cargando" y se queda "pegado" en "cargando", esto pasa con más de 15.000 registros
36
+ public DatosParaPoblarLaTabla: any[] = [];
37
+ public tiposDeLicencias: any[] = [];
38
+ public cargando = false;
39
+
40
+ // TipoDeFiltro: Ninguno,BaseDeDatos,Tabla
41
+ // Ninguno: la columna no aparecerá en la lista desplegable
42
+ // BaseDeDatos: para las tablas paginadas se usará en la cláusa WHERE
43
+ // Tabla: para las NO tablas paginadas se usará predeterminadamente
44
+ // Si la tabla no pagina los resultados, TipoDeFiltro puede ser siempre 'Tabla'
45
+ public columnas = [
46
+ { Llave: 'NumeroBoleta', Alias: 'N° de boleta', TipoDeFiltro: 'Tabla' },
47
+ { Llave: 'Descripcion', Alias: 'Tipo de ausencia', TipoDeFiltro: 'Tabla' },
48
+ { Llave: 'FechaDeInicio', Alias: 'Fecha de inicio', TipoDeFiltro: 'Tabla' },
49
+ { Llave: 'FechaDeFinal', Alias: 'Fecha final', TipoDeFiltro: 'Tabla' },
50
+ { Llave: 'TotalDeDias', Alias: 'Total de días', TipoDeFiltro: 'Tabla' },
51
+ { Llave: 'CodigoDeDoctor', Alias: 'Código y nombre del doctor', TipoDeFiltro: 'Tabla' },
52
+ { Llave: 'AreaDeSalud', Alias: 'Área de salud', TipoDeFiltro: 'Tabla' },
53
+ { Llave: 'Estado', Alias: 'Estado', TipoDeFiltro: 'Tabla' }
54
+ ];
55
+ public subColumnas = [];
56
+ public estadosQuePermitenEdicion = ['Pendiente'];
57
+ public subEstadosQuePermitenEdicion = [];
58
+ // https://fonts.google.com/icons
59
+ public acciones = [
60
+ { icono: 'edit', color: 'azul', textoAyuda: 'Editar', ejecutar: (fila: any) => this.AbrirModal(fila), },
61
+ { icono: 'draw', color: 'marino', textoAyuda: 'Firmar', ejecutar: (fila: any) => this.confirmacionFirmaDelUsuario(fila), },
62
+ { icono: 'delete', color: 'rojo', textoAyuda: 'Eliminar', ejecutar: (fila: any) => this.confirmacionEliminar(fila), },
63
+ ];
64
+ public accionesDinamicas = [];
65
+ public accionesSiempreClickeable = [
66
+ { icono: 'upload_file', color: 'verde', textoAyuda: 'Subir adjuntos', ejecutar: (fila: any) => this.AbrirModalArchivo(fila), },
67
+ { icono: 'info', color: 'verdeoscuro', textoAyuda: 'Información', ejecutar: (fila: any) => this.mostrarDetalleDelRegistro(fila.LicenciaId), }
68
+ ];
69
+ public subAcciones = [];
70
+ public subAccionesSiempreClickeable = [];
71
+ public subAccionesDinamicas = [];
72
+ constructor(private http: HttpClient, private dialog: MatDialog, private datosGlobalesService: DatosGlobalesService) {
73
+ this.obtenerDatosParaPoblarLaTabla();
74
+ this.obtenerTiposLicencias();
75
+ }
76
+
77
+ // PuntosPorColegioEnCantonConMIDH(fila: any): void {
78
+ // this.dialog.open(MensajeConfirmacionComponent, {
79
+ // data: {
80
+ // titulo: 'Confirmación',
81
+ // mensaje: `¿Confirma que desea actualizar las los púntos por colegio en cantón con MIDH?`,
82
+ // textoCerrar: 'Cancelar',
83
+ // textoAceptar: 'Actualizar',
84
+ // onClose: () => { },
85
+ // onAccept: () => {
86
+ // this.cargando = true;
87
+ // this.http.post(`${this.datosGlobalesService.ObtenerURL()}ParametrosAcciones/PuntosPorColegioEnCantonConMIDH`, { Periodo: fila.Periodo }).subscribe({
88
+ // next: (datos: any) => {
89
+ // this.dialog.open(MensajeConfirmacionComponent, {
90
+ // data: {
91
+ // titulo: 'Confirmación',
92
+ // mensaje: datos.body,
93
+ // textoCerrar: 'Cancelar',
94
+ // textoAceptar: 'Cerrar',
95
+ // onClose: () => { },
96
+ // onAccept: () => { },
97
+ // },
98
+ // });
99
+ // this.obtenerDatosParaPoblarLaTabla();
100
+ // },
101
+ // error: (error) => {
102
+ // this.obtenerDatosParaPoblarLaTabla();
103
+ // },
104
+ // complete: () => {
105
+ // this.cargando = false; // Ocultar spinner
106
+ // }
107
+ // });
108
+ // },
109
+ // },
110
+ // });
111
+ // }
112
+
113
+ mostrarDetalleDelRegistro(LicenciaId: any): void {
114
+ let data = {};
115
+ this.http
116
+ .get(`${this.datosGlobalesService.ObtenerURL()}licencias/datosDeUnaLicencia/${LicenciaId}`)
117
+ .subscribe({
118
+ next: (datos: any) => {
119
+ let data = datos.body[0];
120
+ this.dialog.open(MensajeInformacionComponent, { data });
121
+ },
122
+ });
123
+ }
124
+
125
+ confirmacionFirmaDelUsuario(fila: any): void {
126
+ this.dialog.open(MensajeConfirmacionComponent, {
127
+ data: {
128
+ titulo: 'Confirmación',
129
+ mensaje: `¿Realmente desea hacer la confirmación de este registro?`,
130
+ textoCerrar: 'Cancelar',
131
+ textoAceptar: 'Firmar',
132
+ onClose: () => { },
133
+ onAccept: () => { this.firmaFuncionario(fila.LicenciaId) },
134
+ },
135
+ });
136
+ }
137
+ firmaFuncionario(LicenciaId: any): void {
138
+ this.http
139
+ .post(`${this.datosGlobalesService.ObtenerURL()}licencias/firmaFuncionario`, { LicenciaId })
140
+ .subscribe({
141
+ next: (datos: any) => {
142
+ this.obtenerDatosParaPoblarLaTabla();
143
+ },
144
+ error: (error) => {
145
+ this.obtenerDatosParaPoblarLaTabla();
146
+ },
147
+ });
148
+ }
149
+ confirmacionEliminar(fila: any): void {
150
+ this.dialog.open(MensajeConfirmacionComponent, {
151
+ data: {
152
+ titulo: 'Confirmación',
153
+ mensaje: `¿Confirma que desea eliminar este registro?`,
154
+ textoCerrar: 'Cancelar',
155
+ textoAceptar: 'Eliminar',
156
+ onClose: () => { },
157
+ onAccept: () => { this.eliminar(fila.LicenciaId) },
158
+ },
159
+ });
160
+ }
161
+ eliminar(LicenciaId: any): void {
162
+ this.http
163
+ .post(`${this.datosGlobalesService.ObtenerURL()}licencias/borrar`, { LicenciaId })
164
+ .subscribe({
165
+ next: (datos: any) => {
166
+ this.obtenerDatosParaPoblarLaTabla();
167
+ },
168
+ error: (error) => {
169
+ this.obtenerDatosParaPoblarLaTabla();
170
+ },
171
+ });
172
+ }
173
+
174
+ public PaginarResultados: boolean = false;
175
+ public TotalDeRegistros: number = 0;
176
+ public PaginadorAccion: string = '-';
177
+ public PaginadorIndice: number = 0;
178
+ public PaginadorTamanio: number = 0;
179
+ public PaginadorFiltro: string = '&&&&';
180
+ public PaginadorColumnaParaFiltrar: string = '-';
181
+ public PaginadorColumnasParaFiltrar: string = '-';
182
+ public ColumnaParaOrdenar: string = '-';
183
+ public TipoDeOrden: string = '-';
184
+ onCambioDePagina(event: { accion: string, pageIndex: number, pageSize: number, valorParaFiltrar: string, columnaParaFiltrar: string, columnasParaFiltrar: string, ordenColumna: string, ordenDireccion: string }) {
185
+ this.PaginadorAccion = event.accion;
186
+ this.PaginadorIndice = event.pageIndex;
187
+ this.PaginadorTamanio = event.pageSize;
188
+ this.PaginadorFiltro = event.valorParaFiltrar || '&&&&';
189
+ this.PaginadorColumnaParaFiltrar = event.columnaParaFiltrar || '-';
190
+ this.PaginadorColumnasParaFiltrar = event.columnasParaFiltrar || '-';
191
+ this.ColumnaParaOrdenar = event.ordenColumna || '-';
192
+ this.TipoDeOrden = event.ordenDireccion || '-';
193
+ if (this.PaginarResultados) {
194
+ this.obtenerDatosParaPoblarLaTabla();
195
+ }
196
+ }
197
+
198
+ obtenerDatosParaPoblarLaTabla() {
199
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/listar`).subscribe({
200
+ next: (datos: any) => {
201
+ if (datos.error) {
202
+ console.error('Problemas al obtener los registros:', datos.error);
203
+ return;
204
+ }
205
+ if (this.PaginarResultados) {
206
+ this.DatosParaPoblarLaTabla = datos.body.Registros || [];
207
+ this.TotalDeRegistros = datos.body.TotalDeRegistros || 0;
208
+ } else {
209
+ this.DatosParaPoblarLaTabla = datos.body || [];
210
+ this.TotalDeRegistros = datos.body.length || 0;
211
+ }
212
+ },
213
+ error: (error) => {
214
+ console.error('Problemas al intentar obtener los registros: ', error);
215
+ },
216
+ });
217
+ }
218
+ obtenerTiposLicencias() {
219
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/tipos`).subscribe({
220
+ next: (datos: any) => {
221
+ if (datos.error) {
222
+ console.error('Problemas al intentar obtener los registros:', datos.error);
223
+ return;
224
+ }
225
+ this.tiposDeLicencias = datos.body || [];
226
+
227
+ },
228
+ error: (error) => {
229
+ console.error('Problemas al intentar obtener los registros: ', error);
230
+ },
231
+ });
232
+ }
233
+ Agregar(incapacidad: any) {
234
+ this.http.post(`${this.datosGlobalesService.ObtenerURL()}licencias/agregar`, incapacidad).subscribe({
235
+ next: (datos: any) => {
236
+ if (datos.error) {
237
+ console.log('Problemas al intentar obtener los registros:', datos.error);
238
+ return;
239
+ }
240
+ this.obtenerDatosParaPoblarLaTabla();
241
+ },
242
+ error: (error) => {
243
+ console.log('Problemas al intentar obtener los registros', error);
244
+ },
245
+ });
246
+ }
247
+ Actualizar(incapacidad: any) {
248
+ this.http.post(`${this.datosGlobalesService.ObtenerURL()}licencias/actualizar`, incapacidad).subscribe({
249
+ next: (datos: any) => {
250
+ if (datos.error) {
251
+ console.log('Problemas al intentar obtener los registros:', datos.error);
252
+ return;
253
+ }
254
+ this.obtenerDatosParaPoblarLaTabla();
255
+ },
256
+ error: (error) => {
257
+ console.log('Problemas al intentar obtener los registros', error);
258
+ },
259
+ });
260
+ }
261
+ DescargarReporte() {
262
+ this.cargando = true;
263
+ this.http.get(`${this.datosGlobalesService.ObtenerURL()}licencias/reporte`, {
264
+ responseType: 'text'
265
+ }).subscribe({
266
+ next: (datos: any) => {
267
+ const blob = new Blob([decodeURIComponent(datos)], { type: 'text/csv;charset=utf-8;' });
268
+ const enlace = document.createElement('a');
269
+ enlace.href = URL.createObjectURL(blob);
270
+ enlace.download = 'datos.csv';
271
+ enlace.click();
272
+ },
273
+ error: (error) => {
274
+ console.error('Problemas al intentar descargar el reporte: ', error);
275
+ },
276
+ complete: () => {
277
+ this.cargando = false;
278
+ }
279
+ });
280
+ }
281
+ AbrirModal(incapacidad?: any): void {
282
+ const dialogRef = this.dialog.open(GuardarIncapacidadComponent, {
283
+ data: { Incapacidad: incapacidad, TiposDeLicencias: this.tiposDeLicencias },
284
+ });
285
+ dialogRef.afterClosed().subscribe(result => {
286
+ if (result !== undefined) {
287
+ if (incapacidad) {
288
+ this.Actualizar(result);
289
+ }
290
+ else {
291
+ this.Agregar(result);
292
+ }
293
+ }
294
+ });
295
+ }
296
+ async AbrirModalArchivo(incapacidad?: any): Promise<void> {
297
+ const dialogRef = this.dialog.open(SubirArchivoComponent, {
298
+ data: {
299
+ Etiqueta: incapacidad.LicenciaId
300
+ , EsEditable: incapacidad.Estado == 'Pendiente'
301
+ , Permiso: 'Usuario'
302
+ },
303
+ });
304
+ }
305
+ }
@@ -0,0 +1,13 @@
1
+ .cargando-overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background: rgba(255,255,255,0.8);
8
+ display: flex;
9
+ flex-direction: column;
10
+ justify-content: center;
11
+ align-items: center;
12
+ z-index: 2000;
13
+ }