sync
This commit is contained in:
@@ -638,6 +638,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
const data = await option.requestAssignedTo(asset.Id, loc?.ID ?? -1, this._var.el.dropDepartment.selected?.Id ?? -1)
|
||||
this._var.el.dropAssignedTo.source = [{ IID: '', DisplayName: '' }, ...data];
|
||||
}
|
||||
this.filterStatuses();
|
||||
};
|
||||
dropDepartment.onSelected = async dep => {
|
||||
// get assigned to
|
||||
@@ -646,7 +647,11 @@ export default class AddWorkOrder extends OptionBase {
|
||||
const data = await option.requestAssignedTo(asset.Id, this._var.el.dropLocation.selected?.ID ?? -1, dep?.Id ?? -1)
|
||||
this._var.el.dropAssignedTo.source = [{ IID: '', DisplayName: '' }, ...data];
|
||||
}
|
||||
this.filterStatuses();
|
||||
}
|
||||
dropWorkOrderType.onSelected = async loc => {
|
||||
this.filterStatuses();
|
||||
};
|
||||
dateCompleted.value = new Date();
|
||||
this._var.container = container;
|
||||
const popup = new Popup({
|
||||
@@ -905,8 +910,9 @@ export default class AddWorkOrder extends OptionBase {
|
||||
dropDepartment.source = [{ Id: -1, Name: '' }, ...data.Departments];
|
||||
|
||||
this._var.params = data;
|
||||
dropStatus.source = data.Statuses;
|
||||
const defaultStatus = data.Statuses.find(s => s.DefaultOnOpen);
|
||||
this.filterStatuses();
|
||||
//dropStatus.source = data.Statuses;
|
||||
const defaultStatus = dropStatus.source.find(s => s.DefaultOnOpen);
|
||||
if (defaultStatus != null) {
|
||||
dropStatus.select(defaultStatus.Id);
|
||||
}
|
||||
@@ -914,4 +920,39 @@ export default class AddWorkOrder extends OptionBase {
|
||||
textComplaint.focus();
|
||||
return mask;
|
||||
}
|
||||
|
||||
filterStatuses() {
|
||||
const wotype = this._var.el.dropWorkOrderType.selected?.Key;
|
||||
|
||||
let locs = [];
|
||||
const loc = this._var.el.dropLocation.selected?.ID;
|
||||
if (loc > 0)
|
||||
locs.push(loc);
|
||||
const subLocs = this._var.params?.Locations.filter(l => l.PId == loc).map(l => l.Id);
|
||||
locs = locs.concat(subLocs);
|
||||
|
||||
let depts = [];
|
||||
const dept = this._var.el.dropDepartment.selected?.Id;
|
||||
if (dept > 0)
|
||||
depts.push(dept);
|
||||
const subDepts = this._var.params?.Departments.filter(d => d.PId == dept).map(d => d.Id);
|
||||
depts = depts.concat(subDepts);
|
||||
|
||||
const workOrderStatus = this._var.params?.Statuses;
|
||||
|
||||
const ss = workOrderStatus.filter((s) => {
|
||||
if (s.WorkOrderTypes?.length > 0 && !s.WorkOrderTypes.some(t => t.toLowerCase() == wotype?.toLowerCase()))
|
||||
return false;
|
||||
|
||||
if (s.Locations?.length > 0 && !s.Locations.some(l => locs.includes(Number(l)))) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (s.Departments?.length > 0 && !s.Departments.some(l => depts.includes(Number(l)))) {
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this._var.el.dropStatus.source = ss;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4386,7 +4386,7 @@ export class Grid {
|
||||
this._var.refs.footer.parentElement.style.bottom = `${this._var.footerOffset - e.target.scrollTop}px`;
|
||||
}
|
||||
const tti = this._topToIndex(top);
|
||||
if (this.onBodyScrolled === 'function') {
|
||||
if (typeof this.onBodyScrolled === 'function') {
|
||||
this.onBodyScrolled(e, tti.index, this._var.rowCount);
|
||||
}
|
||||
return;
|
||||
@@ -4395,7 +4395,7 @@ export class Grid {
|
||||
if (this.total != null) {
|
||||
this._var.refs.footer.parentElement.style.bottom = `${this._var.refs.table.offsetTop + this._var.footerOffset - e.target.scrollTop}px`;
|
||||
}
|
||||
if (this.onBodyScrolled === 'function') {
|
||||
if (typeof this.onBodyScrolled === 'function') {
|
||||
this.onBodyScrolled(e, this._var.startIndex, this._var.rowCount);
|
||||
}
|
||||
if (this._var.isFirefox) {
|
||||
|
||||
Reference in New Issue
Block a user