|
|
@@ -1,22 +1,32 @@
|
|
|
-
|
|
|
import { Component, Inject, OnInit, DOCUMENT } from '@angular/core';
|
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
|
import { ResourcesService } from '../../../../services/resources.service';
|
|
|
-import { CorrectiveWorkOrderDetailsResponse, WorkOrderStatusHistoryListItem } from '../../../../interfaces/corrective-maintenance.interface';
|
|
|
+import {
|
|
|
+ CorrectiveWorkOrderDetailsResponse,
|
|
|
+ WorkOrderStatusHistoryListItem,
|
|
|
+} from '../../../../interfaces/corrective-maintenance.interface';
|
|
|
+import { PreventiveVisitDetailsResponse } from '../../../../interfaces/preventive-maintenance.interface';
|
|
|
import { lastValueFrom } from 'rxjs';
|
|
|
import { CorrectiveMaintenanceService } from '../../../../services/corrective-maintenance.service';
|
|
|
+import { PreventiveMaintenanceService } from '../../../../services/preventive-maintenance.service';
|
|
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|
|
import { EncService } from '../../../../services/enc.service';
|
|
|
import { EmployeeService } from '../../../../services/personal-management/employee.service';
|
|
|
-import { EmployeesListItem, EmployeesListResponse } from '../../../../interfaces/personal-managment/employee.interface';
|
|
|
+import {
|
|
|
+ EmployeesListItem,
|
|
|
+ EmployeesListResponse,
|
|
|
+} from '../../../../interfaces/personal-managment/employee.interface';
|
|
|
import { SubcontratistService } from '../../../../services/personal-management/subcontratist.service';
|
|
|
-import { SubcontratistItem, SubcontratistsResponse } from '../../../../interfaces/personal-managment/subcontratists.interface';
|
|
|
+import {
|
|
|
+ SubcontratistItem,
|
|
|
+ SubcontratistsResponse,
|
|
|
+} from '../../../../interfaces/personal-managment/subcontratists.interface';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-staff-selection',
|
|
|
standalone: false,
|
|
|
templateUrl: './staff-selection.component.html',
|
|
|
- styleUrl: './staff-selection.component.css'
|
|
|
+ styleUrl: './staff-selection.component.css',
|
|
|
})
|
|
|
export class StaffSelectionComponent implements OnInit {
|
|
|
isLoading: boolean;
|
|
|
@@ -27,6 +37,7 @@ export class StaffSelectionComponent implements OnInit {
|
|
|
employees: EmployeesListItem[];
|
|
|
subcontratists: EmployeesListItem[];
|
|
|
excludedUsers: string[];
|
|
|
+ orderType: 'Correctivo' | 'Preventivo';
|
|
|
|
|
|
formGroup: FormGroup;
|
|
|
|
|
|
@@ -36,113 +47,209 @@ export class StaffSelectionComponent implements OnInit {
|
|
|
private _resourcesService: ResourcesService,
|
|
|
private _dialogRef: MatDialogRef<StaffSelectionComponent>,
|
|
|
private _correctiveMaintenanceService: CorrectiveMaintenanceService,
|
|
|
+ private _preventiveMaintenanceService: PreventiveMaintenanceService,
|
|
|
private _encService: EncService,
|
|
|
private _employeeService: EmployeeService,
|
|
|
- private _subcontratistService: SubcontratistService,
|
|
|
+ private _subcontratistService: SubcontratistService
|
|
|
) {
|
|
|
this.isLoading = true;
|
|
|
this.hasError = true;
|
|
|
- this.errorStr = "";
|
|
|
+ this.errorStr = '';
|
|
|
this.staffSpecialtiesMap = new Map();
|
|
|
this.staffOperariesMap = new Map();
|
|
|
this.employees = [];
|
|
|
this.subcontratists = [];
|
|
|
this.excludedUsers = [];
|
|
|
+ this.orderType = 'Correctivo'; // default
|
|
|
|
|
|
this.formGroup = new FormGroup({});
|
|
|
}
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
- if(this._data.idOrder != null && this._data.idOrder != undefined){
|
|
|
+ if (this._data.idOrder != null && this._data.idOrder != undefined) {
|
|
|
+ // Set orderType from data, default to 'corrective' if not provided
|
|
|
+ this.orderType = this._data.orderType || 'Correctivo';
|
|
|
this.getOrderDetails();
|
|
|
- }else{
|
|
|
- this._resourcesService.openSnackBar('No se envió el ID de la orden de mantenimiento.');
|
|
|
+ } else {
|
|
|
+ this._resourcesService.openSnackBar(
|
|
|
+ 'No se envió el ID de la orden de mantenimiento.'
|
|
|
+ );
|
|
|
this._dialogRef.close();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async getOrderDetails(){
|
|
|
- try{
|
|
|
+ private async getOrderDetails() {
|
|
|
+ try {
|
|
|
let idUser = localStorage.getItem('idusuario')!;
|
|
|
- let order: CorrectiveWorkOrderDetailsResponse = await lastValueFrom(this._correctiveMaintenanceService.getWorkOrder(
|
|
|
- this._data.idOrder,
|
|
|
- idUser,
|
|
|
- 1
|
|
|
- ));
|
|
|
+ let personalData: string = '';
|
|
|
+ let historialEstatus: string = '';
|
|
|
+
|
|
|
+ console.log('🔍 Staff Selection - Order Type:', this.orderType);
|
|
|
+ console.log('🔍 Staff Selection - Order ID:', this._data.idOrder);
|
|
|
+
|
|
|
+ // Fetch order details based on orderType
|
|
|
+ if (this.orderType === 'Correctivo') {
|
|
|
+ let order: CorrectiveWorkOrderDetailsResponse = await lastValueFrom(
|
|
|
+ this._correctiveMaintenanceService.getWorkOrder(
|
|
|
+ this._data.idOrder,
|
|
|
+ idUser,
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ console.log('✅ Corrective Order Response:', order);
|
|
|
+
|
|
|
+ this.hasError = order.error;
|
|
|
+ this.errorStr = order.msg;
|
|
|
+
|
|
|
+ if (this.hasError) {
|
|
|
+ console.error('❌ Error getting corrective order:', this.errorStr);
|
|
|
+ this.isLoading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- this.hasError = order.error;
|
|
|
- this.errorStr = order.msg;
|
|
|
+ personalData = order.response.PERSONAL;
|
|
|
+ historialEstatus = order.response.HISTORIAL_ESTATUS;
|
|
|
+ console.log('📋 PERSONAL data (raw):', personalData);
|
|
|
+ } else {
|
|
|
+ // Preventive maintenance
|
|
|
+ let order: PreventiveVisitDetailsResponse = await lastValueFrom(
|
|
|
+ this._preventiveMaintenanceService.getVisit(
|
|
|
+ this._data.idOrder,
|
|
|
+ idUser,
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ console.log('✅ Preventive Order Response:', order);
|
|
|
+
|
|
|
+ this.hasError = order.error;
|
|
|
+ this.errorStr = order.msg;
|
|
|
+
|
|
|
+ if (this.hasError) {
|
|
|
+ console.error('❌ Error getting preventive order:', this.errorStr);
|
|
|
+ this.isLoading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if(this.hasError){
|
|
|
- this.isLoading = false;
|
|
|
- }else{
|
|
|
- let statusHistory: WorkOrderStatusHistoryListItem[] = JSON.parse(order.response.HISTORIAL_ESTATUS);
|
|
|
- let validatedStatus = statusHistory.filter(item => item.ESTADO == 'VA');
|
|
|
+ personalData = order.response.PERSONAL || '';
|
|
|
+ // Preventive visits might not have HISTORIAL_ESTATUS in the same format
|
|
|
+ // We'll handle this case by using an empty string
|
|
|
+ historialEstatus = '';
|
|
|
+ console.log('📋 PERSONAL data (raw):', personalData);
|
|
|
+ }
|
|
|
|
|
|
- if(validatedStatus.length > 0){
|
|
|
+ // Process excluded users from status history (only for corrective orders)
|
|
|
+ if (this.orderType === 'Correctivo' && historialEstatus) {
|
|
|
+ let statusHistory: WorkOrderStatusHistoryListItem[] =
|
|
|
+ JSON.parse(historialEstatus);
|
|
|
+ let validatedStatus = statusHistory.filter(
|
|
|
+ (item) => item.ESTADO == 'VA'
|
|
|
+ );
|
|
|
+
|
|
|
+ if (validatedStatus.length > 0 && validatedStatus[0].ATENCION) {
|
|
|
let excludedUsersArr: string[] = [];
|
|
|
- for(const item of validatedStatus[0].ATENCION!){
|
|
|
- if(item.RESPUESTA == 'R') excludedUsersArr.push(item.ID);
|
|
|
+ for (const item of validatedStatus[0].ATENCION!) {
|
|
|
+ if (item.RESPUESTA == 'R') excludedUsersArr.push(item.ID);
|
|
|
}
|
|
|
|
|
|
this.excludedUsers = excludedUsersArr;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- let staffArr = JSON.parse(order.response.PERSONAL);
|
|
|
- for(const specialty of staffArr){
|
|
|
+ // Process staff requirements (same for both types)
|
|
|
+ if (personalData) {
|
|
|
+ let staffArr = JSON.parse(personalData);
|
|
|
+ console.log('👥 Staff Array (parsed):', staffArr);
|
|
|
+
|
|
|
+ for (const specialty of staffArr) {
|
|
|
let idDec = await this._encService.decrypt(specialty.ID);
|
|
|
+ console.log(`🔓 Specialty ID decrypted: ${specialty.ID} -> ${idDec}`);
|
|
|
+ console.log(
|
|
|
+ `📛 Specialty Name: ${specialty.NAME}, Cantidad: ${specialty.CANT}`
|
|
|
+ );
|
|
|
+
|
|
|
this.staffSpecialtiesMap.set(idDec, specialty.NAME);
|
|
|
|
|
|
- let operaries: string[] = this.staffOperariesMap.get(idDec) === undefined ? [] : this.staffOperariesMap.get(idDec)!;
|
|
|
- for(let i = 0; i < specialty.CANT; i++){
|
|
|
+ let operaries: string[] =
|
|
|
+ this.staffOperariesMap.get(idDec) === undefined
|
|
|
+ ? []
|
|
|
+ : this.staffOperariesMap.get(idDec)!;
|
|
|
+ for (let i = 0; i < specialty.CANT; i++) {
|
|
|
let index = `${idDec}${i}Control`;
|
|
|
- this.formGroup.addControl(index, new FormControl('', Validators.required));
|
|
|
-
|
|
|
+ console.log(`➕ Adding form control: ${index}`);
|
|
|
+ this.formGroup.addControl(
|
|
|
+ index,
|
|
|
+ new FormControl('', Validators.required)
|
|
|
+ );
|
|
|
+
|
|
|
operaries.push(index);
|
|
|
}
|
|
|
|
|
|
this.staffOperariesMap.set(idDec, operaries);
|
|
|
}
|
|
|
|
|
|
- this.getEmployees();
|
|
|
+ console.log('🗺️ staffSpecialtiesMap:', this.staffSpecialtiesMap);
|
|
|
+ console.log('🗺️ staffOperariesMap:', this.staffOperariesMap);
|
|
|
+ } else {
|
|
|
+ console.warn('⚠️ No PERSONAL data found in response');
|
|
|
}
|
|
|
- }catch(error: any){
|
|
|
- if(error.error == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else if(error.error.msg == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else{
|
|
|
+
|
|
|
+ this.getEmployees();
|
|
|
+ } catch (error: any) {
|
|
|
+ if (error.error == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else if (error.error.msg == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else {
|
|
|
this.errorStr = error.error.msg;
|
|
|
}
|
|
|
+ this.hasError = true;
|
|
|
+ this.isLoading = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async getEmployees(){
|
|
|
- try{
|
|
|
+ private async getEmployees() {
|
|
|
+ try {
|
|
|
let idUser = localStorage.getItem('idusuario')!;
|
|
|
- let employees: EmployeesListResponse = await lastValueFrom(this._employeeService.getConsultOfEmployees(idUser, 1));
|
|
|
+ let employees: EmployeesListResponse = await lastValueFrom(
|
|
|
+ this._employeeService.getConsultOfEmployees(idUser, 1)
|
|
|
+ );
|
|
|
+
|
|
|
+ console.log('👷 Employees Response:', employees);
|
|
|
|
|
|
this.hasError = employees.error;
|
|
|
this.errorStr = employees.msg;
|
|
|
|
|
|
- if(this.hasError){
|
|
|
+ if (this.hasError) {
|
|
|
+ console.error('❌ Error getting employees:', this.errorStr);
|
|
|
this.isLoading = false;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
let employeesArr: EmployeesListItem[] = [];
|
|
|
let subcontratistsEmployees: EmployeesListItem[] = [];
|
|
|
-
|
|
|
- for(const employee of employees.response){
|
|
|
+ console.log(
|
|
|
+ `📊 Total employees received: ${employees.response.length}`
|
|
|
+ );
|
|
|
+
|
|
|
+ for (const employee of employees.response) {
|
|
|
let idEmployee = await this._encService.decrypt(employee.ID_EMPLOYEE);
|
|
|
employee.NAME = `${employee.NAME} (${idEmployee})`;
|
|
|
|
|
|
- if(employee.CONTRACT_TYPE == 'Interno' && employee.STATUS == 'Activo'){
|
|
|
+ if (
|
|
|
+ employee.CONTRACT_TYPE == 'Interno' &&
|
|
|
+ employee.STATUS == 'Activo'
|
|
|
+ ) {
|
|
|
let specialtiesArr = JSON.parse(employee.SPECIALITY);
|
|
|
let specialtiesStrArr: string[] = [];
|
|
|
|
|
|
- for(const specialtyStr of specialtiesArr){
|
|
|
- let specialtyEnc = await this._encService.isEncrypted(specialtyStr);
|
|
|
- let specialtyDec = specialtyEnc ? await this._encService.decrypt(specialtyStr) : specialtyStr;
|
|
|
- let specialtyArr = specialtyDec.split(" - ");
|
|
|
+ for (const specialtyStr of specialtiesArr) {
|
|
|
+ let specialtyEnc = await this._encService.isEncrypted(
|
|
|
+ specialtyStr
|
|
|
+ );
|
|
|
+ let specialtyDec = specialtyEnc
|
|
|
+ ? await this._encService.decrypt(specialtyStr)
|
|
|
+ : specialtyStr;
|
|
|
+ let specialtyArr = specialtyDec.split(' - ');
|
|
|
let specialtyInd = specialtyArr[0];
|
|
|
|
|
|
specialtiesStrArr.push(specialtyInd);
|
|
|
@@ -150,97 +257,133 @@ export class StaffSelectionComponent implements OnInit {
|
|
|
|
|
|
employee.SPECIALITY_ARR = specialtiesStrArr;
|
|
|
let idUser = await this._encService.decrypt(employee.ID_USUARIO);
|
|
|
- let userExceptionFilt = this.excludedUsers.filter(item => item == idUser);
|
|
|
+ let userExceptionFilt = this.excludedUsers.filter(
|
|
|
+ (item) => item == idUser
|
|
|
+ );
|
|
|
|
|
|
- if(userExceptionFilt.length <= 0){
|
|
|
+ if (userExceptionFilt.length <= 0) {
|
|
|
employeesArr.push(employee);
|
|
|
}
|
|
|
- }else if(employee.CONTRACT_TYPE == 'Subcontratista'){
|
|
|
+ } else if (employee.CONTRACT_TYPE == 'Subcontratista') {
|
|
|
subcontratistsEmployees.push(employee);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.employees = employeesArr;
|
|
|
+ console.log(`✅ Internal employees filtered: ${employeesArr.length}`);
|
|
|
+ console.log(
|
|
|
+ `🏢 Subcontractor employees to process: ${subcontratistsEmployees.length}`
|
|
|
+ );
|
|
|
this.getSubcontratists(subcontratistsEmployees);
|
|
|
}
|
|
|
- }catch(error: any){
|
|
|
- if(error.error == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else if(error.error.msg == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else{
|
|
|
+ } catch (error: any) {
|
|
|
+ if (error.error == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else if (error.error.msg == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else {
|
|
|
this.errorStr = error.error.msg;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async getSubcontratists(subcontratistsEmployees: EmployeesListItem[]){
|
|
|
- try{
|
|
|
+ private async getSubcontratists(
|
|
|
+ subcontratistsEmployees: EmployeesListItem[]
|
|
|
+ ) {
|
|
|
+ try {
|
|
|
let idUser = localStorage.getItem('idusuario')!;
|
|
|
- let subcontratists: SubcontratistsResponse = await lastValueFrom(this._subcontratistService.getConsultOfSubcontratists(idUser, 1));
|
|
|
+ let subcontratists: SubcontratistsResponse = await lastValueFrom(
|
|
|
+ this._subcontratistService.getConsultOfSubcontratists(idUser, 1)
|
|
|
+ );
|
|
|
|
|
|
this.hasError = subcontratists.error;
|
|
|
this.errorStr = subcontratists.msg;
|
|
|
|
|
|
- if(!this.hasError){
|
|
|
+ if (!this.hasError) {
|
|
|
let subcontratistsArr: SubcontratistItem[] = [];
|
|
|
- for(const subcontratist of subcontratists.response){
|
|
|
- subcontratist.ID_SUBCONTRATIST = await this._encService.decrypt(subcontratist.ID_SUBCONTRATIST);
|
|
|
+ for (const subcontratist of subcontratists.response) {
|
|
|
+ subcontratist.ID_SUBCONTRATIST = await this._encService.decrypt(
|
|
|
+ subcontratist.ID_SUBCONTRATIST
|
|
|
+ );
|
|
|
subcontratistsArr.push(subcontratist);
|
|
|
}
|
|
|
|
|
|
let subcontratistEmployeesArr: EmployeesListItem[] = [];
|
|
|
- for(const employee of subcontratistsEmployees){
|
|
|
- let idSubcontratistDec = await this._encService.decrypt(employee.ID_SUBCONTRATISTA!);
|
|
|
- let subcontratistFilt = subcontratistsArr.filter(item => item.ID_SUBCONTRATIST == idSubcontratistDec);
|
|
|
-
|
|
|
- if(subcontratistFilt.length > 0){
|
|
|
+ for (const employee of subcontratistsEmployees) {
|
|
|
+ let idSubcontratistDec = await this._encService.decrypt(
|
|
|
+ employee.ID_SUBCONTRATISTA!
|
|
|
+ );
|
|
|
+ let subcontratistFilt = subcontratistsArr.filter(
|
|
|
+ (item) => item.ID_SUBCONTRATIST == idSubcontratistDec
|
|
|
+ );
|
|
|
+
|
|
|
+ if (subcontratistFilt.length > 0) {
|
|
|
let specialtiesArr = JSON.parse(employee.SPECIALITY);
|
|
|
let specialtiesStrArr: string[] = [];
|
|
|
|
|
|
- for(const specialtyStr of specialtiesArr){
|
|
|
- let specialtyEnc = await this._encService.isEncrypted(specialtyStr);
|
|
|
- let specialtyDec = specialtyEnc ? await this._encService.decrypt(specialtyStr) : specialtyStr;
|
|
|
- let specialtyArr = specialtyDec.split(" - ");
|
|
|
+ for (const specialtyStr of specialtiesArr) {
|
|
|
+ let specialtyEnc = await this._encService.isEncrypted(
|
|
|
+ specialtyStr
|
|
|
+ );
|
|
|
+ let specialtyDec = specialtyEnc
|
|
|
+ ? await this._encService.decrypt(specialtyStr)
|
|
|
+ : specialtyStr;
|
|
|
+ let specialtyArr = specialtyDec.split(' - ');
|
|
|
let specialtyInd = specialtyArr[0];
|
|
|
|
|
|
specialtiesStrArr.push(specialtyInd);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
employee.SPECIALITY_ARR = specialtiesStrArr;
|
|
|
employee.NAME = `${subcontratistFilt[0].NAME} - ${employee.NAME}`;
|
|
|
let idUser = await this._encService.decrypt(employee.ID_USUARIO);
|
|
|
- let userExceptionFilt = this.excludedUsers.filter(item => item == idUser);
|
|
|
+ let userExceptionFilt = this.excludedUsers.filter(
|
|
|
+ (item) => item == idUser
|
|
|
+ );
|
|
|
|
|
|
- if(userExceptionFilt.length <= 0){
|
|
|
+ if (userExceptionFilt.length <= 0) {
|
|
|
subcontratistEmployeesArr.push(employee);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.subcontratists = subcontratistEmployeesArr;
|
|
|
+ console.log(
|
|
|
+ `✅ Final subcontractor employees: ${subcontratistEmployeesArr.length}`
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
+ console.log('🎯 Final data loaded:');
|
|
|
+ console.log(' - Employees:', this.employees.length);
|
|
|
+ console.log(' - Subcontratists:', this.subcontratists.length);
|
|
|
+ console.log(' - Specialties Map:', this.staffSpecialtiesMap);
|
|
|
+ console.log(' - Operaries Map:', this.staffOperariesMap);
|
|
|
+
|
|
|
this.isLoading = false;
|
|
|
- }catch(error: any){
|
|
|
- if(error.error == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else if(error.error.msg == undefined){
|
|
|
- this.errorStr = "Ocurrió un error inesperado.";
|
|
|
- }else{
|
|
|
+ } catch (error: any) {
|
|
|
+ if (error.error == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else if (error.error.msg == undefined) {
|
|
|
+ this.errorStr = 'Ocurrió un error inesperado.';
|
|
|
+ } else {
|
|
|
this.errorStr = error.error.msg;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- isSelected(value: string): boolean{
|
|
|
+ isSelected(value: string): boolean {
|
|
|
let isSelected = false;
|
|
|
|
|
|
- for(const key in this.formGroup.controls){
|
|
|
+ for (const key in this.formGroup.controls) {
|
|
|
let control = this.formGroup.controls[key];
|
|
|
let selection = control.value;
|
|
|
|
|
|
- if(selection != null && selection != undefined && selection != '' && selection == value){
|
|
|
+ if (
|
|
|
+ selection != null &&
|
|
|
+ selection != undefined &&
|
|
|
+ selection != '' &&
|
|
|
+ selection == value
|
|
|
+ ) {
|
|
|
isSelected = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -248,17 +391,17 @@ export class StaffSelectionComponent implements OnInit {
|
|
|
return isSelected;
|
|
|
}
|
|
|
|
|
|
- async saveConfig(){
|
|
|
+ async saveConfig() {
|
|
|
let config = [];
|
|
|
- for(const key of this.staffOperariesMap.keys()){
|
|
|
+ for (const key of this.staffOperariesMap.keys()) {
|
|
|
let operaries = this.staffOperariesMap.get(key)!;
|
|
|
let operariesConfig = [];
|
|
|
|
|
|
- for(const control of operaries){
|
|
|
+ for (const control of operaries) {
|
|
|
let controlValue = this.formGroup.controls[control].value;
|
|
|
let valueArr = controlValue.split('|');
|
|
|
|
|
|
- if(valueArr.length > 1){
|
|
|
+ if (valueArr.length > 1) {
|
|
|
let operaryConfig = {
|
|
|
ID: valueArr[0],
|
|
|
TYPE: valueArr[1],
|
|
|
@@ -270,13 +413,14 @@ export class StaffSelectionComponent implements OnInit {
|
|
|
|
|
|
let specialtyConfig = {
|
|
|
SPECIALTY: await this._encService.encrypt(key),
|
|
|
- STAFF: operariesConfig
|
|
|
+ STAFF: operariesConfig,
|
|
|
};
|
|
|
|
|
|
config.push(specialtyConfig);
|
|
|
}
|
|
|
|
|
|
let configStr = JSON.stringify(config);
|
|
|
+ console.log('Staff Selection Request:', configStr);
|
|
|
this._dialogRef.close(configStr);
|
|
|
}
|
|
|
}
|