transfer focus with fee and transaction modals
parent
699dc02a71
commit
c0cee3fb67
|
|
@ -1090,7 +1090,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
|
||||
"use strict";
|
||||
/* eslint-disable @typescript-eslint/indent, unicorn/prefer-module */
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyFees = exports.lotOccupancyFees;
|
||||
delete exports.lotOccupancyFees;
|
||||
|
|
@ -1220,7 +1219,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2);
|
||||
renderLotOccupancyTransactions();
|
||||
}
|
||||
(_a = document.querySelector('#button--addFee')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
|
||||
const addFeeButtonElement = document.querySelector('#button--addFee');
|
||||
addFeeButtonElement.addEventListener('click', () => {
|
||||
if (los.hasUnsavedChanges()) {
|
||||
bulmaJS.alert({
|
||||
message: 'Please save all unsaved changes before adding fees.',
|
||||
|
|
@ -1378,6 +1378,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
addFeeButtonElement.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1518,9 +1519,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
'</div>');
|
||||
}
|
||||
}
|
||||
document
|
||||
.querySelector('#button--addTransaction')
|
||||
.addEventListener('click', () => {
|
||||
const addTransactionButtonElement = document.querySelector('#button--addTransaction');
|
||||
addTransactionButtonElement.addEventListener('click', () => {
|
||||
let transactionAmountElement;
|
||||
let externalReceiptNumberElement;
|
||||
let addCloseModalFunction;
|
||||
|
|
@ -1554,8 +1554,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
.querySelector('.help');
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' ';
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
iconElement.innerHTML = '<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
return;
|
||||
}
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', {
|
||||
|
|
@ -1606,6 +1605,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
transactionAmountElement.focus();
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
|
|
@ -1613,6 +1613,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
addTransactionButtonElement.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
/* eslint-disable @typescript-eslint/indent, unicorn/prefer-module */
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let lotOccupancyFees = exports.lotOccupancyFees;
|
||||
delete exports.lotOccupancyFees;
|
||||
|
|
@ -130,7 +129,8 @@ function renderLotOccupancyFees() {
|
|||
lotOccupancyFeesContainerElement.querySelector('#lotOccupancyFees--grandTotal').textContent = '$' + (feeAmountTotal + taxAmountTotal).toFixed(2);
|
||||
renderLotOccupancyTransactions();
|
||||
}
|
||||
(_a = document.querySelector('#button--addFee')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
|
||||
const addFeeButtonElement = document.querySelector('#button--addFee');
|
||||
addFeeButtonElement.addEventListener('click', () => {
|
||||
if (los.hasUnsavedChanges()) {
|
||||
bulmaJS.alert({
|
||||
message: 'Please save all unsaved changes before adding fees.',
|
||||
|
|
@ -288,6 +288,7 @@ function renderLotOccupancyFees() {
|
|||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
addFeeButtonElement.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -428,9 +429,8 @@ function renderLotOccupancyTransactions() {
|
|||
'</div>');
|
||||
}
|
||||
}
|
||||
document
|
||||
.querySelector('#button--addTransaction')
|
||||
.addEventListener('click', () => {
|
||||
const addTransactionButtonElement = document.querySelector('#button--addTransaction');
|
||||
addTransactionButtonElement.addEventListener('click', () => {
|
||||
let transactionAmountElement;
|
||||
let externalReceiptNumberElement;
|
||||
let addCloseModalFunction;
|
||||
|
|
@ -464,8 +464,7 @@ document
|
|||
.querySelector('.help');
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' ';
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
iconElement.innerHTML = '<i class="fas fa-minus" aria-hidden="true"></i>';
|
||||
return;
|
||||
}
|
||||
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument', {
|
||||
|
|
@ -516,6 +515,7 @@ document
|
|||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
transactionAmountElement.focus();
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
modalElement
|
||||
.querySelector('form')
|
||||
|
|
@ -523,6 +523,7 @@ document
|
|||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped();
|
||||
addTransactionButtonElement.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -185,7 +185,9 @@ function renderLotOccupancyFees(): void {
|
|||
renderLotOccupancyTransactions()
|
||||
}
|
||||
|
||||
document.querySelector('#button--addFee')?.addEventListener('click', () => {
|
||||
const addFeeButtonElement = document.querySelector('#button--addFee') as HTMLButtonElement
|
||||
|
||||
addFeeButtonElement.addEventListener('click', () => {
|
||||
if (los.hasUnsavedChanges()) {
|
||||
bulmaJS.alert({
|
||||
message: 'Please save all unsaved changes before adding fees.',
|
||||
|
|
@ -410,6 +412,7 @@ document.querySelector('#button--addFee')?.addEventListener('click', () => {
|
|||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
addFeeButtonElement.focus()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -602,171 +605,175 @@ function renderLotOccupancyTransactions(): void {
|
|||
}
|
||||
}
|
||||
|
||||
document
|
||||
.querySelector('#button--addTransaction')!
|
||||
.addEventListener('click', () => {
|
||||
let transactionAmountElement: HTMLInputElement
|
||||
let externalReceiptNumberElement: HTMLInputElement
|
||||
const addTransactionButtonElement = document.querySelector(
|
||||
'#button--addTransaction'
|
||||
) as HTMLButtonElement
|
||||
|
||||
let addCloseModalFunction: () => void
|
||||
addTransactionButtonElement.addEventListener('click', () => {
|
||||
let transactionAmountElement: HTMLInputElement
|
||||
let externalReceiptNumberElement: HTMLInputElement
|
||||
|
||||
function doAddTransaction(submitEvent: SubmitEvent): void {
|
||||
submitEvent.preventDefault()
|
||||
let addCloseModalFunction: () => void
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction',
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[]
|
||||
}
|
||||
function doAddTransaction(submitEvent: SubmitEvent): void {
|
||||
submitEvent.preventDefault()
|
||||
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions!
|
||||
addCloseModalFunction()
|
||||
renderLotOccupancyTransactions()
|
||||
} else {
|
||||
bulmaJS.confirm({
|
||||
title: 'Error Adding Transaction',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
}
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doAddLotOccupancyTransaction',
|
||||
submitEvent.currentTarget,
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
lotOccupancyTransactions?: recordTypes.LotOccupancyTransaction[]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function dynamicsGP_refreshExternalReceiptNumberIcon(): void {
|
||||
const externalReceiptNumber = externalReceiptNumberElement.value
|
||||
|
||||
const iconElement = externalReceiptNumberElement
|
||||
.closest('.control')!
|
||||
.querySelector('.icon') as HTMLElement
|
||||
|
||||
const helpTextElement = externalReceiptNumberElement
|
||||
.closest('.field')!
|
||||
.querySelector('.help') as HTMLElement
|
||||
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' '
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-minus" aria-hidden="true"></i>'
|
||||
return
|
||||
if (responseJSON.success) {
|
||||
lotOccupancyTransactions = responseJSON.lotOccupancyTransactions!
|
||||
addCloseModalFunction()
|
||||
renderLotOccupancyTransactions()
|
||||
} else {
|
||||
bulmaJS.confirm({
|
||||
title: 'Error Adding Transaction',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument',
|
||||
{
|
||||
externalReceiptNumber
|
||||
},
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
dynamicsGPDocument?: recordTypes.DynamicsGPDocument
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function dynamicsGP_refreshExternalReceiptNumberIcon(): void {
|
||||
const externalReceiptNumber = externalReceiptNumberElement.value
|
||||
|
||||
if (
|
||||
!responseJSON.success ||
|
||||
responseJSON.dynamicsGPDocument === undefined
|
||||
) {
|
||||
helpTextElement.textContent = 'No Matching Document Found'
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-times-circle" aria-hidden="true"></i>'
|
||||
} else if (
|
||||
transactionAmountElement.valueAsNumber ===
|
||||
responseJSON.dynamicsGPDocument.documentTotal
|
||||
) {
|
||||
helpTextElement.textContent = 'Matching Document Found'
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-check-circle" aria-hidden="true"></i>'
|
||||
} else {
|
||||
helpTextElement.textContent =
|
||||
'Matching Document: $' +
|
||||
responseJSON.dynamicsGPDocument.documentTotal.toFixed(2)
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-exclamation-triangle" aria-hidden="true"></i>'
|
||||
}
|
||||
}
|
||||
)
|
||||
const iconElement = externalReceiptNumberElement
|
||||
.closest('.control')!
|
||||
.querySelector('.icon') as HTMLElement
|
||||
|
||||
const helpTextElement = externalReceiptNumberElement
|
||||
.closest('.field')!
|
||||
.querySelector('.help') as HTMLElement
|
||||
|
||||
if (externalReceiptNumber === '') {
|
||||
helpTextElement.innerHTML = ' '
|
||||
iconElement.innerHTML = '<i class="fas fa-minus" aria-hidden="true"></i>'
|
||||
return
|
||||
}
|
||||
|
||||
cityssm.openHtmlModal('lotOccupancy-addTransaction', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--lotOccupancyId'
|
||||
) as HTMLInputElement
|
||||
).value = lotOccupancyId.toString()
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix + '/lotOccupancies/doGetDynamicsGPDocument',
|
||||
{
|
||||
externalReceiptNumber
|
||||
},
|
||||
(rawResponseJSON) => {
|
||||
const responseJSON = rawResponseJSON as {
|
||||
success: boolean
|
||||
dynamicsGPDocument?: recordTypes.DynamicsGPDocument
|
||||
}
|
||||
|
||||
const feeGrandTotal = getFeeGrandTotal()
|
||||
const transactionGrandTotal = getTransactionGrandTotal()
|
||||
if (
|
||||
!responseJSON.success ||
|
||||
responseJSON.dynamicsGPDocument === undefined
|
||||
) {
|
||||
helpTextElement.textContent = 'No Matching Document Found'
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-times-circle" aria-hidden="true"></i>'
|
||||
} else if (
|
||||
transactionAmountElement.valueAsNumber ===
|
||||
responseJSON.dynamicsGPDocument.documentTotal
|
||||
) {
|
||||
helpTextElement.textContent = 'Matching Document Found'
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-check-circle" aria-hidden="true"></i>'
|
||||
} else {
|
||||
helpTextElement.textContent =
|
||||
'Matching Document: $' +
|
||||
responseJSON.dynamicsGPDocument.documentTotal.toFixed(2)
|
||||
iconElement.innerHTML =
|
||||
'<i class="fas fa-exclamation-triangle" aria-hidden="true"></i>'
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
transactionAmountElement = modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--transactionAmount'
|
||||
cityssm.openHtmlModal('lotOccupancy-addTransaction', {
|
||||
onshow(modalElement) {
|
||||
los.populateAliases(modalElement)
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--lotOccupancyId'
|
||||
) as HTMLInputElement
|
||||
).value = lotOccupancyId.toString()
|
||||
|
||||
transactionAmountElement.min = (-1 * transactionGrandTotal).toFixed(2)
|
||||
const feeGrandTotal = getFeeGrandTotal()
|
||||
const transactionGrandTotal = getTransactionGrandTotal()
|
||||
|
||||
transactionAmountElement.max = Math.max(
|
||||
feeGrandTotal - transactionGrandTotal,
|
||||
0
|
||||
).toFixed(2)
|
||||
transactionAmountElement = modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--transactionAmount'
|
||||
) as HTMLInputElement
|
||||
|
||||
transactionAmountElement.value = Math.max(
|
||||
feeGrandTotal - transactionGrandTotal,
|
||||
0
|
||||
).toFixed(2)
|
||||
transactionAmountElement.min = (-1 * transactionGrandTotal).toFixed(2)
|
||||
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
externalReceiptNumberElement = modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--externalReceiptNumber'
|
||||
)!
|
||||
transactionAmountElement.max = Math.max(
|
||||
feeGrandTotal - transactionGrandTotal,
|
||||
0
|
||||
).toFixed(2)
|
||||
|
||||
const externalReceiptNumberControlElement =
|
||||
externalReceiptNumberElement.closest('.control')!
|
||||
transactionAmountElement.value = Math.max(
|
||||
feeGrandTotal - transactionGrandTotal,
|
||||
0
|
||||
).toFixed(2)
|
||||
|
||||
externalReceiptNumberControlElement.classList.add('has-icons-right')
|
||||
if (los.dynamicsGPIntegrationIsEnabled) {
|
||||
externalReceiptNumberElement = modalElement.querySelector(
|
||||
'#lotOccupancyTransactionAdd--externalReceiptNumber'
|
||||
)!
|
||||
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML(
|
||||
'beforeend',
|
||||
'<span class="icon is-small is-right"></span>'
|
||||
)
|
||||
const externalReceiptNumberControlElement =
|
||||
externalReceiptNumberElement.closest('.control')!
|
||||
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML(
|
||||
'afterend',
|
||||
'<p class="help has-text-right"></p>'
|
||||
)
|
||||
externalReceiptNumberControlElement.classList.add('has-icons-right')
|
||||
|
||||
externalReceiptNumberElement.addEventListener(
|
||||
'change',
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon
|
||||
)
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML(
|
||||
'beforeend',
|
||||
'<span class="icon is-small is-right"></span>'
|
||||
)
|
||||
|
||||
transactionAmountElement.addEventListener(
|
||||
'change',
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon
|
||||
)
|
||||
externalReceiptNumberControlElement.insertAdjacentHTML(
|
||||
'afterend',
|
||||
'<p class="help has-text-right"></p>'
|
||||
)
|
||||
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon()
|
||||
}
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
externalReceiptNumberElement.addEventListener(
|
||||
'change',
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon
|
||||
)
|
||||
|
||||
addCloseModalFunction = closeModalFunction
|
||||
transactionAmountElement.addEventListener(
|
||||
'change',
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon
|
||||
)
|
||||
|
||||
modalElement
|
||||
.querySelector('form')!
|
||||
.addEventListener('submit', doAddTransaction)
|
||||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
dynamicsGP_refreshExternalReceiptNumberIcon()
|
||||
}
|
||||
})
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
|
||||
transactionAmountElement.focus()
|
||||
|
||||
addCloseModalFunction = closeModalFunction
|
||||
|
||||
modalElement
|
||||
.querySelector('form')!
|
||||
.addEventListener('submit', doAddTransaction)
|
||||
},
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
addTransactionButtonElement.focus()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
renderLotOccupancyFees()
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue