clear lot value

deepsource-autofix-76c6eb20
Dan Gowans 2022-09-01 14:20:00 -04:00
parent 2cb0bf3697
commit d10cc97417
4 changed files with 78 additions and 37 deletions

View File

@ -147,7 +147,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
});
}
document.querySelector("#lotOccupancy--lotName").addEventListener("click", (clickEvent) => {
const lotNameElement = document.querySelector("#lotOccupancy--lotName");
lotNameElement.addEventListener("click", (clickEvent) => {
const currentLotName = clickEvent.currentTarget.value;
let lotSelectCloseModalFunction;
let lotSelectFormElement;
@ -210,7 +211,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.toggleHtmlClipped();
lotSelectCloseModalFunction = closeModalFunction;
const lotNameFilterElement = modalElement.querySelector("#lotSelect--lotName");
if (document.querySelector("#lotOccupancy--lotId").value !== "") {
lotNameFilterElement.value = currentLotName;
}
lotNameFilterElement.focus();
lotNameFilterElement.addEventListener("change", searchLots);
const occupancyStatusFilterElement = modalElement.querySelector("#lotSelect--occupancyStatus");
@ -242,6 +245,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
});
}
});
document.querySelector(".is-clear-lot-button").addEventListener("click", () => {
if (lotNameElement.disabled) {
bulmaJS.alert({
message: "You need to unlock the field before clearing it.",
contextualColorName: "info"
});
}
else {
lotNameElement.value = "(No " + exports.aliases.lot + ")";
document.querySelector("#lotOccupancy--lotId").value = "";
setUnsavedChanges();
}
});
document.querySelector("#lotOccupancy--occupancyStartDateString").addEventListener("change", () => {
document.querySelector("#lotOccupancy--occupancyEndDateString").min =
document.querySelector("#lotOccupancy--occupancyStartDateString").value;

View File

@ -224,7 +224,9 @@ declare const bulmaJS: BulmaJS;
// Lot Selector
document.querySelector("#lotOccupancy--lotName").addEventListener("click", (clickEvent) => {
const lotNameElement = document.querySelector("#lotOccupancy--lotName") as HTMLInputElement;
lotNameElement.addEventListener("click", (clickEvent) => {
const currentLotName = (clickEvent.currentTarget as HTMLInputElement).value;
@ -302,7 +304,7 @@ declare const bulmaJS: BulmaJS;
lotSelectResultsElement.innerHTML = "";
lotSelectResultsElement.append(panelElement);
});
}
};
cityssm.openHtmlModal("lotOccupancy-selectLot", {
onshow: (modalElement) => {
@ -315,7 +317,11 @@ declare const bulmaJS: BulmaJS;
lotSelectCloseModalFunction = closeModalFunction;
const lotNameFilterElement = modalElement.querySelector("#lotSelect--lotName") as HTMLInputElement;
if ((document.querySelector("#lotOccupancy--lotId") as HTMLInputElement).value !== "") {
lotNameFilterElement.value = currentLotName;
}
lotNameFilterElement.focus();
lotNameFilterElement.addEventListener("change", searchLots);
@ -355,6 +361,20 @@ declare const bulmaJS: BulmaJS;
}
});
document.querySelector(".is-clear-lot-button").addEventListener("click", () => {
if (lotNameElement.disabled) {
bulmaJS.alert({
message: "You need to unlock the field before clearing it.",
contextualColorName: "info"
});
} else {
lotNameElement.value = "(No " + exports.aliases.lot + ")";
(document.querySelector("#lotOccupancy--lotId") as HTMLInputElement).value = "";
setUnsavedChanges();
}
});
// Start Date
document.querySelector("#lotOccupancy--occupancyStartDateString").addEventListener("change", () => {

File diff suppressed because one or more lines are too long

View File

@ -109,10 +109,15 @@
</label>
<div class="field has-addons">
<div class="control is-expanded">
<input class="input has-text-left" id="lotOccupancy--lotName" type="button" value="<%= lotOccupancy.lotName %>"
<input class="input is-clickable has-text-left" id="lotOccupancy--lotName" type="button" value="<%= lotOccupancy.lotName || "(No " + configFunctions.getProperty("aliases.lot") + ")" %>"
<%= (configFunctions.getProperty("settings.lotOccupancy.lotIdIsRequired") ? " required" : "") %>
<%= (isCreate ? "" : " disabled") %> />
</div>
<div class="control is-hidden-print">
<button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<i class="fas fa-eraser" aria-hidden="true"></i>
</button>
</div>
<div class="control is-hidden-print">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
@ -125,7 +130,7 @@
</div>
</div>
</div>
<div class="column">
<div class="column is-3">
<div class="field">
<label class="label" for="lotOccupancy--occupancyStartDateString">Start Date</label>
<div class="control">