edit fee quantities
parent
c0cee3fb67
commit
a3203f5113
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { Request, Response } from 'express';
|
||||||
|
export declare function handler(request: Request, response: Response): Promise<void>;
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { updateLotOccupancyFeeQuantity } from '../../helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js';
|
||||||
|
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js';
|
||||||
|
export async function handler(request, response) {
|
||||||
|
const success = await updateLotOccupancyFeeQuantity(request.body, request.session);
|
||||||
|
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId);
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyFees
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export default handler;
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import type { Request, Response } from 'express'
|
||||||
|
|
||||||
|
import { updateLotOccupancyFeeQuantity } from '../../helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js'
|
||||||
|
|
||||||
|
import { getLotOccupancyFees } from '../../helpers/lotOccupancyDB/getLotOccupancyFees.js'
|
||||||
|
|
||||||
|
export async function handler(
|
||||||
|
request: Request,
|
||||||
|
response: Response
|
||||||
|
): Promise<void> {
|
||||||
|
const success = await updateLotOccupancyFeeQuantity(
|
||||||
|
request.body,
|
||||||
|
request.session
|
||||||
|
)
|
||||||
|
|
||||||
|
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId)
|
||||||
|
|
||||||
|
response.json({
|
||||||
|
success,
|
||||||
|
lotOccupancyFees
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default handler
|
||||||
|
|
@ -4,7 +4,7 @@ export async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
|
||||||
const lotOccupancyFees = database
|
const lotOccupancyFees = database
|
||||||
.prepare(`select o.lotOccupancyId, o.feeId,
|
.prepare(`select o.lotOccupancyId, o.feeId,
|
||||||
c.feeCategory, f.feeName,
|
c.feeCategory, f.feeName,
|
||||||
f.includeQuantity, o.feeAmount, o.taxAmount, o.quantity
|
f.includeQuantity, o.feeAmount, o.taxAmount, o.quantity, f.quantityUnit
|
||||||
from LotOccupancyFees o
|
from LotOccupancyFees o
|
||||||
left join Fees f on o.feeId = f.feeId
|
left join Fees f on o.feeId = f.feeId
|
||||||
left join FeeCategories c on f.feeCategoryId = c.feeCategoryId
|
left join FeeCategories c on f.feeCategoryId = c.feeCategoryId
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export async function getLotOccupancyFees(
|
||||||
.prepare(
|
.prepare(
|
||||||
`select o.lotOccupancyId, o.feeId,
|
`select o.lotOccupancyId, o.feeId,
|
||||||
c.feeCategory, f.feeName,
|
c.feeCategory, f.feeName,
|
||||||
f.includeQuantity, o.feeAmount, o.taxAmount, o.quantity
|
f.includeQuantity, o.feeAmount, o.taxAmount, o.quantity, f.quantityUnit
|
||||||
from LotOccupancyFees o
|
from LotOccupancyFees o
|
||||||
left join Fees f on o.feeId = f.feeId
|
left join Fees f on o.feeId = f.feeId
|
||||||
left join FeeCategories c on f.feeCategoryId = c.feeCategoryId
|
left join FeeCategories c on f.feeCategoryId = c.feeCategoryId
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import type * as recordTypes from '../../types/recordTypes';
|
||||||
|
interface UpdateLotOccupancyFeeQuantityForm {
|
||||||
|
lotOccupancyId: string | number;
|
||||||
|
feeId: string | number;
|
||||||
|
quantity: string | number;
|
||||||
|
}
|
||||||
|
export declare function updateLotOccupancyFeeQuantity(feeQuantityForm: UpdateLotOccupancyFeeQuantityForm, requestSession: recordTypes.PartialSession): Promise<boolean>;
|
||||||
|
export default updateLotOccupancyFeeQuantity;
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { acquireConnection } from './pool.js';
|
||||||
|
export async function updateLotOccupancyFeeQuantity(feeQuantityForm, requestSession) {
|
||||||
|
const rightNowMillis = Date.now();
|
||||||
|
const database = await acquireConnection();
|
||||||
|
const result = database
|
||||||
|
.prepare(`update LotOccupancyFees
|
||||||
|
set quantity = ?,
|
||||||
|
recordUpdate_userName = ?,
|
||||||
|
recordUpdate_timeMillis = ?
|
||||||
|
where recordDelete_timeMillis is null
|
||||||
|
and lotOccupancyId = ?
|
||||||
|
and feeId = ?`)
|
||||||
|
.run(feeQuantityForm.quantity, requestSession.user.userName, rightNowMillis, feeQuantityForm.lotOccupancyId, feeQuantityForm.feeId);
|
||||||
|
database.release();
|
||||||
|
return result.changes > 0;
|
||||||
|
}
|
||||||
|
export default updateLotOccupancyFeeQuantity;
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
|
import {
|
||||||
|
dateStringToInteger,
|
||||||
|
timeStringToInteger
|
||||||
|
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
|
||||||
|
|
||||||
|
import type * as recordTypes from '../../types/recordTypes'
|
||||||
|
|
||||||
|
interface UpdateLotOccupancyFeeQuantityForm {
|
||||||
|
lotOccupancyId: string | number
|
||||||
|
feeId: string | number
|
||||||
|
quantity: string | number
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateLotOccupancyFeeQuantity(
|
||||||
|
feeQuantityForm: UpdateLotOccupancyFeeQuantityForm,
|
||||||
|
requestSession: recordTypes.PartialSession
|
||||||
|
): Promise<boolean> {
|
||||||
|
const rightNowMillis = Date.now()
|
||||||
|
|
||||||
|
const database = await acquireConnection()
|
||||||
|
|
||||||
|
const result = database
|
||||||
|
.prepare(
|
||||||
|
`update LotOccupancyFees
|
||||||
|
set quantity = ?,
|
||||||
|
recordUpdate_userName = ?,
|
||||||
|
recordUpdate_timeMillis = ?
|
||||||
|
where recordDelete_timeMillis is null
|
||||||
|
and lotOccupancyId = ?
|
||||||
|
and feeId = ?`
|
||||||
|
)
|
||||||
|
.run(
|
||||||
|
feeQuantityForm.quantity,
|
||||||
|
requestSession.user!.userName,
|
||||||
|
rightNowMillis,
|
||||||
|
feeQuantityForm.lotOccupancyId,
|
||||||
|
feeQuantityForm.feeId
|
||||||
|
)
|
||||||
|
|
||||||
|
database.release()
|
||||||
|
|
||||||
|
return result.changes > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
export default updateLotOccupancyFeeQuantity
|
||||||
|
|
@ -1103,6 +1103,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
}
|
}
|
||||||
return feeGrandTotal;
|
return feeGrandTotal;
|
||||||
}
|
}
|
||||||
|
function editLotOccupancyFeeQuantity(clickEvent) {
|
||||||
|
const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||||
|
.feeId, 10);
|
||||||
|
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||||
|
return possibleFee.feeId === feeId;
|
||||||
|
});
|
||||||
|
if (fee === undefined) {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Fee Not Found',
|
||||||
|
message: 'Please refresh the page',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let updateCloseModalFunction;
|
||||||
|
function doUpdateQuantity(formEvent) {
|
||||||
|
formEvent.preventDefault();
|
||||||
|
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => {
|
||||||
|
const responseJSON = rawResponseJSON;
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyFees = responseJSON.lotOccupancyFees;
|
||||||
|
renderLotOccupancyFees();
|
||||||
|
updateCloseModalFunction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Error Updating Quantity',
|
||||||
|
message: 'Please try again.',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', {
|
||||||
|
onshow(modalElement) {
|
||||||
|
;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString();
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||||
|
},
|
||||||
|
onshown(modalElement, closeModalFunction) {
|
||||||
|
var _a;
|
||||||
|
updateCloseModalFunction = closeModalFunction;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').focus();
|
||||||
|
(_a = modalElement
|
||||||
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doUpdateQuantity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function deleteLotOccupancyFee(clickEvent) {
|
function deleteLotOccupancyFee(clickEvent) {
|
||||||
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
|
|
@ -1136,7 +1186,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotOccupancyFees() {
|
function renderLotOccupancyFees() {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c, _d, _e, _f, _g;
|
||||||
if (lotOccupancyFees.length === 0) {
|
if (lotOccupancyFees.length === 0) {
|
||||||
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
||||||
<p class="message-body">There are no fees associated with this record.</p>
|
<p class="message-body">There are no fees associated with this record.</p>
|
||||||
|
|
@ -1200,16 +1250,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
('<td class="is-hidden-print">' +
|
('<td class="is-hidden-print">' +
|
||||||
'<button class="button is-small is-danger is-light" data-tooltip="Delete Fee" type="button">' +
|
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||||
|
(((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false)
|
||||||
|
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||||
|
: '') +
|
||||||
|
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||||
'</button>' +
|
'</button>' +
|
||||||
|
'</div>' +
|
||||||
'</td>');
|
'</td>');
|
||||||
tableRowElement
|
(_e = tableRowElement
|
||||||
.querySelector('button')
|
.querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||||
.addEventListener('click', deleteLotOccupancyFee);
|
(_f = tableRowElement
|
||||||
lotOccupancyFeesContainerElement
|
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee);
|
||||||
.querySelector('tbody')
|
(_g = lotOccupancyFeesContainerElement
|
||||||
.append(tableRowElement);
|
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||||
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
||||||
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,56 @@ function getFeeGrandTotal() {
|
||||||
}
|
}
|
||||||
return feeGrandTotal;
|
return feeGrandTotal;
|
||||||
}
|
}
|
||||||
|
function editLotOccupancyFeeQuantity(clickEvent) {
|
||||||
|
const feeId = Number.parseInt(clickEvent.currentTarget.closest('tr').dataset
|
||||||
|
.feeId, 10);
|
||||||
|
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||||
|
return possibleFee.feeId === feeId;
|
||||||
|
});
|
||||||
|
if (fee === undefined) {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Fee Not Found',
|
||||||
|
message: 'Please refresh the page',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let updateCloseModalFunction;
|
||||||
|
function doUpdateQuantity(formEvent) {
|
||||||
|
formEvent.preventDefault();
|
||||||
|
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity', formEvent.currentTarget, (rawResponseJSON) => {
|
||||||
|
const responseJSON = rawResponseJSON;
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyFees = responseJSON.lotOccupancyFees;
|
||||||
|
renderLotOccupancyFees();
|
||||||
|
updateCloseModalFunction();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Error Updating Quantity',
|
||||||
|
message: 'Please try again.',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', {
|
||||||
|
onshow(modalElement) {
|
||||||
|
;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--lotOccupancyId').value = lotOccupancyId;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--feeId').value = fee.feeId.toString();
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').valueAsNumber = fee.quantity;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantityUnit').textContent = fee.quantityUnit;
|
||||||
|
},
|
||||||
|
onshown(modalElement, closeModalFunction) {
|
||||||
|
var _a;
|
||||||
|
updateCloseModalFunction = closeModalFunction;
|
||||||
|
modalElement.querySelector('#lotOccupancyFeeQuantity--quantity').focus();
|
||||||
|
(_a = modalElement
|
||||||
|
.querySelector('form')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', doUpdateQuantity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function deleteLotOccupancyFee(clickEvent) {
|
function deleteLotOccupancyFee(clickEvent) {
|
||||||
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
const feeId = clickEvent.currentTarget.closest('.container--lotOccupancyFee').dataset.feeId;
|
||||||
function doDelete() {
|
function doDelete() {
|
||||||
|
|
@ -46,7 +96,7 @@ function deleteLotOccupancyFee(clickEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function renderLotOccupancyFees() {
|
function renderLotOccupancyFees() {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c, _d, _e, _f, _g;
|
||||||
if (lotOccupancyFees.length === 0) {
|
if (lotOccupancyFees.length === 0) {
|
||||||
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
lotOccupancyFeesContainerElement.innerHTML = `<div class="message is-info">
|
||||||
<p class="message-body">There are no fees associated with this record.</p>
|
<p class="message-body">There are no fees associated with this record.</p>
|
||||||
|
|
@ -110,16 +160,21 @@ function renderLotOccupancyFees() {
|
||||||
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
(lotOccupancyFee.feeAmount * lotOccupancyFee.quantity).toFixed(2) +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
('<td class="is-hidden-print">' +
|
('<td class="is-hidden-print">' +
|
||||||
'<button class="button is-small is-danger is-light" data-tooltip="Delete Fee" type="button">' +
|
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||||
|
(((_d = lotOccupancyFee.includeQuantity) !== null && _d !== void 0 ? _d : false)
|
||||||
|
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||||
|
: '') +
|
||||||
|
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||||
'</button>' +
|
'</button>' +
|
||||||
|
'</div>' +
|
||||||
'</td>');
|
'</td>');
|
||||||
tableRowElement
|
(_e = tableRowElement
|
||||||
.querySelector('button')
|
.querySelector('.button--editQuantity')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', editLotOccupancyFeeQuantity);
|
||||||
.addEventListener('click', deleteLotOccupancyFee);
|
(_f = tableRowElement
|
||||||
lotOccupancyFeesContainerElement
|
.querySelector('.button--delete')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', deleteLotOccupancyFee);
|
||||||
.querySelector('tbody')
|
(_g = lotOccupancyFeesContainerElement
|
||||||
.append(tableRowElement);
|
.querySelector('tbody')) === null || _g === void 0 ? void 0 : _g.append(tableRowElement);
|
||||||
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
feeAmountTotal += lotOccupancyFee.feeAmount * lotOccupancyFee.quantity;
|
||||||
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
taxAmountTotal += lotOccupancyFee.taxAmount * lotOccupancyFee.quantity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,92 @@ function getFeeGrandTotal(): number {
|
||||||
return feeGrandTotal
|
return feeGrandTotal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editLotOccupancyFeeQuantity(clickEvent: Event): void {
|
||||||
|
const feeId = Number.parseInt(
|
||||||
|
(clickEvent.currentTarget as HTMLButtonElement).closest('tr')!.dataset
|
||||||
|
.feeId!,
|
||||||
|
10
|
||||||
|
)
|
||||||
|
const fee = lotOccupancyFees.find((possibleFee) => {
|
||||||
|
return possibleFee.feeId === feeId
|
||||||
|
})
|
||||||
|
|
||||||
|
if (fee === undefined) {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Fee Not Found',
|
||||||
|
message: 'Please refresh the page',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let updateCloseModalFunction: () => void
|
||||||
|
|
||||||
|
function doUpdateQuantity(formEvent: SubmitEvent): void {
|
||||||
|
formEvent.preventDefault()
|
||||||
|
|
||||||
|
cityssm.postJSON(
|
||||||
|
los.urlPrefix + '/lotOccupancies/doUpdateLotOccupancyFeeQuantity',
|
||||||
|
formEvent.currentTarget,
|
||||||
|
(rawResponseJSON) => {
|
||||||
|
const responseJSON = rawResponseJSON as {
|
||||||
|
success: boolean
|
||||||
|
lotOccupancyFees?: recordTypes.LotOccupancyFee[]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseJSON.success) {
|
||||||
|
lotOccupancyFees = responseJSON.lotOccupancyFees!
|
||||||
|
renderLotOccupancyFees()
|
||||||
|
updateCloseModalFunction()
|
||||||
|
} else {
|
||||||
|
bulmaJS.alert({
|
||||||
|
title: 'Error Updating Quantity',
|
||||||
|
message: 'Please try again.',
|
||||||
|
contextualColorName: 'danger'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
cityssm.openHtmlModal('lotOccupancy-editFeeQuantity', {
|
||||||
|
onshow(modalElement) {
|
||||||
|
;(
|
||||||
|
modalElement.querySelector(
|
||||||
|
'#lotOccupancyFeeQuantity--lotOccupancyId'
|
||||||
|
) as HTMLInputElement
|
||||||
|
).value = lotOccupancyId
|
||||||
|
;(
|
||||||
|
modalElement.querySelector(
|
||||||
|
'#lotOccupancyFeeQuantity--feeId'
|
||||||
|
) as HTMLInputElement
|
||||||
|
).value = fee.feeId.toString()
|
||||||
|
;(
|
||||||
|
modalElement.querySelector(
|
||||||
|
'#lotOccupancyFeeQuantity--quantity'
|
||||||
|
) as HTMLInputElement
|
||||||
|
).valueAsNumber = fee.quantity!
|
||||||
|
;(
|
||||||
|
modalElement.querySelector(
|
||||||
|
'#lotOccupancyFeeQuantity--quantityUnit'
|
||||||
|
) as HTMLElement
|
||||||
|
).textContent = fee.quantityUnit!
|
||||||
|
},
|
||||||
|
onshown(modalElement, closeModalFunction) {
|
||||||
|
updateCloseModalFunction = closeModalFunction
|
||||||
|
;(
|
||||||
|
modalElement.querySelector(
|
||||||
|
'#lotOccupancyFeeQuantity--quantity'
|
||||||
|
) as HTMLInputElement
|
||||||
|
).focus()
|
||||||
|
|
||||||
|
modalElement
|
||||||
|
.querySelector('form')
|
||||||
|
?.addEventListener('submit', doUpdateQuantity)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function deleteLotOccupancyFee(clickEvent: Event): void {
|
function deleteLotOccupancyFee(clickEvent: Event): void {
|
||||||
const feeId = (
|
const feeId = (
|
||||||
(clickEvent.currentTarget as HTMLElement).closest(
|
(clickEvent.currentTarget as HTMLElement).closest(
|
||||||
|
|
@ -149,18 +235,27 @@ function renderLotOccupancyFees(): void {
|
||||||
(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2) +
|
(lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!).toFixed(2) +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
('<td class="is-hidden-print">' +
|
('<td class="is-hidden-print">' +
|
||||||
'<button class="button is-small is-danger is-light" data-tooltip="Delete Fee" type="button">' +
|
'<div class="buttons are-small is-flex-wrap-nowrap is-justify-content-end">' +
|
||||||
|
(lotOccupancyFee.includeQuantity ?? false
|
||||||
|
? '<button class="button is-primary button--editQuantity"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span><span>Edit</span></button>'
|
||||||
|
: '') +
|
||||||
|
'<button class="button is-danger is-light button--delete" data-tooltip="Delete Fee" type="button">' +
|
||||||
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
'<i class="fas fa-trash" aria-hidden="true"></i>' +
|
||||||
'</button>' +
|
'</button>' +
|
||||||
|
'</div>' +
|
||||||
'</td>')
|
'</td>')
|
||||||
|
|
||||||
tableRowElement
|
tableRowElement
|
||||||
.querySelector('button')!
|
.querySelector('.button--editQuantity')
|
||||||
.addEventListener('click', deleteLotOccupancyFee)
|
?.addEventListener('click', editLotOccupancyFeeQuantity)
|
||||||
|
|
||||||
|
tableRowElement
|
||||||
|
.querySelector('.button--delete')
|
||||||
|
?.addEventListener('click', deleteLotOccupancyFee)
|
||||||
|
|
||||||
lotOccupancyFeesContainerElement
|
lotOccupancyFeesContainerElement
|
||||||
.querySelector('tbody')!
|
.querySelector('tbody')
|
||||||
.append(tableRowElement)
|
?.append(tableRowElement)
|
||||||
|
|
||||||
feeAmountTotal += lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!
|
feeAmountTotal += lotOccupancyFee.feeAmount! * lotOccupancyFee.quantity!
|
||||||
taxAmountTotal += lotOccupancyFee.taxAmount! * lotOccupancyFee.quantity!
|
taxAmountTotal += lotOccupancyFee.taxAmount! * lotOccupancyFee.quantity!
|
||||||
|
|
@ -185,7 +280,9 @@ function renderLotOccupancyFees(): void {
|
||||||
renderLotOccupancyTransactions()
|
renderLotOccupancyTransactions()
|
||||||
}
|
}
|
||||||
|
|
||||||
const addFeeButtonElement = document.querySelector('#button--addFee') as HTMLButtonElement
|
const addFeeButtonElement = document.querySelector(
|
||||||
|
'#button--addFee'
|
||||||
|
) as HTMLButtonElement
|
||||||
|
|
||||||
addFeeButtonElement.addEventListener('click', () => {
|
addFeeButtonElement.addEventListener('click', () => {
|
||||||
if (los.hasUnsavedChanges()) {
|
if (los.hasUnsavedChanges()) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<div class="modal" role="dialog">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-card">
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<h3 class="modal-card-title">Edit Quantity</h3>
|
||||||
|
<button
|
||||||
|
class="delete is-close-modal-button"
|
||||||
|
aria-label="close"
|
||||||
|
type="button"
|
||||||
|
></button>
|
||||||
|
</header>
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<form id="form--lotOccupancyFeeQuantity">
|
||||||
|
<input id="lotOccupancyFeeQuantity--lotOccupancyId" name="lotOccupancyId" type="hidden" />
|
||||||
|
<input id="lotOccupancyFeeQuantity--feeId" name="feeId" type="hidden" />
|
||||||
|
<label class="label" for="lotOccupancyFeeQuantity--quantity"
|
||||||
|
>Quantity</label
|
||||||
|
>
|
||||||
|
<div class="field has-addons">
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
id="lotOccupancyFeeQuantity--quantity"
|
||||||
|
name="quantity"
|
||||||
|
type="number"
|
||||||
|
value="1"
|
||||||
|
min="0.1"
|
||||||
|
max="999.9"
|
||||||
|
step="0.1"
|
||||||
|
required
|
||||||
|
onwheel="return false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<span
|
||||||
|
class="button is-static"
|
||||||
|
id="lotOccupancyFeeQuantity--quantityUnit"
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot justify-right">
|
||||||
|
<button
|
||||||
|
class="button is-success"
|
||||||
|
type="submit"
|
||||||
|
form="form--lotOccupancyFeeQuantity"
|
||||||
|
>
|
||||||
|
<span class="icon"><i class="fas fa-save" aria-hidden="true"></i></span>
|
||||||
|
<span>Update Quantity</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
|
|
@ -18,6 +18,7 @@ import handler_doUpdateLotOccupancyComment from '../handlers/lotOccupancies-post
|
||||||
import handler_doDeleteLotOccupancyComment from '../handlers/lotOccupancies-post/doDeleteLotOccupancyComment.js';
|
import handler_doDeleteLotOccupancyComment from '../handlers/lotOccupancies-post/doDeleteLotOccupancyComment.js';
|
||||||
import handler_doGetFees from '../handlers/lotOccupancies-post/doGetFees.js';
|
import handler_doGetFees from '../handlers/lotOccupancies-post/doGetFees.js';
|
||||||
import handler_doAddLotOccupancyFee from '../handlers/lotOccupancies-post/doAddLotOccupancyFee.js';
|
import handler_doAddLotOccupancyFee from '../handlers/lotOccupancies-post/doAddLotOccupancyFee.js';
|
||||||
|
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js';
|
||||||
import handler_doDeleteLotOccupancyFee from '../handlers/lotOccupancies-post/doDeleteLotOccupancyFee.js';
|
import handler_doDeleteLotOccupancyFee from '../handlers/lotOccupancies-post/doDeleteLotOccupancyFee.js';
|
||||||
import handler_doGetDynamicsGPDocument from '../handlers/lotOccupancies-post/doGetDynamicsGPDocument.js';
|
import handler_doGetDynamicsGPDocument from '../handlers/lotOccupancies-post/doGetDynamicsGPDocument.js';
|
||||||
import handler_doAddLotOccupancyTransaction from '../handlers/lotOccupancies-post/doAddLotOccupancyTransaction.js';
|
import handler_doAddLotOccupancyTransaction from '../handlers/lotOccupancies-post/doAddLotOccupancyTransaction.js';
|
||||||
|
|
@ -44,6 +45,7 @@ router.post('/doUpdateLotOccupancyComment', permissionHandlers.updatePostHandler
|
||||||
router.post('/doDeleteLotOccupancyComment', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyComment);
|
router.post('/doDeleteLotOccupancyComment', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyComment);
|
||||||
router.post('/doGetFees', permissionHandlers.updatePostHandler, handler_doGetFees);
|
router.post('/doGetFees', permissionHandlers.updatePostHandler, handler_doGetFees);
|
||||||
router.post('/doAddLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyFee);
|
router.post('/doAddLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doAddLotOccupancyFee);
|
||||||
|
router.post('/doUpdateLotOccupancyFeeQuantity', permissionHandlers.updatePostHandler, handler_doUpdateLotOccupancyFeeQuantity);
|
||||||
router.post('/doDeleteLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyFee);
|
router.post('/doDeleteLotOccupancyFee', permissionHandlers.updatePostHandler, handler_doDeleteLotOccupancyFee);
|
||||||
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||||
router.post('/doGetDynamicsGPDocument', permissionHandlers.updatePostHandler, handler_doGetDynamicsGPDocument);
|
router.post('/doGetDynamicsGPDocument', permissionHandlers.updatePostHandler, handler_doGetDynamicsGPDocument);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import handler_doDeleteLotOccupancyComment from '../handlers/lotOccupancies-post
|
||||||
|
|
||||||
import handler_doGetFees from '../handlers/lotOccupancies-post/doGetFees.js'
|
import handler_doGetFees from '../handlers/lotOccupancies-post/doGetFees.js'
|
||||||
import handler_doAddLotOccupancyFee from '../handlers/lotOccupancies-post/doAddLotOccupancyFee.js'
|
import handler_doAddLotOccupancyFee from '../handlers/lotOccupancies-post/doAddLotOccupancyFee.js'
|
||||||
|
import handler_doUpdateLotOccupancyFeeQuantity from '../handlers/lotOccupancies-post/doUpdateLotOccupancyFeeQuantity.js'
|
||||||
import handler_doDeleteLotOccupancyFee from '../handlers/lotOccupancies-post/doDeleteLotOccupancyFee.js'
|
import handler_doDeleteLotOccupancyFee from '../handlers/lotOccupancies-post/doDeleteLotOccupancyFee.js'
|
||||||
|
|
||||||
import handler_doGetDynamicsGPDocument from '../handlers/lotOccupancies-post/doGetDynamicsGPDocument.js'
|
import handler_doGetDynamicsGPDocument from '../handlers/lotOccupancies-post/doGetDynamicsGPDocument.js'
|
||||||
|
|
@ -156,6 +157,12 @@ router.post(
|
||||||
handler_doAddLotOccupancyFee as RequestHandler
|
handler_doAddLotOccupancyFee as RequestHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
|
router.post(
|
||||||
|
'/doUpdateLotOccupancyFeeQuantity',
|
||||||
|
permissionHandlers.updatePostHandler,
|
||||||
|
handler_doUpdateLotOccupancyFeeQuantity as RequestHandler
|
||||||
|
)
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/doDeleteLotOccupancyFee',
|
'/doDeleteLotOccupancyFee',
|
||||||
permissionHandlers.updatePostHandler,
|
permissionHandlers.updatePostHandler,
|
||||||
|
|
|
||||||
|
|
@ -549,28 +549,28 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns is-desktop">
|
||||||
<div class="column">
|
<div class="column is-7-desktop">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="level is-mobile">
|
<div class="level is-mobile">
|
||||||
<div class="level-left">
|
<div class="level-left">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<h2 class="title is-4">Fees</h2>
|
<h2 class="title is-4">Fees</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="level-right">
|
|
||||||
<div class="level-item">
|
|
||||||
<button class="button is-small is-success is-hidden-print" id="button--addFee" type="button">
|
|
||||||
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
|
||||||
<span>Add Fee</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-block is-block" id="container--lotOccupancyFees"></div>
|
<div class="level-right">
|
||||||
|
<div class="level-item">
|
||||||
|
<button class="button is-small is-success is-hidden-print" id="button--addFee" type="button">
|
||||||
|
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
|
||||||
|
<span>Add Fee</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel-block is-block" id="container--lotOccupancyFees"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue