select first work order type when only 1

deepsource-autofix-76c6eb20
Dan Gowans 2022-12-16 10:23:02 -05:00
parent 926e20d3d5
commit efa16bc7c8
3 changed files with 13 additions and 3 deletions

View File

@ -168,7 +168,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector("#workOrderCreate--lotOccupancyId").value = lotOccupancyId;
modalElement.querySelector("#workOrderCreate--workOrderOpenDateString").value = cityssm.dateToString(new Date());
const workOrderTypeSelectElement = modalElement.querySelector("#workOrderCreate--workOrderTypeId");
for (const workOrderType of exports.workOrderTypes) {
const workOrderTypes = exports.workOrderTypes;
if (workOrderTypes.length === 1) {
workOrderTypeSelectElement.innerHTML = "";
}
for (const workOrderType of workOrderTypes) {
const optionElement = document.createElement("option");
optionElement.value = workOrderType.workOrderTypeId.toString();
optionElement.textContent = workOrderType.workOrderType;

View File

@ -242,7 +242,13 @@ declare const bulmaJS: BulmaJS;
"#workOrderCreate--workOrderTypeId"
) as HTMLSelectElement;
for (const workOrderType of exports.workOrderTypes as recordTypes.WorkOrderType[]) {
const workOrderTypes = exports.workOrderTypes as recordTypes.WorkOrderType[];
if (workOrderTypes.length === 1) {
workOrderTypeSelectElement.innerHTML = "";
}
for (const workOrderType of workOrderTypes) {
const optionElement = document.createElement("option");
optionElement.value = (
workOrderType.workOrderTypeId as number

File diff suppressed because one or more lines are too long