time pickers
parent
0c0a565bdb
commit
a594b81dd5
|
|
@ -179,7 +179,8 @@ span.button.is-static {
|
||||||
|
|
||||||
.datetimepicker-clear-button {
|
.datetimepicker-clear-button {
|
||||||
transform: none;
|
transform: none;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.25rem;
|
||||||
|
margin-top: 0.25rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
},
|
},
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
modalElement.querySelector("#lotCommentEdit--lotComment").focus();
|
modalElement.querySelector("#lotCommentEdit--lotComment").focus();
|
||||||
editFormElement = modalElement.querySelector("form");
|
editFormElement = modalElement.querySelector("form");
|
||||||
editFormElement.addEventListener("submit", editComment);
|
editFormElement.addEventListener("submit", editComment);
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,9 @@ declare const bulmaJS: BulmaJS;
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
||||||
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
|
|
||||||
(
|
(
|
||||||
modalElement.querySelector("#lotCommentEdit--lotComment") as HTMLTextAreaElement
|
modalElement.querySelector("#lotCommentEdit--lotComment") as HTMLTextAreaElement
|
||||||
).focus();
|
).focus();
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: exports.aliases.occupancy +
|
message: exports.aliases.occupancy + " Updated Successfully",
|
||||||
" Updated Successfully",
|
|
||||||
contextualColorName: "success"
|
contextualColorName: "success"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +53,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
for (const formInputElement of formInputElements) {
|
for (const formInputElement of formInputElements) {
|
||||||
formInputElement.addEventListener("change", setUnsavedChanges);
|
formInputElement.addEventListener("change", setUnsavedChanges);
|
||||||
}
|
}
|
||||||
los.initializeDatePickers(formElement);
|
|
||||||
if (!isCreate) {
|
if (!isCreate) {
|
||||||
document
|
document
|
||||||
.querySelector("#button--deleteLotOccupancy")
|
.querySelector("#button--deleteLotOccupancy")
|
||||||
|
|
@ -67,9 +65,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
cityssm.disableNavBlocker();
|
cityssm.disableNavBlocker();
|
||||||
window.location.href =
|
window.location.href =
|
||||||
urlPrefix +
|
urlPrefix + "/lotOccupancies?t=" + Date.now();
|
||||||
"/lotOccupancies?t=" +
|
|
||||||
Date.now();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
|
|
@ -119,10 +115,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
lotOccupancyFieldsContainerElement.innerHTML = "";
|
lotOccupancyFieldsContainerElement.innerHTML = "";
|
||||||
let occupancyTypeFieldIds = "";
|
let occupancyTypeFieldIds = "";
|
||||||
for (const occupancyTypeField of responseJSON.occupancyTypeFields) {
|
for (const occupancyTypeField of responseJSON.occupancyTypeFields) {
|
||||||
occupancyTypeFieldIds +=
|
occupancyTypeFieldIds += "," + occupancyTypeField.occupancyTypeFieldId;
|
||||||
"," + occupancyTypeField.occupancyTypeFieldId;
|
const fieldName = "lotOccupancyFieldValue_" + occupancyTypeField.occupancyTypeFieldId;
|
||||||
const fieldName = "lotOccupancyFieldValue_" +
|
|
||||||
occupancyTypeField.occupancyTypeFieldId;
|
|
||||||
const fieldId = "lotOccupancy--" + fieldName;
|
const fieldId = "lotOccupancy--" + fieldName;
|
||||||
const fieldElement = document.createElement("div");
|
const fieldElement = document.createElement("div");
|
||||||
fieldElement.className = "field";
|
fieldElement.className = "field";
|
||||||
|
|
@ -139,20 +133,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
inputElement.id = fieldId;
|
inputElement.id = fieldId;
|
||||||
inputElement.name = fieldName;
|
inputElement.name = fieldName;
|
||||||
inputElement.type = "text";
|
inputElement.type = "text";
|
||||||
inputElement.required =
|
inputElement.required = occupancyTypeField.isRequired;
|
||||||
occupancyTypeField.isRequired;
|
inputElement.minLength = occupancyTypeField.minimumLength;
|
||||||
inputElement.minLength =
|
inputElement.maxLength = occupancyTypeField.maximumLength;
|
||||||
occupancyTypeField.minimumLength;
|
if (occupancyTypeField.pattern && occupancyTypeField.pattern !== "") {
|
||||||
inputElement.maxLength =
|
inputElement.pattern = occupancyTypeField.pattern;
|
||||||
occupancyTypeField.maximumLength;
|
|
||||||
if (occupancyTypeField.pattern &&
|
|
||||||
occupancyTypeField.pattern !== "") {
|
|
||||||
inputElement.pattern =
|
|
||||||
occupancyTypeField.pattern;
|
|
||||||
}
|
}
|
||||||
fieldElement
|
fieldElement.querySelector(".control").append(inputElement);
|
||||||
.querySelector(".control")
|
|
||||||
.append(inputElement);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fieldElement.querySelector(".control").innerHTML =
|
fieldElement.querySelector(".control").innerHTML =
|
||||||
|
|
@ -201,8 +188,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
cancelButton: {
|
cancelButton: {
|
||||||
text: "Revert the Change",
|
text: "Revert the Change",
|
||||||
callbackFunction: () => {
|
callbackFunction: () => {
|
||||||
occupancyTypeIdElement.value =
|
occupancyTypeIdElement.value = originalOccupancyTypeId;
|
||||||
originalOccupancyTypeId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -211,16 +197,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
const lotNameElement = document.querySelector("#lotOccupancy--lotName");
|
const lotNameElement = document.querySelector("#lotOccupancy--lotName");
|
||||||
lotNameElement.addEventListener("click", (clickEvent) => {
|
lotNameElement.addEventListener("click", (clickEvent) => {
|
||||||
const currentLotName = clickEvent.currentTarget
|
const currentLotName = clickEvent.currentTarget.value;
|
||||||
.value;
|
|
||||||
let lotSelectCloseModalFunction;
|
let lotSelectCloseModalFunction;
|
||||||
let lotSelectFormElement;
|
let lotSelectFormElement;
|
||||||
let lotSelectResultsElement;
|
let lotSelectResultsElement;
|
||||||
const selectLot = (clickEvent) => {
|
const selectLot = (clickEvent) => {
|
||||||
clickEvent.preventDefault();
|
clickEvent.preventDefault();
|
||||||
const selectedLotElement = clickEvent.currentTarget;
|
const selectedLotElement = clickEvent.currentTarget;
|
||||||
document.querySelector("#lotOccupancy--lotId").value = selectedLotElement.dataset.lotId;
|
document.querySelector("#lotOccupancy--lotId").value =
|
||||||
document.querySelector("#lotOccupancy--lotName").value = selectedLotElement.dataset.lotName;
|
selectedLotElement.dataset.lotId;
|
||||||
|
document.querySelector("#lotOccupancy--lotName").value =
|
||||||
|
selectedLotElement.dataset.lotName;
|
||||||
setUnsavedChanges();
|
setUnsavedChanges();
|
||||||
lotSelectCloseModalFunction();
|
lotSelectCloseModalFunction();
|
||||||
};
|
};
|
||||||
|
|
@ -261,9 +248,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
cityssm.escapeHTML(lot.lotStatus) +
|
cityssm.escapeHTML(lot.lotStatus) +
|
||||||
"<br />" +
|
"<br />" +
|
||||||
'<span class="is-size-7">' +
|
'<span class="is-size-7">' +
|
||||||
(lot.lotOccupancyCount > 0
|
(lot.lotOccupancyCount > 0 ? "Currently Occupied" : "") +
|
||||||
? "Currently Occupied"
|
|
||||||
: "") +
|
|
||||||
"</span>" +
|
"</span>" +
|
||||||
"</div>") +
|
"</div>") +
|
||||||
"</div>";
|
"</div>";
|
||||||
|
|
@ -282,7 +267,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
lotSelectCloseModalFunction = closeModalFunction;
|
lotSelectCloseModalFunction = closeModalFunction;
|
||||||
const lotNameFilterElement = modalElement.querySelector("#lotSelect--lotName");
|
const lotNameFilterElement = modalElement.querySelector("#lotSelect--lotName");
|
||||||
if (document.querySelector("#lotOccupancy--lotId").value !== "") {
|
if (document.querySelector("#lotOccupancy--lotId").value !==
|
||||||
|
"") {
|
||||||
lotNameFilterElement.value = currentLotName;
|
lotNameFilterElement.value = currentLotName;
|
||||||
}
|
}
|
||||||
lotNameFilterElement.focus();
|
lotNameFilterElement.focus();
|
||||||
|
|
@ -292,8 +278,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
if (currentLotName !== "") {
|
if (currentLotName !== "") {
|
||||||
occupancyStatusFilterElement.value = "";
|
occupancyStatusFilterElement.value = "";
|
||||||
}
|
}
|
||||||
lotSelectFormElement =
|
lotSelectFormElement = modalElement.querySelector("#form--lotSelect");
|
||||||
modalElement.querySelector("#form--lotSelect");
|
|
||||||
lotSelectResultsElement = modalElement.querySelector("#resultsContainer--lotSelect");
|
lotSelectResultsElement = modalElement.querySelector("#resultsContainer--lotSelect");
|
||||||
lotSelectFormElement.addEventListener("submit", (submitEvent) => {
|
lotSelectFormElement.addEventListener("submit", (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
|
|
@ -305,25 +290,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document
|
document.querySelector(".is-lot-view-button").addEventListener("click", () => {
|
||||||
.querySelector(".is-lot-view-button")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
const lotId = document.querySelector("#lotOccupancy--lotId").value;
|
const lotId = document.querySelector("#lotOccupancy--lotId").value;
|
||||||
if (lotId) {
|
if (lotId) {
|
||||||
window.open(urlPrefix + "/lots/" + lotId);
|
window.open(urlPrefix + "/lots/" + lotId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: "No " +
|
message: "No " + exports.aliases.lot.toLowerCase() + " selected.",
|
||||||
exports.aliases.lot.toLowerCase() +
|
|
||||||
" selected.",
|
|
||||||
contextualColorName: "info"
|
contextualColorName: "info"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document
|
document.querySelector(".is-clear-lot-button").addEventListener("click", () => {
|
||||||
.querySelector(".is-clear-lot-button")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
if (lotNameElement.disabled) {
|
if (lotNameElement.disabled) {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: "You need to unlock the field before clearing it.",
|
message: "You need to unlock the field before clearing it.",
|
||||||
|
|
@ -336,21 +315,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
setUnsavedChanges();
|
setUnsavedChanges();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
los.initializeDatePickers(formElement);
|
||||||
document
|
document
|
||||||
.querySelector("#lotOccupancy--occupancyStartDateString")
|
.querySelector("#lotOccupancy--occupancyStartDateString")
|
||||||
.addEventListener("change", () => {
|
.addEventListener("change", () => {
|
||||||
document.querySelector("#lotOccupancy--occupancyEndDateString").min = document.querySelector("#lotOccupancy--occupancyStartDateString").value;
|
const endDatePicker = document.querySelector("#lotOccupancy--occupancyEndDateString")
|
||||||
|
.bulmaCalendar.datePicker;
|
||||||
|
endDatePicker.min = document.querySelector("#lotOccupancy--occupancyStartDateString").value;
|
||||||
|
endDatePicker.refresh();
|
||||||
});
|
});
|
||||||
los.initializeUnlockFieldButtons(formElement);
|
los.initializeUnlockFieldButtons(formElement);
|
||||||
if (!isCreate) {
|
if (!isCreate) {
|
||||||
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||||
delete exports.lotOccupancyOccupants;
|
delete exports.lotOccupancyOccupants;
|
||||||
const openEditLotOccupancyOccupant = (clickEvent) => {
|
const openEditLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset
|
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex, 10);
|
||||||
.lotOccupantIndex, 10);
|
|
||||||
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||||
return (currentLotOccupancyOccupant.lotOccupantIndex ===
|
return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex;
|
||||||
lotOccupantIndex);
|
|
||||||
});
|
});
|
||||||
let editFormElement;
|
let editFormElement;
|
||||||
let editCloseModalFunction;
|
let editCloseModalFunction;
|
||||||
|
|
@ -358,15 +339,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyOccupant", editFormElement, (responseJSON) => {
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyOccupant", editFormElement, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyOccupants =
|
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants;
|
||||||
responseJSON.lotOccupancyOccupants;
|
|
||||||
editCloseModalFunction();
|
editCloseModalFunction();
|
||||||
renderLotOccupancyOccupants();
|
renderLotOccupancyOccupants();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: "Error Updating " +
|
title: "Error Updating " + exports.aliases.occupant,
|
||||||
exports.aliases.occupant,
|
|
||||||
message: responseJSON.errorMessage,
|
message: responseJSON.errorMessage,
|
||||||
contextualColorName: "danger"
|
contextualColorName: "danger"
|
||||||
});
|
});
|
||||||
|
|
@ -382,10 +361,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
let lotOccupantTypeSelected = false;
|
let lotOccupantTypeSelected = false;
|
||||||
for (const lotOccupantType of exports.lotOccupantTypes) {
|
for (const lotOccupantType of exports.lotOccupantTypes) {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value =
|
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
||||||
lotOccupantType.lotOccupantTypeId.toString();
|
optionElement.textContent = lotOccupantType.lotOccupantType;
|
||||||
optionElement.textContent =
|
|
||||||
lotOccupantType.lotOccupantType;
|
|
||||||
if (lotOccupantType.lotOccupantTypeId ===
|
if (lotOccupantType.lotOccupantTypeId ===
|
||||||
lotOccupancyOccupant.lotOccupantTypeId) {
|
lotOccupancyOccupant.lotOccupantTypeId) {
|
||||||
optionElement.selected = true;
|
optionElement.selected = true;
|
||||||
|
|
@ -395,10 +372,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
if (!lotOccupantTypeSelected) {
|
if (!lotOccupantTypeSelected) {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value =
|
optionElement.value = lotOccupancyOccupant.lotOccupantTypeId.toString();
|
||||||
lotOccupancyOccupant.lotOccupantTypeId.toString();
|
optionElement.textContent = lotOccupancyOccupant.lotOccupantType;
|
||||||
optionElement.textContent =
|
|
||||||
lotOccupancyOccupant.lotOccupantType;
|
|
||||||
optionElement.selected = true;
|
optionElement.selected = true;
|
||||||
lotOccupantTypeSelectElement.append(optionElement);
|
lotOccupantTypeSelectElement.append(optionElement);
|
||||||
}
|
}
|
||||||
|
|
@ -423,21 +398,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const deleteLotOccupancyOccupant = (clickEvent) => {
|
const deleteLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex;
|
const lotOccupantIndex = clickEvent.currentTarget.closest("tr").dataset
|
||||||
|
.lotOccupantIndex;
|
||||||
const doDelete = () => {
|
const doDelete = () => {
|
||||||
cityssm.postJSON(urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
lotOccupantIndex
|
lotOccupantIndex
|
||||||
}, (responseJSON) => {
|
}, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyOccupants =
|
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants;
|
||||||
responseJSON.lotOccupancyOccupants;
|
|
||||||
renderLotOccupancyOccupants();
|
renderLotOccupancyOccupants();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: "Error Removing " +
|
title: "Error Removing " + exports.aliases.occupant,
|
||||||
exports.aliases.occupant,
|
|
||||||
message: responseJSON.errorMessage,
|
message: responseJSON.errorMessage,
|
||||||
contextualColorName: "danger"
|
contextualColorName: "danger"
|
||||||
});
|
});
|
||||||
|
|
@ -469,8 +443,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tableElement = document.createElement("table");
|
const tableElement = document.createElement("table");
|
||||||
tableElement.className =
|
tableElement.className = "table is-fullwidth is-striped is-hoverable";
|
||||||
"table is-fullwidth is-striped is-hoverable";
|
|
||||||
tableElement.innerHTML =
|
tableElement.innerHTML =
|
||||||
"<thead><tr>" +
|
"<thead><tr>" +
|
||||||
"<th>" +
|
"<th>" +
|
||||||
|
|
@ -492,9 +465,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
"<td>" +
|
"<td>" +
|
||||||
cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) +
|
cityssm.escapeHTML(lotOccupancyOccupant.lotOccupantType) +
|
||||||
"</td>" +
|
"</td>" +
|
||||||
("<td>" +
|
("<td>" + cityssm.escapeHTML(lotOccupancyOccupant.occupantName) + "</td>") +
|
||||||
cityssm.escapeHTML(lotOccupancyOccupant.occupantName) +
|
|
||||||
"</td>") +
|
|
||||||
("<td>" +
|
("<td>" +
|
||||||
cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1) +
|
cityssm.escapeHTML(lotOccupancyOccupant.occupantAddress1) +
|
||||||
"<br />" +
|
"<br />" +
|
||||||
|
|
@ -534,24 +505,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
occupantsContainer.append(tableElement);
|
occupantsContainer.append(tableElement);
|
||||||
};
|
};
|
||||||
document
|
document.querySelector("#button--addOccupant").addEventListener("click", () => {
|
||||||
.querySelector("#button--addOccupant")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
const addOccupant = (submitEvent) => {
|
const addOccupant = (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyOccupant", addFormElement, (responseJSON) => {
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyOccupant", addFormElement, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyOccupants =
|
lotOccupancyOccupants = responseJSON.lotOccupancyOccupants;
|
||||||
responseJSON.lotOccupancyOccupants;
|
|
||||||
addCloseModalFunction();
|
addCloseModalFunction();
|
||||||
renderLotOccupancyOccupants();
|
renderLotOccupancyOccupants();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
title: "Error Adding " +
|
title: "Error Adding " + exports.aliases.occupant,
|
||||||
exports.aliases.occupant,
|
|
||||||
message: responseJSON.errorMessage,
|
message: responseJSON.errorMessage,
|
||||||
contextualColorName: "danger"
|
contextualColorName: "danger"
|
||||||
});
|
});
|
||||||
|
|
@ -565,10 +532,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const lotOccupantTypeSelectElement = modalElement.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");
|
const lotOccupantTypeSelectElement = modalElement.querySelector("#lotOccupancyOccupantAdd--lotOccupantTypeId");
|
||||||
for (const lotOccupantType of exports.lotOccupantTypes) {
|
for (const lotOccupantType of exports.lotOccupantTypes) {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value =
|
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
||||||
lotOccupantType.lotOccupantTypeId.toString();
|
optionElement.textContent = lotOccupantType.lotOccupantType;
|
||||||
optionElement.textContent =
|
|
||||||
lotOccupantType.lotOccupantType;
|
|
||||||
lotOccupantTypeSelectElement.append(optionElement);
|
lotOccupantTypeSelectElement.append(optionElement);
|
||||||
}
|
}
|
||||||
modalElement.querySelector("#lotOccupancyOccupantAdd--occupantCity").value = exports.occupantCityDefault;
|
modalElement.querySelector("#lotOccupancyOccupantAdd--occupantCity").value = exports.occupantCityDefault;
|
||||||
|
|
@ -595,8 +560,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const lotOccupancyCommentId = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset
|
const lotOccupancyCommentId = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset
|
||||||
.lotOccupancyCommentId, 10);
|
.lotOccupancyCommentId, 10);
|
||||||
const lotOccupancyComment = lotOccupancyComments.find((currentLotOccupancyComment) => {
|
const lotOccupancyComment = lotOccupancyComments.find((currentLotOccupancyComment) => {
|
||||||
return (currentLotOccupancyComment.lotOccupancyCommentId ===
|
return currentLotOccupancyComment.lotOccupancyCommentId === lotOccupancyCommentId;
|
||||||
lotOccupancyCommentId);
|
|
||||||
});
|
});
|
||||||
let editFormElement;
|
let editFormElement;
|
||||||
let editCloseModalFunction;
|
let editCloseModalFunction;
|
||||||
|
|
@ -604,8 +568,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyComment", editFormElement, (responseJSON) => {
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyComment", editFormElement, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyComments =
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
responseJSON.lotOccupancyComments;
|
|
||||||
editCloseModalFunction();
|
editCloseModalFunction();
|
||||||
renderLotOccupancyComments();
|
renderLotOccupancyComments();
|
||||||
}
|
}
|
||||||
|
|
@ -629,6 +592,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
},
|
},
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus();
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").focus();
|
||||||
editFormElement = modalElement.querySelector("form");
|
editFormElement = modalElement.querySelector("form");
|
||||||
editFormElement.addEventListener("submit", editComment);
|
editFormElement.addEventListener("submit", editComment);
|
||||||
|
|
@ -648,8 +613,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
lotOccupancyCommentId
|
lotOccupancyCommentId
|
||||||
}, (responseJSON) => {
|
}, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyComments =
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
responseJSON.lotOccupancyComments;
|
|
||||||
renderLotOccupancyComments();
|
renderLotOccupancyComments();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -681,8 +645,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tableElement = document.createElement("table");
|
const tableElement = document.createElement("table");
|
||||||
tableElement.className =
|
tableElement.className = "table is-fullwidth is-striped is-hoverable";
|
||||||
"table is-fullwidth is-striped is-hoverable";
|
|
||||||
tableElement.innerHTML =
|
tableElement.innerHTML =
|
||||||
"<thead><tr>" +
|
"<thead><tr>" +
|
||||||
"<th>Commentor</th>" +
|
"<th>Commentor</th>" +
|
||||||
|
|
@ -703,8 +666,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
lotOccupancyComment.lotOccupancyCommentDateString +
|
lotOccupancyComment.lotOccupancyCommentDateString +
|
||||||
(lotOccupancyComment.lotOccupancyCommentTime === 0
|
(lotOccupancyComment.lotOccupancyCommentTime === 0
|
||||||
? ""
|
? ""
|
||||||
: " " +
|
: " " + lotOccupancyComment.lotOccupancyCommentTimeString) +
|
||||||
lotOccupancyComment.lotOccupancyCommentTimeString) +
|
|
||||||
"</td>" +
|
"</td>" +
|
||||||
"<td>" +
|
"<td>" +
|
||||||
cityssm.escapeHTML(lotOccupancyComment.lotOccupancyComment) +
|
cityssm.escapeHTML(lotOccupancyComment.lotOccupancyComment) +
|
||||||
|
|
@ -731,17 +693,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
containerElement.innerHTML = "";
|
containerElement.innerHTML = "";
|
||||||
containerElement.append(tableElement);
|
containerElement.append(tableElement);
|
||||||
};
|
};
|
||||||
document
|
document.querySelector("#button--addComment").addEventListener("click", () => {
|
||||||
.querySelector("#button--addComment")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
const addComment = (submitEvent) => {
|
const addComment = (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyComment", addFormElement, (responseJSON) => {
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyComment", addFormElement, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyComments =
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
responseJSON.lotOccupancyComments;
|
|
||||||
addCloseModalFunction();
|
addCloseModalFunction();
|
||||||
renderLotOccupancyComments();
|
renderLotOccupancyComments();
|
||||||
}
|
}
|
||||||
|
|
@ -848,10 +807,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
for (const lotOccupancyFee of lotOccupancyFees) {
|
for (const lotOccupancyFee of lotOccupancyFees) {
|
||||||
const tableRowElement = document.createElement("tr");
|
const tableRowElement = document.createElement("tr");
|
||||||
tableRowElement.className = "container--lotOccupancyFee";
|
tableRowElement.className = "container--lotOccupancyFee";
|
||||||
tableRowElement.dataset.feeId =
|
tableRowElement.dataset.feeId = lotOccupancyFee.feeId.toString();
|
||||||
lotOccupancyFee.feeId.toString();
|
tableRowElement.dataset.includeQuantity = lotOccupancyFee.includeQuantity
|
||||||
tableRowElement.dataset.includeQuantity =
|
? "1"
|
||||||
lotOccupancyFee.includeQuantity ? "1" : "0";
|
: "0";
|
||||||
tableRowElement.innerHTML =
|
tableRowElement.innerHTML =
|
||||||
'<td colspan="' +
|
'<td colspan="' +
|
||||||
(lotOccupancyFee.quantity === 1 ? "5" : "1") +
|
(lotOccupancyFee.quantity === 1 ? "5" : "1") +
|
||||||
|
|
@ -879,22 +838,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector("button")
|
.querySelector("button")
|
||||||
.addEventListener("click", deleteLotOccupancyFee);
|
.addEventListener("click", deleteLotOccupancyFee);
|
||||||
lotOccupancyFeesContainerElement
|
lotOccupancyFeesContainerElement.querySelector("tbody").append(tableRowElement);
|
||||||
.querySelector("tbody")
|
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
||||||
.append(tableRowElement);
|
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
||||||
feeAmountTotal +=
|
|
||||||
lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
|
||||||
taxAmountTotal +=
|
|
||||||
lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
|
||||||
}
|
}
|
||||||
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--feeAmountTotal").textContent = "$" + feeAmountTotal.toFixed(2);
|
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--feeAmountTotal").textContent = "$" + feeAmountTotal.toFixed(2);
|
||||||
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--taxAmountTotal").textContent = "$" + taxAmountTotal.toFixed(2);
|
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--taxAmountTotal").textContent = "$" + taxAmountTotal.toFixed(2);
|
||||||
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--grandTotal").textContent = "$" + (feeAmountTotal + taxAmountTotal).toFixed(2);
|
lotOccupancyFeesContainerElement.querySelector("#lotOccupancyFees--grandTotal").textContent = "$" + (feeAmountTotal + taxAmountTotal).toFixed(2);
|
||||||
renderLotOccupancyTransactions();
|
renderLotOccupancyTransactions();
|
||||||
};
|
};
|
||||||
document
|
document.querySelector("#button--addFee").addEventListener("click", () => {
|
||||||
.querySelector("#button--addFee")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
if (hasUnsavedChanges) {
|
if (hasUnsavedChanges) {
|
||||||
bulmaJS.alert({
|
bulmaJS.alert({
|
||||||
message: "Please save all unsaved changes before adding fees.",
|
message: "Please save all unsaved changes before adding fees.",
|
||||||
|
|
@ -912,8 +865,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
quantity
|
quantity
|
||||||
}, (responseJSON) => {
|
}, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyFees =
|
lotOccupancyFees = responseJSON.lotOccupancyFees;
|
||||||
responseJSON.lotOccupancyFees;
|
|
||||||
renderLotOccupancyFees();
|
renderLotOccupancyFees();
|
||||||
filterFees();
|
filterFees();
|
||||||
}
|
}
|
||||||
|
|
@ -952,8 +904,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
|
const feeId = Number.parseInt(clickEvent.currentTarget.dataset.feeId, 10);
|
||||||
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest(".container--feeCategory").dataset.feeCategoryId, 10);
|
const feeCategoryId = Number.parseInt(clickEvent.currentTarget.closest(".container--feeCategory").dataset.feeCategoryId, 10);
|
||||||
const feeCategory = feeCategories.find((currentFeeCategory) => {
|
const feeCategory = feeCategories.find((currentFeeCategory) => {
|
||||||
return (currentFeeCategory.feeCategoryId ===
|
return currentFeeCategory.feeCategoryId === feeCategoryId;
|
||||||
feeCategoryId);
|
|
||||||
});
|
});
|
||||||
const fee = feeCategory.fees.find((currentFee) => {
|
const fee = feeCategory.fees.find((currentFee) => {
|
||||||
return currentFee.feeId === feeId;
|
return currentFee.feeId === feeId;
|
||||||
|
|
@ -966,15 +917,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const filterFees = () => {
|
const filterFees = () => {
|
||||||
const filterStringPieces = feeFilterElement.value
|
const filterStringPieces = feeFilterElement.value.trim().toLowerCase().split(" ");
|
||||||
.trim()
|
|
||||||
.toLowerCase()
|
|
||||||
.split(" ");
|
|
||||||
feeFilterResultsElement.innerHTML = "";
|
feeFilterResultsElement.innerHTML = "";
|
||||||
for (const feeCategory of feeCategories) {
|
for (const feeCategory of feeCategories) {
|
||||||
const categoryContainerElement = document.createElement("div");
|
const categoryContainerElement = document.createElement("div");
|
||||||
categoryContainerElement.className =
|
categoryContainerElement.className = "container--feeCategory";
|
||||||
"container--feeCategory";
|
|
||||||
categoryContainerElement.dataset.feeCategoryId =
|
categoryContainerElement.dataset.feeCategoryId =
|
||||||
feeCategory.feeCategoryId.toString();
|
feeCategory.feeCategoryId.toString();
|
||||||
categoryContainerElement.innerHTML =
|
categoryContainerElement.innerHTML =
|
||||||
|
|
@ -991,9 +938,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
let includeFee = true;
|
let includeFee = true;
|
||||||
for (const filterStringPiece of filterStringPieces) {
|
for (const filterStringPiece of filterStringPieces) {
|
||||||
if (!fee.feeName
|
if (!fee.feeName.toLowerCase().includes(filterStringPiece)) {
|
||||||
.toLowerCase()
|
|
||||||
.includes(filterStringPiece)) {
|
|
||||||
includeFee = false;
|
includeFee = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1003,24 +948,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
hasFees = true;
|
hasFees = true;
|
||||||
const panelBlockElement = document.createElement("a");
|
const panelBlockElement = document.createElement("a");
|
||||||
panelBlockElement.className =
|
panelBlockElement.className = "panel-block is-block container--fee";
|
||||||
"panel-block is-block container--fee";
|
panelBlockElement.dataset.feeId = fee.feeId.toString();
|
||||||
panelBlockElement.dataset.feeId =
|
|
||||||
fee.feeId.toString();
|
|
||||||
panelBlockElement.href = "#";
|
panelBlockElement.href = "#";
|
||||||
panelBlockElement.innerHTML =
|
panelBlockElement.innerHTML =
|
||||||
"<strong>" +
|
"<strong>" +
|
||||||
cityssm.escapeHTML(fee.feeName) +
|
cityssm.escapeHTML(fee.feeName) +
|
||||||
"</strong><br />" +
|
"</strong><br />" +
|
||||||
"<small>" +
|
"<small>" +
|
||||||
cityssm
|
cityssm.escapeHTML(fee.feeDescription).replace(/\n/g, "<br />") +
|
||||||
.escapeHTML(fee.feeDescription)
|
|
||||||
.replace(/\n/g, "<br />") +
|
|
||||||
"</small>";
|
"</small>";
|
||||||
panelBlockElement.addEventListener("click", tryAddFee);
|
panelBlockElement.addEventListener("click", tryAddFee);
|
||||||
categoryContainerElement
|
categoryContainerElement.querySelector(".panel").append(panelBlockElement);
|
||||||
.querySelector(".panel")
|
|
||||||
.append(panelBlockElement);
|
|
||||||
}
|
}
|
||||||
if (hasFees) {
|
if (hasFees) {
|
||||||
feeFilterResultsElement.append(categoryContainerElement);
|
feeFilterResultsElement.append(categoryContainerElement);
|
||||||
|
|
@ -1058,22 +997,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const getTransactionGrandTotal = () => {
|
const getTransactionGrandTotal = () => {
|
||||||
let transactionGrandTotal = 0;
|
let transactionGrandTotal = 0;
|
||||||
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
|
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
|
||||||
transactionGrandTotal +=
|
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
|
||||||
lotOccupancyTransaction.transactionAmount;
|
|
||||||
}
|
}
|
||||||
return transactionGrandTotal;
|
return transactionGrandTotal;
|
||||||
};
|
};
|
||||||
const deleteLotOccupancyTransaction = (clickEvent) => {
|
const deleteLotOccupancyTransaction = (clickEvent) => {
|
||||||
const transactionIndex = clickEvent.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;
|
const transactionIndex = clickEvent.currentTarget.closest(".container--lotOccupancyTransaction").dataset.transactionIndex;
|
||||||
const doDelete = () => {
|
const doDelete = () => {
|
||||||
cityssm.postJSON(urlPrefix +
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doDeleteLotOccupancyTransaction", {
|
||||||
"/lotOccupancies/doDeleteLotOccupancyTransaction", {
|
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
transactionIndex
|
transactionIndex
|
||||||
}, (responseJSON) => {
|
}, (responseJSON) => {
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyTransactions =
|
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
|
||||||
responseJSON.lotOccupancyTransactions;
|
|
||||||
renderLotOccupancyTransactions();
|
renderLotOccupancyTransactions();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1124,11 +1060,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
"</table>";
|
"</table>";
|
||||||
let transactionGrandTotal = 0;
|
let transactionGrandTotal = 0;
|
||||||
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
|
for (const lotOccupancyTransaction of lotOccupancyTransactions) {
|
||||||
transactionGrandTotal +=
|
transactionGrandTotal += lotOccupancyTransaction.transactionAmount;
|
||||||
lotOccupancyTransaction.transactionAmount;
|
|
||||||
const tableRowElement = document.createElement("tr");
|
const tableRowElement = document.createElement("tr");
|
||||||
tableRowElement.className =
|
tableRowElement.className = "container--lotOccupancyTransaction";
|
||||||
"container--lotOccupancyTransaction";
|
|
||||||
tableRowElement.dataset.transactionIndex =
|
tableRowElement.dataset.transactionIndex =
|
||||||
lotOccupancyTransaction.transactionIndex.toString();
|
lotOccupancyTransaction.transactionIndex.toString();
|
||||||
tableRowElement.innerHTML =
|
tableRowElement.innerHTML =
|
||||||
|
|
@ -1172,17 +1106,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
"</div>");
|
"</div>");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
document
|
document.querySelector("#button--addTransaction").addEventListener("click", () => {
|
||||||
.querySelector("#button--addTransaction")
|
|
||||||
.addEventListener("click", () => {
|
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
const doAddTransaction = (submitEvent) => {
|
const doAddTransaction = (submitEvent) => {
|
||||||
submitEvent.preventDefault();
|
submitEvent.preventDefault();
|
||||||
cityssm.postJSON(urlPrefix +
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyTransaction", submitEvent.currentTarget, (responseJSON) => {
|
||||||
"/lotOccupancies/doAddLotOccupancyTransaction", submitEvent.currentTarget, (responseJSON) => {
|
|
||||||
if (responseJSON.success) {
|
if (responseJSON.success) {
|
||||||
lotOccupancyTransactions =
|
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions;
|
||||||
responseJSON.lotOccupancyTransactions;
|
|
||||||
addCloseModalFunction();
|
addCloseModalFunction();
|
||||||
renderLotOccupancyTransactions();
|
renderLotOccupancyTransactions();
|
||||||
}
|
}
|
||||||
|
|
@ -1209,9 +1139,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
addCloseModalFunction = closeModalFunction;
|
addCloseModalFunction = closeModalFunction;
|
||||||
modalElement
|
modalElement.querySelector("form").addEventListener("submit", doAddTransaction);
|
||||||
.querySelector("form")
|
|
||||||
.addEventListener("submit", doAddTransaction);
|
|
||||||
},
|
},
|
||||||
onremoved: () => {
|
onremoved: () => {
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -43,9 +43,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const datePickerBaseOptions = {
|
const datePickerBaseOptions = {
|
||||||
|
type: "date",
|
||||||
dateFormat: "yyyy-MM-dd",
|
dateFormat: "yyyy-MM-dd",
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
color: "info"
|
color: "info",
|
||||||
|
displayMode: "dialog"
|
||||||
};
|
};
|
||||||
const initializeDatePickers = (containerElement) => {
|
const initializeDatePickers = (containerElement) => {
|
||||||
const dateElements = containerElement.querySelectorAll("input[type='date']");
|
const dateElements = containerElement.querySelectorAll("input[type='date']");
|
||||||
|
|
@ -64,7 +66,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
cal.on("save", () => {
|
cal.on("save", () => {
|
||||||
dateElement.dispatchEvent(new Event("change"));
|
dateElement.dispatchEvent(new Event("change"));
|
||||||
});
|
});
|
||||||
const clearButtonElement = containerElement.querySelector("#" + cal._id + " .datetimepicker-clear-button");
|
const datepickerElement = containerElement.querySelector("#" + cal._id);
|
||||||
|
const datePickerNavButtonElements = datepickerElement.querySelectorAll(".datepicker-nav button.is-text");
|
||||||
|
for (const datePickerNavButtonElement of datePickerNavButtonElements) {
|
||||||
|
datePickerNavButtonElement.classList.add("is-" + datePickerBaseOptions.color);
|
||||||
|
datePickerNavButtonElement.classList.remove("is-text");
|
||||||
|
}
|
||||||
|
const clearButtonElement = datepickerElement.querySelector(".datetimepicker-clear-button");
|
||||||
if (clearButtonElement) {
|
if (clearButtonElement) {
|
||||||
if (dateElement.required) {
|
if (dateElement.required) {
|
||||||
clearButtonElement.remove();
|
clearButtonElement.remove();
|
||||||
|
|
@ -72,7 +80,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
else {
|
else {
|
||||||
clearButtonElement.dataset.tooltip = "Clear";
|
clearButtonElement.dataset.tooltip = "Clear";
|
||||||
clearButtonElement.innerHTML =
|
clearButtonElement.innerHTML =
|
||||||
'<i class="fas fa-times" aria-hidden="true"></i>';
|
'<span class="has-text-weight-bold" aria-hidden="true">×</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const timePickerBaseOptions = {
|
||||||
|
type: "time",
|
||||||
|
timeFormat: "hh:mm",
|
||||||
|
color: "info",
|
||||||
|
displayMode: "dialog",
|
||||||
|
validateLabel: "Set Time",
|
||||||
|
minuteSteps: 1
|
||||||
|
};
|
||||||
|
const initializeTimePickers = (containerElement) => {
|
||||||
|
const timeElements = containerElement.querySelectorAll("input[type='time']");
|
||||||
|
for (const timeElement of timeElements) {
|
||||||
|
const timePickerOptions = Object.assign({}, timePickerBaseOptions);
|
||||||
|
if (timeElement.required) {
|
||||||
|
timePickerOptions.showClearButton = false;
|
||||||
|
}
|
||||||
|
const cal = exports.bulmaCalendar.attach(timeElement, timePickerOptions)[0];
|
||||||
|
cal.on("save", () => {
|
||||||
|
timeElement.dispatchEvent(new Event("change"));
|
||||||
|
});
|
||||||
|
const timePickerElement = containerElement.querySelector("#" + cal._id);
|
||||||
|
const timePickerCancelButtonElement = timePickerElement.querySelector(".datetimepicker-footer-cancel");
|
||||||
|
if (timePickerCancelButtonElement) {
|
||||||
|
timePickerCancelButtonElement.remove();
|
||||||
|
}
|
||||||
|
const clearButtonElement = timePickerElement.querySelector(".datetimepicker-clear-button");
|
||||||
|
if (clearButtonElement) {
|
||||||
|
if (timeElement.required) {
|
||||||
|
clearButtonElement.remove();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clearButtonElement.dataset.tooltip = "Clear";
|
||||||
|
clearButtonElement.innerHTML =
|
||||||
|
'<span class="has-text-weight-bold" aria-hidden="true">×</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +167,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
highlightMap,
|
highlightMap,
|
||||||
initializeUnlockFieldButtons,
|
initializeUnlockFieldButtons,
|
||||||
initializeDatePickers,
|
initializeDatePickers,
|
||||||
|
initializeTimePickers,
|
||||||
populateAliases,
|
populateAliases,
|
||||||
getRandomColor
|
getRandomColor
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,11 @@ declare const cityssm: cityssmGlobal;
|
||||||
};
|
};
|
||||||
|
|
||||||
const datePickerBaseOptions: BulmaCalendarOptions = {
|
const datePickerBaseOptions: BulmaCalendarOptions = {
|
||||||
|
type: "date",
|
||||||
dateFormat: "yyyy-MM-dd",
|
dateFormat: "yyyy-MM-dd",
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
color: "info"
|
color: "info",
|
||||||
|
displayMode: "dialog"
|
||||||
};
|
};
|
||||||
|
|
||||||
const initializeDatePickers = (containerElement: HTMLElement) => {
|
const initializeDatePickers = (containerElement: HTMLElement) => {
|
||||||
|
|
@ -108,9 +110,25 @@ declare const cityssm: cityssmGlobal;
|
||||||
dateElement.dispatchEvent(new Event("change"));
|
dateElement.dispatchEvent(new Event("change"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// style the clear button
|
// Get the datepicker container element
|
||||||
const clearButtonElement = containerElement.querySelector(
|
|
||||||
"#" + cal._id + " .datetimepicker-clear-button"
|
const datepickerElement = containerElement.querySelector("#" + cal._id) as HTMLElement;
|
||||||
|
|
||||||
|
// Override the previous and next month button styles
|
||||||
|
|
||||||
|
const datePickerNavButtonElements = datepickerElement.querySelectorAll(
|
||||||
|
".datepicker-nav button.is-text"
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const datePickerNavButtonElement of datePickerNavButtonElements) {
|
||||||
|
datePickerNavButtonElement.classList.add("is-" + datePickerBaseOptions.color);
|
||||||
|
datePickerNavButtonElement.classList.remove("is-text");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override the clear button style
|
||||||
|
|
||||||
|
const clearButtonElement = datepickerElement.querySelector(
|
||||||
|
".datetimepicker-clear-button"
|
||||||
) as HTMLElement;
|
) as HTMLElement;
|
||||||
|
|
||||||
if (clearButtonElement) {
|
if (clearButtonElement) {
|
||||||
|
|
@ -119,7 +137,66 @@ declare const cityssm: cityssmGlobal;
|
||||||
} else {
|
} else {
|
||||||
clearButtonElement.dataset.tooltip = "Clear";
|
clearButtonElement.dataset.tooltip = "Clear";
|
||||||
clearButtonElement.innerHTML =
|
clearButtonElement.innerHTML =
|
||||||
'<i class="fas fa-times" aria-hidden="true"></i>';
|
'<span class="has-text-weight-bold" aria-hidden="true">×</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const timePickerBaseOptions: BulmaCalendarOptions = {
|
||||||
|
type: "time",
|
||||||
|
timeFormat: "hh:mm",
|
||||||
|
color: "info",
|
||||||
|
displayMode: "dialog",
|
||||||
|
validateLabel: "Set Time",
|
||||||
|
minuteSteps: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
const initializeTimePickers = (containerElement: HTMLElement) => {
|
||||||
|
const timeElements = containerElement.querySelectorAll(
|
||||||
|
"input[type='time']"
|
||||||
|
) as NodeListOf<HTMLInputElement>;
|
||||||
|
|
||||||
|
for (const timeElement of timeElements) {
|
||||||
|
const timePickerOptions = Object.assign({}, timePickerBaseOptions);
|
||||||
|
|
||||||
|
if (timeElement.required) {
|
||||||
|
timePickerOptions.showClearButton = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cal = exports.bulmaCalendar.attach(timeElement, timePickerOptions)[0];
|
||||||
|
|
||||||
|
// trigger change event on original element
|
||||||
|
cal.on("save", () => {
|
||||||
|
timeElement.dispatchEvent(new Event("change"));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get the datepicker container element
|
||||||
|
const timePickerElement = containerElement.querySelector("#" + cal._id) as HTMLElement;
|
||||||
|
|
||||||
|
// Remove "cancel" button
|
||||||
|
|
||||||
|
const timePickerCancelButtonElement = timePickerElement.querySelector(
|
||||||
|
".datetimepicker-footer-cancel"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (timePickerCancelButtonElement) {
|
||||||
|
timePickerCancelButtonElement.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override the clear button style
|
||||||
|
|
||||||
|
const clearButtonElement = timePickerElement.querySelector(
|
||||||
|
".datetimepicker-clear-button"
|
||||||
|
) as HTMLElement;
|
||||||
|
|
||||||
|
if (clearButtonElement) {
|
||||||
|
if (timeElement.required) {
|
||||||
|
clearButtonElement.remove();
|
||||||
|
} else {
|
||||||
|
clearButtonElement.dataset.tooltip = "Clear";
|
||||||
|
clearButtonElement.innerHTML =
|
||||||
|
'<span class="has-text-weight-bold" aria-hidden="true">×</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,6 +264,7 @@ declare const cityssm: cityssmGlobal;
|
||||||
highlightMap,
|
highlightMap,
|
||||||
initializeUnlockFieldButtons,
|
initializeUnlockFieldButtons,
|
||||||
initializeDatePickers,
|
initializeDatePickers,
|
||||||
|
initializeTimePickers,
|
||||||
populateAliases,
|
populateAliases,
|
||||||
getRandomColor
|
getRandomColor
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -812,8 +812,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
},
|
},
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
editCloseModalFunction = closeModalFunction;
|
editCloseModalFunction = closeModalFunction;
|
||||||
los.initializeDatePickers(modalElement);
|
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
modalElement
|
modalElement
|
||||||
.querySelector("form")
|
.querySelector("form")
|
||||||
.addEventListener("submit", doEdit);
|
.addEventListener("submit", doEdit);
|
||||||
|
|
@ -963,6 +964,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
addModalElement = modalElement;
|
addModalElement = modalElement;
|
||||||
addCloseModalFunction = closeModalFunction;
|
addCloseModalFunction = closeModalFunction;
|
||||||
los.initializeDatePickers(modalElement);
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
modalElement
|
modalElement
|
||||||
.querySelector("form")
|
.querySelector("form")
|
||||||
|
|
|
||||||
|
|
@ -1196,9 +1196,11 @@ declare const bulmaJS: BulmaJS;
|
||||||
onshown: (modalElement, closeModalFunction) => {
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
editCloseModalFunction = closeModalFunction;
|
editCloseModalFunction = closeModalFunction;
|
||||||
|
|
||||||
los.initializeDatePickers(modalElement);
|
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
||||||
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
|
|
||||||
modalElement
|
modalElement
|
||||||
.querySelector("form")
|
.querySelector("form")
|
||||||
.addEventListener("submit", doEdit);
|
.addEventListener("submit", doEdit);
|
||||||
|
|
@ -1407,6 +1409,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
addCloseModalFunction = closeModalFunction;
|
addCloseModalFunction = closeModalFunction;
|
||||||
|
|
||||||
los.initializeDatePickers(modalElement);
|
los.initializeDatePickers(modalElement);
|
||||||
|
los.initializeTimePickers(modalElement);
|
||||||
|
|
||||||
bulmaJS.toggleHtmlClipped();
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,22 @@
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="lotCommentEdit--lotCommentDateString">Comment Date</label>
|
<label class="label" for="lotCommentEdit--lotCommentDateString">Comment Date</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="lotCommentEdit--lotCommentDateString" name="lotCommentDateString" type="date" required />
|
<input class="input" id="lotCommentEdit--lotCommentDateString" name="lotCommentDateString" type="date" required />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-calendar" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="lotCommentEdit--lotCommentTimeString">Comment Time</label>
|
<label class="label" for="lotCommentEdit--lotCommentTimeString">Comment Time</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="lotCommentEdit--lotCommentTimeString" name="lotCommentTimeString" type="time" required />
|
<input class="input" id="lotCommentEdit--lotCommentTimeString" name="lotCommentTimeString" type="time" required />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-clock" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -21,16 +21,22 @@
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentDateString">Comment Date</label>
|
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentDateString">Comment Date</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentDateString" name="lotOccupancyCommentDateString" type="date" required />
|
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentDateString" name="lotOccupancyCommentDateString" type="date" required />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-calendar" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentTimeString">Comment Time</label>
|
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentTimeString">Comment Time</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentTimeString" name="lotOccupancyCommentTimeString" type="time" required />
|
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentTimeString" name="lotOccupancyCommentTimeString" type="time" required />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-clock" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,11 @@
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="milestoneAdd--workOrderMilestoneTimeString">Milestone Time</label>
|
<label class="label" for="milestoneAdd--workOrderMilestoneTimeString">Milestone Time</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="milestoneAdd--workOrderMilestoneTimeString" name="workOrderMilestoneTimeString" type="time" />
|
<input class="input" id="milestoneAdd--workOrderMilestoneTimeString" name="workOrderMilestoneTimeString" type="time" />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-clock" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,11 @@
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label" for="milestoneEdit--workOrderMilestoneTimeString">Milestone Time</label>
|
<label class="label" for="milestoneEdit--workOrderMilestoneTimeString">Milestone Time</label>
|
||||||
<div class="control">
|
<div class="control has-icons-left">
|
||||||
<input class="input" id="milestoneEdit--workOrderMilestoneTimeString" name="workOrderMilestoneTimeString" type="time" />
|
<input class="input" id="milestoneEdit--workOrderMilestoneTimeString" name="workOrderMilestoneTimeString" type="time" />
|
||||||
|
<span class="icon is-left">
|
||||||
|
<i class="fas fa-clock" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("main").dataset.urlPrefix,o=document.querySelector("#lot--lotId").value,l=""===o,s=document.querySelector("#form--lot");s.addEventListener("submit",t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/"+(l?"doCreateLot":"doUpdateLot"),s,t=>{t.success?l?window.location.href=e+"/lots/"+t.lotId+"/edit":bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"}):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}),t.initializeUnlockFieldButtons(s),l||document.querySelector("#button--deleteLot").addEventListener("click",t=>{t.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:"Are you sure you want to delete this "+exports.aliases.lot.toLowerCase()+"?",contextualColorName:"warning",okButton:{text:"Yes, Delete "+exports.aliases.lot,callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLot",{lotId:o},t=>{t.success?(cityssm.disableNavBlocker(),window.location.href=e+"/lots/?t="+Date.now()):bulmaJS.alert({title:"Error Deleting "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}}})});let n=exports.lotComments;delete exports.lotComments;const r=l=>{const s=Number.parseInt(l.currentTarget.closest("tr").dataset.lotCommentId,10),r=n.find(t=>t.lotCommentId===s);let a,i;const d=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doUpdateLotComment",a,t=>{t.success?(n=t.lotComments,i(),m()):bulmaJS.alert({title:"Error Updating Comment",message:t.errorMessage,contextualColorName:"danger"})})};cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=r.lotComment,e.querySelector("#lotCommentEdit--lotCommentDateString").value=r.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=r.lotCommentTimeString},onshown:(t,e)=>{bulmaJS.toggleHtmlClipped(),t.querySelector("#lotCommentEdit--lotComment").focus(),(a=t.querySelector("form")).addEventListener("submit",d),i=e},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})},a=t=>{const l=Number.parseInt(t.currentTarget.closest("tr").dataset.lotCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:l},t=>{t.success?(n=t.lotComments,m()):bulmaJS.alert({title:"Error Removing Comment",message:t.errorMessage,contextualColorName:"danger"})})}},contextualColorName:"warning"})},m=()=>{const t=document.querySelector("#container--lotComments");if(0===n.length)return void(t.innerHTML='<div class="message is-info"><p class="message-body">There are no comments to display.</p></div>');const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML='<thead><tr><th>Commentor</th><th>Comment Date</th><th>Comment</th><th class="is-hidden-print"><span class="is-sr-only">Options</span></th></tr></thead><tbody></tbody>';for(const t of n){const o=document.createElement("tr");o.dataset.lotCommentId=t.lotCommentId.toString(),o.innerHTML="<td>"+cityssm.escapeHTML(t.recordCreate_userName)+"</td><td>"+t.lotCommentDateString+(0===t.lotCommentTime?"":" "+t.lotCommentTimeString)+"</td><td>"+cityssm.escapeHTML(t.lotComment)+'</td><td class="is-hidden-print"><div class="buttons are-small is-justify-content-end"><button class="button is-primary button--edit" type="button"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span> <span>Edit</span></button><button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button></div></td>',o.querySelector(".button--edit").addEventListener("click",r),o.querySelector(".button--delete").addEventListener("click",a),e.querySelector("tbody").append(o)}t.innerHTML="",t.append(e)},i=()=>{let l;const s=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doAddLotComment",t.currentTarget,t=>{t.success&&(n=t.lotComments,m(),l())})};cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",s)},onshown(t,e){bulmaJS.toggleHtmlClipped(),l=e,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})};l||(document.querySelector("#lotComments--add").addEventListener("click",i),m())})();
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("main").dataset.urlPrefix,o=document.querySelector("#lot--lotId").value,l=""===o,s=document.querySelector("#form--lot");s.addEventListener("submit",t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/"+(l?"doCreateLot":"doUpdateLot"),s,t=>{t.success?l?window.location.href=e+"/lots/"+t.lotId+"/edit":bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"}):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}),t.initializeUnlockFieldButtons(s),l||document.querySelector("#button--deleteLot").addEventListener("click",t=>{t.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:"Are you sure you want to delete this "+exports.aliases.lot.toLowerCase()+"?",contextualColorName:"warning",okButton:{text:"Yes, Delete "+exports.aliases.lot,callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLot",{lotId:o},t=>{t.success?(cityssm.disableNavBlocker(),window.location.href=e+"/lots/?t="+Date.now()):bulmaJS.alert({title:"Error Deleting "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}}})});let n=exports.lotComments;delete exports.lotComments;const r=l=>{const s=Number.parseInt(l.currentTarget.closest("tr").dataset.lotCommentId,10),r=n.find(t=>t.lotCommentId===s);let a,i;const d=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doUpdateLotComment",a,t=>{t.success?(n=t.lotComments,i(),m()):bulmaJS.alert({title:"Error Updating Comment",message:t.errorMessage,contextualColorName:"danger"})})};cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=r.lotComment,e.querySelector("#lotCommentEdit--lotCommentDateString").value=r.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=r.lotCommentTimeString},onshown:(e,o)=>{bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),t.initializeTimePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(a=e.querySelector("form")).addEventListener("submit",d),i=o},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})},a=t=>{const l=Number.parseInt(t.currentTarget.closest("tr").dataset.lotCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:l},t=>{t.success?(n=t.lotComments,m()):bulmaJS.alert({title:"Error Removing Comment",message:t.errorMessage,contextualColorName:"danger"})})}},contextualColorName:"warning"})},m=()=>{const t=document.querySelector("#container--lotComments");if(0===n.length)return void(t.innerHTML='<div class="message is-info"><p class="message-body">There are no comments to display.</p></div>');const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML='<thead><tr><th>Commentor</th><th>Comment Date</th><th>Comment</th><th class="is-hidden-print"><span class="is-sr-only">Options</span></th></tr></thead><tbody></tbody>';for(const t of n){const o=document.createElement("tr");o.dataset.lotCommentId=t.lotCommentId.toString(),o.innerHTML="<td>"+cityssm.escapeHTML(t.recordCreate_userName)+"</td><td>"+t.lotCommentDateString+(0===t.lotCommentTime?"":" "+t.lotCommentTimeString)+"</td><td>"+cityssm.escapeHTML(t.lotComment)+'</td><td class="is-hidden-print"><div class="buttons are-small is-justify-content-end"><button class="button is-primary button--edit" type="button"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span> <span>Edit</span></button><button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button></div></td>',o.querySelector(".button--edit").addEventListener("click",r),o.querySelector(".button--delete").addEventListener("click",a),e.querySelector("tbody").append(o)}t.innerHTML="",t.append(e)},i=()=>{let l;const s=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doAddLotComment",t.currentTarget,t=>{t.success&&(n=t.lotComments,m(),l())})};cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",s)},onshown(t,e){bulmaJS.toggleHtmlClipped(),l=e,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})};l||(document.querySelector("#lotComments--add").addEventListener("click",i),m())})();
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
||||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=e=>{const t=e.currentTarget.closest(".field").querySelector("input, select");if(t.classList.remove("is-readonly"),"INPUT"===t.tagName)t.readOnly=!1,t.disabled=!1;else{const e=t.querySelectorAll("option");for(const t of e)t.disabled=!1}t.focus()},t={dateFormat:"yyyy-MM-dd",showFooter:!1,color:"info"},o=["red","green","orange","blue","pink","yellow","purple"],a=["bright","light","dark"],s={highlightMap:(e,t,o)=>{let a,s=t;for(;!(a=e.querySelector("#"+s))&&s.includes("-");)s=s.slice(0,Math.max(0,s.lastIndexOf("-")));if(a){a.style.fill=null,a.classList.add("highlight","is-"+o);const e=a.querySelectorAll("path");for(const t of e)t.style.fill=null}},initializeUnlockFieldButtons:t=>{const o=t.querySelectorAll(".is-unlock-field-button");for(const t of o)t.addEventListener("click",e)},initializeDatePickers:e=>{const o=e.querySelectorAll("input[type='date']");for(const a of o){const o=Object.assign({},t);a.required&&(o.showClearButton=!1),a.min&&(o.minDate=cityssm.dateStringToDate(a.min)),a.max&&(o.maxDate=cityssm.dateStringToDate(a.max));const s=exports.bulmaCalendar.attach(a,o)[0];s.on("save",()=>{a.dispatchEvent(new Event("change"))});const l=e.querySelector("#"+s._id+" .datetimepicker-clear-button");l&&(a.required?l.remove():(l.dataset.tooltip="Clear",l.innerHTML='<i class="fas fa-times" aria-hidden="true"></i>'))}},populateAliases:e=>{const t=e.querySelectorAll(".alias");for(const e of t)switch(e.dataset.alias){case"Lot":e.textContent=exports.aliases.lot;break;case"lot":e.textContent=exports.aliases.lot.toLowerCase();break;case"Occupancy":e.textContent=exports.aliases.occupancy;break;case"occupancy":e.textContent=exports.aliases.occupancy.toLowerCase();break;case"Occupant":e.textContent=exports.aliases.occupant;break;case"occupant":e.textContent=exports.aliases.occupant.toLowerCase();break;case"ExternalReceiptNumber":e.textContent=exports.aliases.externalReceiptNumber}},getRandomColor:e=>{let t=e;return t.length<2&&(t+="a1"),exports.randomColor({seed:t+t,hue:o[t.codePointAt(t.length-1)%o.length],luminosity:a[t.codePointAt(t.length-2)%a.length]})}};exports.los=s})();
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=e=>{const t=e.currentTarget.closest(".field").querySelector("input, select");if(t.classList.remove("is-readonly"),"INPUT"===t.tagName)t.readOnly=!1,t.disabled=!1;else{const e=t.querySelectorAll("option");for(const t of e)t.disabled=!1}t.focus()},t={type:"date",dateFormat:"yyyy-MM-dd",showFooter:!1,color:"info",displayMode:"dialog"},o={type:"time",timeFormat:"hh:mm",color:"info",displayMode:"dialog",validateLabel:"Set Time",minuteSteps:1},a=["red","green","orange","blue","pink","yellow","purple"],s=["bright","light","dark"],l={highlightMap:(e,t,o)=>{let a,s=t;for(;!(a=e.querySelector("#"+s))&&s.includes("-");)s=s.slice(0,Math.max(0,s.lastIndexOf("-")));if(a){a.style.fill=null,a.classList.add("highlight","is-"+o);const e=a.querySelectorAll("path");for(const t of e)t.style.fill=null}},initializeUnlockFieldButtons:t=>{const o=t.querySelectorAll(".is-unlock-field-button");for(const t of o)t.addEventListener("click",e)},initializeDatePickers:e=>{const o=e.querySelectorAll("input[type='date']");for(const a of o){const o=Object.assign({},t);a.required&&(o.showClearButton=!1),a.min&&(o.minDate=cityssm.dateStringToDate(a.min)),a.max&&(o.maxDate=cityssm.dateStringToDate(a.max));const s=exports.bulmaCalendar.attach(a,o)[0];s.on("save",()=>{a.dispatchEvent(new Event("change"))});const l=e.querySelector("#"+s._id),r=l.querySelectorAll(".datepicker-nav button.is-text");for(const e of r)e.classList.add("is-"+t.color),e.classList.remove("is-text");const n=l.querySelector(".datetimepicker-clear-button");n&&(a.required?n.remove():(n.dataset.tooltip="Clear",n.innerHTML='<span class="has-text-weight-bold" aria-hidden="true">×</span>'))}},initializeTimePickers:e=>{const t=e.querySelectorAll("input[type='time']");for(const a of t){const t=Object.assign({},o);a.required&&(t.showClearButton=!1);const s=exports.bulmaCalendar.attach(a,t)[0];s.on("save",()=>{a.dispatchEvent(new Event("change"))});const l=e.querySelector("#"+s._id),r=l.querySelector(".datetimepicker-footer-cancel");r&&r.remove();const n=l.querySelector(".datetimepicker-clear-button");n&&(a.required?n.remove():(n.dataset.tooltip="Clear",n.innerHTML='<span class="has-text-weight-bold" aria-hidden="true">×</span>'))}},populateAliases:e=>{const t=e.querySelectorAll(".alias");for(const e of t)switch(e.dataset.alias){case"Lot":e.textContent=exports.aliases.lot;break;case"lot":e.textContent=exports.aliases.lot.toLowerCase();break;case"Occupancy":e.textContent=exports.aliases.occupancy;break;case"occupancy":e.textContent=exports.aliases.occupancy.toLowerCase();break;case"Occupant":e.textContent=exports.aliases.occupant;break;case"occupant":e.textContent=exports.aliases.occupant.toLowerCase();break;case"ExternalReceiptNumber":e.textContent=exports.aliases.externalReceiptNumber}},getRandomColor:e=>{let t=e;return t.length<2&&(t+="a1"),exports.randomColor({seed:t+t,hue:a[t.codePointAt(t.length-1)%a.length],luminosity:s[t.codePointAt(t.length-2)%s.length]})}};exports.los=l})();
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,7 @@
|
||||||
export interface LOS {
|
export interface LOS {
|
||||||
highlightMap: (mapContainerElement: HTMLElement, mapKey: string, contextualClass: "success" | "danger") => void;
|
highlightMap: (mapContainerElement: HTMLElement, mapKey: string, contextualClass: "success" | "danger") => void;
|
||||||
initializeDatePickers: (containerElement: HTMLElement) => void;
|
initializeDatePickers: (containerElement: HTMLElement) => void;
|
||||||
|
initializeTimePickers: (containerElement: HTMLElement) => void;
|
||||||
initializeUnlockFieldButtons: (containerElement: HTMLElement) => void;
|
initializeUnlockFieldButtons: (containerElement: HTMLElement) => void;
|
||||||
populateAliases: (containerElement: HTMLElement) => void;
|
populateAliases: (containerElement: HTMLElement) => void;
|
||||||
getRandomColor: (seedString: string) => string;
|
getRandomColor: (seedString: string) => string;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ export interface LOS {
|
||||||
contextualClass: "success" | "danger"
|
contextualClass: "success" | "danger"
|
||||||
) => void;
|
) => void;
|
||||||
initializeDatePickers: (containerElement: HTMLElement) => void;
|
initializeDatePickers: (containerElement: HTMLElement) => void;
|
||||||
|
initializeTimePickers: (containerElement: HTMLElement) => void;
|
||||||
initializeUnlockFieldButtons: (containerElement: HTMLElement) => void;
|
initializeUnlockFieldButtons: (containerElement: HTMLElement) => void;
|
||||||
populateAliases: (containerElement: HTMLElement) => void;
|
populateAliases: (containerElement: HTMLElement) => void;
|
||||||
getRandomColor: (seedString: string) => string;
|
getRandomColor: (seedString: string) => string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue