sync
This commit is contained in:
@@ -205,7 +205,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
}
|
||||
|
||||
async getItem() {
|
||||
const title = this.r('P_WO_OPENWORKORDER', 'Open Work Order');
|
||||
const title = this.r('FLTL_02078', 'Open Work Order');
|
||||
const el = this._var.el;
|
||||
let status = el.dropStatus.selected;
|
||||
if (status != null) {
|
||||
@@ -223,7 +223,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
}
|
||||
let machine = this._var.asset;
|
||||
if (machine == null) {
|
||||
showAlert(title, this.r('P_WO_ASSETNOTEMPTY', 'Asset cannot be empty.')).then(() => this._var.container.querySelector('.wo-asset>svg')?.focus());
|
||||
showAlert(title, this.r('FLTL_00311', 'Asset cannot be empty.')).then(() => this._var.container.querySelector('.wo-asset>svg')?.focus());
|
||||
return null;
|
||||
}
|
||||
const item = {
|
||||
@@ -256,24 +256,24 @@ export default class AddWorkOrder extends OptionBase {
|
||||
item.Contacts = this._var.contacts ?? [];
|
||||
item.Followers = this._var.followers ?? [];
|
||||
if (nullOrEmpty(el.textComplaint?.value)) {
|
||||
showAlert(title, this.r('P_WO_COMPLAINTREQUIRED', 'Complaint is required.')).then(() => el.textComplaint.focus());
|
||||
showAlert(title, this.r('FLTL_00602', 'Complaint is required.')).then(() => el.textComplaint.focus());
|
||||
return null;
|
||||
}
|
||||
if (el.dropStatus.selected?.Completed) {
|
||||
if (!el.dateCompleted.element.validity.valid) {
|
||||
showAlert(title, this.r('P_WO_COMPLETEDDATECANNOTBEEMPTY', 'Completed Date cannot be empty.')).then(() => el.dateCompleted.element.focus());
|
||||
showAlert(title, this.r('FLTL_00613', 'Completed Date cannot be empty.')).then(() => el.dateCompleted.element.focus());
|
||||
return null;
|
||||
}
|
||||
if (machine.OnRoad) {
|
||||
item.MeterType = 'Odometer';
|
||||
if (nullOrEmpty(item.Odometer) || isNaN(item.Odometer) || item.Odometer < 0) {
|
||||
showAlert(title, this.r('P_WO_ODOMETERFORMATERROR', 'Odometer format error.')).then(() => el.inputOdometer.focus());
|
||||
showAlert(title, this.r('FLTL_02044', 'Odometer format error.')).then(() => el.inputOdometer.focus());
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
item.MeterType = 'HourMeter';
|
||||
if (nullOrEmpty(item.HourMeter) || isNaN(item.HourMeter) || item.HourMeter < 0) {
|
||||
showAlert(title, this.r('P_WO_HOURMETERFORMATERROR', 'Hour Meter format error.')).then(() => el.inputHours.focus());
|
||||
showAlert(title, this.r('FLTL_01516', 'Hour Meter format error.')).then(() => el.inputHours.focus());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -284,12 +284,12 @@ export default class AddWorkOrder extends OptionBase {
|
||||
async show() {
|
||||
const option = this._option;
|
||||
const allowCustomer = option.allowCustomer === true;
|
||||
const title = this.r('P_WO_OPENWORKORDER', 'Open Work Order');
|
||||
const title = this.r('FLTL_02078', 'Open Work Order');
|
||||
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
|
||||
const textComplaint = createElement('textarea', textarea => {
|
||||
textarea.tabIndex = tabIndex + 2;
|
||||
textarea.className = 'ui-text wo-complaint';
|
||||
textarea.placeholder = this.r('P_WO_ENTERCOMPLAINT', 'Enter Complaint');
|
||||
textarea.placeholder = this.r('FLTL_01155', 'Enter Complaint');
|
||||
});
|
||||
const baseOption = {
|
||||
search: true,
|
||||
@@ -330,8 +330,8 @@ export default class AddWorkOrder extends OptionBase {
|
||||
selected: 'Mile'
|
||||
});
|
||||
dropOdometerUnit.source = [
|
||||
{ value: 'Mile', text: GetTextByKey('P_WO_MILE', 'Mile') },
|
||||
{ value: 'Kilometre', text: GetTextByKey('P_WO_KILOMETER', 'Kilometer') }
|
||||
{ value: 'Mile', text: this.r('FLTL_01922', 'Mile') },
|
||||
{ value: 'Kilometre', text: this.r('FLTL_01694', 'Kilometer') }
|
||||
]
|
||||
const dropAssignedTo = new Dropdown({
|
||||
tabIndex: tabIndex + 10,
|
||||
@@ -385,7 +385,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
createElement('div', 'wo-combined wo-asset',
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-title-required';
|
||||
span.innerText = this.r('P_WO_ASSET_COLON', 'Asset:');
|
||||
span.innerText = this.r('FLTL_00361', 'Asset:');
|
||||
}),
|
||||
createIcon('fa-light', 'search', svg => {
|
||||
svg.tabIndex = tabIndex + 1;
|
||||
@@ -430,16 +430,16 @@ export default class AddWorkOrder extends OptionBase {
|
||||
}
|
||||
};
|
||||
popup = new Popup({
|
||||
title: this.r('P_MA_SELECTASSET', 'Select Asset'),
|
||||
title: this.r('FLTL_02645', 'Select Asset'),
|
||||
content: selector.create(),
|
||||
persistent: true,
|
||||
buttons: [
|
||||
{
|
||||
key: 'ok',
|
||||
text: this.r('P_GRID_OK', 'OK'),
|
||||
text: this.r('FLTL_02057', 'OK'),
|
||||
trigger: () => selector.select()
|
||||
},
|
||||
{ text: this.r('P_WO_CANCEL', 'Cancel') }
|
||||
{ text: this.r('FLTL_00499', 'Cancel') }
|
||||
]
|
||||
});
|
||||
this._var.assetSelectorPopup = popup;
|
||||
@@ -458,7 +458,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
createElement('div', 'wo-line wo-combined',
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-title-required';
|
||||
span.innerText = this.r('P_WO_COMPLAINTCOLON', 'Complaint:');
|
||||
span.innerText = this.r('FLTL_00603', 'Complaint:');
|
||||
})
|
||||
),
|
||||
createElement('div', div => {
|
||||
@@ -470,7 +470,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title';
|
||||
span.innerText = this.r('P_WO_WORKORDERTYPE_COLON', 'Work Order Type:');
|
||||
span.innerText = this.r('FLTL_03359', 'Work Order Type:');
|
||||
}),
|
||||
dropWorkOrderType.create(),
|
||||
createElement('div', div => {
|
||||
@@ -481,7 +481,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
},
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title';
|
||||
span.innerText = this.r('P_WO_COMPANYNAME_COLON', 'Company Name:');
|
||||
span.innerText = this.r('FLTL_00598', 'Company Name:');
|
||||
}),
|
||||
createIcon('fa-light', 'search', svg => {
|
||||
svg.tabIndex = tabIndex + 4;
|
||||
@@ -507,18 +507,18 @@ export default class AddWorkOrder extends OptionBase {
|
||||
displayElement(createElement('span', 'wo-company-name'), allowCustomer),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title';
|
||||
span.innerText = this.r('P_WO_STATUS_COLON', 'Status:');
|
||||
span.innerText = this.r('FLTL_02834', 'Status:');
|
||||
}),
|
||||
dropStatus.create(),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-title-required wo-sub-line wo-status-closed';
|
||||
span.innerText = this.r('P_WO_COMPLETEDDATE_COLON', 'Completed Date:');
|
||||
span.innerText = this.r('FLTL_00617', 'Completed Date:');
|
||||
displayElement(span, false);
|
||||
}),
|
||||
displayElement(dateCompleted.create(), false),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-title-required wo-sub-line wo-hours';
|
||||
span.innerText = this.r('P_WO_HOURS_COLON', 'Hours:');
|
||||
span.innerText = this.r('FLTL_01530', 'Hours:');
|
||||
displayElement(span, false);
|
||||
}),
|
||||
displayElement(
|
||||
@@ -527,7 +527,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-title-required wo-sub-line wo-odometer';
|
||||
span.innerText = this.r('P_WO_ODOMETER_COLON', 'Odometer:');
|
||||
span.innerText = this.r('FLTL_02054', 'Odometer:');
|
||||
displayElement(span, false);
|
||||
}),
|
||||
createElement('div', div => {
|
||||
@@ -539,12 +539,12 @@ export default class AddWorkOrder extends OptionBase {
|
||||
),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title';
|
||||
span.innerText = this.r('P_WO_ASSIGNEDTO_COLON', 'Assigned Tech:');
|
||||
span.innerText = this.r('FLTL_00382', 'Assigned Tech:');
|
||||
}),
|
||||
dropAssignedTo.create(),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-customer-record';
|
||||
span.innerText = this.r('P_WO_ADVISOR_COLON', 'Advisor:');
|
||||
span.innerText = this.r('FLTL_00199', 'Advisor:');
|
||||
if (!allowCustomer) {
|
||||
displayElement(span, false);
|
||||
}
|
||||
@@ -552,7 +552,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
displayElement(dropAdvisor.create(), allowCustomer),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-customer-record';
|
||||
span.innerText = this.r('P_WO_LOCATION_COLON', 'Location:');
|
||||
span.innerText = this.r('FLTL_01796', 'Location:');
|
||||
if (!allowCustomer) {
|
||||
displayElement(span, false);
|
||||
}
|
||||
@@ -560,7 +560,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
displayElement(dropLocation.create(), allowCustomer),
|
||||
createElement('span', span => {
|
||||
span.className = 'wo-title wo-customer-record';
|
||||
span.innerText = this.r('P_WO_DEPARTMENT_COLON', 'Department:');
|
||||
span.innerText = this.r('FLTL_00869', 'Department:');
|
||||
if (!allowCustomer) {
|
||||
displayElement(span, false);
|
||||
}
|
||||
@@ -616,12 +616,12 @@ export default class AddWorkOrder extends OptionBase {
|
||||
}
|
||||
if (this._var.asset.Hide) {
|
||||
if (!option.assetFullcontrol) {
|
||||
await showAlert(title, this.r('P_WO_HIDDENCANNOTCREATE', 'The selected asset is hidden and a work order cannot be created.') + '\n\n' + this.r('P_WO_CONTACTTOUNHIDE', 'Please contact your Fleet Manager to Unhide the asset if you require a work order.'));
|
||||
await showAlert(title, this.r('FLTL_02992', 'The selected asset is hidden and a work order cannot be created.') + '\n\n' + this.r('FLTL_02213', 'Please contact your Fleet Manager to Unhide the asset if you require a work order.'));
|
||||
return false;
|
||||
}
|
||||
const next = await showConfirm(title, this.r('P_WO_HIDDENCANNOTCREATE', 'The selected asset is hidden and a work order cannot be created.') + '\n\n' + this.r('P_WO_PROMPTUNHIDE', 'Do you wish to "Un-Hide" the asset?'), [
|
||||
{ key: 'unhide', text: this.r('P_WO_UNHIDE', 'Unhide') },
|
||||
{ key: 'cancel', text: this.r('P_WO_CANCELWO', 'Cancel Work Order') }
|
||||
const next = await showConfirm(title, this.r('FLTL_02992', 'The selected asset is hidden and a work order cannot be created.') + '\n\n' + this.r('FLTL_00999', 'Do you wish to "Un-Hide" the asset?'), [
|
||||
{ key: 'unhide', text: this.r('FLTL_03136', 'Unhide') },
|
||||
{ key: 'cancel', text: this.r('FLTL_00502', 'Cancel Work Order') }
|
||||
]);
|
||||
if (next.result !== 'unhide') {
|
||||
return false;
|
||||
@@ -642,21 +642,21 @@ export default class AddWorkOrder extends OptionBase {
|
||||
const popWorkorders = new Popup({
|
||||
title,
|
||||
content: createElement('div', 'wo-opened-workorder',
|
||||
createElement('header', header => header.innerText = this.r('P_WO_ASSETOPENEDWORKORDER', 'The selected asset has the following open work orders:')),
|
||||
createElement('header', header => header.innerText = this.r('FLTL_02991', 'The selected asset has the following open work orders:')),
|
||||
createElement('div', 'wo-grid-opened')
|
||||
),
|
||||
resolve,
|
||||
buttons: [
|
||||
{ key: 'create', text: this.r('P_WO_CREATEWO', 'Create Work Order'), trigger: () => resolve('create') },
|
||||
{ key: 'cancel', text: this.r('P_WO_CANCELWO', 'Cancel Work Order'), trigger: () => resolve('cancel') }
|
||||
{ key: 'create', text: this.r('FLTL_00700', 'Create Work Order'), trigger: () => resolve('create') },
|
||||
{ key: 'cancel', text: this.r('FLTL_00502', 'Cancel Work Order'), trigger: () => resolve('cancel') }
|
||||
]
|
||||
});
|
||||
popWorkorders.show().then(mask => {
|
||||
const grid = new Grid(mask.querySelector('.wo-grid-opened'), this.r);
|
||||
grid.columns = [
|
||||
{ key: 'WorkOrderNumber', caption: 'WO #', width: 100 },
|
||||
{ key: 'CreateDateStr', caption: this.r('P_WO_CREATEDDATE', 'Created Date'), width: 120 },
|
||||
{ key: 'Description', caption: this.r('P_WO_COMPLAINT', 'Complaint'), width: 360 }
|
||||
{ key: 'CreateDateStr', caption: this.r('FLTL_00703', 'Created Date'), width: 120 },
|
||||
{ key: 'Description', caption: this.r('FLTL_00600', 'Complaint'), width: 360 }
|
||||
];
|
||||
grid.init();
|
||||
grid.source = wos.map(w => ({
|
||||
@@ -682,7 +682,7 @@ export default class AddWorkOrder extends OptionBase {
|
||||
}
|
||||
}
|
||||
},
|
||||
{ text: this.r('P_WO_CANCEL', 'Cancel') }
|
||||
{ text: this.r('FLTL_00499', 'Cancel') }
|
||||
]
|
||||
});
|
||||
popup.create();
|
||||
|
||||
Reference in New Issue
Block a user