parent
269c18a801
commit
fad2578773
|
|
@ -3,7 +3,6 @@ import type {
|
||||||
} from "express";
|
} from "express";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getLotOccupantTypes,
|
|
||||||
getOccupancyTypes
|
getOccupancyTypes
|
||||||
} from "../../helpers/functions.cache.js";
|
} from "../../helpers/functions.cache.js";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { RequestHandler } from "express";
|
||||||
|
export declare const handler: RequestHandler;
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { addLotOccupancyComment } from "../../helpers/lotOccupancyDB/addLotOccupancyComment.js";
|
||||||
|
import { getLotOccupancyComments } from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
export const handler = async (request, response) => {
|
||||||
|
addLotOccupancyComment(request.body, request.session);
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
response.json({
|
||||||
|
success: true,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import type {
|
||||||
|
RequestHandler
|
||||||
|
} from "express";
|
||||||
|
|
||||||
|
import {
|
||||||
|
addLotOccupancyComment
|
||||||
|
} from "../../helpers/lotOccupancyDB/addLotOccupancyComment.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
getLotOccupancyComments
|
||||||
|
} from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
|
||||||
|
|
||||||
|
export const handler: RequestHandler = async (request, response) => {
|
||||||
|
|
||||||
|
addLotOccupancyComment(request.body, request.session);
|
||||||
|
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
|
||||||
|
response.json({
|
||||||
|
success: true,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { RequestHandler } from "express";
|
||||||
|
export declare const handler: RequestHandler;
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { deleteLotOccupancyComment } from "../../helpers/lotOccupancyDB/deleteLotOccupancyComment.js";
|
||||||
|
import { getLotOccupancyComments } from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
export const handler = async (request, response) => {
|
||||||
|
const success = deleteLotOccupancyComment(request.body.lotOccupancyCommentId, request.session);
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import type {
|
||||||
|
RequestHandler
|
||||||
|
} from "express";
|
||||||
|
|
||||||
|
import {
|
||||||
|
deleteLotOccupancyComment
|
||||||
|
} from "../../helpers/lotOccupancyDB/deleteLotOccupancyComment.js";
|
||||||
|
|
||||||
|
import {getLotOccupancyComments} from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
|
||||||
|
|
||||||
|
export const handler: RequestHandler = async (request, response) => {
|
||||||
|
|
||||||
|
const success = deleteLotOccupancyComment(request.body.lotOccupancyCommentId, request.session);
|
||||||
|
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { RequestHandler } from "express";
|
||||||
|
export declare const handler: RequestHandler;
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { updateLotOccupancyComment } from "../../helpers/lotOccupancyDB/updateLotOccupancyComment.js";
|
||||||
|
import { getLotOccupancyComments } from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
export const handler = async (request, response) => {
|
||||||
|
const success = updateLotOccupancyComment(request.body, request.session);
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
import type {
|
||||||
|
RequestHandler
|
||||||
|
} from "express";
|
||||||
|
|
||||||
|
import {
|
||||||
|
updateLotOccupancyComment
|
||||||
|
} from "../../helpers/lotOccupancyDB/updateLotOccupancyComment.js";
|
||||||
|
|
||||||
|
import {getLotOccupancyComments} from "../../helpers/lotOccupancyDB/getLotOccupancyComments.js";
|
||||||
|
|
||||||
|
|
||||||
|
export const handler: RequestHandler = async (request, response) => {
|
||||||
|
|
||||||
|
const success = updateLotOccupancyComment(request.body, request.session);
|
||||||
|
|
||||||
|
const lotOccupancyComments = getLotOccupancyComments(request.body.lotOccupancyId);
|
||||||
|
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyComments
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default handler;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type * as recordTypes from "../../types/recordTypes";
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
interface AddLotOccupancyCommentForm {
|
interface AddLotOccupancyCommentForm {
|
||||||
lotOccupancyId: string | number;
|
lotOccupancyId: string | number;
|
||||||
lotOccupancyCommentDateString: string;
|
lotOccupancyCommentDateString?: string;
|
||||||
lotOccupancyCommentTimeString: string;
|
lotOccupancyCommentTimeString?: string;
|
||||||
lotOccupancyComment: string;
|
lotOccupancyComment: string;
|
||||||
}
|
}
|
||||||
export declare const addLotOccupancyComment: (commentForm: AddLotOccupancyCommentForm, requestSession: recordTypes.PartialSession) => number;
|
export declare const addLotOccupancyComment: (commentForm: AddLotOccupancyCommentForm, requestSession: recordTypes.PartialSession) => number;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,26 @@
|
||||||
import { dateStringToInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
|
||||||
import sqlite from "better-sqlite3";
|
import sqlite from "better-sqlite3";
|
||||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||||
|
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||||
export const addLotOccupancyComment = (commentForm, requestSession) => {
|
export const addLotOccupancyComment = (commentForm, requestSession) => {
|
||||||
|
const rightNow = new Date();
|
||||||
|
let lotOccupancyCommentDate;
|
||||||
|
let lotOccupancyCommentTime;
|
||||||
|
if (commentForm.lotOccupancyCommentDateString) {
|
||||||
|
lotOccupancyCommentDate = dateStringToInteger(commentForm.lotOccupancyCommentDateString);
|
||||||
|
lotOccupancyCommentTime = timeStringToInteger(commentForm.lotOccupancyCommentTimeString);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lotOccupancyCommentDate = dateToInteger(rightNow);
|
||||||
|
lotOccupancyCommentTime = dateToTimeInteger(rightNow);
|
||||||
|
}
|
||||||
const database = sqlite(databasePath);
|
const database = sqlite(databasePath);
|
||||||
const rightNowMillis = Date.now();
|
|
||||||
const result = database
|
const result = database
|
||||||
.prepare("insert into LotOccupancyComments (" +
|
.prepare("insert into LotOccupancyComments (" +
|
||||||
"lotOccupancyId, lotOccupancyCommentDate, lotOccupancyCommentTime, lotOccupancyComment," +
|
"lotOccupancyId, lotOccupancyCommentDate, lotOccupancyCommentTime, lotOccupancyComment," +
|
||||||
" recordCreate_userName, recordCreate_timeMillis," +
|
" recordCreate_userName, recordCreate_timeMillis," +
|
||||||
" recordUpdate_userName, recordUpdate_timeMillis)" +
|
" recordUpdate_userName, recordUpdate_timeMillis)" +
|
||||||
" values (?, ?, ?, ?, ?, ?, ?, ?)")
|
" values (?, ?, ?, ?, ?, ?, ?, ?)")
|
||||||
.run(commentForm.lotOccupancyId, dateStringToInteger(commentForm.lotOccupancyCommentDateString), timeStringToInteger(commentForm.lotOccupancyCommentTimeString), commentForm.lotOccupancyComment, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
.run(commentForm.lotOccupancyId, lotOccupancyCommentDate, lotOccupancyCommentTime, commentForm.lotOccupancyComment, requestSession.user.userName, rightNow.getTime(), requestSession.user.userName, rightNow.getTime());
|
||||||
database.close();
|
database.close();
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
import { dateStringToInteger, timeStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
|
||||||
import sqlite from "better-sqlite3";
|
import sqlite from "better-sqlite3";
|
||||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
|
||||||
|
import {
|
||||||
|
lotOccupancyDB as databasePath
|
||||||
|
} from "../../data/databasePaths.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
dateStringToInteger,
|
||||||
|
dateToInteger,
|
||||||
|
dateToTimeInteger,
|
||||||
|
timeStringToInteger
|
||||||
|
} from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||||
|
|
||||||
import type * as recordTypes from "../../types/recordTypes";
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
|
||||||
|
|
||||||
interface AddLotOccupancyCommentForm {
|
interface AddLotOccupancyCommentForm {
|
||||||
lotOccupancyId: string | number;
|
lotOccupancyId: string | number;
|
||||||
lotOccupancyCommentDateString: string;
|
lotOccupancyCommentDateString ? : string;
|
||||||
lotOccupancyCommentTimeString: string;
|
lotOccupancyCommentTimeString ? : string;
|
||||||
lotOccupancyComment: string;
|
lotOccupancyComment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16,9 +25,20 @@ interface AddLotOccupancyCommentForm {
|
||||||
export const addLotOccupancyComment =
|
export const addLotOccupancyComment =
|
||||||
(commentForm: AddLotOccupancyCommentForm, requestSession: recordTypes.PartialSession): number => {
|
(commentForm: AddLotOccupancyCommentForm, requestSession: recordTypes.PartialSession): number => {
|
||||||
|
|
||||||
const database = sqlite(databasePath);
|
const rightNow = new Date();
|
||||||
|
|
||||||
const rightNowMillis = Date.now();
|
let lotOccupancyCommentDate: number;
|
||||||
|
let lotOccupancyCommentTime: number;
|
||||||
|
|
||||||
|
if (commentForm.lotOccupancyCommentDateString) {
|
||||||
|
lotOccupancyCommentDate = dateStringToInteger(commentForm.lotOccupancyCommentDateString);
|
||||||
|
lotOccupancyCommentTime = timeStringToInteger(commentForm.lotOccupancyCommentTimeString);
|
||||||
|
} else {
|
||||||
|
lotOccupancyCommentDate = dateToInteger(rightNow);
|
||||||
|
lotOccupancyCommentTime = dateToTimeInteger(rightNow);
|
||||||
|
}
|
||||||
|
|
||||||
|
const database = sqlite(databasePath);
|
||||||
|
|
||||||
const result = database
|
const result = database
|
||||||
.prepare("insert into LotOccupancyComments (" +
|
.prepare("insert into LotOccupancyComments (" +
|
||||||
|
|
@ -27,13 +47,13 @@ export const addLotOccupancyComment =
|
||||||
" recordUpdate_userName, recordUpdate_timeMillis)" +
|
" recordUpdate_userName, recordUpdate_timeMillis)" +
|
||||||
" values (?, ?, ?, ?, ?, ?, ?, ?)")
|
" values (?, ?, ?, ?, ?, ?, ?, ?)")
|
||||||
.run(commentForm.lotOccupancyId,
|
.run(commentForm.lotOccupancyId,
|
||||||
dateStringToInteger(commentForm.lotOccupancyCommentDateString),
|
lotOccupancyCommentDate,
|
||||||
timeStringToInteger(commentForm.lotOccupancyCommentTimeString),
|
lotOccupancyCommentTime,
|
||||||
commentForm.lotOccupancyComment,
|
commentForm.lotOccupancyComment,
|
||||||
requestSession.user.userName,
|
requestSession.user.userName,
|
||||||
rightNowMillis,
|
rightNow.getTime(),
|
||||||
requestSession.user.userName,
|
requestSession.user.userName,
|
||||||
rightNowMillis);
|
rightNow.getTime());
|
||||||
|
|
||||||
database.close();
|
database.close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
export declare const deleteLotOccupancyComment: (lotOccupancyCommentId: number | string, requestSession: recordTypes.PartialSession) => boolean;
|
||||||
|
export default deleteLotOccupancyComment;
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import sqlite from "better-sqlite3";
|
||||||
|
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||||
|
export const deleteLotOccupancyComment = (lotOccupancyCommentId, requestSession) => {
|
||||||
|
const database = sqlite(databasePath);
|
||||||
|
const rightNowMillis = Date.now();
|
||||||
|
const result = database
|
||||||
|
.prepare("update LotOccupancyComments" +
|
||||||
|
" set recordDelete_userName = ?," +
|
||||||
|
" recordDelete_timeMillis = ?" +
|
||||||
|
" where lotOccupancyCommentId = ?")
|
||||||
|
.run(requestSession.user.userName, rightNowMillis, lotOccupancyCommentId);
|
||||||
|
database.close();
|
||||||
|
return (result.changes > 0);
|
||||||
|
};
|
||||||
|
export default deleteLotOccupancyComment;
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import sqlite from "better-sqlite3";
|
||||||
|
|
||||||
|
import {
|
||||||
|
lotOccupancyDB as databasePath
|
||||||
|
} from "../../data/databasePaths.js";
|
||||||
|
|
||||||
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
|
||||||
|
|
||||||
|
export const deleteLotOccupancyComment =
|
||||||
|
(lotOccupancyCommentId: number | string,
|
||||||
|
requestSession: recordTypes.PartialSession): boolean => {
|
||||||
|
|
||||||
|
const database = sqlite(databasePath);
|
||||||
|
|
||||||
|
const rightNowMillis = Date.now();
|
||||||
|
|
||||||
|
const result = database
|
||||||
|
.prepare("update LotOccupancyComments" +
|
||||||
|
" set recordDelete_userName = ?," +
|
||||||
|
" recordDelete_timeMillis = ?" +
|
||||||
|
" where lotOccupancyCommentId = ?")
|
||||||
|
.run(requestSession.user.userName,
|
||||||
|
rightNowMillis,
|
||||||
|
lotOccupancyCommentId);
|
||||||
|
|
||||||
|
database.close();
|
||||||
|
|
||||||
|
return (result.changes > 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default deleteLotOccupancyComment;
|
||||||
|
|
@ -11,7 +11,8 @@ export const getLotOccupancyComments = (lotOccupancyId, connectedDatabase) => {
|
||||||
.prepare("select lotOccupancyCommentId," +
|
.prepare("select lotOccupancyCommentId," +
|
||||||
" lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString," +
|
" lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString," +
|
||||||
" lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString," +
|
" lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString," +
|
||||||
" lotOccupancyComment" +
|
" lotOccupancyComment," +
|
||||||
|
" recordCreate_userName, recordUpdate_userName" +
|
||||||
" from LotOccupancyComments" +
|
" from LotOccupancyComments" +
|
||||||
" where recordDelete_timeMillis is null" +
|
" where recordDelete_timeMillis is null" +
|
||||||
" and lotOccupancyId = ?" +
|
" and lotOccupancyId = ?" +
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ export const getLotOccupancyComments = (lotOccupancyId: number | string, connect
|
||||||
.prepare("select lotOccupancyCommentId," +
|
.prepare("select lotOccupancyCommentId," +
|
||||||
" lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString," +
|
" lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString," +
|
||||||
" lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString," +
|
" lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString," +
|
||||||
" lotOccupancyComment" +
|
" lotOccupancyComment," +
|
||||||
|
" recordCreate_userName, recordUpdate_userName" +
|
||||||
" from LotOccupancyComments" +
|
" from LotOccupancyComments" +
|
||||||
" where recordDelete_timeMillis is null" +
|
" where recordDelete_timeMillis is null" +
|
||||||
" and lotOccupancyId = ?" +
|
" and lotOccupancyId = ?" +
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
interface UpdateLotOccupancyCommentForm {
|
||||||
|
lotOccupancyCommentId: string | number;
|
||||||
|
lotOccupancyCommentDateString: string;
|
||||||
|
lotOccupancyCommentTimeString: string;
|
||||||
|
lotOccupancyComment: string;
|
||||||
|
}
|
||||||
|
export declare const updateLotOccupancyComment: (commentForm: UpdateLotOccupancyCommentForm, requestSession: recordTypes.PartialSession) => boolean;
|
||||||
|
export default updateLotOccupancyComment;
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import sqlite from "better-sqlite3";
|
||||||
|
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||||
|
import { dateStringToInteger } from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||||
|
export const updateLotOccupancyComment = (commentForm, requestSession) => {
|
||||||
|
const rightNowMillis = Date.now();
|
||||||
|
const database = sqlite(databasePath);
|
||||||
|
const result = database
|
||||||
|
.prepare("update LotOccupancyComments" +
|
||||||
|
" set lotOccupancyCommentDate = ?," +
|
||||||
|
" lotOccupancyCommentTime = ?," +
|
||||||
|
" lotOccupancyComment = ?," +
|
||||||
|
" recordUpdate_userName = ?," +
|
||||||
|
" recordUpdate_timeMillis = ?" +
|
||||||
|
" where recordDelete_timeMillis is null" +
|
||||||
|
" and lotOccupancyCommentId = ?")
|
||||||
|
.run(dateStringToInteger(commentForm.lotOccupancyCommentDateString), dateStringToInteger(commentForm.lotOccupancyCommentTimeString), commentForm.lotOccupancyComment, requestSession.user.userName, rightNowMillis, commentForm.lotOccupancyCommentId);
|
||||||
|
database.close();
|
||||||
|
return result.changes > 0;
|
||||||
|
};
|
||||||
|
export default updateLotOccupancyComment;
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
import sqlite from "better-sqlite3";
|
||||||
|
|
||||||
|
import {
|
||||||
|
lotOccupancyDB as databasePath
|
||||||
|
} from "../../data/databasePaths.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
dateStringToInteger,
|
||||||
|
dateToInteger,
|
||||||
|
dateToTimeInteger,
|
||||||
|
timeStringToInteger
|
||||||
|
} from "@cityssm/expressjs-server-js/dateTimeFns.js";
|
||||||
|
|
||||||
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
|
||||||
|
|
||||||
|
interface UpdateLotOccupancyCommentForm {
|
||||||
|
lotOccupancyCommentId: string | number;
|
||||||
|
lotOccupancyCommentDateString: string;
|
||||||
|
lotOccupancyCommentTimeString: string;
|
||||||
|
lotOccupancyComment: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const updateLotOccupancyComment =
|
||||||
|
(commentForm: UpdateLotOccupancyCommentForm, requestSession: recordTypes.PartialSession): boolean => {
|
||||||
|
|
||||||
|
const rightNowMillis = Date.now();
|
||||||
|
|
||||||
|
const database = sqlite(databasePath);
|
||||||
|
|
||||||
|
const result = database
|
||||||
|
.prepare("update LotOccupancyComments" +
|
||||||
|
" set lotOccupancyCommentDate = ?," +
|
||||||
|
" lotOccupancyCommentTime = ?," +
|
||||||
|
" lotOccupancyComment = ?," +
|
||||||
|
" recordUpdate_userName = ?," +
|
||||||
|
" recordUpdate_timeMillis = ?" +
|
||||||
|
" where recordDelete_timeMillis is null" +
|
||||||
|
" and lotOccupancyCommentId = ?")
|
||||||
|
.run(dateStringToInteger(commentForm.lotOccupancyCommentDateString),
|
||||||
|
dateStringToInteger(commentForm.lotOccupancyCommentTimeString),
|
||||||
|
commentForm.lotOccupancyComment,
|
||||||
|
requestSession.user.userName,
|
||||||
|
rightNowMillis,
|
||||||
|
commentForm.lotOccupancyCommentId);
|
||||||
|
|
||||||
|
database.close();
|
||||||
|
|
||||||
|
return result.changes > 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default updateLotOccupancyComment;
|
||||||
|
|
@ -395,4 +395,162 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
renderLotOccupancyOccupants();
|
renderLotOccupancyOccupants();
|
||||||
}
|
}
|
||||||
|
if (!isCreate) {
|
||||||
|
let lotOccupancyComments = exports.lotOccupancyComments;
|
||||||
|
const openEditLotOccupancyComment = (clickEvent) => {
|
||||||
|
const lotOccupancyCommentId = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupancyCommentId, 10);
|
||||||
|
const lotOccupancyComment = lotOccupancyComments.find((currentLotOccupancyComment) => {
|
||||||
|
return currentLotOccupancyComment.lotOccupancyCommentId === lotOccupancyCommentId;
|
||||||
|
});
|
||||||
|
let editFormElement;
|
||||||
|
let editCloseModalFunction;
|
||||||
|
const editComment = (submitEvent) => {
|
||||||
|
submitEvent.preventDefault();
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyComment", editFormElement, (responseJSON) => {
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
editCloseModalFunction();
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Updating Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
cityssm.openHtmlModal("lotOccupancy-editComment", {
|
||||||
|
onshow: (modalElement) => {
|
||||||
|
los.populateAliases(modalElement);
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value = lotOccupancyId;
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value = lotOccupancyCommentId.toString();
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value = lotOccupancyComment.lotOccupancyComment;
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString").value = lotOccupancyComment.lotOccupancyCommentDateString;
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value = lotOccupancyComment.lotOccupancyCommentTimeString;
|
||||||
|
},
|
||||||
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
editFormElement = modalElement.querySelector("form");
|
||||||
|
editFormElement.addEventListener("submit", editComment);
|
||||||
|
editCloseModalFunction = closeModalFunction;
|
||||||
|
},
|
||||||
|
onremoved: () => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const deleteLotOccupancyComment = (clickEvent) => {
|
||||||
|
const lotOccupancyCommentId = Number.parseInt(clickEvent.currentTarget.closest("tr").dataset.lotOccupancyCommentId, 10);
|
||||||
|
const doDelete = () => {
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doDeleteLotOccupancyComment", {
|
||||||
|
lotOccupancyId,
|
||||||
|
lotOccupancyCommentId
|
||||||
|
}, (responseJSON) => {
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Removing Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
bulmaJS.confirm({
|
||||||
|
title: "Remove Comment?",
|
||||||
|
message: "Are you sure you want to remove this comment?",
|
||||||
|
okButton: {
|
||||||
|
text: "Yes, Remove Comment",
|
||||||
|
callbackFunction: doDelete
|
||||||
|
},
|
||||||
|
contextualColorName: "warning"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const renderLotOccupancyComments = () => {
|
||||||
|
const containerElement = document.querySelector("#container--lotOccupancyComments");
|
||||||
|
if (lotOccupancyComments.length === 0) {
|
||||||
|
containerElement.innerHTML = "<div class=\"message is-info\">" +
|
||||||
|
"<p class=\"message-body\">There are no comments associated with this record.</p>" +
|
||||||
|
"</div>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tableElement = document.createElement("table");
|
||||||
|
tableElement.className = "table is-fullwidth is-striped is-hoverable";
|
||||||
|
tableElement.innerHTML = "<thead><tr>" +
|
||||||
|
"<th>Commentor</th>" +
|
||||||
|
"<th>Comment Date</th>" +
|
||||||
|
"<th>Comment</th>" +
|
||||||
|
"<th><span class=\"is-sr-only\">Options</span></th>" +
|
||||||
|
"</tr></thead>" +
|
||||||
|
"<tbody></tbody>";
|
||||||
|
for (const lotOccupancyComment of lotOccupancyComments) {
|
||||||
|
const tableRowElement = document.createElement("tr");
|
||||||
|
tableRowElement.dataset.lotOccupancyCommentId = lotOccupancyComment.lotOccupancyCommentId.toString();
|
||||||
|
tableRowElement.innerHTML = "<td>" + cityssm.escapeHTML(lotOccupancyComment.recordCreate_userName) + "</td>" +
|
||||||
|
"<td>" +
|
||||||
|
lotOccupancyComment.lotOccupancyCommentDateString +
|
||||||
|
(lotOccupancyComment.lotOccupancyCommentTime === 0 ? "" : " " + lotOccupancyComment.lotOccupancyCommentTimeString) +
|
||||||
|
"</td>" +
|
||||||
|
"<td>" + cityssm.escapeHTML(lotOccupancyComment.lotOccupancyComment) + "</td>" +
|
||||||
|
("<td>" +
|
||||||
|
"<div class=\"buttons are-small is-justify-content-end\">" +
|
||||||
|
("<button class=\"button is-primary button--edit\" type=\"button\">" +
|
||||||
|
"<span class=\"icon is-small\"><i class=\"fas fa-pencil-alt\" aria-hidden=\"true\"></i></span>" +
|
||||||
|
" <span>Edit</span>" +
|
||||||
|
"</button>") +
|
||||||
|
("<button class=\"button is-light is-danger button--delete\" type=\"button\" aria-label=\"Delete\">" +
|
||||||
|
"<i class=\"fas fa-trash\" aria-hidden=\"true\"></i>" +
|
||||||
|
"</button>") +
|
||||||
|
"</div>" +
|
||||||
|
"</td>");
|
||||||
|
tableRowElement.querySelector(".button--edit").addEventListener("click", openEditLotOccupancyComment);
|
||||||
|
tableRowElement.querySelector(".button--delete").addEventListener("click", deleteLotOccupancyComment);
|
||||||
|
tableElement.querySelector("tbody").append(tableRowElement);
|
||||||
|
}
|
||||||
|
containerElement.innerHTML = "";
|
||||||
|
containerElement.append(tableElement);
|
||||||
|
};
|
||||||
|
document.querySelector("#button--addComment").addEventListener("click", () => {
|
||||||
|
let addFormElement;
|
||||||
|
let addCloseModalFunction;
|
||||||
|
const addComment = (submitEvent) => {
|
||||||
|
submitEvent.preventDefault();
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyComment", addFormElement, (responseJSON) => {
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
addCloseModalFunction();
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Adding Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
cityssm.openHtmlModal("lotOccupancy-addComment", {
|
||||||
|
onshow: (modalElement) => {
|
||||||
|
los.populateAliases(modalElement);
|
||||||
|
modalElement.querySelector("#lotOccupancyCommentAdd--lotOccupancyId").value = lotOccupancyId;
|
||||||
|
},
|
||||||
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
addFormElement = modalElement.querySelector("form");
|
||||||
|
addFormElement.addEventListener("submit", addComment);
|
||||||
|
addCloseModalFunction = closeModalFunction;
|
||||||
|
},
|
||||||
|
onremoved: () => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ import type {
|
||||||
} from "@cityssm/bulma-webapp-js/src/types";
|
} from "@cityssm/bulma-webapp-js/src/types";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
BulmaJS,
|
BulmaJS
|
||||||
StringConfigProperties
|
|
||||||
} from "@cityssm/bulma-js/types";
|
} from "@cityssm/bulma-js/types";
|
||||||
|
|
||||||
declare const cityssm: cityssmGlobal;
|
declare const cityssm: cityssmGlobal;
|
||||||
|
|
@ -575,6 +574,221 @@ declare const bulmaJS: BulmaJS;
|
||||||
* Comments
|
* Comments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!isCreate) {
|
||||||
|
let lotOccupancyComments: recordTypes.LotOccupancyComment[] = exports.lotOccupancyComments;
|
||||||
|
|
||||||
|
const openEditLotOccupancyComment = (clickEvent: Event) => {
|
||||||
|
|
||||||
|
const lotOccupancyCommentId = Number.parseInt((clickEvent.currentTarget as HTMLElement).closest("tr").dataset.lotOccupancyCommentId, 10);
|
||||||
|
|
||||||
|
const lotOccupancyComment = lotOccupancyComments.find((currentLotOccupancyComment) => {
|
||||||
|
return currentLotOccupancyComment.lotOccupancyCommentId === lotOccupancyCommentId;
|
||||||
|
});
|
||||||
|
|
||||||
|
let editFormElement: HTMLFormElement;
|
||||||
|
let editCloseModalFunction: () => void;
|
||||||
|
|
||||||
|
const editComment = (submitEvent: SubmitEvent) => {
|
||||||
|
|
||||||
|
submitEvent.preventDefault();
|
||||||
|
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doUpdateLotOccupancyComment",
|
||||||
|
editFormElement,
|
||||||
|
(responseJSON: {
|
||||||
|
success: boolean;
|
||||||
|
errorMessage ? : string;
|
||||||
|
lotOccupancyComments ? : recordTypes.LotOccupancyComment[];
|
||||||
|
}) => {
|
||||||
|
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
editCloseModalFunction();
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
} else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Updating Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
cityssm.openHtmlModal("lotOccupancy-editComment", {
|
||||||
|
onshow: (modalElement) => {
|
||||||
|
los.populateAliases(modalElement);
|
||||||
|
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyId") as HTMLInputElement).value = lotOccupancyId;
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId") as HTMLInputElement).value = lotOccupancyCommentId.toString();
|
||||||
|
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment") as HTMLInputElement).value = lotOccupancyComment.lotOccupancyComment;
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString") as HTMLInputElement).value = lotOccupancyComment.lotOccupancyCommentDateString;
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString") as HTMLInputElement).value = lotOccupancyComment.lotOccupancyCommentTimeString;
|
||||||
|
},
|
||||||
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
|
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
||||||
|
editFormElement = modalElement.querySelector("form");
|
||||||
|
editFormElement.addEventListener("submit", editComment);
|
||||||
|
|
||||||
|
editCloseModalFunction = closeModalFunction;
|
||||||
|
},
|
||||||
|
onremoved: () => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteLotOccupancyComment = (clickEvent: Event) => {
|
||||||
|
|
||||||
|
const lotOccupancyCommentId = Number.parseInt((clickEvent.currentTarget as HTMLElement).closest("tr").dataset.lotOccupancyCommentId, 10);
|
||||||
|
|
||||||
|
const doDelete = () => {
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doDeleteLotOccupancyComment", {
|
||||||
|
lotOccupancyId,
|
||||||
|
lotOccupancyCommentId
|
||||||
|
},
|
||||||
|
(responseJSON: {
|
||||||
|
success: boolean;
|
||||||
|
errorMessage ? : string;
|
||||||
|
lotOccupancyComments: recordTypes.LotOccupancyComment[];
|
||||||
|
}) => {
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
} else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Removing Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
bulmaJS.confirm({
|
||||||
|
title: "Remove Comment?",
|
||||||
|
message: "Are you sure you want to remove this comment?",
|
||||||
|
okButton: {
|
||||||
|
text: "Yes, Remove Comment",
|
||||||
|
callbackFunction: doDelete
|
||||||
|
},
|
||||||
|
contextualColorName: "warning"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderLotOccupancyComments = () => {
|
||||||
|
|
||||||
|
const containerElement = document.querySelector("#container--lotOccupancyComments") as HTMLElement;
|
||||||
|
|
||||||
|
if (lotOccupancyComments.length === 0) {
|
||||||
|
containerElement.innerHTML = "<div class=\"message is-info\">" +
|
||||||
|
"<p class=\"message-body\">There are no comments associated with this record.</p>" +
|
||||||
|
"</div>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableElement = document.createElement("table");
|
||||||
|
tableElement.className = "table is-fullwidth is-striped is-hoverable";
|
||||||
|
tableElement.innerHTML = "<thead><tr>" +
|
||||||
|
"<th>Commentor</th>" +
|
||||||
|
"<th>Comment Date</th>" +
|
||||||
|
"<th>Comment</th>" +
|
||||||
|
"<th><span class=\"is-sr-only\">Options</span></th>" +
|
||||||
|
"</tr></thead>" +
|
||||||
|
"<tbody></tbody>";
|
||||||
|
|
||||||
|
for (const lotOccupancyComment of lotOccupancyComments) {
|
||||||
|
|
||||||
|
const tableRowElement = document.createElement("tr");
|
||||||
|
tableRowElement.dataset.lotOccupancyCommentId = lotOccupancyComment.lotOccupancyCommentId.toString();
|
||||||
|
|
||||||
|
tableRowElement.innerHTML = "<td>" + cityssm.escapeHTML(lotOccupancyComment.recordCreate_userName) + "</td>" +
|
||||||
|
"<td>" +
|
||||||
|
lotOccupancyComment.lotOccupancyCommentDateString +
|
||||||
|
(lotOccupancyComment.lotOccupancyCommentTime === 0 ? "" : " " + lotOccupancyComment.lotOccupancyCommentTimeString) +
|
||||||
|
"</td>" +
|
||||||
|
"<td>" + cityssm.escapeHTML(lotOccupancyComment.lotOccupancyComment) + "</td>" +
|
||||||
|
("<td>" +
|
||||||
|
"<div class=\"buttons are-small is-justify-content-end\">" +
|
||||||
|
("<button class=\"button is-primary button--edit\" type=\"button\">" +
|
||||||
|
"<span class=\"icon is-small\"><i class=\"fas fa-pencil-alt\" aria-hidden=\"true\"></i></span>" +
|
||||||
|
" <span>Edit</span>" +
|
||||||
|
"</button>") +
|
||||||
|
("<button class=\"button is-light is-danger button--delete\" type=\"button\" aria-label=\"Delete\">" +
|
||||||
|
"<i class=\"fas fa-trash\" aria-hidden=\"true\"></i>" +
|
||||||
|
"</button>") +
|
||||||
|
"</div>" +
|
||||||
|
"</td>");
|
||||||
|
|
||||||
|
tableRowElement.querySelector(".button--edit").addEventListener("click", openEditLotOccupancyComment);
|
||||||
|
tableRowElement.querySelector(".button--delete").addEventListener("click", deleteLotOccupancyComment);
|
||||||
|
|
||||||
|
tableElement.querySelector("tbody").append(tableRowElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
containerElement.innerHTML = "";
|
||||||
|
containerElement.append(tableElement);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
document.querySelector("#button--addComment").addEventListener("click", () => {
|
||||||
|
|
||||||
|
let addFormElement: HTMLFormElement;
|
||||||
|
let addCloseModalFunction: () => void;
|
||||||
|
|
||||||
|
const addComment = (submitEvent: SubmitEvent) => {
|
||||||
|
|
||||||
|
submitEvent.preventDefault();
|
||||||
|
|
||||||
|
cityssm.postJSON(urlPrefix + "/lotOccupancies/doAddLotOccupancyComment",
|
||||||
|
addFormElement,
|
||||||
|
(responseJSON: {
|
||||||
|
success: boolean;
|
||||||
|
errorMessage ? : string;
|
||||||
|
lotOccupancyComments ? : recordTypes.LotOccupancyComment[];
|
||||||
|
}) => {
|
||||||
|
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyComments = responseJSON.lotOccupancyComments;
|
||||||
|
addCloseModalFunction();
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
} else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: "Error Adding Comment",
|
||||||
|
message: responseJSON.errorMessage,
|
||||||
|
contextualColorName: "danger"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
cityssm.openHtmlModal("lotOccupancy-addComment", {
|
||||||
|
onshow: (modalElement) => {
|
||||||
|
los.populateAliases(modalElement);
|
||||||
|
|
||||||
|
(modalElement.querySelector("#lotOccupancyCommentAdd--lotOccupancyId") as HTMLInputElement).value = lotOccupancyId;
|
||||||
|
},
|
||||||
|
onshown: (modalElement, closeModalFunction) => {
|
||||||
|
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
|
||||||
|
addFormElement = modalElement.querySelector("form");
|
||||||
|
addFormElement.addEventListener("submit", addComment);
|
||||||
|
|
||||||
|
addCloseModalFunction = closeModalFunction;
|
||||||
|
},
|
||||||
|
onremoved: () => {
|
||||||
|
bulmaJS.toggleHtmlClipped();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
renderLotOccupancyComments();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fees
|
* Fees
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<div class="modal">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-card">
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<h3 class="modal-card-title">
|
||||||
|
Add Comment
|
||||||
|
</h3>
|
||||||
|
<button class="delete is-close-modal-button" aria-label="close" type="button"></button>
|
||||||
|
</header>
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<form id="form--lotOccupancyCommentAdd">
|
||||||
|
<input id="lotOccupancyCommentAdd--lotOccupancyId" name="lotOccupancyId" type="hidden" value="" />
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="lotOccupancyCommentAdd--lotOccupancyComment">Comment</label>
|
||||||
|
<div class="control">
|
||||||
|
<textarea class="textarea" id="lotOccupancyCommentAdd--lotOccupancyComment" name="lotOccupancyComment" required></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot justify-right">
|
||||||
|
<button class="button is-success" type="submit" form="form--lotOccupancyCommentAdd">
|
||||||
|
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||||
|
<span>Add Comment</span>
|
||||||
|
</button>
|
||||||
|
<button class="button is-close-modal-button" type="button">Cancel</button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<div class="modal">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-card">
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<h3 class="modal-card-title">
|
||||||
|
Add Comment
|
||||||
|
</h3>
|
||||||
|
<button class="delete is-close-modal-button" aria-label="close" type="button"></button>
|
||||||
|
</header>
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<form id="form--lotOccupancyCommentEdit">
|
||||||
|
<input id="lotOccupancyCommentEdit--lotOccupancyId" name="lotOccupancyId" type="hidden" value="" />
|
||||||
|
<input id="lotOccupancyCommentEdit--lotOccupancyCommentId" name="lotOccupancyCommentId" type="hidden" value="" />
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyComment">Comment</label>
|
||||||
|
<div class="control">
|
||||||
|
<textarea class="textarea" id="lotOccupancyCommentEdit--lotOccupancyComment" name="lotOccupancyComment" required></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentDateString">Comment Date</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentDateString" name="lotOccupancyCommentDateString" type="date" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="lotOccupancyCommentEdit--lotOccupancyCommentTimeString">Comment Time</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" id="lotOccupancyCommentEdit--lotOccupancyCommentTimeString" name="lotOccupancyCommentTimeString" type="time" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot justify-right">
|
||||||
|
<button class="button is-success" type="submit" form="form--lotOccupancyCommentEdit">
|
||||||
|
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||||
|
<span>Update Comment</span>
|
||||||
|
</button>
|
||||||
|
<button class="button is-close-modal-button" type="button">Cancel</button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -10,6 +10,9 @@ import handler_doUpdateLotOccupancy from "../handlers/lotOccupancies-post/doUpda
|
||||||
import handler_doAddLotOccupancyOccupant from "../handlers/lotOccupancies-post/doAddLotOccupancyOccupant.js";
|
import handler_doAddLotOccupancyOccupant from "../handlers/lotOccupancies-post/doAddLotOccupancyOccupant.js";
|
||||||
import handler_doUpdateLotOccupancyOccupant from "../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js";
|
import handler_doUpdateLotOccupancyOccupant from "../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js";
|
||||||
import handler_doDeleteLotOccupancyOccupant from "../handlers/lotOccupancies-post/doDeleteLotOccupancyOccupant.js";
|
import handler_doDeleteLotOccupancyOccupant from "../handlers/lotOccupancies-post/doDeleteLotOccupancyOccupant.js";
|
||||||
|
import handler_doAddLotOccupancyComment from "../handlers/lotOccupancies-post/doAddLotOccupancyComment.js";
|
||||||
|
import handler_doUpdateLotOccupancyComment from "../handlers/lotOccupancies-post/doUpdateLotOccupancyComment.js";
|
||||||
|
import handler_doDeleteLotOccupancyComment from "../handlers/lotOccupancies-post/doDeleteLotOccupancyComment.js";
|
||||||
import * as permissionHandlers from "../handlers/permissions.js";
|
import * as permissionHandlers from "../handlers/permissions.js";
|
||||||
export const router = Router();
|
export const router = Router();
|
||||||
router.get("/", handler_search);
|
router.get("/", handler_search);
|
||||||
|
|
@ -23,4 +26,7 @@ router.post("/doUpdateLotOccupancy", permissionHandlers.updatePostHandler, handl
|
||||||
router.post("/doAddLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doAddLotOccupancyOccupant);
|
router.post("/doAddLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doAddLotOccupancyOccupant);
|
||||||
router.post("/doUpdateLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyOccupant);
|
router.post("/doUpdateLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyOccupant);
|
||||||
router.post("/doDeleteLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyOccupant);
|
router.post("/doDeleteLotOccupancyOccupant", permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyOccupant);
|
||||||
|
router.post("/doAddLotOccupancyComment", permissionHandlers.updatePostHandler, handler_doAddLotOccupancyComment);
|
||||||
|
router.post("/doUpdateLotOccupancyComment", permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyComment);
|
||||||
|
router.post("/doDeleteLotOccupancyComment", permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyComment);
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ import handler_doAddLotOccupancyOccupant from "../handlers/lotOccupancies-post/d
|
||||||
import handler_doUpdateLotOccupancyOccupant from "../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js";
|
import handler_doUpdateLotOccupancyOccupant from "../handlers/lotOccupancies-post/doUpdateLotOccupancyOccupant.js";
|
||||||
import handler_doDeleteLotOccupancyOccupant from "../handlers/lotOccupancies-post/doDeleteLotOccupancyOccupant.js";
|
import handler_doDeleteLotOccupancyOccupant from "../handlers/lotOccupancies-post/doDeleteLotOccupancyOccupant.js";
|
||||||
|
|
||||||
|
import handler_doAddLotOccupancyComment from "../handlers/lotOccupancies-post/doAddLotOccupancyComment.js";
|
||||||
|
import handler_doUpdateLotOccupancyComment from "../handlers/lotOccupancies-post/doUpdateLotOccupancyComment.js";
|
||||||
|
import handler_doDeleteLotOccupancyComment from "../handlers/lotOccupancies-post/doDeleteLotOccupancyComment.js";
|
||||||
|
|
||||||
import * as permissionHandlers from "../handlers/permissions.js";
|
import * as permissionHandlers from "../handlers/permissions.js";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -69,5 +73,17 @@ router.post("/doDeleteLotOccupancyOccupant",
|
||||||
permissionHandlers.updatePostHandler,
|
permissionHandlers.updatePostHandler,
|
||||||
handler_doDeleteLotOccupancyOccupant);
|
handler_doDeleteLotOccupancyOccupant);
|
||||||
|
|
||||||
|
router.post("/doAddLotOccupancyComment",
|
||||||
|
permissionHandlers.updatePostHandler,
|
||||||
|
handler_doAddLotOccupancyComment);
|
||||||
|
|
||||||
|
router.post("/doUpdateLotOccupancyComment",
|
||||||
|
permissionHandlers.updatePostHandler,
|
||||||
|
handler_doUpdateLotOccupancyComment);
|
||||||
|
|
||||||
|
router.post("/doDeleteLotOccupancyComment",
|
||||||
|
permissionHandlers.updatePostHandler,
|
||||||
|
handler_doDeleteLotOccupancyComment);
|
||||||
|
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
@ -181,7 +181,8 @@ function importFromCSV() {
|
||||||
occupancyTypeId: preneedOccupancyType.occupancyTypeId,
|
occupancyTypeId: preneedOccupancyType.occupancyTypeId,
|
||||||
lotId,
|
lotId,
|
||||||
occupancyStartDateString,
|
occupancyStartDateString,
|
||||||
occupancyEndDateString
|
occupancyEndDateString,
|
||||||
|
occupancyTypeFieldIds: ""
|
||||||
}, user);
|
}, user);
|
||||||
const occupantPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
const occupantPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
||||||
addLotOccupancyOccupant({
|
addLotOccupancyOccupant({
|
||||||
|
|
@ -228,7 +229,8 @@ function importFromCSV() {
|
||||||
occupancyTypeId: deceasedOccupancyType.occupancyTypeId,
|
occupancyTypeId: deceasedOccupancyType.occupancyTypeId,
|
||||||
lotId,
|
lotId,
|
||||||
occupancyStartDateString,
|
occupancyStartDateString,
|
||||||
occupancyEndDateString
|
occupancyEndDateString,
|
||||||
|
occupancyTypeFieldIds: ""
|
||||||
}, user);
|
}, user);
|
||||||
const deceasedPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
const deceasedPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
||||||
addLotOccupancyOccupant({
|
addLotOccupancyOccupant({
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,8 @@ function importFromCSV() {
|
||||||
occupancyTypeId: preneedOccupancyType.occupancyTypeId,
|
occupancyTypeId: preneedOccupancyType.occupancyTypeId,
|
||||||
lotId,
|
lotId,
|
||||||
occupancyStartDateString,
|
occupancyStartDateString,
|
||||||
occupancyEndDateString
|
occupancyEndDateString,
|
||||||
|
occupancyTypeFieldIds: ""
|
||||||
}, user);
|
}, user);
|
||||||
|
|
||||||
const occupantPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
const occupantPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
||||||
|
|
@ -392,7 +393,8 @@ function importFromCSV() {
|
||||||
occupancyTypeId: deceasedOccupancyType.occupancyTypeId,
|
occupancyTypeId: deceasedOccupancyType.occupancyTypeId,
|
||||||
lotId,
|
lotId,
|
||||||
occupancyStartDateString,
|
occupancyStartDateString,
|
||||||
occupancyEndDateString
|
occupancyEndDateString,
|
||||||
|
occupancyTypeFieldIds: ""
|
||||||
}, user);
|
}, user);
|
||||||
|
|
||||||
const deceasedPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
const deceasedPostalCode = ((masterRow.CM_POST1 || "") + " " + (masterRow.CM_POST2 || "")).trim();
|
||||||
|
|
|
||||||
|
|
@ -202,10 +202,26 @@
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
<div class="level is-mobile">
|
||||||
|
<div class="level-left">
|
||||||
|
<div class="level-item">
|
||||||
<h2 class="title is-4 mt-2">Comments</h2>
|
<h2 class="title is-4 mt-2">Comments</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-right">
|
||||||
|
<div class="level-item">
|
||||||
|
<button class="button is-small is-success" id="button--addComment" type="button">
|
||||||
|
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||||
|
<span>Add Comment</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="container--lotOccupancyComments"></div>
|
<div id="container--lotOccupancyComments"></div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h2 class="title is-4">Fees</h2>
|
<h2 class="title is-4">Fees</h2>
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,10 @@
|
||||||
|
|
||||||
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
|
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
|
||||||
<div class="message is-warning">
|
<div class="message is-warning">
|
||||||
<p class="message-body">There are no <%= configFunctions.getProperty("aliases.occupants").toLowerCase() %>
|
<p class="message-body">
|
||||||
associated with this record.</p>
|
There are no <%= configFunctions.getProperty("aliases.occupants").toLowerCase() %>
|
||||||
|
associated with this record.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<table class="table is-fullwidth is-striped is-hoverable">
|
<table class="table is-fullwidth is-striped is-hoverable">
|
||||||
|
|
@ -118,6 +120,27 @@
|
||||||
|
|
||||||
<% if (lotOccupancy.lotOccupancyComments.length > 0) { %>
|
<% if (lotOccupancy.lotOccupancyComments.length > 0) { %>
|
||||||
<h2 class="title is-4">Comments</h2>
|
<h2 class="title is-4">Comments</h2>
|
||||||
|
<table class="table is-fullwidth is-striped is-hoverable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Commentor</th>
|
||||||
|
<th>Comment Date</th>
|
||||||
|
<th>Comment</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% for (const lotOccupancyComment of lotOccupancy.lotOccupancyComments) { %>
|
||||||
|
<tr>
|
||||||
|
<td><%= lotOccupancyComment.recordCreate_userName %></td>
|
||||||
|
<td>
|
||||||
|
<%= lotOccupancyComment.lotOccupancyCommentDateString %>
|
||||||
|
<%= (lotOccupancyComment.lotOccupancyCommentTime === 0 ? "" : lotOccupancyComment.lotOccupancyCommentTimeString) %>
|
||||||
|
</td>
|
||||||
|
<td><%= lotOccupancyComment.lotOccupancyComment %></td>
|
||||||
|
</tr>
|
||||||
|
<% } %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue