diff --git a/ogWebconsole/angular.json b/ogWebconsole/angular.json
index f9f3df9..163f14c 100644
--- a/ogWebconsole/angular.json
+++ b/ogWebconsole/angular.json
@@ -4,6 +4,12 @@
"newProjectRoot": "projects",
"projects": {
"ogWebconsole": {
+ "i18n": {
+ "sourceLocale": "es",
+ "locales": {
+ "en-US": "src/locale/messages.en.json"
+ }
+ },
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
@@ -23,11 +29,14 @@
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
+ "localize": true,
+ "aot": true,
"outputPath": "dist/og-webconsole",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
- "zone.js"
+ "zone.js",
+ "@angular/localize/init"
],
"tsConfig": "tsconfig.app.json",
"assets": [
@@ -61,6 +70,12 @@
"optimization": false,
"extractLicenses": false,
"sourceMap": true
+ },
+ "es": {
+ "localize": ["es-ES"]
+ },
+ "en": {
+ "localize": ["en-US"]
}
},
"defaultConfiguration": "production"
@@ -73,6 +88,12 @@
},
"development": {
"buildTarget": "ogWebconsole:build:development"
+ },
+ "es": {
+ "buildTarget": "ogWebconsole:build:es"
+ },
+ "en": {
+ "buildTarget": "ogWebconsole:build:en"
}
},
"defaultConfiguration": "development"
@@ -88,7 +109,8 @@
"options": {
"polyfills": [
"zone.js",
- "zone.js/testing"
+ "zone.js/testing",
+ "@angular/localize/init"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
diff --git a/ogWebconsole/package-lock.json b/ogWebconsole/package-lock.json
index 1610f0f..3c83606 100644
--- a/ogWebconsole/package-lock.json
+++ b/ogWebconsole/package-lock.json
@@ -28,6 +28,7 @@
"@angular-devkit/build-angular": "^18.0.1",
"@angular/cli": "^18.0.1",
"@angular/compiler-cli": "^18.0.0",
+ "@angular/localize": "^18.1.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
@@ -486,6 +487,30 @@
"rxjs": "^6.5.3 || ^7.4.0"
}
},
+ "node_modules/@angular/localize": {
+ "version": "18.1.0",
+ "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-18.1.0.tgz",
+ "integrity": "sha512-84D06p2Th5NxoJZzsSIn4FkTJGImj7rtNnvyTrHvHdomzzUKwiBOXDB2FiCLDstND0DsCtgjD/uBJivg77z9tg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/core": "7.24.7",
+ "@types/babel__core": "7.20.5",
+ "fast-glob": "3.3.2",
+ "yargs": "^17.2.1"
+ },
+ "bin": {
+ "localize-extract": "tools/bundles/src/extract/cli.js",
+ "localize-migrate": "tools/bundles/src/migrate/cli.js",
+ "localize-translate": "tools/bundles/src/translate/cli.js"
+ },
+ "engines": {
+ "node": "^18.19.1 || ^20.11.1 || >=22.0.0"
+ },
+ "peerDependencies": {
+ "@angular/compiler": "18.1.0",
+ "@angular/compiler-cli": "18.1.0"
+ }
+ },
"node_modules/@angular/material": {
"version": "18.0.6",
"resolved": "https://registry.npmjs.org/@angular/material/-/material-18.0.6.tgz",
@@ -4938,6 +4963,47 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/@types/babel__core": {
+ "version": "7.20.5",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
+ "dev": true,
+ "dependencies": {
+ "@babel/parser": "^7.20.7",
+ "@babel/types": "^7.20.7",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "node_modules/@types/babel__generator": {
+ "version": "7.6.8",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz",
+ "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==",
+ "dev": true,
+ "dependencies": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__template": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
+ "dev": true,
+ "dependencies": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__traverse": {
+ "version": "7.20.6",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz",
+ "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/types": "^7.20.7"
+ }
+ },
"node_modules/@types/body-parser": {
"version": "1.19.5",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
diff --git a/ogWebconsole/package.json b/ogWebconsole/package.json
index ad2a0a8..9a5ed71 100644
--- a/ogWebconsole/package.json
+++ b/ogWebconsole/package.json
@@ -30,6 +30,7 @@
"@angular-devkit/build-angular": "^18.0.1",
"@angular/cli": "^18.0.1",
"@angular/compiler-cli": "^18.0.0",
+ "@angular/localize": "^18.1.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts
index 7d2e8fd..9ac672f 100644
--- a/ogWebconsole/src/app/app.module.ts
+++ b/ogWebconsole/src/app/app.module.ts
@@ -56,7 +56,7 @@ import { DeleteGroupsModalComponent } from './components/groups/delete-groups-mo
import { DragDropModule } from '@angular/cdk/drag-drop';
import { ToastrModule } from 'ngx-toastr';
import { ShowOrganizationalUnitComponent } from './components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component';
-import { MatGridList } from "@angular/material/grid-list";
+import {MatGridList, MatGridTile} from "@angular/material/grid-list";
import { TreeViewComponent } from './components/groups/tree-view/tree-view.component';
import {
MatNestedTreeNode,
@@ -68,6 +68,9 @@ import {
} from "@angular/material/tree";
import { LegendComponent } from './components/groups/legend/legend.component';
import { ClassroomViewDialogComponent } from './components/groups/classroom-view/classroom-view-modal';
+import {MatPaginator} from "@angular/material/paginator";
+import { SaveFiltersDialogComponent } from './components/groups/save-filters-dialog/save-filters-dialog.component';
+import { AcctionsModalComponent } from './components/groups/acctions-modal/acctions-modal.component';
@NgModule({
declarations: [
@@ -99,7 +102,9 @@ import { ClassroomViewDialogComponent } from './components/groups/classroom-view
ShowOrganizationalUnitComponent,
TreeViewComponent,
LegendComponent,
- ClassroomViewDialogComponent
+ ClassroomViewDialogComponent,
+ SaveFiltersDialogComponent,
+ AcctionsModalComponent
],
bootstrap: [AppComponent],
imports: [BrowserModule,
@@ -132,7 +137,7 @@ import { ClassroomViewDialogComponent } from './components/groups/classroom-view
progressAnimation: 'increasing',
closeButton: true
}
- ), MatGridList, MatTree, MatTreeNode, MatNestedTreeNode, MatTreeNodeToggle, MatTreeNodeDef, MatTreeNodePadding, MatTreeNodeOutlet
+ ), MatGridList, MatTree, MatTreeNode, MatNestedTreeNode, MatTreeNodeToggle, MatTreeNodeDef, MatTreeNodePadding, MatTreeNodeOutlet, MatPaginator, MatGridTile
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
diff --git a/ogWebconsole/src/app/components/dashboard/dashboard.component.html b/ogWebconsole/src/app/components/dashboard/dashboard.component.html
index 9c5fce9..c83a790 100644
--- a/ogWebconsole/src/app/components/dashboard/dashboard.component.html
+++ b/ogWebconsole/src/app/components/dashboard/dashboard.component.html
@@ -1 +1 @@
-
dashboard works!
+dashboard works!
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.css b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.css
new file mode 100644
index 0000000..a63ee5d
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.css
@@ -0,0 +1,20 @@
+
+.button-column {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: #fff;
+ padding: 20px;
+ border-radius: 10px;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Sombra ligera */
+}
+
+.button-column button {
+ margin: 10px 0; /* Espaciado entre los botones */
+ width: 200px; /* Ancho uniforme para todos los botones */
+ font-size: 16px; /* Tamaño de fuente consistente */
+}
+
+.button-column button.mat-flat-button {
+ border-radius: 5px; /* Bordes ligeramente redondeados */
+}
diff --git a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.html b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.html
new file mode 100644
index 0000000..4530933
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.html
@@ -0,0 +1,9 @@
+Acciones
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.spec.ts b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.spec.ts
new file mode 100644
index 0000000..671341d
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { AcctionsModalComponent } from './acctions-modal.component';
+
+describe('AcctionsModalComponent', () => {
+ let component: AcctionsModalComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [AcctionsModalComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(AcctionsModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts
new file mode 100644
index 0000000..9d81caa
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts
@@ -0,0 +1,29 @@
+// componente
+import { Component, Inject } from '@angular/core';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { ToastrService } from 'ngx-toastr';
+@Component({
+ selector: 'app-acctions-modal',
+ templateUrl: './acctions-modal.component.html',
+ styleUrls: ['./acctions-modal.component.css']
+})
+export class AcctionsModalComponent {
+ selectedElements: any;
+
+ constructor(
+ private toastService: ToastrService,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: any
+ ) {
+ this.selectedElements = data.selectedElements;
+ }
+
+ onCancel(): void {
+ this.dialogRef.close(null);
+ }
+
+ onSend(): void {
+
+ this.toastService.success(' Acción enviada a: ' + this.selectedElements);
+ }
+}
diff --git a/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.css b/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.css
index de8a3a0..58d2ab4 100644
--- a/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.css
+++ b/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.css
@@ -41,12 +41,12 @@ mat-card {
background-color: rgba(0, 0, 0, 0);
color: black;
text-align: center;
- padding: 10px;
+ padding: 15px;
box-sizing: border-box;
}
.client-name {
- font-size: medium;
+ font-size: small;
font-weight: bold;
}
diff --git a/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.html b/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.html
index 8f75087..d332bf1 100644
--- a/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.html
+++ b/ogWebconsole/src/app/components/groups/classroom-view/classroom-view.component.html
@@ -1,9 +1,8 @@
-
-
Pizarra digital
-

+
Pizarra digital
+
-

+
@@ -25,4 +24,4 @@
-
+
diff --git a/ogWebconsole/src/app/components/groups/client-view/client-view.component.html b/ogWebconsole/src/app/components/groups/client-view/client-view.component.html
index 3ddfe30..d60e173 100644
--- a/ogWebconsole/src/app/components/groups/client-view/client-view.component.html
+++ b/ogWebconsole/src/app/components/groups/client-view/client-view.component.html
@@ -1,14 +1,15 @@
-
Propiedades cliente
+
Propiedades cliente
+
- Propiedad |
+ Propiedad |
{{element.property}} |
- Valor |
+ Valor |
{{element.value}} |
@@ -18,11 +19,11 @@
- Propiedad |
+ Propiedad |
{{element.property}} |
- Valor |
+ Valor |
{{element.value}} |
@@ -32,11 +33,11 @@
- Propiedad |
+ Propiedad |
{{element.property}} |
- Valor |
+ Valor |
{{element.value}} |
@@ -45,12 +46,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -58,5 +59,5 @@
-
+
diff --git a/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.html b/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.html
index 0458898..88d1eef 100644
--- a/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.html
+++ b/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.html
@@ -1,69 +1,71 @@
-
Añadir Cliente
-
-
-
-
-
+
Añadir Cliente
+
+
+
+
+
diff --git a/ogWebconsole/src/app/components/groups/clients/edit-client/edit-client.component.html b/ogWebconsole/src/app/components/groups/clients/edit-client/edit-client.component.html
index 7ed4b23..dd18a6e 100644
--- a/ogWebconsole/src/app/components/groups/clients/edit-client/edit-client.component.html
+++ b/ogWebconsole/src/app/components/groups/clients/edit-client/edit-client.component.html
@@ -1,23 +1,25 @@
-Editar Cliente
+Editar Cliente
-
-
+
+
diff --git a/ogWebconsole/src/app/components/groups/data.service.ts b/ogWebconsole/src/app/components/groups/data.service.ts
index 9b0f503..89863aa 100644
--- a/ogWebconsole/src/app/components/groups/data.service.ts
+++ b/ogWebconsole/src/app/components/groups/data.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
+import {HttpClient, HttpParams} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { UnidadOrganizativa } from './model';
@@ -10,7 +10,7 @@ import { UnidadOrganizativa } from './model';
export class DataService {
private apiUrl = 'http://127.0.0.1:8080/organizational-units?page=1&itemsPerPage=1000';
- private clientsUrl = 'http://127.0.0.1:8080/clients?page=1&itemsPerPage=30';
+ private clientsUrl = 'http://127.0.0.1:8080/clients?page=1&itemsPerPage=1000';
constructor(private http: HttpClient) {}
@@ -107,5 +107,72 @@ export class DataService {
);
}
+ getFilteredResults(filter1: string, filter2: string, filterName: string, page: number, pageSize: number): Observable {
+ let params = new HttpParams();
+ if (filter2 && filter2 !== 'none') {
+ params = params.set('type', filter2);
+ }
+ if (filterName) {
+ params = params.set('name', filterName);
+ }
+
+ params = params.set('page', page.toString());
+ params = params.set('itemsPerPage', pageSize.toString());
+
+ const url = filter1 === 'client' ? this.clientsUrl : this.apiUrl;
+
+ return this.http.get(url, { params }).pipe(
+ map(response => {
+ if (response['hydra:member'] && Array.isArray(response['hydra:member'])) {
+ return {
+ results: response['hydra:member'],
+ total: response['hydra:totalItems'] || response['hydra:member'].length
+ };
+ } else {
+ throw new Error('Unexpected response format');
+ }
+ }),
+ catchError(error => {
+ console.error('Error fetching data', error);
+ return throwError(error);
+ })
+ );
+ }
+
+ getFilters(): Observable {
+ return this.http.get('http://127.0.0.1:8080/views?page=1&itemsPerPage=30').pipe(
+ map(response => {
+ if (response['hydra:member'] && Array.isArray(response['hydra:member'])) {
+ return response['hydra:member'];
+ } else {
+ throw new Error('Unexpected response format');
+ }
+ }),
+ catchError(error => {
+ console.error('Error fetching filters', error);
+ return throwError(error);
+ })
+ );
+ }
+
+ getFilter(id: string): Observable {
+ return this.http.get('http://127.0.0.1:8080/views/' + id).pipe(
+ map(response => {
+
+
+ if (response.name && response.filters) {
+ return response;
+ } else {
+ throw new Error('Unexpected response format');
+ }
+ }),
+ catchError(error => {
+ console.error('Error fetching filters', error);
+ return throwError(error);
+ })
+ );
+ }
+
+
}
diff --git a/ogWebconsole/src/app/components/groups/delete-groups-modal/delete-groups-modal.component.ts b/ogWebconsole/src/app/components/groups/delete-groups-modal/delete-groups-modal.component.ts
index 524987f..9b06690 100644
--- a/ogWebconsole/src/app/components/groups/delete-groups-modal/delete-groups-modal.component.ts
+++ b/ogWebconsole/src/app/components/groups/delete-groups-modal/delete-groups-modal.component.ts
@@ -4,14 +4,16 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@Component({
selector: 'app-delete-confirm-dialog',
template: `
- Eliminar
-
-
¿Quiere borrar los clientes situados en {{data.name}} o quiere resituarlos en el nivel superior?
-
-
-
-
-
+ Eliminar
+
+
¿Quiere borrar los clientes situados en {{data.name}} o quiere resituarlos en el nivel superior?
+
+
+
+
+
+
+
`
})
export class DeleteGroupsModalComponent {
diff --git a/ogWebconsole/src/app/components/groups/delete-modal/delete-modal.component.ts b/ogWebconsole/src/app/components/groups/delete-modal/delete-modal.component.ts
index 7285277..80675f7 100644
--- a/ogWebconsole/src/app/components/groups/delete-modal/delete-modal.component.ts
+++ b/ogWebconsole/src/app/components/groups/delete-modal/delete-modal.component.ts
@@ -4,14 +4,15 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@Component({
selector: 'app-delete-confirm-dialog',
template: `
- Eliminar
-
-
¿Estás seguro que deseas eliminar {{data.name}}?
-
-
-
-
-
+ Eliminar
+
+
¿Estás seguro que deseas eliminar {{data.name}}?
+
+
+
+
+
+
`
})
export class DeleteModalComponent {
diff --git a/ogWebconsole/src/app/components/groups/groups.component.css b/ogWebconsole/src/app/components/groups/groups.component.css
index a406e9b..4dd1ce4 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.css
+++ b/ogWebconsole/src/app/components/groups/groups.component.css
@@ -122,12 +122,85 @@ mat-spinner {
align-self: center;
}
-
-.container { /* Asegúrate de que esta clase sea la del contenedor del botón */
+.container {
display: flex;
justify-content: flex-end;
}
-
-.roomMap-btn {
+.classroomBtn-container {
+ display: flex;
+ justify-content: flex-end;
+ width: 100%;
+ padding-right: 20px;
}
+.roomMap-btn{
+}
+
+.container {
+ display: flex;
+ flex-direction: column;
+}
+
+.header {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 20px;
+}
+
+.header mat-form-field {
+ width: 300px;
+}
+
+.main-content {
+ display: flex;
+}
+
+.filters {
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ width: 300px;
+}
+
+.saved-filter {
+ display: flex;
+ flex-direction: column;
+ width: 300px;
+ margin-bottom: 10px;
+ padding: 10px;
+}
+
+.results {
+ width: 100%;
+}
+
+.results-container {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
+ gap: 16px;
+ margin-bottom: 16px;
+}
+
+.result-card {
+ width: 100%;
+ max-width: 250px;
+ height: 250px; /* Fijo para mantener la forma cuadrada */
+}
+
+.paginator-container {
+ display: flex;
+ justify-content: center;
+ margin-bottom: 30px;
+}
+
+.divider {
+ margin: 20px 0;
+}
+
+mat-card {
+ margin-bottom: 20px;
+}
+
+.temp_filter{color: red;
+}
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html
index 8226e41..bccfb25 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.html
+++ b/ogWebconsole/src/app/components/groups/groups.component.html
@@ -1,151 +1,295 @@
-
-
-
- Búsqueda
-
- search
- Pulsar 'enter' para buscar entre las unidades organizativas
-
-
-
-
- Unidad organizativa
-
-
-
-
-
- apartment
- {{ unidad.name }}
-
- menu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Elementos internos
-
-
- {{ crumb }}
- >
-
-
+
+
+
+
+
diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts
index c68ba3d..da86861 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.ts
+++ b/ogWebconsole/src/app/components/groups/groups.component.ts
@@ -13,8 +13,11 @@ import {ToastrService} from "ngx-toastr";
import {TreeViewComponent} from "./tree-view/tree-view.component";
import {MatBottomSheet} from "@angular/material/bottom-sheet";
import {LegendComponent} from "./legend/legend.component";
-import { ClassroomViewComponent } from './classroom-view/classroom-view.component';
import { ClassroomViewDialogComponent } from './classroom-view/classroom-view-modal';
+import {HttpClient} from "@angular/common/http";
+import {PageEvent} from "@angular/material/paginator";
+import { SaveFiltersDialogComponent } from './save-filters-dialog/save-filters-dialog.component';
+import { AcctionsModalComponent } from './acctions-modal/acctions-modal.component';
@Component({
selector: 'app-groups',
@@ -24,23 +27,55 @@ import { ClassroomViewDialogComponent } from './classroom-view/classroom-view-mo
export class GroupsComponent implements OnInit {
organizationalUnits: UnidadOrganizativa[] = [];
selectedUnidad: UnidadOrganizativa | null = null;
- selectedDetail: any | null = null; // Nueva variable para el detalle del elemento seleccionado
+ selectedDetail: any | null = null;
children: any[] = [];
breadcrumb: string[] = [];
- clientsData: any[] = []; // Nueva variable para almacenar los datos de clients
- breadcrumbData: any[] = []; // Almacenar datos de breadcrumb para navegar
+ clientsData: any[] = [];
+ breadcrumbData: any[] = [];
loading:boolean = false;
loadingChildren:boolean = false;
searchTerm: string = '';
-constructor(
+ selectedFilter1: string = 'none';
+ selectedFilter2: string = 'none';
+
+ selectedFilterOS: string[] = [];
+ selectedFilterStatus: string[] = [];
+ filterIP: string = '';
+ filterMAC: string = '';
+
+ filterName: string = '';
+ filteredResults: any[] = [];
+ savedFilterNames: any[] = [];
+ length: number = 0;
+ itemsPerPage: number = 10;
+ page: number = 1;
+ pageSizeOptions: number[] = [5, 10, 25, 100];
+ selectedElements: string[] = [];
+ isAllSelected: boolean = false;
+
+
+ constructor(
private dataService: DataService,
public dialog: MatDialog,
private toastService: ToastrService,
- private _bottomSheet: MatBottomSheet
+ private _bottomSheet: MatBottomSheet,
+ private http: HttpClient
) {}
ngOnInit(): void {
this.search();
+ this.getFilters();
+ }
+
+ getFilters(): void {
+ this.dataService.getFilters().subscribe(
+ data => {
+ this.savedFilterNames = data.map((filter: any) => [filter.name, filter.uuid]);
+ },
+ error => {
+ console.error('Error fetching filters:', error);
+ }
+ );
}
search(): void {
@@ -48,11 +83,11 @@ constructor(
this.dataService.getOrganizationalUnits(this.searchTerm).subscribe(
data => {
this.organizationalUnits = data;
- this.loading = false; // Desactivar el spinner después de obtener los datos
+ this.loading = false;
},
error => {
console.error('Error fetching unidades organizativas', error);
- this.loading = false; // Desactivar el spinner en caso de error
+ this.loading = false;
}
);
}
@@ -60,14 +95,14 @@ constructor(
onSelectUnidad(unidad: UnidadOrganizativa): void {
this.selectedUnidad = unidad;
- this.selectedDetail = unidad; // Mostrar detalles de la unidad seleccionada
+ this.selectedDetail = unidad;
this.breadcrumb = [unidad.name];
this.breadcrumbData = [unidad];
this.loadChildrenAndClients(unidad.id);
}
onSelectChild(child: any): void {
- this.selectedDetail = child; // Mostrar detalles del niño seleccionado
+ this.selectedDetail = child;
if (child.type !== 'client' && child.uuid && child.id) {
this.breadcrumb.push(child.name || child.name);
this.breadcrumbData.push(child);
@@ -93,27 +128,27 @@ constructor(
console.log('Children data:', childrenData);
this.dataService.getClients(id).subscribe(
clientsData => {
- this.clientsData = clientsData; // Almacenar clientsData para pasarlo al componente hijo
+ this.clientsData = clientsData;
const newChildren = [...childrenData, ...clientsData];
if (newChildren.length > 0) {
this.children = newChildren;
} else {
- this.children = []; // Limpiar card2 cuando no hay elementos
+ this.children = [];
}
this.loadingChildren = false
},
error => {
console.error('Error fetching clients', error);
- this.clientsData = []; // Limpiar clientsData en caso de error
- this.children = []; // Limpiar card2 en caso de error
+ this.clientsData = [];
+ this.children = [];
this.loadingChildren = false
}
);
},
error => {
console.error('Error fetching children', error);
- this.children = []; // Limpiar card2 en caso de error
+ this.children = [];
this.loadingChildren = false
}
);
@@ -138,7 +173,6 @@ constructor(
const dialogRef = this.dialog.open(CreateClientComponent, { data: { organizationalUnit }, width: '700px'});
- // Subscribirse al evento unitAdded del componente de creación después de cerrar el diálogo
dialogRef.afterClosed().subscribe(() => {
this.dataService.getOrganizationalUnits().subscribe(
data => {
@@ -267,4 +301,117 @@ constructor(
});
}
}
+
+ applyFilter() {
+ this.dataService.getFilteredResults(this.selectedFilter1, this.selectedFilter2, this.filterName, this.page, this.itemsPerPage)
+ .subscribe(
+ response => {
+ this.filteredResults = response.results;
+ this.length = response.total;
+ },
+ error => {
+ console.error('Error al obtener los resultados filtrados', error);
+ this.filteredResults = [];
+ }
+ );
+ }
+
+ onPageChange(event: PageEvent) {
+ this.page = event.pageIndex;
+ this.itemsPerPage = event.pageSize;
+ this.applyFilter();
+ }
+
+
+ saveFilters() {
+ const dialogRef = this.dialog.open(SaveFiltersDialogComponent);
+
+ dialogRef.afterClosed().subscribe(result => {
+ if (result) {
+ const filters = {
+ name: result,
+ favourite: true,
+ filters: {
+ filter0: this.filterName,
+ filter1: this.selectedFilter1,
+ filter2: this.selectedFilter2,
+ filter3: this.selectedFilterOS,
+ filter4: this.selectedFilterStatus,
+ filter5: this.filterIP,
+ filter6: this.filterMAC,
+
+ }
+ };
+
+ this.http.post('http://127.0.0.1:8080/views', filters).subscribe(response => {
+ console.log('Response from server:', response);
+ this.toastService.success('Se ha guardado el filtro correctamente');
+ }, error => {
+ console.error('Error:', error);
+ this.toastService.error(error);
+ });
+ }
+ });
+ }
+
+ loadSelectedFilter(savedFilter: any) {
+ const url = 'http://127.0.0.1:8080/views/' + savedFilter[1];
+ console.log('llamando a:', url);
+
+ this.dataService.getFilter(savedFilter[1]).subscribe(response => {
+ console.log('Response from server:', response.filters);
+ if (response) {
+ console.log('Filter1:', response.filters);
+ this.filterName = response.filters.filter0 || '';
+ this.selectedFilter1 = response.filters.filter1 || null;
+ this.selectedFilter2 = response.filters.filter2 || '';
+
+ this.selectedFilterOS = response.filters.filter3 || [];
+ this.selectedFilterStatus = response.filters.filter4 || [];
+ this.filterIP = response.filters.filter5 || '';
+ this.filterMAC = response.filters.filter6 || '';
+
+ this.applyFilter();
+ }
+ }, error => {
+ console.error('Error:', error);
+ });
+
+ }
+
+
+ onCheckboxChange(event: any, name: string) {
+ if (event.checked) {
+ this.selectedElements.push(name);
+ } else {
+ const index = this.selectedElements.indexOf(name);
+ if (index > -1) {
+ this.selectedElements.splice(index, 1);
+ }
+ }
+
+ this.isAllSelected = this.selectedElements.length === this.filteredResults.length;
+ console.log(this.selectedElements);
+ }
+
+ toggleSelectAll() {
+ this.isAllSelected = !this.isAllSelected;
+
+ if (this.isAllSelected) {
+ this.selectedElements = this.filteredResults.map(result => result.name);
+ } else {
+ this.selectedElements = [];
+ }
+ console.log(this.selectedElements);
+ }
+
+ isSelected(name: string): boolean {
+ return this.selectedElements.includes(name);
+ }
+
+
+ sendActions() {
+ const dialogRef = this.dialog.open(AcctionsModalComponent, { data: { selectedElements: this.selectedElements }, width: '700px'});
+ }
+
}
diff --git a/ogWebconsole/src/app/components/groups/legend/legend.component.html b/ogWebconsole/src/app/components/groups/legend/legend.component.html
index 24929b2..9c1ecd5 100644
--- a/ogWebconsole/src/app/components/groups/legend/legend.component.html
+++ b/ogWebconsole/src/app/components/groups/legend/legend.component.html
@@ -1,22 +1,22 @@
apartment
- Unidad organizativa
+ Unidad organizativa
meeting_room
- Grupos de aula
+ Grupos de aula
school
- Aula
+ Aula
lan
- Grupos de clientes
+ Grupos de clientes
computer
- Cliente
+ Cliente
diff --git a/ogWebconsole/src/app/components/groups/organizational-units/create-organizational-unit/create-organizational-unit.component.html b/ogWebconsole/src/app/components/groups/organizational-units/create-organizational-unit/create-organizational-unit.component.html
index 21d080c..e076917 100644
--- a/ogWebconsole/src/app/components/groups/organizational-units/create-organizational-unit/create-organizational-unit.component.html
+++ b/ogWebconsole/src/app/components/groups/organizational-units/create-organizational-unit/create-organizational-unit.component.html
@@ -1,13 +1,13 @@
-
Añadir Unidad Organizativa
+
Añadir Unidad Organizativa
-
+
diff --git a/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html b/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html
index 3160f95..f2ff39d 100644
--- a/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html
+++ b/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html
@@ -1,32 +1,32 @@
-
Editar Unidad Organizativa
+
Editar Unidad Organizativa
-
+
diff --git a/ogWebconsole/src/app/components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component.html b/ogWebconsole/src/app/components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component.html
index 61639be..93406cd 100644
--- a/ogWebconsole/src/app/components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component.html
+++ b/ogWebconsole/src/app/components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component.html
@@ -1,42 +1,42 @@
-
Propiedades unidad organizativa
+
Propiedades unidad organizativa
-
+
- Propiedad |
+ Propiedad |
{{ element.property }} |
- Valor |
+ Valor |
{{ element.value }} |
-
+
- Propiedad |
+ Propiedad |
{{ element.property }} |
- Valor |
+ Valor |
{{ element.value }} |
-
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.css b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.html b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.html
new file mode 100644
index 0000000..c02fcb8
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.html
@@ -0,0 +1 @@
+
save-filters-dialog works!
diff --git a/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.spec.ts b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.spec.ts
new file mode 100644
index 0000000..1a1622b
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SaveFiltersDialogComponent } from './save-filters-dialog.component';
+
+describe('SaveFiltersDialogComponent', () => {
+ let component: SaveFiltersDialogComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [SaveFiltersDialogComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(SaveFiltersDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.ts b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.ts
new file mode 100644
index 0000000..9707c63
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/save-filters-dialog/save-filters-dialog.component.ts
@@ -0,0 +1,38 @@
+import { Component } from '@angular/core';
+import { MatDialogRef } from '@angular/material/dialog';
+import { FormControl, Validators } from '@angular/forms';
+
+@Component({
+ selector: 'app-save-filters-dialog',
+ template: `
+ Guardar filtros
+
+
+ Nombre del filtro
+
+
+ El nombre es obligatorio
+
+
+
+
+
+
+
+ `
+})
+export class SaveFiltersDialogComponent {
+ filterNameControl = new FormControl('', [Validators.required]);
+
+ constructor(public dialogRef: MatDialogRef) {}
+
+ onCancel(): void {
+ this.dialogRef.close(null);
+ }
+
+ onSave(): void {
+ if (this.filterNameControl.valid) {
+ this.dialogRef.close(this.filterNameControl.value);
+ }
+ }
+}
diff --git a/ogWebconsole/src/app/components/groups/tree-view/tree-view.component.html b/ogWebconsole/src/app/components/groups/tree-view/tree-view.component.html
index 4c4e7ec..e15be5b 100644
--- a/ogWebconsole/src/app/components/groups/tree-view/tree-view.component.html
+++ b/ogWebconsole/src/app/components/groups/tree-view/tree-view.component.html
@@ -1,4 +1,4 @@
-Visualizar arbol unidad Organizativa
+Visualizar árbol unidad Organizativa
@@ -17,7 +17,8 @@