refs #798 OU detail add calendar info
parent
8b26b4e060
commit
daca59b7bc
|
@ -48,7 +48,7 @@
|
||||||
<button mat-button color="primary" class="primary-button" [disabled]="false" (click)="execute()" >
|
<button mat-button color="primary" class="primary-button" [disabled]="false" (click)="execute()" >
|
||||||
{{ showClientSelect ? 'Ejecutar' : 'Configurar ejecución' }}
|
{{ showClientSelect ? 'Ejecutar' : 'Configurar ejecución' }}
|
||||||
</button>
|
</button>
|
||||||
<button mat-button color="accent" class="accent-button" (click)="edit()">Editar</button>
|
<!-- <button mat-button color="accent" class="accent-button" (click)="edit()">Editar</button> -->
|
||||||
<button mat-button class="cancel-button" (click)="cancel()">Cancelar</button>
|
<button mat-button class="cancel-button" (click)="cancel()">Cancelar</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,18 +32,18 @@ export class EditOrganizationalUnitComponent implements OnInit {
|
||||||
{"name": 'Half duplex', "value": "half-duplex"},
|
{"name": 'Half duplex', "value": "half-duplex"},
|
||||||
{"name": 'Full duplex', "value": "full-duplex"},
|
{"name": 'Full duplex', "value": "full-duplex"},
|
||||||
];
|
];
|
||||||
@Output() unitAdded = new EventEmitter(); // Event emitter to notify parent component about unit addition
|
@Output() unitAdded = new EventEmitter();
|
||||||
calendars: any;
|
calendars: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _formBuilder: FormBuilder,
|
private _formBuilder: FormBuilder,
|
||||||
private dialogRef: MatDialogRef<CreateOrganizationalUnitComponent>,
|
private dialogRef: MatDialogRef<CreateOrganizationalUnitComponent>,
|
||||||
private http: HttpClient, // Inject HttpClient for HTTP requests
|
private http: HttpClient,
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
private toastService: ToastrService,
|
private toastService: ToastrService,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any // Inject data for edit mode
|
@Inject(MAT_DIALOG_DATA) public data: any
|
||||||
) {
|
) {
|
||||||
this.isEditMode = !!data?.uuid; // Check if uuid is passed to determine edit mode
|
this.isEditMode = !!data?.uuid;
|
||||||
|
|
||||||
this.generalFormGroup = this._formBuilder.group({
|
this.generalFormGroup = this._formBuilder.group({
|
||||||
name: ['', Validators.required],
|
name: ['', Validators.required],
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
import {Component, Inject} from '@angular/core';
|
import {Component, Inject} from '@angular/core';
|
||||||
import {MAT_DIALOG_DATA} from "@angular/material/dialog";
|
import {MAT_DIALOG_DATA} from "@angular/material/dialog";
|
||||||
|
|
||||||
|
@ -7,43 +8,52 @@ import {MAT_DIALOG_DATA} from "@angular/material/dialog";
|
||||||
styleUrl: './show-organizational-unit.component.css'
|
styleUrl: './show-organizational-unit.component.css'
|
||||||
})
|
})
|
||||||
export class ShowOrganizationalUnitComponent {
|
export class ShowOrganizationalUnitComponent {
|
||||||
|
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
|
||||||
displayedColumns: string[] = ['property', 'value'];
|
displayedColumns: string[] = ['property', 'value'];
|
||||||
|
currentCalendar: any;
|
||||||
generalData = [
|
generalData: any[] = [];
|
||||||
{ property: 'Nombre', value: this.data.data.name },
|
|
||||||
{ property: 'Uuid', value: this.data.data.uuid },
|
|
||||||
{ property: 'Descripción', value: this.data.data.description },
|
|
||||||
{ property: 'Comentarios', value: this.data.data.comments },
|
|
||||||
{ property: 'Tipo', value: this.data.data.type },
|
|
||||||
{ property: 'Unidad organizativa superior', value: this.data.data.parent ? this.data.data.parent.name : '-' },
|
|
||||||
{ property: 'Creado por', value: this.data.data.createdBy },
|
|
||||||
{ property: 'Creado el', value: this.data.data.createdAt }
|
|
||||||
];
|
|
||||||
|
|
||||||
networkData = [
|
networkData = [
|
||||||
{ property: 'Localización', value: this.data.data.location },
|
|
||||||
{ property: 'Proyector', value: this.data.data.projector ? 'Sí' : 'No' },
|
|
||||||
{ property: 'Pizzarra', value: this.data.data.board ? 'Sí' : 'No' },
|
|
||||||
{ property: 'Aforo', value: this.data.data.capacity },
|
|
||||||
{ property: 'Url servidor proxy', value: this.data.data.networkSettings ? this.data.data.networkSettings.proxy : '' },
|
|
||||||
{ property: 'IP DNS', value: this.data.data.networkSettings ? this.data.data.networkSettings.dns : '' },
|
|
||||||
{ property: 'Máscara de red', value: this.data.data.networkSettings ? this.data.data.networkSettings.netmask : '' },
|
|
||||||
{ property: 'Router', value: this.data.data.networkSettings ? this.data.data.networkSettings.router : '' },
|
|
||||||
{ property: 'NTP', value: this.data.data.networkSettings ? this.data.data.networkSettings.ntp : '' },
|
|
||||||
{ property: 'Modo p2p', value: this.data.data.networkSettings ? this.data.data.networkSettings.p2pMode : '' },
|
|
||||||
{ property: 'Tiempo p2p', value: this.data.data.networkSettings ? this.data.data.networkSettings.p2pTime : '' },
|
|
||||||
{ property: 'IP multicast', value: this.data.data.networkSettings ? this.data.data.networkSettings.mcastIp : '' },
|
|
||||||
{ property: 'Modo multicast', value: this.data.data.networkSettings ? this.data.data.networkSettings.mcastMode : '' },
|
|
||||||
{ property: 'Puerto multicast', value: this.data.data.networkSettings ? this.data.data.networkSettings.mcastPort : '' },
|
|
||||||
{ property: 'Velocidad multicast', value: this.data.data.networkSettings ? this.data.data.networkSettings.mcastSpeed : '' },
|
|
||||||
{ property: 'Perfil hardware', value: this.data.data.networkSettings && this.data.data.networkSettings.hardwareProfile ? this.data.data.networkSettings.hardwareProfile.description : '' },
|
|
||||||
{ property: 'Menú', value: this.data.data.networkSettings && this.data.data.networkSettings.menu ? this.data.data.networkSettings.menu.description : '' }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any // Inject data for edit mode
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private http: HttpClient
|
||||||
) {
|
) {
|
||||||
console.log(this.data)
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (this.data.data.remoteCalendar) {
|
||||||
|
this.loadCurrentCalendar(this.data.data.remoteCalendar.uuid);
|
||||||
|
} else {
|
||||||
|
this.initializeGeneralData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadCurrentCalendar(uuid: string): void {
|
||||||
|
const apiUrl = `${this.baseUrl}/remote-calendars/${uuid}`;
|
||||||
|
this.http.get<any>(apiUrl).subscribe(
|
||||||
|
response => {
|
||||||
|
this.currentCalendar = response.name;
|
||||||
|
this.initializeGeneralData();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.error('Error loading current calendar', error);
|
||||||
|
this.initializeGeneralData();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeGeneralData(): void {
|
||||||
|
this.generalData = [
|
||||||
|
{ property: 'Nombre', value: this.data.data.name },
|
||||||
|
{ property: 'Uuid', value: this.data.data.uuid },
|
||||||
|
{ property: 'Descripción', value: this.data.data.description },
|
||||||
|
{ property: 'Comentarios', value: this.data.data.comments },
|
||||||
|
{ property: 'Tipo', value: this.data.data.type },
|
||||||
|
{ property: 'Unidad organizativa superior', value: this.data.data.parent ? this.data.data.parent.name : '-' },
|
||||||
|
{ property: 'Creado por', value: this.data.data.createdBy },
|
||||||
|
{ property: 'Creado el', value: this.data.data.createdAt },
|
||||||
|
{ property: 'Calendario asociado', value: this.data.data.remoteCalendar ? this.currentCalendar : '-' }
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue