create lot from lot occupancy
parent
75ced51d7e
commit
c117cc84e4
|
|
@ -1,6 +1,7 @@
|
|||
import { getLotOccupantTypes, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
import { getLotOccupantTypes, getLotStatuses, getLotTypes, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
import * as configFunctions from "../../helpers/functions.config.js";
|
||||
import { getLotOccupancy } from "../../helpers/lotOccupancyDB/getLotOccupancy.js";
|
||||
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
|
||||
export const handler = (request, response) => {
|
||||
const lotOccupancy = getLotOccupancy(request.params.lotOccupancyId);
|
||||
if (!lotOccupancy) {
|
||||
|
|
@ -9,6 +10,9 @@ export const handler = (request, response) => {
|
|||
}
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const lotOccupantTypes = getLotOccupantTypes();
|
||||
const lotTypes = getLotTypes();
|
||||
const lotStatuses = getLotStatuses();
|
||||
const maps = getMaps();
|
||||
return response.render("lotOccupancy-edit", {
|
||||
headTitle: configFunctions.getProperty("aliases.lot") +
|
||||
" " +
|
||||
|
|
@ -17,6 +21,9 @@ export const handler = (request, response) => {
|
|||
lotOccupancy,
|
||||
occupancyTypes,
|
||||
lotOccupantTypes,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
maps,
|
||||
isCreate: false
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ import type { RequestHandler } from "express";
|
|||
|
||||
import {
|
||||
getLotOccupantTypes,
|
||||
getLotStatuses,
|
||||
getLotTypes,
|
||||
getOccupancyTypes
|
||||
} from "../../helpers/functions.cache.js";
|
||||
|
||||
import * as configFunctions from "../../helpers/functions.config.js";
|
||||
|
||||
import { getLotOccupancy } from "../../helpers/lotOccupancyDB/getLotOccupancy.js";
|
||||
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
|
||||
|
||||
export const handler: RequestHandler = (request, response) => {
|
||||
const lotOccupancy = getLotOccupancy(request.params.lotOccupancyId);
|
||||
|
|
@ -21,6 +24,9 @@ export const handler: RequestHandler = (request, response) => {
|
|||
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const lotOccupantTypes = getLotOccupantTypes();
|
||||
const lotTypes = getLotTypes();
|
||||
const lotStatuses = getLotStatuses();
|
||||
const maps = getMaps();
|
||||
|
||||
return response.render("lotOccupancy-edit", {
|
||||
headTitle:
|
||||
|
|
@ -32,6 +38,10 @@ export const handler: RequestHandler = (request, response) => {
|
|||
|
||||
occupancyTypes,
|
||||
lotOccupantTypes,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
maps,
|
||||
|
||||
isCreate: false
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { dateToInteger, dateToString } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||
import { getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
import { getLotStatuses, getLotTypes, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
import { getLot } from "../../helpers/lotOccupancyDB/getLot.js";
|
||||
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
|
||||
import * as configFunctions from "../../helpers/functions.config.js";
|
||||
export const handler = (request, response) => {
|
||||
const startDate = new Date();
|
||||
|
|
@ -16,6 +17,9 @@ export const handler = (request, response) => {
|
|||
lotOccupancy.mapName = lot.mapName;
|
||||
}
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const lotTypes = getLotTypes();
|
||||
const lotStatuses = getLotStatuses();
|
||||
const maps = getMaps();
|
||||
return response.render("lotOccupancy-edit", {
|
||||
headTitle: "Create a New " +
|
||||
configFunctions.getProperty("aliases.lot") +
|
||||
|
|
@ -24,6 +28,9 @@ export const handler = (request, response) => {
|
|||
" Record",
|
||||
lotOccupancy,
|
||||
occupancyTypes,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
maps,
|
||||
isCreate: true
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import {
|
||||
dateToInteger,
|
||||
dateToString
|
||||
} from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||
import { dateToInteger, dateToString } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||
|
||||
import { getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
import { getLotStatuses, getLotTypes, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
|
||||
import { getLot } from "../../helpers/lotOccupancyDB/getLot.js";
|
||||
import { getMaps } from "../../helpers/lotOccupancyDB/getMaps.js";
|
||||
|
||||
import * as configFunctions from "../../helpers/functions.config.js";
|
||||
|
||||
|
|
@ -30,6 +28,9 @@ export const handler: RequestHandler = (request, response) => {
|
|||
}
|
||||
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const lotTypes = getLotTypes();
|
||||
const lotStatuses = getLotStatuses();
|
||||
const maps = getMaps();
|
||||
|
||||
return response.render("lotOccupancy-edit", {
|
||||
headTitle:
|
||||
|
|
@ -41,6 +42,10 @@ export const handler: RequestHandler = (request, response) => {
|
|||
lotOccupancy,
|
||||
|
||||
occupancyTypes,
|
||||
lotTypes,
|
||||
lotStatuses,
|
||||
maps,
|
||||
|
||||
isCreate: true
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -199,18 +199,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
lotNameElement.addEventListener("click", (clickEvent) => {
|
||||
const currentLotName = clickEvent.currentTarget.value;
|
||||
let lotSelectCloseModalFunction;
|
||||
let lotSelectModalElement;
|
||||
let lotSelectFormElement;
|
||||
let lotSelectResultsElement;
|
||||
const selectLot = (clickEvent) => {
|
||||
clickEvent.preventDefault();
|
||||
const selectedLotElement = clickEvent.currentTarget;
|
||||
const renderSelectedLotAndClose = (lotId, lotName) => {
|
||||
document.querySelector("#lotOccupancy--lotId").value =
|
||||
selectedLotElement.dataset.lotId;
|
||||
document.querySelector("#lotOccupancy--lotName").value =
|
||||
selectedLotElement.dataset.lotName;
|
||||
lotId.toString();
|
||||
document.querySelector("#lotOccupancy--lotName").value = lotName;
|
||||
setUnsavedChanges();
|
||||
lotSelectCloseModalFunction();
|
||||
};
|
||||
const selectExistingLot = (clickEvent) => {
|
||||
clickEvent.preventDefault();
|
||||
const selectedLotElement = clickEvent.currentTarget;
|
||||
renderSelectedLotAndClose(selectedLotElement.dataset.lotId, selectedLotElement.dataset.lotName);
|
||||
};
|
||||
const searchLots = () => {
|
||||
lotSelectResultsElement.innerHTML =
|
||||
'<p class="has-text-centered">' +
|
||||
|
|
@ -252,20 +255,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
"</span>" +
|
||||
"</div>") +
|
||||
"</div>";
|
||||
panelBlockElement.addEventListener("click", selectLot);
|
||||
panelBlockElement.addEventListener("click", selectExistingLot);
|
||||
panelElement.append(panelBlockElement);
|
||||
}
|
||||
lotSelectResultsElement.innerHTML = "";
|
||||
lotSelectResultsElement.append(panelElement);
|
||||
});
|
||||
};
|
||||
const createLotAndSelect = (submitEvent) => {
|
||||
submitEvent.preventDefault();
|
||||
const lotName = lotSelectModalElement.querySelector("#lotCreate--lotName").value;
|
||||
cityssm.postJSON(urlPrefix + "/lots/doCreateLot", submitEvent.currentTarget, (responseJSON) => {
|
||||
if (responseJSON.success) {
|
||||
renderSelectedLotAndClose(responseJSON.lotId, lotName);
|
||||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Creating " + exports.aliases.lot,
|
||||
message: responseJSON.errorMessage,
|
||||
contextualColorName: "danger"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
cityssm.openHtmlModal("lotOccupancy-selectLot", {
|
||||
onshow: (modalElement) => {
|
||||
los.populateAliases(modalElement);
|
||||
},
|
||||
onshown: (modalElement, closeModalFunction) => {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
lotSelectModalElement = modalElement;
|
||||
lotSelectCloseModalFunction = closeModalFunction;
|
||||
bulmaJS.init(modalElement);
|
||||
const lotNameFilterElement = modalElement.querySelector("#lotSelect--lotName");
|
||||
if (document.querySelector("#lotOccupancy--lotId").value !==
|
||||
"") {
|
||||
|
|
@ -284,6 +305,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
submitEvent.preventDefault();
|
||||
});
|
||||
searchLots();
|
||||
if (exports.lotNamePattern) {
|
||||
const regex = exports.lotNamePattern;
|
||||
modalElement.querySelector("#lotCreate--lotName").pattern = regex.source;
|
||||
}
|
||||
const lotTypeElement = modalElement.querySelector("#lotCreate--lotTypeId");
|
||||
for (const lotType of exports.lotTypes) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = lotType.lotTypeId.toString();
|
||||
optionElement.textContent = lotType.lotType;
|
||||
lotTypeElement.append(optionElement);
|
||||
}
|
||||
const lotStatusElement = modalElement.querySelector("#lotCreate--lotStatusId");
|
||||
for (const lotStatus of exports.lotStatuses) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = lotStatus.lotStatusId.toString();
|
||||
optionElement.textContent = lotStatus.lotStatus;
|
||||
lotStatusElement.append(optionElement);
|
||||
}
|
||||
const mapElement = modalElement.querySelector("#lotCreate--mapId");
|
||||
for (const map of exports.maps) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = map.mapId.toString();
|
||||
optionElement.textContent = map.mapName || "(No Name)";
|
||||
mapElement.append(optionElement);
|
||||
}
|
||||
modalElement
|
||||
.querySelector("#form--lotCreate")
|
||||
.addEventListener("submit", createLotAndSelect);
|
||||
},
|
||||
onremoved: () => {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
|
|
|
|||
|
|
@ -284,23 +284,29 @@ declare const bulmaJS: BulmaJS;
|
|||
const currentLotName = (clickEvent.currentTarget as HTMLInputElement).value;
|
||||
|
||||
let lotSelectCloseModalFunction: () => void;
|
||||
let lotSelectModalElement: HTMLElement;
|
||||
|
||||
let lotSelectFormElement: HTMLFormElement;
|
||||
let lotSelectResultsElement: HTMLElement;
|
||||
|
||||
const selectLot = (clickEvent: Event) => {
|
||||
const renderSelectedLotAndClose = (lotId: number | string, lotName: string) => {
|
||||
(document.querySelector("#lotOccupancy--lotId") as HTMLInputElement).value =
|
||||
lotId.toString();
|
||||
(document.querySelector("#lotOccupancy--lotName") as HTMLInputElement).value = lotName;
|
||||
|
||||
setUnsavedChanges();
|
||||
lotSelectCloseModalFunction();
|
||||
};
|
||||
|
||||
const selectExistingLot = (clickEvent: Event) => {
|
||||
clickEvent.preventDefault();
|
||||
|
||||
const selectedLotElement = clickEvent.currentTarget as HTMLElement;
|
||||
|
||||
(document.querySelector("#lotOccupancy--lotId") as HTMLInputElement).value =
|
||||
selectedLotElement.dataset.lotId;
|
||||
(document.querySelector("#lotOccupancy--lotName") as HTMLInputElement).value =
|
||||
selectedLotElement.dataset.lotName;
|
||||
|
||||
setUnsavedChanges();
|
||||
|
||||
lotSelectCloseModalFunction();
|
||||
renderSelectedLotAndClose(
|
||||
selectedLotElement.dataset.lotId,
|
||||
selectedLotElement.dataset.lotName
|
||||
);
|
||||
};
|
||||
|
||||
const searchLots = () => {
|
||||
|
|
@ -354,7 +360,7 @@ declare const bulmaJS: BulmaJS;
|
|||
"</div>") +
|
||||
"</div>";
|
||||
|
||||
panelBlockElement.addEventListener("click", selectLot);
|
||||
panelBlockElement.addEventListener("click", selectExistingLot);
|
||||
|
||||
panelElement.append(panelBlockElement);
|
||||
}
|
||||
|
|
@ -365,6 +371,30 @@ declare const bulmaJS: BulmaJS;
|
|||
);
|
||||
};
|
||||
|
||||
const createLotAndSelect = (submitEvent: SubmitEvent) => {
|
||||
submitEvent.preventDefault();
|
||||
|
||||
const lotName = (
|
||||
lotSelectModalElement.querySelector("#lotCreate--lotName") as HTMLInputElement
|
||||
).value;
|
||||
|
||||
cityssm.postJSON(
|
||||
urlPrefix + "/lots/doCreateLot",
|
||||
submitEvent.currentTarget,
|
||||
(responseJSON: { success: boolean; errorMessage?: string; lotId?: number }) => {
|
||||
if (responseJSON.success) {
|
||||
renderSelectedLotAndClose(responseJSON.lotId, lotName);
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Creating " + exports.aliases.lot,
|
||||
message: responseJSON.errorMessage,
|
||||
contextualColorName: "danger"
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
cityssm.openHtmlModal("lotOccupancy-selectLot", {
|
||||
onshow: (modalElement) => {
|
||||
los.populateAliases(modalElement);
|
||||
|
|
@ -372,8 +402,13 @@ declare const bulmaJS: BulmaJS;
|
|||
onshown: (modalElement, closeModalFunction) => {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
|
||||
lotSelectModalElement = modalElement;
|
||||
lotSelectCloseModalFunction = closeModalFunction;
|
||||
|
||||
bulmaJS.init(modalElement);
|
||||
|
||||
// search Tab
|
||||
|
||||
const lotNameFilterElement = modalElement.querySelector(
|
||||
"#lotSelect--lotName"
|
||||
) as HTMLInputElement;
|
||||
|
|
@ -407,6 +442,53 @@ declare const bulmaJS: BulmaJS;
|
|||
});
|
||||
|
||||
searchLots();
|
||||
|
||||
// Create Tab
|
||||
|
||||
if (exports.lotNamePattern) {
|
||||
const regex = exports.lotNamePattern as RegExp;
|
||||
|
||||
(
|
||||
modalElement.querySelector("#lotCreate--lotName") as HTMLInputElement
|
||||
).pattern = regex.source;
|
||||
}
|
||||
|
||||
const lotTypeElement = modalElement.querySelector(
|
||||
"#lotCreate--lotTypeId"
|
||||
) as HTMLSelectElement;
|
||||
|
||||
for (const lotType of exports.lotTypes as recordTypes.LotType[]) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = lotType.lotTypeId.toString();
|
||||
optionElement.textContent = lotType.lotType;
|
||||
lotTypeElement.append(optionElement);
|
||||
}
|
||||
|
||||
const lotStatusElement = modalElement.querySelector(
|
||||
"#lotCreate--lotStatusId"
|
||||
) as HTMLSelectElement;
|
||||
|
||||
for (const lotStatus of exports.lotStatuses as recordTypes.LotStatus[]) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = lotStatus.lotStatusId.toString();
|
||||
optionElement.textContent = lotStatus.lotStatus;
|
||||
lotStatusElement.append(optionElement);
|
||||
}
|
||||
|
||||
const mapElement = modalElement.querySelector(
|
||||
"#lotCreate--mapId"
|
||||
) as HTMLSelectElement;
|
||||
|
||||
for (const map of exports.maps as recordTypes.Map[]) {
|
||||
const optionElement = document.createElement("option");
|
||||
optionElement.value = map.mapId.toString();
|
||||
optionElement.textContent = map.mapName || "(No Name)";
|
||||
mapElement.append(optionElement);
|
||||
}
|
||||
|
||||
modalElement
|
||||
.querySelector("#form--lotCreate")
|
||||
.addEventListener("submit", createLotAndSelect);
|
||||
},
|
||||
onremoved: () => {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
"</td>") +
|
||||
("<td>" + cityssm.escapeHTML(lot.lotType) + "</td>") +
|
||||
("<td>" +
|
||||
cityssm.escapeHTML(lot.lotStatus) +
|
||||
(lot.lotStatusId
|
||||
? cityssm.escapeHTML(lot.lotStatus)
|
||||
: '<span class="has-text-grey">(No Status)</span>') +
|
||||
"<br />" +
|
||||
(lot.lotOccupancyCount > 0
|
||||
? '<span class="is-size-7">Currently Occupied</span>'
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ declare const cityssm: cityssmGlobal;
|
|||
"</td>") +
|
||||
("<td>" + cityssm.escapeHTML(lot.lotType) + "</td>") +
|
||||
("<td>" +
|
||||
cityssm.escapeHTML(lot.lotStatus) +
|
||||
(lot.lotStatusId
|
||||
? cityssm.escapeHTML(lot.lotStatus)
|
||||
: '<span class="has-text-grey">(No Status)</span>') +
|
||||
"<br />" +
|
||||
(lot.lotOccupancyCount > 0
|
||||
? '<span class="is-size-7">Currently Occupied</span>'
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const aliasElements = containerElement.querySelectorAll(".alias");
|
||||
for (const aliasElement of aliasElements) {
|
||||
switch (aliasElement.dataset.alias) {
|
||||
case "Map": {
|
||||
aliasElement.textContent = exports.aliases.map;
|
||||
break;
|
||||
}
|
||||
case "Lot": {
|
||||
aliasElement.textContent = exports.aliases.lot;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -211,36 +211,34 @@ declare const cityssm: cityssmGlobal;
|
|||
|
||||
for (const aliasElement of aliasElements) {
|
||||
switch (aliasElement.dataset.alias) {
|
||||
case "Map": {
|
||||
aliasElement.textContent = exports.aliases.map;
|
||||
break;
|
||||
}
|
||||
case "Lot": {
|
||||
aliasElement.textContent = exports.aliases.lot;
|
||||
break;
|
||||
}
|
||||
|
||||
case "lot": {
|
||||
aliasElement.textContent = exports.aliases.lot.toLowerCase();
|
||||
break;
|
||||
}
|
||||
|
||||
case "Occupancy": {
|
||||
aliasElement.textContent = exports.aliases.occupancy;
|
||||
break;
|
||||
}
|
||||
|
||||
case "occupancy": {
|
||||
aliasElement.textContent = exports.aliases.occupancy.toLowerCase();
|
||||
break;
|
||||
}
|
||||
|
||||
case "Occupant": {
|
||||
aliasElement.textContent = exports.aliases.occupant;
|
||||
break;
|
||||
}
|
||||
|
||||
case "occupant": {
|
||||
aliasElement.textContent = exports.aliases.occupant.toLowerCase();
|
||||
break;
|
||||
}
|
||||
|
||||
case "ExternalReceiptNumber": {
|
||||
aliasElement.textContent = exports.aliases.externalReceiptNumber;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,18 @@
|
|||
<button class="delete is-close-modal-button" aria-label="close" type="button"></button>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="tabs is-boxed">
|
||||
<ul>
|
||||
<li class="is-active">
|
||||
<a href="#tab--lotSelect">From Existing</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tab--lotCreate">Create New</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-container">
|
||||
<div id="tab--lotSelect">
|
||||
<div class="box">
|
||||
<form id="form--lotSelect">
|
||||
<input name="limit" type="hidden" value="100" />
|
||||
|
|
@ -37,6 +49,68 @@
|
|||
</form>
|
||||
</div>
|
||||
<div id="resultsContainer--lotSelect"></div>
|
||||
</div>
|
||||
<div class="is-hidden" id="tab--lotCreate">
|
||||
<div class="message is-info is-small">
|
||||
<p class="message-body">
|
||||
Be sure to confirm if the <span class="alias" data-alias="lot"></span> exists before creating a new one.
|
||||
</p>
|
||||
</div>
|
||||
<form id="form--lotCreate">
|
||||
<input name="mapKey" type="hidden" value="" />
|
||||
<input name="lotLatitude" type="hidden" value="" />
|
||||
<input name="lotLongitude" type="hidden" value="" />
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--lotName">New <span class="alias" data-alias="Lot"></span> Name</label>
|
||||
<div class="control">
|
||||
<input class="input" id="lotCreate--lotName" name="lotName" maxlength="100" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--lotTypeId"><span class="alias" data-alias="Lot"></span> Type</label>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="lotCreate--lotTypeId" name="lotTypeId" required>
|
||||
<option value="">(No Type)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--lotStatusId"><span class="alias" data-alias="Lot"></span> Status</label>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="lotCreate--lotStatusId" name="lotStatusId">
|
||||
<option value="">(No Status)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label" for="lotCreate--mapId"><span class="alias" data-alias="Map"></span></label>
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select id="lotCreate--mapId" name="mapId">
|
||||
<option value="">(None Selected)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="has-text-right">
|
||||
<button class="button is-success" type="submit">
|
||||
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||
<span>Create New <span class="alias" data-alias="Lot"></span></span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot justify-right">
|
||||
<button class="button is-close-modal-button" type="button">Cancel</button>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),i=document.querySelector("#searchFilter--offset"),r=()=>{const r=Number.parseInt(i.value,10);s.innerHTML='<div class="has-text-grey has-text-centered"><i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br />Loading '+exports.aliases.lots+"...</div>",cityssm.postJSON(e+"/lots/doSearchLots",t,t=>{if(0===t.lots.length)return void(s.innerHTML='<div class="message is-info"><p class="message-body">There are no '+exports.aliases.lots.toLowerCase()+" that meet the search criteria.</p></div>");const i=document.createElement("tbody");for(const s of t.lots)i.insertAdjacentHTML("beforeend",'<tr><td><a class="has-text-weight-bold" href="'+e+"/lots/"+s.lotId+'">'+cityssm.escapeHTML(s.lotName)+'</a></td><td><a href="'+e+"/maps/"+s.mapId+'">'+(s.mapName?cityssm.escapeHTML(s.mapName):'<span class="has-text-grey">(No Name)</span>')+"</a></td><td>"+cityssm.escapeHTML(s.lotType)+"</td><td>"+cityssm.escapeHTML(s.lotStatus)+"<br />"+(s.lotOccupancyCount>0?'<span class="is-size-7">Currently Occupied</span>':"")+"</td></tr>");s.innerHTML='<table class="table is-fullwidth is-striped is-hoverable has-sticky-header"><thead><tr><th>'+cityssm.escapeHTML(exports.aliases.lot)+"</th><th>"+cityssm.escapeHTML(exports.aliases.map)+"</th><th>"+cityssm.escapeHTML(exports.aliases.lot)+' Type</th><th>Status</th></tr></thead><table><div class="level"><div class="level-left"><div class="level-item has-text-weight-bold">Displaying '+(r+1).toString()+" to "+Math.min(t.count,a+r)+" of "+t.count+'</div></div><div class="level-right">'+(r>0?'<div class="level-item"><button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous"><i class="fas fa-arrow-left" aria-hidden="true"></i></button></div>':"")+(a+r<t.count?'<div class="level-item"><button class="button is-rounded is-link" data-page="next" type="button" title="Next"><span>Next</span><span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span></button></div>':"")+"</div></div>",s.querySelector("table").append(i),r>0&&s.querySelector("button[data-page='previous']").addEventListener("click",o),a+r<t.count&&s.querySelector("button[data-page='next']").addEventListener("click",n)})},l=()=>{i.value="0",r()},o=()=>{i.value=Math.max(Number.parseInt(i.value,10)-a,0).toString(),r()},n=()=>{i.value=(Number.parseInt(i.value,10)+a).toString(),r()},c=t.querySelectorAll("input, select");for(const e of c)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault(),l()}),r()})();
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),i=document.querySelector("#searchFilter--offset"),r=()=>{const r=Number.parseInt(i.value,10);s.innerHTML='<div class="has-text-grey has-text-centered"><i class="fas fa-5x fa-circle-notch fa-spin" aria-hidden="true"></i><br />Loading '+exports.aliases.lots+"...</div>",cityssm.postJSON(e+"/lots/doSearchLots",t,t=>{if(0===t.lots.length)return void(s.innerHTML='<div class="message is-info"><p class="message-body">There are no '+exports.aliases.lots.toLowerCase()+" that meet the search criteria.</p></div>");const i=document.createElement("tbody");for(const s of t.lots)i.insertAdjacentHTML("beforeend",'<tr><td><a class="has-text-weight-bold" href="'+e+"/lots/"+s.lotId+'">'+cityssm.escapeHTML(s.lotName)+'</a></td><td><a href="'+e+"/maps/"+s.mapId+'">'+(s.mapName?cityssm.escapeHTML(s.mapName):'<span class="has-text-grey">(No Name)</span>')+"</a></td><td>"+cityssm.escapeHTML(s.lotType)+"</td><td>"+(s.lotStatusId?cityssm.escapeHTML(s.lotStatus):'<span class="has-text-grey">(No Status)</span>')+"<br />"+(s.lotOccupancyCount>0?'<span class="is-size-7">Currently Occupied</span>':"")+"</td></tr>");s.innerHTML='<table class="table is-fullwidth is-striped is-hoverable has-sticky-header"><thead><tr><th>'+cityssm.escapeHTML(exports.aliases.lot)+"</th><th>"+cityssm.escapeHTML(exports.aliases.map)+"</th><th>"+cityssm.escapeHTML(exports.aliases.lot)+' Type</th><th>Status</th></tr></thead><table><div class="level"><div class="level-left"><div class="level-item has-text-weight-bold">Displaying '+(r+1).toString()+" to "+Math.min(t.count,a+r)+" of "+t.count+'</div></div><div class="level-right">'+(r>0?'<div class="level-item"><button class="button is-rounded is-link is-outlined" data-page="previous" type="button" title="Previous"><i class="fas fa-arrow-left" aria-hidden="true"></i></button></div>':"")+(a+r<t.count?'<div class="level-item"><button class="button is-rounded is-link" data-page="next" type="button" title="Next"><span>Next</span><span class="icon"><i class="fas fa-arrow-right" aria-hidden="true"></i></span></button></div>':"")+"</div></div>",s.querySelector("table").append(i),r>0&&s.querySelector("button[data-page='previous']").addEventListener("click",o),a+r<t.count&&s.querySelector("button[data-page='next']").addEventListener("click",n)})},l=()=>{i.value="0",r()},o=()=>{i.value=Math.max(Number.parseInt(i.value,10)-a,0).toString(),r()},n=()=>{i.value=(Number.parseInt(i.value,10)+a).toString(),r()},c=t.querySelectorAll("input, select");for(const e of c)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault(),l()}),r()})();
|
||||
|
|
@ -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={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.value=s.value(),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.value=s.value(),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})();
|
||||
"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.value=s.value(),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.value=s.value(),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"Map":e.textContent=exports.aliases.map;break;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})();
|
||||
|
|
@ -389,19 +389,27 @@
|
|||
|
||||
<%- include('_footerA'); -%>
|
||||
|
||||
<% if (!isCreate) { %>
|
||||
<script>
|
||||
<% if (!isCreate) { %>
|
||||
exports.occupantCityDefault = "<%= configFunctions.getProperty("settings.lotOccupancy.occupantCityDefault") %>";
|
||||
exports.occupantProvinceDefault = "<%= configFunctions.getProperty("settings.lotOccupancy.occupantProvinceDefault") %>";
|
||||
|
||||
exports.lotOccupantTypes = <%- JSON.stringify(lotOccupantTypes) %>;
|
||||
|
||||
exports.lotOccupancyOccupants = <%- JSON.stringify(lotOccupancy.lotOccupancyOccupants) %>;
|
||||
exports.lotOccupancyComments = <%- JSON.stringify(lotOccupancy.lotOccupancyComments) %>;
|
||||
exports.lotOccupancyFees = <%- JSON.stringify(lotOccupancy.lotOccupancyFees) %>;
|
||||
exports.lotOccupancyTransactions = <%- JSON.stringify(lotOccupancy.lotOccupancyTransactions) %>;
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<% if (configFunctions.getProperty("settings.lot.lotNamePattern")) { %>
|
||||
exports.lotNamePattern = /<%= configFunctions.getProperty("settings.lot.lotNamePattern").source %>/;
|
||||
<% } %>
|
||||
exports.lotTypes = <%- JSON.stringify(lotTypes) %>;
|
||||
exports.lotStatuses = <%- JSON.stringify(lotStatuses) %>;
|
||||
exports.maps = <%- JSON.stringify(maps) %>;
|
||||
</script>
|
||||
|
||||
<script src="<%= urlPrefix %>/javascripts/lotOccupancyEdit.min.js"></script>
|
||||
|
||||
<%- include('_footerB'); -%>
|
||||
|
|
|
|||
Loading…
Reference in New Issue