development

preparing to make public
deepsource-autofix-76c6eb20
Dan Gowans 2022-08-22 13:15:00 -04:00
parent dd6ac7114c
commit 8da22d137a
24 changed files with 863 additions and 480 deletions

View File

@ -1,7 +1,20 @@
import { dateToInteger, dateToString } from "@cityssm/expressjs-server-js/dateTimeFns.js";
import { getOccupancyTypes } from "../../helpers/functions.cache.js"; import { getOccupancyTypes } from "../../helpers/functions.cache.js";
import { getLot } from "../../helpers/lotOccupancyDB/getLot.js";
import * as configFunctions from "../../helpers/functions.config.js"; import * as configFunctions from "../../helpers/functions.config.js";
export const handler = (request, response) => { export const handler = (request, response) => {
const lotOccupancy = {}; const startDate = new Date();
const lotOccupancy = {
occupancyStartDate: dateToInteger(startDate),
occupancyStartDateString: dateToString(startDate)
};
if (request.query.lotId) {
const lot = getLot(request.query.lotId);
lotOccupancy.lotId = lot.lotId;
lotOccupancy.lotName = lot.lotName;
lotOccupancy.mapId = lot.mapId;
lotOccupancy.mapName = lot.mapName;
}
const occupancyTypes = getOccupancyTypes(); const occupancyTypes = getOccupancyTypes();
return response.render("lotOccupancy-edit", { return response.render("lotOccupancy-edit", {
headTitle: "Create a New " + configFunctions.getProperty("aliases.lot") + " " + configFunctions.getProperty("aliases.occupancy") + " Record", headTitle: "Create a New " + configFunctions.getProperty("aliases.lot") + " " + configFunctions.getProperty("aliases.occupancy") + " Record",

View File

@ -1,3 +1,7 @@
import {
dateToInteger,
dateToString
} from "@cityssm/expressjs-server-js/dateTimeFns.js";
import type { import type {
RequestHandler RequestHandler
} from "express"; } from "express";
@ -6,6 +10,10 @@ import {
getOccupancyTypes getOccupancyTypes
} from "../../helpers/functions.cache.js"; } from "../../helpers/functions.cache.js";
import {
getLot
} from "../../helpers/lotOccupancyDB/getLot.js";
import * as configFunctions from "../../helpers/functions.config.js"; import * as configFunctions from "../../helpers/functions.config.js";
import type * as recordTypes from "../../types/recordTypes"; import type * as recordTypes from "../../types/recordTypes";
@ -13,10 +21,21 @@ import type * as recordTypes from "../../types/recordTypes";
export const handler: RequestHandler = (request, response) => { export const handler: RequestHandler = (request, response) => {
const lotOccupancy: recordTypes.LotOccupancy = { const startDate = new Date();
const lotOccupancy: recordTypes.LotOccupancy = {
occupancyStartDate: dateToInteger(startDate),
occupancyStartDateString: dateToString(startDate)
}; };
if (request.query.lotId) {
const lot = getLot(request.query.lotId as string);
lotOccupancy.lotId = lot.lotId;
lotOccupancy.lotName = lot.lotName;
lotOccupancy.mapId = lot.mapId;
lotOccupancy.mapName = lot.mapName;
}
const occupancyTypes = getOccupancyTypes(); const occupancyTypes = getOccupancyTypes();
return response.render("lotOccupancy-edit", { return response.render("lotOccupancy-edit", {

View File

@ -1,3 +1,24 @@
import { getReportData } from "../../helpers/lotOccupancyDB/getReportData.js";
import papaparse from "papaparse";
export const handler = (request, response) => { export const handler = (request, response) => {
const reportName = request.params.reportName;
let rows;
switch (reportName) {
default:
rows = getReportData(reportName, request.query);
break;
}
if (!rows) {
return response
.status(404)
.json({
success: false,
message: "Report Not Found"
});
}
const csv = papaparse.unparse(rows);
response.setHeader("Content-Disposition", "attachment; filename=" + reportName + "-" + Date.now().toString() + ".csv");
response.setHeader("Content-Type", "text/csv");
response.send(csv);
}; };
export default handler; export default handler;

View File

@ -1,22 +1,45 @@
import type { RequestHandler } from "express"; import type {
RequestHandler
} from "express";
// import * as configFunctions from "../../helpers/functions.config.js"; import {
getReportData,
ReportParameters
} from "../../helpers/lotOccupancyDB/getReportData.js";
import papaparse from "papaparse";
export const handler: RequestHandler = (request, response) => { export const handler: RequestHandler = (request, response) => {
// const reportName = request.params.reportName; const reportName = request.params.reportName;
/* let rows: unknown[];
const csv = rawToCSV(rowsColumnsObject);
response.setHeader("Content-Disposition", switch (reportName) {
"attachment; filename=" + reportName + "-" + Date.now().toString() + ".csv");
response.setHeader("Content-Type", "text/csv"); default:
rows = getReportData(reportName, request.query as ReportParameters);
break;
}
response.send(csv); if (!rows) {
*/ return response
.status(404)
.json({
success: false,
message: "Report Not Found"
});
}
const csv = papaparse.unparse(rows);
response.setHeader("Content-Disposition",
"attachment; filename=" + reportName + "-" + Date.now().toString() + ".csv");
response.setHeader("Content-Type", "text/csv");
response.send(csv);
}; };

View File

@ -6,7 +6,7 @@ export const addLotOccupancyOccupant = (lotOccupancyOccupantForm, requestSession
const maxIndexResult = database.prepare("select lotOccupantIndex" + const maxIndexResult = database.prepare("select lotOccupantIndex" +
" from LotOccupancyOccupants" + " from LotOccupancyOccupants" +
" where lotOccupancyId = ?" + " where lotOccupancyId = ?" +
" order by lotOccupantIndex" + " order by lotOccupantIndex desc" +
" limit 1") " limit 1")
.get(lotOccupancyOccupantForm.lotOccupancyId); .get(lotOccupancyOccupantForm.lotOccupancyId);
if (maxIndexResult) { if (maxIndexResult) {

View File

@ -30,7 +30,7 @@ export const addLotOccupancyOccupant =
const maxIndexResult = database.prepare("select lotOccupantIndex" + const maxIndexResult = database.prepare("select lotOccupantIndex" +
" from LotOccupancyOccupants" + " from LotOccupancyOccupants" +
" where lotOccupancyId = ?" + " where lotOccupancyId = ?" +
" order by lotOccupantIndex" + " order by lotOccupantIndex desc" +
" limit 1") " limit 1")
.get(lotOccupancyOccupantForm.lotOccupancyId); .get(lotOccupancyOccupantForm.lotOccupancyId);

View File

@ -7,12 +7,13 @@ export const addLotOccupancyTransaction = (lotOccupancyTransactionForm, requestS
const maxIndexResult = database.prepare("select transactionIndex" + const maxIndexResult = database.prepare("select transactionIndex" +
" from LotOccupancyTransactions" + " from LotOccupancyTransactions" +
" where lotOccupancyId = ?" + " where lotOccupancyId = ?" +
" order by transactionIndex" + " order by transactionIndex desc" +
" limit 1") " limit 1")
.get(lotOccupancyTransactionForm.lotOccupancyId); .get(lotOccupancyTransactionForm.lotOccupancyId);
if (maxIndexResult) { if (maxIndexResult) {
transactionIndex = maxIndexResult.transactionIndex + 1; transactionIndex = maxIndexResult.transactionIndex + 1;
} }
console.log("transactionIndex = " + transactionIndex);
const rightNow = new Date(); const rightNow = new Date();
const transactionDate = lotOccupancyTransactionForm.transactionDateString ? const transactionDate = lotOccupancyTransactionForm.transactionDateString ?
dateStringToInteger(lotOccupancyTransactionForm.transactionDateString) : dateStringToInteger(lotOccupancyTransactionForm.transactionDateString) :

View File

@ -33,7 +33,7 @@ export const addLotOccupancyTransaction =
const maxIndexResult = database.prepare("select transactionIndex" + const maxIndexResult = database.prepare("select transactionIndex" +
" from LotOccupancyTransactions" + " from LotOccupancyTransactions" +
" where lotOccupancyId = ?" + " where lotOccupancyId = ?" +
" order by transactionIndex" + " order by transactionIndex desc" +
" limit 1") " limit 1")
.get(lotOccupancyTransactionForm.lotOccupancyId); .get(lotOccupancyTransactionForm.lotOccupancyId);
@ -41,6 +41,8 @@ export const addLotOccupancyTransaction =
transactionIndex = maxIndexResult.transactionIndex + 1; transactionIndex = maxIndexResult.transactionIndex + 1;
} }
console.log("transactionIndex = " + transactionIndex);
const rightNow = new Date(); const rightNow = new Date();
const transactionDate = lotOccupancyTransactionForm.transactionDateString ? const transactionDate = lotOccupancyTransactionForm.transactionDateString ?

View File

@ -0,0 +1,5 @@
export interface ReportParameters {
[parameterName: string]: string | number;
}
export declare const getReportData: (reportName: string, reportParameters?: ReportParameters) => unknown[];
export default getReportData;

View File

@ -0,0 +1,51 @@
import sqlite from "better-sqlite3";
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
import * as configFunctions from "../functions.config.js";
import * as dateTimeFunctions from "@cityssm/expressjs-server-js/dateTimeFns.js";
import camelCase from "camelcase";
const mapCamelCase = camelCase(configFunctions.getProperty("aliases.map"));
const mapNameAlias = mapCamelCase + "Name";
const mapDescriptionAlias = mapCamelCase + "Description";
const mapAddress1Alias = mapCamelCase + "Address1";
const mapAddress2Alias = mapCamelCase + "Address2";
const mapCityAlias = mapCamelCase + "City";
const mapProvinceAlias = mapCamelCase + "Province";
const mapPostalCodeAlias = mapCamelCase + "PostalCode";
const mapPhoneNumberAlias = mapCamelCase + "PhoneNumber";
export const getReportData = (reportName, reportParameters) => {
let sql;
const sqlParameters = [];
switch (reportName) {
case "maps-all":
sql = "select * from Maps";
break;
case "maps-formatted":
sql = "select mapName as " + mapNameAlias + "," +
" mapDescription as " + mapDescriptionAlias + "," +
" mapAddress1 as " + mapAddress1Alias + "," +
" mapAddress2 as " + mapAddress2Alias + "," +
" mapCity as " + mapCityAlias + "," +
" mapProvince as " + mapProvinceAlias + "," +
" mapPostalCode as " + mapPostalCodeAlias + "," +
" mapPhoneNumber as " + mapPhoneNumberAlias +
" from Maps" +
" where recordDelete_timeMillis is null" +
" order by mapName";
break;
case "lots-all":
sql = "select * from Lots";
break;
default:
return undefined;
}
const database = sqlite(databasePath, {
readonly: true
});
database.function("userFn_dateIntegerToString", dateTimeFunctions.dateIntegerToString);
database.function("userFn_timeIntegerToString", dateTimeFunctions.timeIntegerToString);
const rows = database.prepare(sql)
.all(sqlParameters);
database.close();
return rows;
};
export default getReportData;

View File

@ -0,0 +1,84 @@
/* eslint-disable no-case-declarations */
import sqlite from "better-sqlite3";
import {
lotOccupancyDB as databasePath
} from "../../data/databasePaths.js";
import * as configFunctions from "../functions.config.js";
import * as dateTimeFunctions from "@cityssm/expressjs-server-js/dateTimeFns.js";
import camelCase from "camelcase";
export interface ReportParameters {
[parameterName: string]: string | number;
}
const mapCamelCase = camelCase(configFunctions.getProperty("aliases.map"));
const mapNameAlias = mapCamelCase + "Name";
const mapDescriptionAlias = mapCamelCase + "Description";
const mapAddress1Alias = mapCamelCase + "Address1";
const mapAddress2Alias = mapCamelCase + "Address2";
const mapCityAlias = mapCamelCase + "City";
const mapProvinceAlias = mapCamelCase + "Province";
const mapPostalCodeAlias = mapCamelCase + "PostalCode";
const mapPhoneNumberAlias = mapCamelCase + "PhoneNumber";
export const getReportData = (reportName: string, reportParameters ? : ReportParameters): unknown[] => {
let sql: string;
const sqlParameters = [];
switch (reportName) {
case "maps-all":
sql = "select * from Maps";
break;
case "maps-formatted":
sql = "select mapName as " + mapNameAlias + "," +
" mapDescription as " + mapDescriptionAlias + "," +
" mapAddress1 as " + mapAddress1Alias + "," +
" mapAddress2 as " + mapAddress2Alias + "," +
" mapCity as " + mapCityAlias + "," +
" mapProvince as " + mapProvinceAlias + "," +
" mapPostalCode as " + mapPostalCodeAlias + "," +
" mapPhoneNumber as " + mapPhoneNumberAlias +
" from Maps" +
" where recordDelete_timeMillis is null" +
" order by mapName";
break;
case "lots-all":
sql = "select * from Lots";
break;
default:
return undefined;
}
const database = sqlite(databasePath, {
readonly: true
});
database.function("userFn_dateIntegerToString", dateTimeFunctions.dateIntegerToString);
database.function("userFn_timeIntegerToString", dateTimeFunctions.timeIntegerToString);
const rows =
database.prepare(sql)
.all(sqlParameters);
database.close();
return rows;
};
export default getReportData;

60
package-lock.json generated
View File

@ -16,6 +16,7 @@
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"activedirectory2": "^2.1.0", "activedirectory2": "^2.1.0",
"better-sqlite3": "^7.6.2", "better-sqlite3": "^7.6.2",
"camelcase": "^7.0.0",
"compression": "^1.7.4", "compression": "^1.7.4",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
@ -28,6 +29,7 @@
"express-session": "^1.17.3", "express-session": "^1.17.3",
"http-errors": "^2.0.0", "http-errors": "^2.0.0",
"leaflet": "^1.8.0", "leaflet": "^1.8.0",
"papaparse": "^5.3.2",
"session-file-store": "^1.5.0" "session-file-store": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
@ -65,7 +67,6 @@
"gulp-minify": "^3.1.0", "gulp-minify": "^3.1.0",
"gulp-sass": "^5.1.0", "gulp-sass": "^5.1.0",
"nodemon": "^2.0.19", "nodemon": "^2.0.19",
"papaparse": "^5.3.2",
"sass": "^1.54.5" "sass": "^1.54.5"
}, },
"engines": { "engines": {
@ -2105,12 +2106,14 @@
} }
}, },
"node_modules/camelcase": { "node_modules/camelcase": {
"version": "3.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==", "integrity": "sha512-JToIvOmz6nhGsUhAYScbo2d6Py5wojjNfoxoc2mEVLUdJ70gJK2gnd+ABY1Tc3sVMyK7QDPtN0T/XdlCQWITyQ==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/chalk": { "node_modules/chalk": {
@ -7621,8 +7624,7 @@
"node_modules/papaparse": { "node_modules/papaparse": {
"version": "5.3.2", "version": "5.3.2",
"resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.2.tgz", "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.2.tgz",
"integrity": "sha512-6dNZu0Ki+gyV0eBsFKJhYr+MdQYAzFUGlBMNj3GNrmHxmz1lfRa24CjFObPXtjcetlOv5Ad299MhIK0znp3afw==", "integrity": "sha512-6dNZu0Ki+gyV0eBsFKJhYr+MdQYAzFUGlBMNj3GNrmHxmz1lfRa24CjFObPXtjcetlOv5Ad299MhIK0znp3afw=="
"dev": true
}, },
"node_modules/parent-module": { "node_modules/parent-module": {
"version": "1.0.1", "version": "1.0.1",
@ -10502,6 +10504,15 @@
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
} }
}, },
"node_modules/yargs-parser/node_modules/camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/yargs/node_modules/ansi-regex": { "node_modules/yargs/node_modules/ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
@ -10511,6 +10522,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/yargs/node_modules/camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/yargs/node_modules/find-up": { "node_modules/yargs/node_modules/find-up": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
@ -12293,10 +12313,9 @@
"dev": true "dev": true
}, },
"camelcase": { "camelcase": {
"version": "3.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==", "integrity": "sha512-JToIvOmz6nhGsUhAYScbo2d6Py5wojjNfoxoc2mEVLUdJ70gJK2gnd+ABY1Tc3sVMyK7QDPtN0T/XdlCQWITyQ=="
"dev": true
}, },
"chalk": { "chalk": {
"version": "4.1.2", "version": "4.1.2",
@ -16588,8 +16607,7 @@
"papaparse": { "papaparse": {
"version": "5.3.2", "version": "5.3.2",
"resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.2.tgz", "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.2.tgz",
"integrity": "sha512-6dNZu0Ki+gyV0eBsFKJhYr+MdQYAzFUGlBMNj3GNrmHxmz1lfRa24CjFObPXtjcetlOv5Ad299MhIK0znp3afw==", "integrity": "sha512-6dNZu0Ki+gyV0eBsFKJhYr+MdQYAzFUGlBMNj3GNrmHxmz1lfRa24CjFObPXtjcetlOv5Ad299MhIK0znp3afw=="
"dev": true
}, },
"parent-module": { "parent-module": {
"version": "1.0.1", "version": "1.0.1",
@ -18850,6 +18868,12 @@
"integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
"dev": true "dev": true
}, },
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==",
"dev": true
},
"find-up": { "find-up": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
@ -18940,6 +18964,14 @@
"requires": { "requires": {
"camelcase": "^3.0.0", "camelcase": "^3.0.0",
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
},
"dependencies": {
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha512-4nhGqUkc4BqbBBB4Q6zLuD7lzzrHYrjKGeYaEji/3tFR5VdJu9v+LilhGIVe8wxEJPPOeWo7eg8dwY13TZ1BNg==",
"dev": true
}
} }
}, },
"yocto-queue": { "yocto-queue": {

View File

@ -37,6 +37,7 @@
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"activedirectory2": "^2.1.0", "activedirectory2": "^2.1.0",
"better-sqlite3": "^7.6.2", "better-sqlite3": "^7.6.2",
"camelcase": "^7.0.0",
"compression": "^1.7.4", "compression": "^1.7.4",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
@ -49,6 +50,7 @@
"express-session": "^1.17.3", "express-session": "^1.17.3",
"http-errors": "^2.0.0", "http-errors": "^2.0.0",
"leaflet": "^1.8.0", "leaflet": "^1.8.0",
"papaparse": "^5.3.2",
"session-file-store": "^1.5.0" "session-file-store": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
@ -86,7 +88,6 @@
"gulp-minify": "^3.1.0", "gulp-minify": "^3.1.0",
"gulp-sass": "^5.1.0", "gulp-sass": "^5.1.0",
"nodemon": "^2.0.19", "nodemon": "^2.0.19",
"papaparse": "^5.3.2",
"sass": "^1.54.5" "sass": "^1.54.5"
} }
} }

View File

@ -896,6 +896,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotOccupancyTransactionsContainerElement.querySelector("#lotOccupancyTransactions--grandTotal").textContent = "$" + transactionGrandTotal.toFixed(2); lotOccupancyTransactionsContainerElement.querySelector("#lotOccupancyTransactions--grandTotal").textContent = "$" + transactionGrandTotal.toFixed(2);
const feeGrandTotal = getFeeGrandTotal(); const feeGrandTotal = getFeeGrandTotal();
if (feeGrandTotal > transactionGrandTotal) { if (feeGrandTotal > transactionGrandTotal) {
lotOccupancyTransactionsContainerElement.insertAdjacentHTML("afterbegin", "<div class=\"message is-warning\">" +
"<div class=\"message-body\">" +
"<div class=\"level\">" +
"<div class=\"level-left\"><div class=\"level-item\">Outstanding Balance</div></div>" +
"<div class=\"level-right\"><div class=\"level-item\">$" + (feeGrandTotal - transactionGrandTotal).toFixed(2) + "</div></div>" +
"</div>" +
"</div>" +
"</div>");
} }
}; };
document.querySelector("#button--addTransaction").addEventListener("click", () => { document.querySelector("#button--addTransaction").addEventListener("click", () => {

View File

@ -1247,10 +1247,15 @@ declare const bulmaJS: BulmaJS;
if (feeGrandTotal > transactionGrandTotal) { if (feeGrandTotal > transactionGrandTotal) {
/*
lotOccupancyTransactionsContainerElement.insertAdjacentHTML("afterbegin", lotOccupancyTransactionsContainerElement.insertAdjacentHTML("afterbegin",
"<div ") "<div class=\"message is-warning\">" +
*/ "<div class=\"message-body\">" +
"<div class=\"level\">" +
"<div class=\"level-left\"><div class=\"level-item\">Outstanding Balance</div></div>" +
"<div class=\"level-right\"><div class=\"level-item\">$" + (feeGrandTotal - transactionGrandTotal).toFixed(2) + "</div></div>" +
"</div>" +
"</div>" +
"</div>");
} }
}; };

File diff suppressed because one or more lines are too long

View File

@ -301,12 +301,16 @@ function importFromCSV() {
}, user); }, user);
} }
if (masterRow.CM_COMMITTAL_TYPE !== "") { if (masterRow.CM_COMMITTAL_TYPE !== "") {
let commitalType = masterRow.CM_COMMITTAL_TYPE;
if (commitalType === "GS") {
commitalType = "Graveside";
}
addOrUpdateLotOccupancyField({ addOrUpdateLotOccupancyField({
lotOccupancyId, lotOccupancyId,
occupancyTypeFieldId: deceasedOccupancyType.occupancyTypeFields.find((occupancyTypeField) => { occupancyTypeFieldId: deceasedOccupancyType.occupancyTypeFields.find((occupancyTypeField) => {
return occupancyTypeField.occupancyTypeField === "Committal Type"; return occupancyTypeField.occupancyTypeField === "Committal Type";
}).occupancyTypeFieldId, }).occupancyTypeFieldId,
lotOccupancyFieldValue: masterRow.CM_COMMITTAL_TYPE lotOccupancyFieldValue: commitalType
}, user); }, user);
} }
if (masterRow.CM_REMARK1 !== "") { if (masterRow.CM_REMARK1 !== "") {

View File

@ -487,12 +487,18 @@ function importFromCSV() {
if (masterRow.CM_COMMITTAL_TYPE !== "") { if (masterRow.CM_COMMITTAL_TYPE !== "") {
let commitalType = masterRow.CM_COMMITTAL_TYPE;
if (commitalType === "GS") {
commitalType = "Graveside";
}
addOrUpdateLotOccupancyField({ addOrUpdateLotOccupancyField({
lotOccupancyId, lotOccupancyId,
occupancyTypeFieldId: deceasedOccupancyType.occupancyTypeFields.find((occupancyTypeField) => { occupancyTypeFieldId: deceasedOccupancyType.occupancyTypeFields.find((occupancyTypeField) => {
return occupancyTypeField.occupancyTypeField === "Committal Type" return occupancyTypeField.occupancyTypeField === "Committal Type"
}).occupancyTypeFieldId, }).occupancyTypeFieldId,
lotOccupancyFieldValue: masterRow.CM_COMMITTAL_TYPE lotOccupancyFieldValue: commitalType
}, user); }, user);
} }

View File

@ -42,83 +42,87 @@
</button> </button>
</div> </div>
<div class="columns"> <div class="panel">
<div class="column"> <div class="panel-block is-block">
<div class="field"> <div class="columns">
<label class="label" for="lot--lotName"> <div class="column">
<%= configFunctions.getProperty("aliases.lot") %> Name <div class="field">
</label> <label class="label" for="lot--lotName">
<div class="control"> <%= configFunctions.getProperty("aliases.lot") %> Name
<input class="input" id="lot--lotName" name="lotName" value="<%= lot.lotName %>" maxlength="100" required /> </label>
</div> <div class="control">
</div> <input class="input" id="lot--lotName" name="lotName" value="<%= lot.lotName %>" maxlength="100" required />
</div> </div>
<div class="column">
<label class="label" for="lot--lotTypeId">
<%= configFunctions.getProperty("aliases.lot") %> Type
</label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select id="lot--lotTypeId" name="lotTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const lotType of lotTypes) { %>
<%
if (lot.lotTypeId === lotType.lotTypeId) {
typeIsFound = true;
}
%>
<option value="<%= lotType.lotTypeId %>"
<%= (lot.lotTypeId === lotType.lotTypeId ? " selected" : "") %>
<%= (!isCreate && lot.lotTypeId !== lotType.lotTypeId ? " disabled" : "") %>>
<%= lotType.lotType %>
</option>
<% } %>
<% if (lot.lotTypeId && !typeIsFound) { %>
<option value="<%= lot.lotTypeId %>" selected>
<%= lot.lotType %>
</option>
<% } %>
</select>
</div> </div>
</div> </div>
<div class="control"> <div class="column">
<button class="button is-unlock-field-button" type="button" title="Unlock Field"> <label class="label" for="lot--lotTypeId">
<i class="fas fa-unlock" aria-hidden="true"></i> <%= configFunctions.getProperty("aliases.lot") %> Type
</button> </label>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select id="lot--lotTypeId" name="lotTypeId" required>
<% if (isCreate) { %>
<option value="">(No Type)</option>
<% } %>
<% let typeIsFound = false; %>
<% for (const lotType of lotTypes) { %>
<%
if (lot.lotTypeId === lotType.lotTypeId) {
typeIsFound = true;
}
%>
<option value="<%= lotType.lotTypeId %>"
<%= (lot.lotTypeId === lotType.lotTypeId ? " selected" : "") %>
<%= (!isCreate && lot.lotTypeId !== lotType.lotTypeId ? " disabled" : "") %>>
<%= lotType.lotType %>
</option>
<% } %>
<% if (lot.lotTypeId && !typeIsFound) { %>
<option value="<%= lot.lotTypeId %>" selected>
<%= lot.lotType %>
</option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
</div> </div>
</div> <div class="column">
</div> <label class="label" for="lot--lotStatusId">
<div class="column"> <%= configFunctions.getProperty("aliases.lot") %> Status
<label class="label" for="lot--lotStatusId"> </label>
<%= configFunctions.getProperty("aliases.lot") %> Status <div class="field">
</label> <div class="control">
<div class="field"> <div class="select is-fullwidth">
<div class="control"> <select id="lot--lotStatusId" name="lotStatusId">
<div class="select is-fullwidth"> <option value="">(No Status)</option>
<select id="lot--lotStatusId" name="lotStatusId"> <% let statusIsFound = false; %>
<option value="">(No Status)</option> <% for (const lotStatus of lotStatuses) { %>
<% let statusIsFound = false; %> <%
<% for (const lotStatus of lotStatuses) { %> if (lot.lotStatusId === lotStatus.lotStatusId) {
<% statusIsFound = true;
if (lot.lotStatusId === lotStatus.lotStatusId) { }
statusIsFound = true; %>
} <option value="<%= lotStatus.lotStatusId %>"
%> <%= (lot.lotStatusId === lotStatus.lotStatusId ? " selected" : "") %>>
<option value="<%= lotStatus.lotStatusId %>" <%= lotStatus.lotStatus %>
<%= (lot.lotStatusId === lotStatus.lotStatusId ? " selected" : "") %>> </option>
<%= lotStatus.lotStatus %> <% } %>
</option> <% if (lot.lotStatusId && !statusIsFound) { %>
<% } %> <option value="<%= lot.lotStatusId %>" selected>
<% if (lot.lotStatusId && !statusIsFound) { %> <%= lot.lotStatus %>
<option value="<%= lot.lotStatusId %>" selected> </option>
<%= lot.lotStatus %> <% } %>
</option> </select>
<% } %> </div>
</select> </div>
</div> </div>
</div> </div>
</div> </div>
@ -127,81 +131,88 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<h2 class="title is-4">Geographic Location</h2> <div class="panel">
<div class="field"> <h2 class="panel-heading">Geographic Location</h2>
<label class="label" for="lot--lotLatitude">Latitude</label> <div class="panel-block is-block">
<div class="control"> <div class="field">
<input class="input" id="lot--lotLatitude" name="lotLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= lot.lotLatitude %>" /> <label class="label" for="lot--lotLatitude">Latitude</label>
</div> <div class="control">
</div> <input class="input" id="lot--lotLatitude" name="lotLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= lot.lotLatitude %>" />
<div class="field"> </div>
<label class="label" for="lot--lotLongitude">Longitude</label> </div>
<div class="control"> <div class="field">
<input class="input" id="lot--lotLongitude" name="lotLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= lot.lotLongitude %>" /> <label class="label" for="lot--lotLongitude">Longitude</label>
<div class="control">
<input class="input" id="lot--lotLongitude" name="lotLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= lot.lotLongitude %>" />
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<h2 class="title is-4">Image</h2> <div class="panel">
<label class="label" for="lot--mapId"><%= configFunctions.getProperty("aliases.map") %></label> <h2 class="panel-heading">Image</h2>
<div class="field has-addons"> <div class="panel-block is-block">
<div class="control is-expanded"> <label class="label" for="lot--mapId"><%= configFunctions.getProperty("aliases.map") %></label>
<div class="select is-fullwidth"> <div class="field has-addons">
<select id="lot--mapId" name="mapId"> <div class="control is-expanded">
<option value="" <%= (!isCreate && lot.mapId ? " disabled" : "") %>> <div class="select is-fullwidth">
(No <%= configFunctions.getProperty("aliases.map") %> Selected) <select id="lot--mapId" name="mapId">
</option> <option value="" <%= (!isCreate && lot.mapId ? " disabled" : "") %>>
<% let mapIsFound = false; %> (No <%= configFunctions.getProperty("aliases.map") %> Selected)
<% for (const map of maps) { %> </option>
<% <% let mapIsFound = false; %>
if (lot.mapId === map.mapId) { <% for (const map of maps) { %>
mapIsFound = true; <%
} if (lot.mapId === map.mapId) {
%> mapIsFound = true;
<option value="<%= map.mapId %>" }
<%= (lot.mapId === map.mapId ? " selected" : "") %> %>
<%= (!isCreate && lot.mapId !== map.mapId ? " disabled" : "") %>> <option value="<%= map.mapId %>"
<%= map.mapName %> <%= (lot.mapId === map.mapId ? " selected" : "") %>
</option> <%= (!isCreate && lot.mapId !== map.mapId ? " disabled" : "") %>>
<% } %> <%= map.mapName %>
<% if (lot.mapId && !mapIsFound) { %> </option>
<option value="<%= lot.mapId %>" selected> <% } %>
<%= lot.mapName %> <% if (lot.mapId && !mapIsFound) { %>
</option> <option value="<%= lot.mapId %>" selected>
<% } %> <%= lot.mapName %>
</select> </option>
<% } %>
</select>
</div>
</div>
<div class="control">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="field">
<label class="label" for="lot--mapKey">
<%= configFunctions.getProperty("aliases.map") %> SVG Key
</label>
<div class="control">
<input class="input" id="lot--mapKey" name="mapKey" value="<%= lot.mapKey %>" maxlength="100" />
</div>
<p class="help">
<a href="https://cityssm.github.io/lot-occupancy-system/docs/" target="_blank" rel="noreferrer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
What is the SVG key?
</a>
</p>
</div> </div>
</div> </div>
<div class="control">
<button class="button is-unlock-field-button" type="button" title="Unlock Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="field">
<label class="label" for="lot--mapKey">
<%= configFunctions.getProperty("aliases.map") %> SVG Key
</label>
<div class="control">
<input class="input" id="lot--mapKey" name="mapKey" value="<%= lot.mapKey %>" maxlength="100" />
</div>
<p class="help">
<a href="https://cityssm.github.io/lot-occupancy-system/docs/" target="_blank" rel="noreferrer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
What is the SVG key?
</a>
</p>
</div> </div>
</div> </div>
</div> </div>
<div class="panel mb-5">
<div class="columns"> <h2 class="panel-heading">
Additional Details
</h2>
<div class="panel-block"></div>
</div> </div>
<h2 class="title is-4">
Additional Details
</h2>
</form> </form>
<% if (isCreate) { %> <% if (isCreate) { %>
@ -211,25 +222,51 @@
</p> </p>
</div> </div>
<% } else { %> <% } else { %>
<div class="columns is-mobile mt-2"> <div class="panel">
<div class="column"> <div class="panel-heading">
<h2 class="title is-4"> <div class="level is-mobile">
Comments <div class="level-left">
</h2> <div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
Comments
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<button class="button is-small is-success" id="lotComments--add" type="button">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add a Comment</span>
</button>
</div>
</div>
</div>
</div> </div>
<div class="column is-narrow has-text-right"> <div class="panel-block is-block" id="container--lotComments"></div>
<button class="button is-small is-success" id="lotComments--add" type="button"> </div>
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add a Comment</span> <div class="panel">
</button> <div class="panel-heading">
<div class="level is-mobile">
<div class="level-left">
<div class="level-item">
<h2 class="has-text-weight-bold is-size-5">
<%= configFunctions.getProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
</h2>
</div>
</div>
<div class="level-right">
<div class="level-item">
<a class="button is-success is-small has-text-weight-normal" href="<%= urlPrefix %>/lotOccupancies/new?lotId=<%= lot.lotId %>">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Create New <%= configFunctions.getProperty("aliases.occupancy") %></span>
</a>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div id="container--lotComments"></div>
<h2 class="title is-4 mt-2">
<%= configFunctions.getProperty("aliases.occupancies") %>
<span class="tag"><%= lot.lotOccupancies.length %></span>
</h2>
<% if (lot.lotOccupancies.length === 0) { %> <% if (lot.lotOccupancies.length === 0) { %>
<div class="message is-info"> <div class="message is-info">

View File

@ -1,124 +1,140 @@
<%- include('_header'); -%> <%- include('_header'); -%>
<nav class="breadcrumb"> <nav class="breadcrumb">
<ul> <ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li> <li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li> <li>
<a href="<%= urlPrefix %>/lots"> <a href="<%= urlPrefix %>/lots">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span> <span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span><%= configFunctions.getProperty("aliases.lots") %></span> <span><%= configFunctions.getProperty("aliases.lots") %></span>
</a> </a>
</li> </li>
<li class="is-active"><a href="#" aria-current="page"> <li class="is-active"><a href="#" aria-current="page">
<%= lot.lotName %> <%= lot.lotName %>
</a></li> </a></li>
</ul> </ul>
</nav> </nav>
<h1 class="title is-1"> <h1 class="title is-1">
<%= lot.lotName %> <%= lot.lotName %>
</h1> </h1>
<% if (user.userProperties.canUpdate) { %> <% if (user.userProperties.canUpdate) { %>
<div class="fixed-container is-fixed-bottom-right mx-4 my-4 has-text-right is-hidden-print"> <div class="fixed-container is-fixed-bottom-right mx-4 my-4 has-text-right is-hidden-print">
<a class="button is-circle is-primary has-tooltip-left" data-tooltip="Update <%= configFunctions.getProperty("aliases.lot") %>" href="<%= urlPrefix %>/lots/<%= lot.lotId %>/edit"> <a class="button is-circle is-primary has-tooltip-left"
<i class="fas fa-pencil-alt" aria-hidden="true"></i> data-tooltip="Update <%= configFunctions.getProperty("aliases.lot") %>"
<span class="sr-only">Update <%= configFunctions.getProperty("aliases.lot") %></span> href="<%= urlPrefix %>/lots/<%= lot.lotId %>/edit">
<i class="fas fa-pencil-alt" aria-hidden="true"></i>
<span class="sr-only">Update <%= configFunctions.getProperty("aliases.lot") %></span>
</a> </a>
</div> </div>
<% } %> <% } %>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div> <div class="panel">
<strong><%= configFunctions.getProperty("aliases.map") %></strong><br /> <div class="panel-block is-block">
<a href="<%= urlPrefix %>/maps/<%= lot.mapId %>"> <div>
<%= lot.mapName %> <strong><%= configFunctions.getProperty("aliases.map") %></strong><br />
</a> <a href="<%= urlPrefix %>/maps/<%= lot.mapId %>">
</div> <%= lot.mapName %>
<div class="mt-2"> </a>
<strong><%= configFunctions.getProperty("aliases.lot") %> Type</strong><br /> </div>
<%= lot.lotType %> <div class="mt-2">
</div> <strong><%= configFunctions.getProperty("aliases.lot") %> Type</strong><br />
<div class="mt-2"> <%= lot.lotType %>
<strong>Status</strong><br /> </div>
<%= lot.lotStatus %> <div class="mt-2">
</div> <strong>Status</strong><br />
</div> <%= lot.lotStatus %>
<div class="column"> </div>
<h2 class="title is-4">Image</h2> </div>
<% if (lot.mapSVG) { %>
<% const imageURL = urlPrefix + "/images/maps/" + lot.mapSVG %>
<div class="image" id="lot--map" data-map-key="<%= lot.mapKey %>">
<%- include('../public/images/maps/' + lot.mapSVG); -%>
</div> </div>
<% } else { %> </div>
<div class="message is-info"> <div class="column">
<p class="message-body">There are no image associated with this <%= configFunctions.getProperty("aliases.lot").toLowerCase() %>.</p> <div class="panel">
<h2 class="panel-heading">Image</h2>
<div class="panel-block is-block">
<% if (lot.mapSVG) { %>
<% const imageURL = urlPrefix + "/images/maps/" + lot.mapSVG %>
<div class="image" id="lot--map" data-map-key="<%= lot.mapKey %>">
<%- include('../public/images/maps/' + lot.mapSVG); -%>
</div>
<% } else { %>
<div class="message is-info">
<p class="message-body">There are no image associated with this
<%= configFunctions.getProperty("aliases.lot").toLowerCase() %>.</p>
</div>
<% } %>
</div>
</div> </div>
<% } %> </div>
</div>
</div> </div>
<h2 class="title is-4"> <div class="panel">
<%= configFunctions.getProperty("aliases.occupancies") %> <h2 class="panel-heading">
<span class="tag"><%= lot.lotOccupancies.length %></span> <%= configFunctions.getProperty("aliases.occupancies") %>
</h2> <span class="tag"><%= lot.lotOccupancies.length %></span>
</h2>
<% if (lot.lotOccupancies.length === 0) { %> <div class="panel-block is-block">
<div class="message is-info"> <% if (lot.lotOccupancies.length === 0) { %>
<p class="message-body">There are no occupancy records asscociated with this <%= configFunctions.getProperty("aliases.lot") %>.</p> <div class="message is-info">
</div> <p class="message-body">There are no occupancy records asscociated with this
<% } else { %> <%= configFunctions.getProperty("aliases.lot") %>.</p>
<table class="table is-fullwidth is-striped is-hoverable"> </div>
<thead> <% } else { %>
<tr> <table class="table is-fullwidth is-striped is-hoverable">
<th class="has-width-10">&nbsp;</th> <thead>
<th><%= configFunctions.getProperty("aliases.occupancy") %> Type</th> <tr>
<th>Start Date</th> <th class="has-width-10">&nbsp;</th>
<th>End Date</th> <th><%= configFunctions.getProperty("aliases.occupancy") %> Type</th>
<th><%= configFunctions.getProperty("aliases.occupants") %></th> <th>Start Date</th>
</tr> <th>End Date</th>
</thead> <th><%= configFunctions.getProperty("aliases.occupants") %></th>
<tbody> </tr>
<% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %> </thead>
<% for (const lotOccupancy of lot.lotOccupancies) { %> <tbody>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> <% const currentDate = dateTimeFunctions.dateToInteger(new Date()); %>
<tr> <% for (const lotOccupancy of lot.lotOccupancies) { %>
<td class="has-text-centered"> <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<% if (isActive) { %> <tr>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i> <td class="has-text-centered">
<% } else { %> <% if (isActive) { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i> <i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %> <% } else { %>
</td> <i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<td> <% } %>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>"> </td>
<%= lotOccupancy.occupancyType %> <td>
</a> <a class="has-text-weight-bold"
</td> href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<td><%= lotOccupancy.occupancyStartDateString %></td> <%= lotOccupancy.occupancyType %>
<td> </a>
<% if (lotOccupancy.occupancyEndDate) { %> </td>
<%= lotOccupancy.occupancyEndDateString %> <td><%= lotOccupancy.occupancyStartDateString %></td>
<% } else { %> <td>
(No End Date) <% if (lotOccupancy.occupancyEndDate) { %>
<% } %> <%= lotOccupancy.occupancyEndDateString %>
</td> <% } else { %>
<td> (No End Date)
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> <% } %>
(No <%= configFunctions.getProperty("aliases.occupants") %>) </td>
<% } else { %> <td>
<% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %> <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
<%= occupant.occupantName %> (No <%= configFunctions.getProperty("aliases.occupants") %>)
<%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %> <% } else { %>
<% } %> <% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %>
</td> <%= occupant.occupantName %>
</tr> <%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %>
<% } %> <% } %>
</tbody> </td>
</table> </tr>
<% } %> <% } %>
</tbody>
</table>
<% } %>
</div>
</div>
<%- include('_footerA'); -%> <%- include('_footerA'); -%>

View File

@ -234,7 +234,29 @@
</p> </p>
</div> </div>
<% } else { %> <% } else { %>
<table class="table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th>Date</th>
<th><%= configFunctions.getProperty("aliases.externalReceiptNumber") %></th>
<th class="has-text-right">Amount</th>
</tr>
</thead>
<tbody>
<% for (const lotOccupancyTransaction of lotOccupancy.lotOccupancyTransactions) { %>
<tr>
<td><%= lotOccupancyTransaction.transactionDateString %></td>
<td>
<%= lotOccupancyTransaction.externalReceiptNumber %><br />
<small><%= lotOccupancyTransaction.transactionNote %></small>
</td>
<td class="has-text-right">
$<%= lotOccupancyTransaction.transactionAmount.toFixed(2) %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %> <% } %>
</div> </div>
</div> </div>

View File

@ -40,65 +40,72 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="field"> <div class="panel">
<label class="label" for="map--mapName"><%= configFunctions.getProperty("aliases.map") %> Name</label> <div class="panel-block is-block">
<div class="control"> <div class="field">
<input class="input" id="map--mapName" name="mapName" type="text" value="<%= map.mapName %>" maxlength="200" required /> <label class="label" for="map--mapName"><%= configFunctions.getProperty("aliases.map") %> Name</label>
</div> <div class="control">
</div> <input class="input" id="map--mapName" name="mapName" type="text" value="<%= map.mapName %>" maxlength="200" required />
<div class="field"> </div>
<label class="label" for="map--mapDescription"><%= configFunctions.getProperty("aliases.map") %> Description</label> </div>
<div class="control"> <div class="field">
<textarea class="textarea" id="map--mapDescription" name="mapDescription"><%= map.mapDescription %></textarea> <label class="label" for="map--mapDescription"><%= configFunctions.getProperty("aliases.map") %> Description</label>
<div class="control">
<textarea class="textarea" id="map--mapDescription" name="mapDescription"><%= map.mapDescription %></textarea>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<h2 class="title is-4">Address</h2> <div class="panel">
<h2 class="panel-heading">Address</h2>
<div class="field"> <div class="panel-block is-block">
<label class="label" for="map--mapAddress1">Address</label>
<div class="control">
<input class="input" id="map--mapAddress1" name="mapAddress1" type="text" value="<%= map.mapAddress1 %>" maxlength="50" placeholder="Line 1" />
</div>
</div>
<div class="field">
<div class="control">
<input class="input" id="map--mapAddress2" name="mapAddress2" type="text" value="<%= map.mapAddress2 %>" maxlength="50" placeholder="Line 2" aria-label="Address Line 2" />
</div>
</div>
<div class="columns">
<div class="column is-8">
<div class="field"> <div class="field">
<label class="label" for="map--mapCity">City</label> <label class="label" for="map--mapAddress1">Address</label>
<div class="control"> <div class="control">
<input class="input" id="map--mapCity" name="mapCity" value="<%= map.mapCity %>" maxlength="20" /> <input class="input" id="map--mapAddress1" name="mapAddress1" type="text" value="<%= map.mapAddress1 %>" maxlength="50" placeholder="Line 1" />
</div> </div>
</div> </div>
</div>
<div class="column">
<div class="field"> <div class="field">
<label class="label" for="map--mapProvince">Province</label>
<div class="control"> <div class="control">
<input class="input" id="map--mapProvince" name="mapProvince" value="<%= map.mapProvince %>" maxlength="2" /> <input class="input" id="map--mapAddress2" name="mapAddress2" type="text" value="<%= map.mapAddress2 %>" maxlength="50" placeholder="Line 2" aria-label="Address Line 2" />
</div> </div>
</div> </div>
</div> <div class="columns">
</div> <div class="column is-8">
<div class="columns"> <div class="field">
<div class="column"> <label class="label" for="map--mapCity">City</label>
<div class="field"> <div class="control">
<label class="label" for="map--mapPostalCode">Postal Code</label> <input class="input" id="map--mapCity" name="mapCity" value="<%= map.mapCity %>" maxlength="20" />
<div class="control"> </div>
<input class="input" id="map--mapPostalCode" name="mapPostalCode" value="<%= map.mapPostalCode %>" maxlength="7" /> </div>
</div>
<div class="column">
<div class="field">
<label class="label" for="map--mapProvince">Province</label>
<div class="control">
<input class="input" id="map--mapProvince" name="mapProvince" value="<%= map.mapProvince %>" maxlength="2" />
</div>
</div>
</div> </div>
</div> </div>
</div> <div class="columns">
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="map--mapPhoneNumber">Phone Number</label> <label class="label" for="map--mapPostalCode">Postal Code</label>
<div class="control"> <div class="control">
<input class="input" id="map--mapPhoneNumber" name="mapPhoneNumber" value="<%= map.mapPhoneNumber %>" maxlength="30" /> <input class="input" id="map--mapPostalCode" name="mapPostalCode" value="<%= map.mapPostalCode %>" maxlength="7" />
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="map--mapPhoneNumber">Phone Number</label>
<div class="control">
<input class="input" id="map--mapPhoneNumber" name="mapPhoneNumber" value="<%= map.mapPhoneNumber %>" maxlength="30" />
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -107,37 +114,46 @@
</div> </div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<h2 class="title is-4">Geographic Location</h2> <div class="panel">
<div class="field"> <h2 class="panel-heading">Geographic Location</h2>
<label class="label" for="map--mapLatitude">Latitude</label> <div class="panel-block is-block">
<div class="control"> <div class="field">
<input class="input" id="map--mapLatitude" name="mapLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= map.mapLatitude %>" /> <label class="label" for="map--mapLatitude">Latitude</label>
</div> <div class="control">
</div> <input class="input" id="map--mapLatitude" name="mapLatitude" type="number" min="-90" max="90" step="0.00000001" value="<%= map.mapLatitude %>" />
<div class="field"> </div>
<label class="label" for="map--mapLongitude">Longitude</label> </div>
<div class="control"> <div class="field">
<input class="input" id="map--mapLongitude" name="mapLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= map.mapLongitude %>" /> <label class="label" for="map--mapLongitude">Longitude</label>
<div class="control">
<input class="input" id="map--mapLongitude" name="mapLongitude" type="number" min="-180" max="180" step="0.00000001" value="<%= map.mapLongitude %>" />
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<h2 class="title is-4">Image</h2> <div class="panel">
<div class="field"> <h2 class="panel-heading">Image</h2>
<label class="label" for="map--mapSVG">SVG File</label> <div class="panel-block is-block">
<div class="control"> <div class="field">
<div class="select is-fullwidth"> <label class="label" for="map--mapSVG">SVG File</label>
<select id="map--mapSVG" name="mapSVG"> <div class="control">
<option value="">(Select a File)</option> <div class="select is-fullwidth">
<% for (const mapSVG of mapSVGs) { %> <select id="map--mapSVG" name="mapSVG">
<option value="<%= mapSVG %>" <%= (map.mapSVG === mapSVG) ? " selected" : "" %>> <option value="">(Select a File)</option>
<%= mapSVG %> <% for (const mapSVG of mapSVGs) { %>
</option> <option value="<%= mapSVG %>" <%= (map.mapSVG === mapSVG) ? " selected" : "" %>>
<% } %> <%= mapSVG %>
</select> </option>
<% } %>
</select>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -33,68 +33,83 @@
</div> </div>
<% } %> <% } %>
<div class="columns"> <div class="panel">
<% if (map.mapDescription && map.mapDescription !== "") { %> <div class="panel-block is-block">
<div class="column"> <div class="columns">
<strong>Description</strong><br /> <% if (map.mapDescription && map.mapDescription !== "") { %>
<%= map.mapDescription %> <div class="column">
<strong>Description</strong><br />
<%= map.mapDescription %>
</div>
<% } %>
<div class="column">
<strong>Address</strong><br />
<% if (map.mapAddress1 !== "") { %>
<%= map.mapAddress1 %><br />
<% } %>
<% if (map.mapAddress2 !== "") { %>
<%= map.mapAddress2 %><br />
<% } %>
<%= map.mapCity %>, <%= map.mapProvince %><br />
<%= map.mapPostalCode %>
</div>
</div> </div>
<% } %> <% if (map.mapPhoneNumber !== "") { %>
<div class="column"> <div class="column">
<strong>Address</strong><br /> <strong>Phone Number</strong><br />
<% if (map.mapAddress1 !== "") { %> <%= map.mapPhoneNumber %>
<%= map.mapAddress1 %><br /> </div>
<% } %> <% } %>
<% if (map.mapAddress2 !== "") { %>
<%= map.mapAddress2 %><br />
<% } %>
<%= map.mapCity %>, <%= map.mapProvince %><br />
<%= map.mapPostalCode %>
</div> </div>
</div> </div>
<% if (map.mapPhoneNumber !== "") { %>
<div class="column">
<strong>Phone Number</strong><br />
<%= map.mapPhoneNumber %>
</div>
<% } %>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<h2 class="title is-4">Geographic Location</h2> <div class="panel">
<h2 class="panel-heading">Geographic Location</h2>
<% if (map.mapLatitude && map.mapLongitude) { %> <div class="panel-block is-block">
<div id="map--leaflet" data-map-latitude="<%= map.mapLatitude %>" data-map-longitude="<%= map.mapLongitude %>" style="height:300px"></div> <% if (map.mapLatitude && map.mapLongitude) { %>
<% } else { %> <div id="map--leaflet" data-map-latitude="<%= map.mapLatitude %>" data-map-longitude="<%= map.mapLongitude %>" style="height:300px"></div>
<div class="message is-info"> <% } else { %>
<p class="message-body">There are no geographic coordinates associated with this <%= configFunctions.getProperty("aliases.map").toLowerCase() %>.</p> <div class="message is-info">
<p class="message-body">There are no geographic coordinates associated with this <%= configFunctions.getProperty("aliases.map").toLowerCase() %>.</p>
</div>
<% } %>
</div> </div>
<% } %> </div>
</div> </div>
<div class="column"> <div class="column">
<h2 class="title is-4">Image</h2> <div class="panel">
<% if (map.mapSVG) { %> <h2 class="panel-heading">Image</h2>
<% const imageURL = urlPrefix + "/images/maps/" + map.mapSVG %> <div class="panel-block is-block">
<a class="image" href="<%= urlPrefix %>/images/maps/<%= map.mapSVG %>" target="_blank"> <% if (map.mapSVG) { %>
<%- include('../public/images/maps/' + map.mapSVG); -%> <% const imageURL = urlPrefix + "/images/maps/" + map.mapSVG %>
</a> <a class="image" href="<%= urlPrefix %>/images/maps/<%= map.mapSVG %>" target="_blank">
<% } else { %> <%- include('../public/images/maps/' + map.mapSVG); -%>
<div class="message is-info"> </a>
<p class="message-body">There are no image associated with this <%= configFunctions.getProperty("aliases.map").toLowerCase() %>.</p> <% } else { %>
<div class="message is-info">
<p class="message-body">There are no image associated with this <%= configFunctions.getProperty("aliases.map").toLowerCase() %>.</p>
</div>
<% } %>
</div> </div>
<% } %> </div>
</div> </div>
</div> </div>
<h2 class="title is-4"> <div class="panel">
Related Searches <h2 class="panel-heading">
</h2> Related Searches
</h2>
<div class="panel-block">
<a class="button is-link" href="<%= urlPrefix %>/lots?mapId=<%= map.mapId %>">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span class="mr-2"><%= configFunctions.getProperty("aliases.lots") %></span>
<span class="tag"><%= map.lotCount %></span>
</a>
</div>
</div>
<a class="button is-link" href="<%= urlPrefix %>/lots?mapId=<%= map.mapId %>">
<span class="icon is-small"><i class="fas fa-vector-square" aria-hidden="true"></i></span>
<span class="mr-2"><%= configFunctions.getProperty("aliases.lots") %></span>
<span class="tag"><%= map.lotCount %></span>
</a>
</div> </div>
</div> </div>

View File

@ -1,80 +1,82 @@
<%- include('_header'); -%> <%- include('_header'); -%>
<nav class="breadcrumb"> <nav class="breadcrumb">
<ul> <ul>
<li><a href="<%= urlPrefix %>/dashboard">Home</a></li> <li><a href="<%= urlPrefix %>/dashboard">Home</a></li>
<li class="is-active"><a href="#" aria-current="page"> <li class="is-active">
<span class="icon is-small"><i class="fas fa-file" aria-hidden="true"></i></span> <a href="#" aria-current="page">
<span>Reports</span> <span class="icon is-small"><i class="fas fa-file" aria-hidden="true"></i></span>
</a></li> <span>Reports</span>
</ul> </a>
</li>
</ul>
</nav> </nav>
<h1 class="title is-1"> <h1 class="title is-1">
Licence Reports Reports
</h1> </h1>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="panel"> <div class="panel">
<h2 class="panel-heading">Licences</h2> <h2 class="panel-heading"><%= configFunctions.getProperty("aliases.maps") %></h2>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/licences-formatted" download> <a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/maps-formatted" download>
<div class="has-text-centered my-2 ml-2 mr-3"> <div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i> <i class="fas fa-2x fa-file" aria-hidden="true"></i>
</span><br /> </span><br />
<span class="tag is-info">CSV</span> <span class="tag is-info">CSV</span>
</div>
<div>
<h3 class="title is-5 is-marginless">Full <%= configFunctions.getProperty("aliases.map") %> List</h3>
<p>
All active <%= configFunctions.getProperty("aliases.maps").toLowerCase() %>.
</p>
</div>
</a>
</div> </div>
<div>
<h3 class="title is-5 is-marginless">Full Licence List</h3>
<p>
All active licences.
</p>
</div>
</a>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/licences-notIssued" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
<i class="fas fa-2x fa-file" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
</div>
<div>
<h3 class="title is-5 is-marginless">Licences Not Issued</h3>
<p>
All licences in the system that have not been issued.
</p>
</div>
</a>
</div> </div>
</div> <div class="column">
<div class="column"> <div class="panel">
<div class="panel"> <h2 class="panel-heading">Table Exports</h2>
<h2 class="panel-heading">Table Exports</h2> <div class="panel-block">
<div class="panel-block"> <div class="message is-info">
<div class="message is-info"> <p class="message-body is-size-7">
<p class="message-body is-size-7"> Note that table exports are full, unfiltered, and unformatted exports.
Note that table exports are full, unfiltered, and unformatted exports. They may contain deleted records that have not been fully purged.
They may contain deleted records that have not been fully purged. </p>
</p> </div>
</div>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/maps-all" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
<i class="fas fa-2x fa-table" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
</div>
<div>
<h3 class="title is-5 is-marginless">Full Maps Table</h3>
<p>
All the data from the Maps (<%= configFunctions.getProperty("aliases.maps") %>) table unfiltered.
</p>
</div>
</a>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/lots-all" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
<i class="fas fa-2x fa-table" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
</div>
<div>
<h3 class="title is-5 is-marginless">Full Lots Table</h3>
<p>
All the data from the Lots (<%= configFunctions.getProperty("aliases.lots") %>) table unfiltered.
</p>
</div>
</a>
</div> </div>
</div>
<a class="panel-block align-items-flex-start" href="<%= urlPrefix %>/reports/licences-all" download>
<div class="has-text-centered my-2 ml-2 mr-3">
<span class="icon has-text-info">
<i class="fas fa-2x fa-table" aria-hidden="true"></i>
</span><br />
<span class="tag is-info">CSV</span>
</div>
<div>
<h3 class="title is-5 is-marginless">Full Licences Table</h3>
<p>
All the data from the Licences table unfiltered.
</p>
</div>
</a>
</div> </div>
</div>
</div> </div>
<%- include('_footerA'); -%> <%- include('_footerA'); -%>