-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] #7118, #7778: add popup, change manager name, provide optional responsible persons #3472
[Feat] #7118, #7778: add popup, change manager name, provide optional responsible persons #3472
Conversation
@@ -703,7 +701,7 @@ export class UbsAdminOrderComponent implements OnInit, OnDestroy, AfterContentCh | |||
this.isFormResetted = true; | |||
} else { | |||
exportDetaisFields.forEach((el) => exportDetails.get(el).setValidators([Validators.required])); | |||
responsiblePersonNames.forEach((el) => responsiblePersons.get(el).setValidators([Validators.required])); | |||
responsiblePersons.get('responsibleCaller')?.setValidators([Validators.required]); | |||
} | |||
this.statusCanceledOrDone(); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 arguments, but got 0:
this.destroy$.next();
return false; | ||
} | ||
|
||
if (requiredFields.includes(controlName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'if' statement can be simplified
} | ||
]; | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 arguments, but got 0.
this.save(); | ||
return; | ||
} | ||
const isCancelOption = ['Canceled', 'Скасовано'].includes(this.newOption); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By using the enums OrderStatusEn and OrderStatusUa
and isStatusOption
to categorize status options, the logic becomes more scalable and easier to maintain
private isStatusOption(...options: string[]): boolean {
return options.includes(this.newOption);
}
} else if (isCancelOption) { | ||
this.openCancelPopUp(); | ||
} else if (this.checkStatus && this.showPopUp) { | ||
this.checkIfStatusConfirmed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can simplify this condition by not creating checkIfStatusConfirmed
.
const isConfirmedOption = this.isStatusOption(OrderStatusEn.CONFIRMED, OrderStatusUa.CONFIRMED);
...
} else if (this.checkStatus && this.showPopUp && !isConfirmedOption) {
this.openPopUp();
} else {
this.save();
}
@@ -1,6 +1,6 @@ | |||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'async' is deprecated, use waitForAsync()
#7778
#7118