Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.load = (getManagersOptionsM, callback) => {
- clearTimeout(getManagerUsers);
- getManagerUsers = setTimeout(() => {
- var notNull = getManagersOptionsM.DepartmentCodes != null && getManagersOptionsM.ProjectCodes != null && getManagersOptionsM.ClauseCodes != null;
- var hasValues = getManagersOptionsM.DepartmentCodes.length > 0 && getManagersOptionsM.ProjectCodes.length > 0 && getManagersOptionsM.ClauseCodes.length > 0;
- var valueNotNull = hasValues && getManagersOptionsM.DepartmentCodes[0] !== "" && getManagersOptionsM.ProjectCodes[0] !== "" && getManagersOptionsM.ClauseCodes[0] !== "";
- if (notNull && valueNotNull) {
- getManagersOptionsM.InvoiceId = this.invoiceId;
- Api.AsyncClient.current.getManagersUsers(getManagersOptionsM, (result) => {
- var canAgreeInvoice = result.filter((u) => { return u.CanAgreeInvoice });
- var canApproveInvoice = result.filter((u) => { return u.CanApproveInvoice });
- var otherUsers = result.filter((u) => { return !u.CanAgreeInvoice && !u.CanApproveInvoice });
- var values = [];
- var emptyAgreeAndApprove = canAgreeInvoice.length === 0 && canApproveInvoice.length === 0;
- if (this.userRole === Api.Roles.Inspector) {
- values = canApproveInvoice.concat(canAgreeInvoice).concat(otherUsers);
- } else {
- values = canAgreeInvoice.concat(canApproveInvoice).concat(otherUsers);
- }
- callback(values, emptyAgreeAndApprove);
- });
- }
- }, 300);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement