Code clean
parent
2fe25308f6
commit
bf3fe8b1ae
|
@ -179,6 +179,9 @@
|
|||
<mat-label i18n="@@nameLabel">Nombre</mat-label>
|
||||
<input matInput placeholder="Unidad organizativa" (input)="applyFilter()" [(ngModel)]="filterName" i18n-placeholder="@@namePlaceholder">
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
||||
<!-- FILTROS UNIDAD ORGANIZATIVA-->
|
||||
|
||||
<ng-container *ngIf="selectedFilter1 === 'ou'">
|
||||
|
@ -216,73 +219,7 @@
|
|||
<mat-option value="Windows 10 Education 1803 64 bits">Windows 10 Education 1803 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.1 LTS 64 bits">Ubuntu 18.04.1 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.4 LTS 64 bits">Ubuntu 16.04.4 LTS 64 bits</mat-option>
|
||||
<mat-option value="DATA">DATA</mat-option>
|
||||
<mat-option value="Windows Boot loader">Windows Boot loader</mat-option>
|
||||
<mat-option value="Windows 7 Professional">Windows 7 Professional</mat-option>
|
||||
<mat-option value="OpenGnsys Live">OpenGnsys Live</mat-option>
|
||||
<mat-option value="Ubuntu 18.04 LTS 64 bits">Ubuntu 18.04 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1709 64 bits">Windows 10 Education 1709 64 bits</mat-option>
|
||||
<mat-option value="Windows 7 Enterprise 64 bits">Windows 7 Enterprise 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1607 64 bits">Windows 10 Education 1607 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.5 LTS 64 bits">Ubuntu 16.04.5 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.2 LTS 64 bits">Ubuntu 16.04.2 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 64 bits">Windows 10 Education 64 bits</mat-option>
|
||||
<mat-option value="CentOS release 6.3 (Final) 64 bits">CentOS release 6.3 (Final) 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.1 LTS 64 bits">Ubuntu 16.04.1 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Enterprise 1803 64 bits">Windows 10 Enterprise 1803 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.3 LTS 64 bits">Ubuntu 16.04.3 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu precise (12.04.4 LTS)">Ubuntu precise (12.04.4 LTS)</mat-option>
|
||||
<mat-option value="GRUB2 Loader">GRUB2 Loader</mat-option>
|
||||
<mat-option value="Mac OS X 10.9.5 64 bits">Mac OS X 10.9.5 64 bits</mat-option>
|
||||
<mat-option value="Mac OS X 10.8.3 recovery">Mac OS X 10.8.3 recovery</mat-option>
|
||||
<mat-option value="Mac OS X 10.13.6">Mac OS X 10.13.6</mat-option>
|
||||
<mat-option value="Windows 10 Education 1703 64 bits">Windows 10 Education 1703 64 bits</mat-option>
|
||||
<mat-option value="Windows 7 Professional 64 bits">Windows 7 Professional 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 14.04.4 LTS 64 bits">Ubuntu 14.04.4 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1511 64 bits">Windows 10 Education 1511 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.2 LTS 64 bits">Ubuntu 18.04.2 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1809 64 bits">Windows 10 Education 1809 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 16.04.6 LTS 64 bits">Ubuntu 16.04.6 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 14.04.5 LTS 64 bits">Ubuntu 14.04.5 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1903 64 bits">Windows 10 Education 1903 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Enterprise 1903 64 bits">Windows 10 Enterprise 1903 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Pro 1903 64 bits">Windows 10 Pro 1903 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.3 LTS 64 bits">Ubuntu 18.04.3 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 1909 64 bits">Windows 10 Education 1909 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.3 LTS">Ubuntu 18.04.3 LTS</mat-option>
|
||||
<mat-option value="Windows 10 Enterprise 1909 64 bits">Windows 10 Enterprise 1909 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.4 LTS 64 bits">Ubuntu 18.04.4 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows Boot loader 64 bits">Windows Boot loader 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 2004 64 bits">Windows 10 Education 2004 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04 LTS 64 bits">Ubuntu 20.04 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04.1 LTS 64 bits">Ubuntu 20.04.1 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Enterprise LTSC 2019 Evaluation 1809 64 bits">Windows 10 Enterprise LTSC 2019 Evaluation 1809 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.5 LTS 64 bits">Ubuntu 18.04.5 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 2009 64 bits">Windows 10 Education 2009 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04.2 LTS 64 bits">Ubuntu 20.04.2 LTS 64 bits</mat-option>
|
||||
<mat-option value="GRUB2 Loader 64 bits">GRUB2 Loader 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Education 2009">Windows 10 Education 2009</mat-option>
|
||||
<mat-option value="Debian GNU/Linux 8 (jessie) 64 bits">Debian GNU/Linux 8 (jessie) 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Enterprise 2009 64 bits">Windows 10 Enterprise 2009 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Pro 2009 64 bits">Windows 10 Pro 2009 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Pro 1909 64 bits">Windows 10 Pro 1909 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Home 2009 64 bits">Windows 10 Home 2009 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04.3 LTS 64 bits">Ubuntu 20.04.3 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04.4 LTS 64 bits">Ubuntu 20.04.4 LTS 64 bits</mat-option>
|
||||
<mat-option value="Microsoft Windows XP">Microsoft Windows XP</mat-option>
|
||||
<mat-option value="Ubuntu 22.04 LTS 64 bits">Ubuntu 22.04 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 22.04.1 LTS 64 bits">Ubuntu 22.04.1 LTS 64 bits</mat-option>
|
||||
<mat-option value="EducaAndOS 20.04 64 bits">EducaAndOS 20.04 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 20.04.5 LTS 64 bits">Ubuntu 20.04.5 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Pro N 2009 64 bits">Windows 10 Pro N 2009 64 bits</mat-option>
|
||||
<mat-option value="Guadalinex Edu 20.04 64 bits">Guadalinex Edu 20.04 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 18.04.6 LTS 64 bits">Ubuntu 18.04.6 LTS 64 bits</mat-option>
|
||||
<mat-option value="elementary OS 6 Odin 64 bits">elementary OS 6 Odin 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 22.04.2 LTS 64 bits">Ubuntu 22.04.2 LTS 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 22.04.3 LTS 64 bits">Ubuntu 22.04.3 LTS 64 bits</mat-option>
|
||||
<mat-option value="Windows 10 Pro for Workstations 2009 64 bits">Windows 10 Pro for Workstations 2009 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 23.10 64 bits">Ubuntu 23.10 64 bits</mat-option>
|
||||
<mat-option value="Ubuntu 22.04.4 LTS 64 bits">Ubuntu 22.04.4 LTS 64 bits</mat-option>
|
||||
<mat-option value="DATA">RESTO DE OPCIONES TBI</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
@ -313,7 +250,7 @@
|
|||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<button mat-raised-button color="primary" (click)="toggleSelectAll()">Seleccionar/Deseleccionar Todos</button>
|
||||
<button mat-raised-button color="primary" (click)="saveFilters()" i18n="@@saveFiltersButton">Guardar Filtros</button>
|
||||
<button mat-raised-button color="accent" (click)="sendActions()" i18n="@@sendFiltersButton" [disabled]="selectedElements.length === 0">Enviar Acción</button>
|
||||
</div>
|
||||
|
@ -322,13 +259,19 @@
|
|||
<mat-grid-list cols="4" rowHeight="1:1">
|
||||
<mat-grid-tile *ngFor="let result of filteredResults">
|
||||
<mat-card class="result-card">
|
||||
<mat-checkbox (change)="onCheckboxChange($event, result.name)"></mat-checkbox>
|
||||
|
||||
<mat-checkbox
|
||||
[checked]="isSelected(result.name)"
|
||||
(change)="onCheckboxChange($event, result.name)">
|
||||
</mat-checkbox>
|
||||
<mat-card-title>{{ result.name }}</mat-card-title>
|
||||
<mat-card-content>
|
||||
<p>{{ result.type }}</p>
|
||||
<p *ngIf="result.type !== 'client'" i18n="@@internalUnits">Unidades internas: {{ result.type !== 'client' ? result.children.length : 0}}</p>
|
||||
<p *ngIf="result.type !== 'client'" i18n="@@clients">Clientes: {{ result.type !== 'client' ? result.clients.length : 0}}</p>
|
||||
<p *ngIf="result.type !== 'client'" i18n="@@internalUnits">
|
||||
Unidades internas: {{ result.type !== 'client' ? result.children.length : 0 }}
|
||||
</p>
|
||||
<p *ngIf="result.type !== 'client'" i18n="@@clients">
|
||||
Clientes: {{ result.type !== 'client' ? result.clients.length : 0 }}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-grid-tile>
|
||||
|
|
|
@ -13,10 +13,8 @@ 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 {Observable} from "rxjs";
|
||||
import {PageEvent} from "@angular/material/paginator";
|
||||
import { SaveFiltersDialogComponent } from './save-filters-dialog/save-filters-dialog.component';
|
||||
import { AcctionsModalComponent } from './acctions-modal/acctions-modal.component';
|
||||
|
@ -29,11 +27,11 @@ import { AcctionsModalComponent } from './acctions-modal/acctions-modal.componen
|
|||
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 = '';
|
||||
|
@ -53,6 +51,8 @@ export class GroupsComponent implements OnInit {
|
|||
page: number = 1;
|
||||
pageSizeOptions: number[] = [5, 10, 25, 100];
|
||||
selectedElements: string[] = [];
|
||||
isAllSelected: boolean = false;
|
||||
|
||||
|
||||
constructor(
|
||||
private dataService: DataService,
|
||||
|
@ -83,11 +83,11 @@ export class GroupsComponent implements OnInit {
|
|||
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;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ export class GroupsComponent implements OnInit {
|
|||
|
||||
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);
|
||||
|
@ -128,27 +128,27 @@ export class GroupsComponent implements OnInit {
|
|||
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
|
||||
}
|
||||
);
|
||||
|
@ -173,7 +173,6 @@ export class GroupsComponent implements OnInit {
|
|||
|
||||
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 => {
|
||||
|
@ -380,6 +379,7 @@ export class GroupsComponent implements OnInit {
|
|||
|
||||
}
|
||||
|
||||
|
||||
onCheckboxChange(event: any, name: string) {
|
||||
if (event.checked) {
|
||||
this.selectedElements.push(name);
|
||||
|
@ -389,9 +389,26 @@ export class GroupsComponent implements OnInit {
|
|||
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'});
|
||||
|
|
Loading…
Reference in New Issue