refactoring
parent
830053b820
commit
cb3c2c4492
|
|
@ -88,7 +88,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>";
|
"</div>";
|
||||||
|
|
||||||
if (feeCategory.fees!.length === 0) {
|
if (feeCategory.fees.length === 0) {
|
||||||
feeCategoryContainerElement.insertAdjacentHTML(
|
feeCategoryContainerElement.insertAdjacentHTML(
|
||||||
"beforeend",
|
"beforeend",
|
||||||
'<div class="panel-block is-block">' +
|
'<div class="panel-block is-block">' +
|
||||||
|
|
@ -100,7 +100,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
"</div>"
|
"</div>"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
for (const fee of feeCategory.fees!) {
|
for (const fee of feeCategory.fees) {
|
||||||
const panelBlockElement = document.createElement("div");
|
const panelBlockElement = document.createElement("div");
|
||||||
|
|
||||||
panelBlockElement.className = "panel-block is-block container--fee";
|
panelBlockElement.className = "panel-block is-block container--fee";
|
||||||
|
|
@ -524,7 +524,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
|
|
||||||
for (const feeCategory of feeCategories) {
|
for (const feeCategory of feeCategories) {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value = feeCategory.feeCategoryId!.toString();
|
optionElement.value = feeCategory.feeCategoryId.toString();
|
||||||
optionElement.textContent = feeCategory.feeCategory!;
|
optionElement.textContent = feeCategory.feeCategory!;
|
||||||
|
|
||||||
if (feeCategory.feeCategoryId === feeCategoryId) {
|
if (feeCategory.feeCategoryId === feeCategoryId) {
|
||||||
|
|
@ -653,7 +653,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
return currentFeeCategory.feeCategoryId === feeCategoryId;
|
return currentFeeCategory.feeCategoryId === feeCategoryId;
|
||||||
})!;
|
})!;
|
||||||
|
|
||||||
const fee = feeCategory.fees!.find((currentFee) => {
|
const fee = feeCategory.fees.find((currentFee) => {
|
||||||
return currentFee.feeId === feeId;
|
return currentFee.feeId === feeId;
|
||||||
})!;
|
})!;
|
||||||
|
|
||||||
|
|
@ -781,7 +781,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
editModalElement = modalElement;
|
editModalElement = modalElement;
|
||||||
|
|
||||||
(modalElement.querySelector("#feeEdit--feeId") as HTMLInputElement).value =
|
(modalElement.querySelector("#feeEdit--feeId") as HTMLInputElement).value =
|
||||||
fee.feeId!.toString();
|
fee.feeId.toString();
|
||||||
|
|
||||||
const feeCategoryElement = modalElement.querySelector(
|
const feeCategoryElement = modalElement.querySelector(
|
||||||
"#feeEdit--feeCategoryId"
|
"#feeEdit--feeCategoryId"
|
||||||
|
|
@ -789,7 +789,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
|
|
||||||
for (const feeCategory of feeCategories) {
|
for (const feeCategory of feeCategories) {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value = feeCategory.feeCategoryId!.toString();
|
optionElement.value = feeCategory.feeCategoryId.toString();
|
||||||
optionElement.textContent = feeCategory.feeCategory!;
|
optionElement.textContent = feeCategory.feeCategory!;
|
||||||
|
|
||||||
if (feeCategory.feeCategoryId === feeCategoryId) {
|
if (feeCategory.feeCategoryId === feeCategoryId) {
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
modalElement.querySelector(
|
modalElement.querySelector(
|
||||||
"#lotTypeFieldEdit--lotTypeFieldId"
|
"#lotTypeFieldEdit--lotTypeFieldId"
|
||||||
) as HTMLInputElement
|
) as HTMLInputElement
|
||||||
).value = lotTypeField.lotTypeFieldId!.toString();
|
).value = lotTypeField.lotTypeFieldId.toString();
|
||||||
|
|
||||||
(
|
(
|
||||||
modalElement.querySelector(
|
modalElement.querySelector(
|
||||||
|
|
@ -494,7 +494,7 @@ declare const bulmaJS: BulmaJS;
|
||||||
panelBlockElement.classList.add("is-hidden");
|
panelBlockElement.classList.add("is-hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
panelBlockElement.dataset.lotTypeFieldId = lotTypeField.lotTypeFieldId!.toString();
|
panelBlockElement.dataset.lotTypeFieldId = lotTypeField.lotTypeFieldId.toString();
|
||||||
|
|
||||||
panelBlockElement.innerHTML =
|
panelBlockElement.innerHTML =
|
||||||
'<div class="level is-mobile">' +
|
'<div class="level is-mobile">' +
|
||||||
|
|
|
||||||
|
|
@ -485,18 +485,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
"use strict";
|
"use strict";
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
if (isCreate) {
|
let lotOccupancyOccupants;
|
||||||
const lotOccupantTypeIdElement = document.querySelector("#lotOccupancy--lotOccupantTypeId");
|
|
||||||
lotOccupantTypeIdElement.addEventListener("change", () => {
|
|
||||||
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
|
|
||||||
for (const occupantField of occupantFields) {
|
|
||||||
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
|
||||||
delete exports.lotOccupancyOccupants;
|
|
||||||
const openEditLotOccupancyOccupant = (clickEvent) => {
|
const openEditLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex, 10);
|
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex, 10);
|
||||||
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||||
|
|
@ -532,8 +521,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
optionElement.value = 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;
|
||||||
lotOccupantTypeSelected = true;
|
lotOccupantTypeSelected = true;
|
||||||
}
|
}
|
||||||
|
|
@ -569,8 +557,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const deleteLotOccupancyOccupant = (clickEvent) => {
|
const deleteLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = clickEvent.currentTarget.closest("tr")
|
const lotOccupantIndex = clickEvent.currentTarget.closest("tr").dataset
|
||||||
.dataset.lotOccupantIndex;
|
.lotOccupantIndex;
|
||||||
const doDelete = () => {
|
const doDelete = () => {
|
||||||
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
|
|
@ -591,9 +579,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
};
|
};
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
title: "Remove " + exports.aliases.occupant + "?",
|
title: "Remove " + exports.aliases.occupant + "?",
|
||||||
message: "Are you sure you want to remove this " +
|
message: "Are you sure you want to remove this " + exports.aliases.occupant.toLowerCase() + "?",
|
||||||
exports.aliases.occupant.toLowerCase() +
|
|
||||||
"?",
|
|
||||||
okButton: {
|
okButton: {
|
||||||
text: "Yes, Remove " + exports.aliases.occupant,
|
text: "Yes, Remove " + exports.aliases.occupant,
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
@ -657,8 +643,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
"</td>") +
|
"</td>") +
|
||||||
("<td>" +
|
("<td>" +
|
||||||
(lotOccupancyOccupant.occupantPhoneNumber
|
(lotOccupancyOccupant.occupantPhoneNumber
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) +
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
(lotOccupancyOccupant.occupantEmailAddress
|
(lotOccupancyOccupant.occupantEmailAddress
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
||||||
|
|
@ -684,6 +669,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
occupantsContainer.append(tableElement);
|
occupantsContainer.append(tableElement);
|
||||||
};
|
};
|
||||||
|
if (isCreate) {
|
||||||
|
const lotOccupantTypeIdElement = document.querySelector("#lotOccupancy--lotOccupantTypeId");
|
||||||
|
lotOccupantTypeIdElement.addEventListener("change", () => {
|
||||||
|
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
|
||||||
|
for (const occupantField of occupantFields) {
|
||||||
|
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||||
|
delete exports.lotOccupancyOccupants;
|
||||||
document.querySelector("#button--addOccupant").addEventListener("click", () => {
|
document.querySelector("#button--addOccupant").addEventListener("click", () => {
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
|
|
@ -764,8 +761,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
||||||
"<br />" +
|
"<br />" +
|
||||||
(occupant.occupantAddress2
|
(occupant.occupantAddress2
|
||||||
? cityssm.escapeHTML(occupant.occupantAddress2) +
|
? cityssm.escapeHTML(occupant.occupantAddress2) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
cityssm.escapeHTML(occupant.occupantCity || "") +
|
cityssm.escapeHTML(occupant.occupantCity || "") +
|
||||||
", " +
|
", " +
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
if (isCreate) {
|
let lotOccupancyOccupants;
|
||||||
const lotOccupantTypeIdElement = document.querySelector("#lotOccupancy--lotOccupantTypeId");
|
|
||||||
lotOccupantTypeIdElement.addEventListener("change", () => {
|
|
||||||
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
|
|
||||||
for (const occupantField of occupantFields) {
|
|
||||||
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
|
||||||
delete exports.lotOccupancyOccupants;
|
|
||||||
const openEditLotOccupancyOccupant = (clickEvent) => {
|
const openEditLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex, 10);
|
const lotOccupantIndex = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupantIndex, 10);
|
||||||
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||||
|
|
@ -48,8 +37,7 @@ else {
|
||||||
const optionElement = document.createElement("option");
|
const optionElement = document.createElement("option");
|
||||||
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
optionElement.value = 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;
|
||||||
lotOccupantTypeSelected = true;
|
lotOccupantTypeSelected = true;
|
||||||
}
|
}
|
||||||
|
|
@ -85,8 +73,8 @@ else {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const deleteLotOccupancyOccupant = (clickEvent) => {
|
const deleteLotOccupancyOccupant = (clickEvent) => {
|
||||||
const lotOccupantIndex = clickEvent.currentTarget.closest("tr")
|
const lotOccupantIndex = clickEvent.currentTarget.closest("tr").dataset
|
||||||
.dataset.lotOccupantIndex;
|
.lotOccupantIndex;
|
||||||
const doDelete = () => {
|
const doDelete = () => {
|
||||||
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doDeleteLotOccupancyOccupant", {
|
||||||
lotOccupancyId,
|
lotOccupancyId,
|
||||||
|
|
@ -107,9 +95,7 @@ else {
|
||||||
};
|
};
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
title: "Remove " + exports.aliases.occupant + "?",
|
title: "Remove " + exports.aliases.occupant + "?",
|
||||||
message: "Are you sure you want to remove this " +
|
message: "Are you sure you want to remove this " + exports.aliases.occupant.toLowerCase() + "?",
|
||||||
exports.aliases.occupant.toLowerCase() +
|
|
||||||
"?",
|
|
||||||
okButton: {
|
okButton: {
|
||||||
text: "Yes, Remove " + exports.aliases.occupant,
|
text: "Yes, Remove " + exports.aliases.occupant,
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
@ -173,8 +159,7 @@ else {
|
||||||
"</td>") +
|
"</td>") +
|
||||||
("<td>" +
|
("<td>" +
|
||||||
(lotOccupancyOccupant.occupantPhoneNumber
|
(lotOccupancyOccupant.occupantPhoneNumber
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) +
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
(lotOccupancyOccupant.occupantEmailAddress
|
(lotOccupancyOccupant.occupantEmailAddress
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
||||||
|
|
@ -200,6 +185,18 @@ else {
|
||||||
}
|
}
|
||||||
occupantsContainer.append(tableElement);
|
occupantsContainer.append(tableElement);
|
||||||
};
|
};
|
||||||
|
if (isCreate) {
|
||||||
|
const lotOccupantTypeIdElement = document.querySelector("#lotOccupancy--lotOccupantTypeId");
|
||||||
|
lotOccupantTypeIdElement.addEventListener("change", () => {
|
||||||
|
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
|
||||||
|
for (const occupantField of occupantFields) {
|
||||||
|
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||||
|
delete exports.lotOccupancyOccupants;
|
||||||
document.querySelector("#button--addOccupant").addEventListener("click", () => {
|
document.querySelector("#button--addOccupant").addEventListener("click", () => {
|
||||||
let addCloseModalFunction;
|
let addCloseModalFunction;
|
||||||
let addFormElement;
|
let addFormElement;
|
||||||
|
|
@ -280,8 +277,7 @@ else {
|
||||||
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
||||||
"<br />" +
|
"<br />" +
|
||||||
(occupant.occupantAddress2
|
(occupant.occupantAddress2
|
||||||
? cityssm.escapeHTML(occupant.occupantAddress2) +
|
? cityssm.escapeHTML(occupant.occupantAddress2) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
cityssm.escapeHTML(occupant.occupantCity || "") +
|
cityssm.escapeHTML(occupant.occupantCity || "") +
|
||||||
", " +
|
", " +
|
||||||
|
|
|
||||||
|
|
@ -16,25 +16,7 @@ declare const lotOccupancyId: string;
|
||||||
declare const isCreate: boolean;
|
declare const isCreate: boolean;
|
||||||
declare const formElement: HTMLFormElement;
|
declare const formElement: HTMLFormElement;
|
||||||
|
|
||||||
if (isCreate) {
|
let lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[];
|
||||||
const lotOccupantTypeIdElement = document.querySelector(
|
|
||||||
"#lotOccupancy--lotOccupantTypeId"
|
|
||||||
) as HTMLSelectElement;
|
|
||||||
|
|
||||||
lotOccupantTypeIdElement.addEventListener("change", () => {
|
|
||||||
const occupantFields = formElement.querySelectorAll(
|
|
||||||
"[data-table='LotOccupancyOccupant']"
|
|
||||||
) as NodeListOf<HTMLInputElement | HTMLTextAreaElement>;
|
|
||||||
|
|
||||||
for (const occupantField of occupantFields) {
|
|
||||||
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] =
|
|
||||||
exports.lotOccupancyOccupants;
|
|
||||||
|
|
||||||
delete exports.lotOccupancyOccupants;
|
|
||||||
|
|
||||||
const openEditLotOccupancyOccupant = (clickEvent: Event) => {
|
const openEditLotOccupancyOccupant = (clickEvent: Event) => {
|
||||||
const lotOccupantIndex = Number.parseInt(
|
const lotOccupantIndex = Number.parseInt(
|
||||||
|
|
@ -42,11 +24,9 @@ if (isCreate) {
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
|
||||||
const lotOccupancyOccupant = lotOccupancyOccupants.find(
|
const lotOccupancyOccupant = lotOccupancyOccupants.find((currentLotOccupancyOccupant) => {
|
||||||
(currentLotOccupancyOccupant) => {
|
|
||||||
return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex;
|
return currentLotOccupancyOccupant.lotOccupantIndex === lotOccupantIndex;
|
||||||
}
|
})!;
|
||||||
)!;
|
|
||||||
|
|
||||||
let editFormElement: HTMLFormElement;
|
let editFormElement: HTMLFormElement;
|
||||||
let editCloseModalFunction: () => void;
|
let editCloseModalFunction: () => void;
|
||||||
|
|
@ -103,10 +83,7 @@ if (isCreate) {
|
||||||
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
optionElement.value = lotOccupantType.lotOccupantTypeId.toString();
|
||||||
optionElement.textContent = lotOccupantType.lotOccupantType;
|
optionElement.textContent = lotOccupantType.lotOccupantType;
|
||||||
|
|
||||||
if (
|
if (lotOccupantType.lotOccupantTypeId === lotOccupancyOccupant.lotOccupantTypeId) {
|
||||||
lotOccupantType.lotOccupantTypeId ===
|
|
||||||
lotOccupancyOccupant.lotOccupantTypeId
|
|
||||||
) {
|
|
||||||
optionElement.selected = true;
|
optionElement.selected = true;
|
||||||
lotOccupantTypeSelected = true;
|
lotOccupantTypeSelected = true;
|
||||||
}
|
}
|
||||||
|
|
@ -195,8 +172,8 @@ if (isCreate) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteLotOccupancyOccupant = (clickEvent: Event) => {
|
const deleteLotOccupancyOccupant = (clickEvent: Event) => {
|
||||||
const lotOccupantIndex = (clickEvent.currentTarget as HTMLElement).closest("tr")!
|
const lotOccupantIndex = (clickEvent.currentTarget as HTMLElement).closest("tr")!.dataset
|
||||||
.dataset.lotOccupantIndex;
|
.lotOccupantIndex;
|
||||||
|
|
||||||
const doDelete = () => {
|
const doDelete = () => {
|
||||||
cityssm.postJSON(
|
cityssm.postJSON(
|
||||||
|
|
@ -227,9 +204,7 @@ if (isCreate) {
|
||||||
bulmaJS.confirm({
|
bulmaJS.confirm({
|
||||||
title: "Remove " + exports.aliases.occupant + "?",
|
title: "Remove " + exports.aliases.occupant + "?",
|
||||||
message:
|
message:
|
||||||
"Are you sure you want to remove this " +
|
"Are you sure you want to remove this " + exports.aliases.occupant.toLowerCase() + "?",
|
||||||
exports.aliases.occupant.toLowerCase() +
|
|
||||||
"?",
|
|
||||||
okButton: {
|
okButton: {
|
||||||
text: "Yes, Remove " + exports.aliases.occupant,
|
text: "Yes, Remove " + exports.aliases.occupant,
|
||||||
callbackFunction: doDelete
|
callbackFunction: doDelete
|
||||||
|
|
@ -303,8 +278,7 @@ if (isCreate) {
|
||||||
"</td>") +
|
"</td>") +
|
||||||
("<td>" +
|
("<td>" +
|
||||||
(lotOccupancyOccupant.occupantPhoneNumber
|
(lotOccupancyOccupant.occupantPhoneNumber
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) +
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantPhoneNumber) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
(lotOccupancyOccupant.occupantEmailAddress
|
(lotOccupancyOccupant.occupantEmailAddress
|
||||||
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
? cityssm.escapeHTML(lotOccupancyOccupant.occupantEmailAddress)
|
||||||
|
|
@ -325,13 +299,15 @@ if (isCreate) {
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</td>");
|
"</td>");
|
||||||
|
|
||||||
(
|
(tableRowElement.querySelector(".button--edit") as HTMLButtonElement).addEventListener(
|
||||||
tableRowElement.querySelector(".button--edit") as HTMLButtonElement
|
"click",
|
||||||
).addEventListener("click", openEditLotOccupancyOccupant);
|
openEditLotOccupancyOccupant
|
||||||
|
);
|
||||||
|
|
||||||
(
|
(tableRowElement.querySelector(".button--delete") as HTMLButtonElement).addEventListener(
|
||||||
tableRowElement.querySelector(".button--delete") as HTMLButtonElement
|
"click",
|
||||||
).addEventListener("click", deleteLotOccupancyOccupant);
|
deleteLotOccupancyOccupant
|
||||||
|
);
|
||||||
|
|
||||||
tableElement.querySelector("tbody")!.append(tableRowElement);
|
tableElement.querySelector("tbody")!.append(tableRowElement);
|
||||||
}
|
}
|
||||||
|
|
@ -339,6 +315,24 @@ if (isCreate) {
|
||||||
occupantsContainer.append(tableElement);
|
occupantsContainer.append(tableElement);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isCreate) {
|
||||||
|
const lotOccupantTypeIdElement = document.querySelector(
|
||||||
|
"#lotOccupancy--lotOccupantTypeId"
|
||||||
|
) as HTMLSelectElement;
|
||||||
|
|
||||||
|
lotOccupantTypeIdElement.addEventListener("change", () => {
|
||||||
|
const occupantFields = formElement.querySelectorAll(
|
||||||
|
"[data-table='LotOccupancyOccupant']"
|
||||||
|
) as NodeListOf<HTMLInputElement | HTMLTextAreaElement>;
|
||||||
|
|
||||||
|
for (const occupantField of occupantFields) {
|
||||||
|
occupantField.disabled = lotOccupantTypeIdElement.value === "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
lotOccupancyOccupants = exports.lotOccupancyOccupants;
|
||||||
|
delete exports.lotOccupancyOccupants;
|
||||||
|
|
||||||
(document.querySelector("#button--addOccupant") as HTMLButtonElement).addEventListener(
|
(document.querySelector("#button--addOccupant") as HTMLButtonElement).addEventListener(
|
||||||
"click",
|
"click",
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -464,8 +458,7 @@ if (isCreate) {
|
||||||
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
cityssm.escapeHTML(occupant.occupantAddress1 || "") +
|
||||||
"<br />" +
|
"<br />" +
|
||||||
(occupant.occupantAddress2
|
(occupant.occupantAddress2
|
||||||
? cityssm.escapeHTML(occupant.occupantAddress2) +
|
? cityssm.escapeHTML(occupant.occupantAddress2) + "<br />"
|
||||||
"<br />"
|
|
||||||
: "") +
|
: "") +
|
||||||
cityssm.escapeHTML(occupant.occupantCity || "") +
|
cityssm.escapeHTML(occupant.occupantCity || "") +
|
||||||
", " +
|
", " +
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -32,7 +32,7 @@ export interface LotType extends Record {
|
||||||
lotTypeFields?: LotTypeField[];
|
lotTypeFields?: LotTypeField[];
|
||||||
}
|
}
|
||||||
export interface LotTypeField extends Record {
|
export interface LotTypeField extends Record {
|
||||||
lotTypeFieldId?: number;
|
lotTypeFieldId: number;
|
||||||
lotTypeField?: string;
|
lotTypeField?: string;
|
||||||
lotTypeId?: number;
|
lotTypeId?: number;
|
||||||
lotType: LotType;
|
lotType: LotType;
|
||||||
|
|
@ -78,7 +78,6 @@ export interface LotComment extends Record {
|
||||||
}
|
}
|
||||||
export interface LotField extends LotTypeField, Record {
|
export interface LotField extends LotTypeField, Record {
|
||||||
lotId?: number;
|
lotId?: number;
|
||||||
lotTypeFieldId?: number;
|
|
||||||
lotFieldValue?: string;
|
lotFieldValue?: string;
|
||||||
}
|
}
|
||||||
export interface OccupancyType extends Record {
|
export interface OccupancyType extends Record {
|
||||||
|
|
@ -106,13 +105,13 @@ export interface LotOccupantType extends Record {
|
||||||
orderNumber?: number;
|
orderNumber?: number;
|
||||||
}
|
}
|
||||||
export interface FeeCategory extends Record {
|
export interface FeeCategory extends Record {
|
||||||
feeCategoryId?: number;
|
feeCategoryId: number;
|
||||||
feeCategory?: string;
|
feeCategory: string;
|
||||||
fees?: Fee[];
|
fees: Fee[];
|
||||||
orderNumber?: number;
|
orderNumber?: number;
|
||||||
}
|
}
|
||||||
export interface Fee extends Record {
|
export interface Fee extends Record {
|
||||||
feeId?: number;
|
feeId: number;
|
||||||
feeCategoryId?: number;
|
feeCategoryId?: number;
|
||||||
feeCategory?: string;
|
feeCategory?: string;
|
||||||
feeName?: string;
|
feeName?: string;
|
||||||
|
|
@ -132,11 +131,7 @@ export interface Fee extends Record {
|
||||||
}
|
}
|
||||||
export interface LotOccupancyFee extends Fee, Record {
|
export interface LotOccupancyFee extends Fee, Record {
|
||||||
lotOccupancyId?: number;
|
lotOccupancyId?: number;
|
||||||
feeId?: number;
|
|
||||||
feeName?: string;
|
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
feeAmount?: number;
|
|
||||||
taxAmount?: number;
|
|
||||||
}
|
}
|
||||||
export interface LotOccupancyTransaction extends Record {
|
export interface LotOccupancyTransaction extends Record {
|
||||||
lotOccupancyId?: number;
|
lotOccupancyId?: number;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export interface LotType extends Record {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LotTypeField extends Record {
|
export interface LotTypeField extends Record {
|
||||||
lotTypeFieldId?: number;
|
lotTypeFieldId: number;
|
||||||
lotTypeField?: string;
|
lotTypeField?: string;
|
||||||
|
|
||||||
lotTypeId?: number;
|
lotTypeId?: number;
|
||||||
|
|
@ -107,7 +107,6 @@ export interface LotComment extends Record {
|
||||||
|
|
||||||
export interface LotField extends LotTypeField, Record {
|
export interface LotField extends LotTypeField, Record {
|
||||||
lotId?: number;
|
lotId?: number;
|
||||||
lotTypeFieldId?: number;
|
|
||||||
lotFieldValue?: string;
|
lotFieldValue?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,14 +138,14 @@ export interface LotOccupantType extends Record {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FeeCategory extends Record {
|
export interface FeeCategory extends Record {
|
||||||
feeCategoryId?: number;
|
feeCategoryId: number;
|
||||||
feeCategory?: string;
|
feeCategory: string;
|
||||||
fees?: Fee[];
|
fees: Fee[];
|
||||||
orderNumber?: number;
|
orderNumber?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Fee extends Record {
|
export interface Fee extends Record {
|
||||||
feeId?: number;
|
feeId: number;
|
||||||
|
|
||||||
feeCategoryId?: number;
|
feeCategoryId?: number;
|
||||||
feeCategory?: string;
|
feeCategory?: string;
|
||||||
|
|
@ -176,13 +175,7 @@ export interface Fee extends Record {
|
||||||
|
|
||||||
export interface LotOccupancyFee extends Fee, Record {
|
export interface LotOccupancyFee extends Fee, Record {
|
||||||
lotOccupancyId?: number;
|
lotOccupancyId?: number;
|
||||||
|
|
||||||
feeId?: number;
|
|
||||||
feeName?: string;
|
|
||||||
|
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
feeAmount?: number;
|
|
||||||
taxAmount?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LotOccupancyTransaction extends Record {
|
export interface LotOccupancyTransaction extends Record {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue