Skip to content

Commit

Permalink
fix(CB2-15892-fix-function-code): fix function code (#1716) (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbardy2000 authored Jan 13, 2025
1 parent bfa919c commit d5e5919
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,23 +267,24 @@ export class VehicleSectionEditComponent implements OnInit, OnDestroy {
}

handleUpdateFunctionCode() {
this.form.controls.techRecord_vehicleConfiguration?.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe((value) => {
if (value) {
const functionCodes: Record<string, string> = {
rigid: 'R',
articulated: 'A',
'semi-trailer': 'A',
};

const functionCode = functionCodes[value];

this.technicalRecordService.updateEditingTechRecord({
techRecord_functionCode: functionCode,
} as TechRecordTypeVerb<'put'>);
}
});
const control = this.form.controls.techRecord_vehicleConfiguration;
control?.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((value) => {
if (value && control?.dirty) {
const functionCodes: Record<string, string> = {
rigid: 'R',
articulated: 'A',
'semi-trailer': 'A',
};

const functionCode = functionCodes[value];

this.technicalRecordService.updateEditingTechRecord({
techRecord_functionCode: functionCode,
} as TechRecordTypeVerb<'put'>);

control.markAsPristine();
}
});
}

handlePsvPassengersChange(): ValidatorFn {
Expand Down

0 comments on commit d5e5919

Please sign in to comment.