This commit is contained in:
2024-08-30 17:36:21 +08:00
parent a3f0288c92
commit eec9d6045c
19 changed files with 332 additions and 219 deletions

View File

@ -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();

View File

@ -80,7 +80,7 @@ export default class AssetSelector extends OptionBase {
super(opt);
}
get title() { return this.r('P_MA_SELECTASSET', 'Select Asset') }
get title() { return this.r('FLTL_02645', 'Select Asset') }
get currentAsset() { return this._var.el.grid.currentItem }
@ -126,7 +126,7 @@ export default class AssetSelector extends OptionBase {
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
const inputSearch = createElement('input', input => {
input.type = 'text';
input.placeholder = this.r('P_SELECTASSETS_SEARCH', 'Search');
input.placeholder = this.r('FLTL_02606', 'Search');
input.tabIndex = tabIndex + 2;
input.className = 'ui-input';
input.addEventListener('keypress', e => {
@ -137,7 +137,7 @@ export default class AssetSelector extends OptionBase {
});
const checkHidden = createCheckbox({
tabIndex: tabIndex + 3,
label: this.r('P_SELECTASSETS_SHOWHIDDEN', 'Show Hidden'),
label: this.r('FLTL_02768', 'Show Hidden'),
onchange: () => this.refresh()
});
if (option.ignoreHidden) {
@ -168,14 +168,14 @@ export default class AssetSelector extends OptionBase {
});
const grid = new Grid(gridContent, this.r);
grid.columns = [
{ key: 'VIN', caption: this.r('P_SELECTASSETS_VIN', 'VIN'), width: 170 },
{ key: 'DisplayName', caption: this.r('P_SELECTASSETS_NAME', 'Name'), width: 190 },
{ key: 'MakeName', caption: this.r('P_SELECTASSETS_MAKE', 'Make'), width: 110, allowFilter: true },
{ key: 'ModelName', caption: this.r('P_SELECTASSETS_MODEL', 'Model'), width: 110, allowFilter: true },
{ key: 'TypeName', caption: this.r('P_SELECTASSETS_TYPE', 'Type'), width: 110, allowFilter: true },
{ key: 'AcquisitionType', caption: this.r('P_MA_ACQUISITIONTYPE', 'Acquisition Type'), width: 130, allowFilter: true },
{ key: 'AssetGroups', caption: this.r('P_MA_ASSETGROUP', 'Asset Group'), width: 150 },
{ key: 'Jobsites', caption: this.r('P_SELECTASSETS_JOBSITE', 'Jobsite'), width: 180, filter: it => it.Jobsites?.map(s => s.Key) }
{ key: 'VIN', caption: this.r('FLTL_03260', 'VIN'), width: 170 },
{ key: 'DisplayName', caption: this.r('FLTL_01966', 'Name'), width: 190 },
{ key: 'MakeName', caption: this.r('FLTL_01832', 'Make'), width: 110, allowFilter: true },
{ key: 'ModelName', caption: this.r('FLTL_01933', 'Model'), width: 110, allowFilter: true },
{ key: 'TypeName', caption: this.r('FLTL_03112', 'Type'), width: 110, allowFilter: true },
{ key: 'AcquisitionType', caption: this.r('FLTL_00072', 'Acquisition Type'), width: 130, allowFilter: true },
{ key: 'AssetGroups', caption: this.r('FLTL_00318', 'Asset Group'), width: 150 },
{ key: 'Jobsites', caption: this.r('FLTL_01666', 'Jobsite'), width: 180, filter: it => it.Jobsites?.map(s => s.Key) }
];
grid.onRowDblClicked = index => {
const item = grid.source[index];
@ -202,7 +202,7 @@ export default class AssetSelector extends OptionBase {
option.assetFullcontrol ? createElement('button', button => {
button.className = 'ui-popup-button';
button.tabIndex = tabIndex + 1;
button.innerText = this.r('P_MA_ADDASSET', 'Add Asset');
button.innerText = this.r('FLTL_00091', 'Add Asset');
button.addEventListener('click', async () => {
if (typeof option.requestAddAsset === 'function') {
this.loading(true);
@ -228,11 +228,11 @@ export default class AssetSelector extends OptionBase {
)
),
checkHidden,
createElement('span', span => span.innerText = this.r('P_WO_ASSETGROUP', 'Asset Group')),
createElement('span', span => span.innerText = this.r('FLTL_00318', 'Asset Group')),
dropAssetGroup.create(),
createElement('span', span => span.innerText = this.r('P_WO_JOBSITE', 'Jobsite')),
createElement('span', span => span.innerText = this.r('FLTL_01666', 'Jobsite')),
dropJobsite.create(),
createElement('span', span => span.innerText = this.r('P_SELECTASSETS_JOBSITECODE', 'Jobsite Code')),
createElement('span', span => span.innerText = this.r('FLTL_01669', 'Jobsite Code')),
dropJobsiteCode.create()
),
gridContent

View File

@ -85,23 +85,23 @@ export default class InspectionWizard extends OptionBase {
templateSelector.create()
];
const popup = new Popup({
title: this.r('ADDINSPECTION', 'Add Inspection'),
title: this.r('FLTL_00121', 'Add Inspection'),
content: createElement('div', null, ...this._var.containers),
persistent: true,
buttons: [
{
text: this.r('BACK', 'Back'),
text: this.r('FLTL_00447', 'Back'),
trigger: () => {
this._changePage(0);
return false;
}
},
{
text: this.r('NEXT', 'Next'),
text: this.r('FLTL_01973', 'Next'),
trigger: () => {
const asset = assetSelector.currentAsset;
if (asset == null) {
showAlert(assetSelector.title, this.r('P_SELECTASSETS_SELECTASSET', 'Please select an Asset.'));
showAlert(assetSelector.title, this.r('FLTL_02269', 'Please select an Asset.'));
return false;
}
this._var.asset = asset;
@ -112,18 +112,18 @@ export default class InspectionWizard extends OptionBase {
}
},
{
text: this.r('P_GRID_OK', 'OK'),
text: this.r('FLTL_02057', 'OK'),
trigger: () => {
const template = templateSelector.currentTemplate;
if (template == null) {
showAlert(templateSelector.title, this.r('P_WO_PLEASESELECTATEMPLATE', 'Please select a template.'));
showAlert(templateSelector.title, this.r('FLTL_02261', 'Please select a template.'));
return false;
}
this._var.template = template;
this._select();
}
},
{ text: this.r('P_WO_CANCEL', 'Cancel') }
{ text: this.r('FLTL_00499', 'Cancel') }
]
});
this._var.popup = popup;

View File

@ -161,7 +161,7 @@ export default class ScheduleItem extends OptionBase {
}),
validation(
createElement('input', i => { i.type = 'text', i.className = 'ui-input schedule-id-occur-once', i.maxLength = 5 }),
/^([01][0-9]|[2][0-3]):[0-5][0-9]$/
/^([1-9]|[01][0-9]|[2][0-3]):([1-9]|[0-5][0-9])$/
)
),
createElement('div', 'schedule-item-line schedule-item-line-occur-every',
@ -182,14 +182,14 @@ export default class ScheduleItem extends OptionBase {
createElement('span', span => span.innerText = 'Starting at'),
validation(
createElement('input', i => { i.type = 'text', i.className = 'ui-input schedule-id-occur-starting', i.maxLength = 5 }),
/^([01][0-9]|[2][0-3]):[0-5][0-9]$/
/^([1-9]|[01][0-9]|[2][0-3]):([1-9]|[0-5][0-9])$/
)
),
createElement('div', 'scheldule-item-line',
createElement('span', span => span.innerText = 'Ending at'),
validation(
createElement('input', i => { i.type = 'text', i.className = 'ui-input schedule-id-occur-ending', i.maxLength = 5 }),
/^([01][0-9]|[2][0-3]):[0-5][0-9]$/
/^([1-9]|[01][0-9]|[2][0-3]):([1-9]|[0-5][0-9])$/
)
)
)

View File

@ -37,7 +37,7 @@ export default class Signature extends OptionBase {
async show() {
const popup = new Popup({
title: this.r('P_IPT_SIGNATURE', 'Signature'),
title: this.r('FLTL_02770', 'Signature'),
content: this._var.canvas = createElement('canvas', canvas => {
canvas.style.width = '100%';
canvas.style.height = '100%';
@ -56,7 +56,7 @@ export default class Signature extends OptionBase {
},
buttons: [
{
text: this.r('P_GRID_OK', 'OK'),
text: this.r('FLTL_02057', 'OK'),
trigger: () => {
if (this._var.allPoints.length === 0) {
return false;
@ -65,14 +65,14 @@ export default class Signature extends OptionBase {
}
},
{
text: this.r('P_GRID_RESET', 'Reset'),
text: this.r('FLTL_02479', 'Reset'),
trigger: () => {
const ctx = this._var.canvas.getContext('2d');
ctx.clearRect(0, 0, this._var.canvas.width, this._var.canvas.height);
return false
}
},
{ text: this.r('P_WO_CANCEL', 'Cancel') }
{ text: this.r('FLTL_00499', 'Cancel') }
]
});
this._var.popup = popup;

View File

@ -50,7 +50,7 @@ export default class TemplateSelector extends OptionBase {
this.refresh();
}
get title() { return this.r('P_MODULE_INSPECTIONTEMPLATES', 'Inspection Templates') }
get title() { return this.r('FLTL_01604', 'Inspection Templates') }
get currentTemplate() { return this._var.el.grid.currentItem }
@ -83,7 +83,7 @@ export default class TemplateSelector extends OptionBase {
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
const inputSearch = createElement('input', input => {
input.type = 'text';
input.placeholder = this.r('P_SELECTASSETS_SEARCH', 'Search');
input.placeholder = this.r('FLTL_02606', 'Search');
input.tabIndex = tabIndex + 1;
input.className = 'ui-input';
input.addEventListener('keypress', e => e.key === 'Enter' && this.refresh());
@ -102,8 +102,8 @@ export default class TemplateSelector extends OptionBase {
resizable: false,
filter: it => nullOrEmpty(it.IssueId) ? '' : 'cubes'
},
{ key: 'Name', caption: this.r('P_IPT_NAME', 'Name'), width: 390 },
{ key: 'Notes', caption: this.r('P_IPT_NOTES', 'Notes'), width: 630 }
{ key: 'Name', caption: this.r('FLTL_01966', 'Name'), width: 390 },
{ key: 'Notes', caption: this.r('FLTL_02012', 'Notes'), width: 630 }
];
grid.onRowDblClicked = index => {
const item = grid.source[index];
@ -122,7 +122,7 @@ export default class TemplateSelector extends OptionBase {
// content
const container = createElement('div', 'popup-selector',
createElement('div', 'popup-selector-header',
createElement('h3', h3 => h3.innerText = this.r('P_WO_PLEASESELECTATEMPLATE', 'Please select a template.'))
createElement('h3', h3 => h3.innerText = this.r('FLTL_02261', 'Please select a template.'))
),
createElement('div', 'popup-selector-function',
createElement('div', 'search-box',