|
|
@@ -60,17 +60,18 @@ export class ContractFormComponent implements OnInit {
|
|
|
this.getEmployees();
|
|
|
this.setHours();
|
|
|
this.decript();
|
|
|
- this.readOnlyForm();
|
|
|
}
|
|
|
|
|
|
private async getEmployees() {
|
|
|
await lastValueFrom(this._employeeService.getConsultOfEmployees()).then(
|
|
|
(responseData: any) => {
|
|
|
responseData.response.forEach((element: any) => {
|
|
|
- if (element.CONTRACT_TYPE == "Interno") {
|
|
|
- this.interns.push(element);
|
|
|
- } else {
|
|
|
- this.subcontratists.push(element);
|
|
|
+ if (element.STATUS === "Activo") {
|
|
|
+ if (element.CONTRACT_TYPE == "Interno") {
|
|
|
+ this.interns.push(element);
|
|
|
+ } else {
|
|
|
+ this.subcontratists.push(element);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}, (error: HttpErrorResponse) => this._resourcesService.checkErrors(error)
|
|
|
@@ -78,18 +79,6 @@ export class ContractFormComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private readOnlyForm() {
|
|
|
- // this.enable == '1' ? this.contractType?.enable() : this.contractType?.disable()
|
|
|
- // this.enable == '1' ? this.denominationSubcontratist?.enable() : this.denominationSubcontratist?.disable()
|
|
|
- // this.enable == '1' ? this.denominationIntern?.enable() : this.denominationIntern?.disable()
|
|
|
- // this.enable == '1' ? this.startDate?.enable() : this.startDate?.disable()
|
|
|
- // this.enable == '1' ? this.endDate?.enable() : this.endDate?.disable()
|
|
|
- // this.enable == '1' ? this.startHour?.enable() : this.startHour?.disable()
|
|
|
- // this.enable == '1' ? this.endHour?.enable() : this.endHour?.disable()
|
|
|
- // this.enable == '1' ? this.cost?.enable() : this.cost?.disable()
|
|
|
- // this.enable == '1' ? this.documentsInput?.enable() : this.documentsInput?.disable()
|
|
|
- }
|
|
|
-
|
|
|
private createFormGroup() {
|
|
|
return new FormGroup({
|
|
|
contractType: new FormControl('', Validators.required),
|
|
|
@@ -176,16 +165,16 @@ export class ContractFormComponent implements OnInit {
|
|
|
private async getData() {
|
|
|
await lastValueFrom(this._interventionService.getContractById(this.idContract)).then(
|
|
|
(responseData: ResponseDataContract) => {
|
|
|
- if(this.enable != "1"){
|
|
|
+ if (this.enable != "1") {
|
|
|
|
|
|
this.subcontratists.forEach(element => {
|
|
|
- if(element.ID_EMPLOYEE == responseData.response.DENOMINATION){
|
|
|
+ if (element.ID_EMPLOYEE == responseData.response.DENOMINATION) {
|
|
|
responseData.response.DENOMINATION = element.NAME;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.interns.forEach(element => {
|
|
|
- if(element.ID_EMPLOYEE == responseData.response.DENOMINATION){
|
|
|
+ if (element.ID_EMPLOYEE == responseData.response.DENOMINATION) {
|
|
|
responseData.response.DENOMINATION = element.NAME;
|
|
|
}
|
|
|
});
|
|
|
@@ -216,11 +205,11 @@ export class ContractFormComponent implements OnInit {
|
|
|
this.endDate.setValue(endDate);
|
|
|
|
|
|
this.hours.forEach(hour => {
|
|
|
- if(hour.value == startHour){
|
|
|
+ if (hour.value == startHour) {
|
|
|
this.startHour.setValue(hour.label);
|
|
|
}
|
|
|
|
|
|
- if(hour.value == endHour){
|
|
|
+ if (hour.value == endHour) {
|
|
|
this.endHour.setValue(hour.label);
|
|
|
}
|
|
|
});
|