update occupant comment title on create

deepsource-autofix-76c6eb20
Dan Gowans 2023-02-01 13:23:55 -05:00
parent 584f33fb98
commit b2077f2f9a
7 changed files with 235 additions and 211 deletions

View File

@ -2,7 +2,7 @@
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c, _d, _e, _f;
const los = exports.los; const los = exports.los;
const lotOccupancyId = document.querySelector('#lotOccupancy--lotOccupancyId').value; const lotOccupancyId = document.querySelector('#lotOccupancy--lotOccupancyId').value;
const isCreate = lotOccupancyId === ''; const isCreate = lotOccupancyId === '';
@ -182,8 +182,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>`; </div>`;
return; return;
} }
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', {
@ -256,7 +256,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.confirm({ bulmaJS.confirm({
title: 'Confirm Change', title: 'Confirm Change',
message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n
This change affects the additional fields associated with this record, and may also affect the available fees.`, This change affects the additional fields associated with this record, and may also affect the available fees.`,
contextualColorName: 'warning', contextualColorName: 'warning',
okButton: { okButton: {
text: 'Yes, Keep the Change', text: 'Yes, Keep the Change',
@ -418,9 +418,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
}); });
}); });
document (_d = document
.querySelector('.is-lot-view-button') .querySelector('.is-lot-view-button')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', () => {
.addEventListener('click', () => {
const lotId = document.querySelector('#lotOccupancy--lotId').value; const lotId = document.querySelector('#lotOccupancy--lotId').value;
if (lotId === '') { if (lotId === '') {
bulmaJS.alert({ bulmaJS.alert({
@ -432,9 +431,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
window.open(los.urlPrefix + '/lots/' + lotId); window.open(los.urlPrefix + '/lots/' + lotId);
} }
}); });
document (_e = document
.querySelector('.is-clear-lot-button') .querySelector('.is-clear-lot-button')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', () => {
.addEventListener('click', () => {
if (lotNameElement.disabled) { if (lotNameElement.disabled) {
bulmaJS.alert({ bulmaJS.alert({
message: 'You need to unlock the field before clearing it.', message: 'You need to unlock the field before clearing it.',
@ -449,9 +447,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
// Start Date // Start Date
los.initializeDatePickers(formElement); los.initializeDatePickers(formElement);
document (_f = document
.querySelector('#lotOccupancy--occupancyStartDateString') .querySelector('#lotOccupancy--occupancyStartDateString')) === null || _f === void 0 ? void 0 : _f.addEventListener('change', () => {
.addEventListener('change', () => {
const endDatePicker = document.querySelector('#lotOccupancy--occupancyEndDateString').bulmaCalendar.datePicker; const endDatePicker = document.querySelector('#lotOccupancy--occupancyEndDateString').bulmaCalendar.datePicker;
endDatePicker.min = document.querySelector('#lotOccupancy--occupancyStartDateString').value; endDatePicker.min = document.querySelector('#lotOccupancy--occupancyStartDateString').value;
endDatePicker.refresh(); endDatePicker.refresh();
@ -699,10 +696,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (isCreate) { if (isCreate) {
const lotOccupantTypeIdElement = document.querySelector('#lotOccupancy--lotOccupantTypeId'); const lotOccupantTypeIdElement = document.querySelector('#lotOccupancy--lotOccupantTypeId');
lotOccupantTypeIdElement.addEventListener('change', () => { lotOccupantTypeIdElement.addEventListener('change', () => {
var _a;
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']"); const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
for (const occupantField of occupantFields) { for (const occupantField of occupantFields) {
occupantField.disabled = lotOccupantTypeIdElement.value === ''; occupantField.disabled = lotOccupantTypeIdElement.value === '';
} }
let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _a !== void 0 ? _a : '';
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
} }
else { else {

View File

@ -2,7 +2,7 @@
/* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */ /* eslint-disable spaced-comment, @typescript-eslint/no-non-null-assertion, unicorn/prefer-module */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
(() => { (() => {
var _a, _b, _c; var _a, _b, _c, _d, _e, _f;
const los = exports.los; const los = exports.los;
const lotOccupancyId = document.querySelector('#lotOccupancy--lotOccupancyId').value; const lotOccupancyId = document.querySelector('#lotOccupancy--lotOccupancyId').value;
const isCreate = lotOccupancyId === ''; const isCreate = lotOccupancyId === '';
@ -182,8 +182,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>`; </div>`;
return; return;
} }
cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', { cityssm.postJSON(los.urlPrefix + '/lotOccupancies/doGetOccupancyTypeFields', {
@ -256,7 +256,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
bulmaJS.confirm({ bulmaJS.confirm({
title: 'Confirm Change', title: 'Confirm Change',
message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n
This change affects the additional fields associated with this record, and may also affect the available fees.`, This change affects the additional fields associated with this record, and may also affect the available fees.`,
contextualColorName: 'warning', contextualColorName: 'warning',
okButton: { okButton: {
text: 'Yes, Keep the Change', text: 'Yes, Keep the Change',
@ -418,9 +418,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
}); });
}); });
document (_d = document
.querySelector('.is-lot-view-button') .querySelector('.is-lot-view-button')) === null || _d === void 0 ? void 0 : _d.addEventListener('click', () => {
.addEventListener('click', () => {
const lotId = document.querySelector('#lotOccupancy--lotId').value; const lotId = document.querySelector('#lotOccupancy--lotId').value;
if (lotId === '') { if (lotId === '') {
bulmaJS.alert({ bulmaJS.alert({
@ -432,9 +431,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
window.open(los.urlPrefix + '/lots/' + lotId); window.open(los.urlPrefix + '/lots/' + lotId);
} }
}); });
document (_e = document
.querySelector('.is-clear-lot-button') .querySelector('.is-clear-lot-button')) === null || _e === void 0 ? void 0 : _e.addEventListener('click', () => {
.addEventListener('click', () => {
if (lotNameElement.disabled) { if (lotNameElement.disabled) {
bulmaJS.alert({ bulmaJS.alert({
message: 'You need to unlock the field before clearing it.', message: 'You need to unlock the field before clearing it.',
@ -449,9 +447,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
// Start Date // Start Date
los.initializeDatePickers(formElement); los.initializeDatePickers(formElement);
document (_f = document
.querySelector('#lotOccupancy--occupancyStartDateString') .querySelector('#lotOccupancy--occupancyStartDateString')) === null || _f === void 0 ? void 0 : _f.addEventListener('change', () => {
.addEventListener('change', () => {
const endDatePicker = document.querySelector('#lotOccupancy--occupancyEndDateString').bulmaCalendar.datePicker; const endDatePicker = document.querySelector('#lotOccupancy--occupancyEndDateString').bulmaCalendar.datePicker;
endDatePicker.min = document.querySelector('#lotOccupancy--occupancyStartDateString').value; endDatePicker.min = document.querySelector('#lotOccupancy--occupancyStartDateString').value;
endDatePicker.refresh(); endDatePicker.refresh();

View File

@ -276,8 +276,8 @@ declare const bulmaJS: BulmaJS
occupancyTypeIdElement.addEventListener('change', () => { occupancyTypeIdElement.addEventListener('change', () => {
if (occupancyTypeIdElement.value === '') { if (occupancyTypeIdElement.value === '') {
lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info"> lotOccupancyFieldsContainerElement.innerHTML = `<div class="message is-info">
<p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p> <p class="message-body">Select the ${los.escapedAliases.occupancy} type to load the available fields.</p>
</div>` </div>`
return return
} }
@ -392,7 +392,7 @@ declare const bulmaJS: BulmaJS
bulmaJS.confirm({ bulmaJS.confirm({
title: 'Confirm Change', title: 'Confirm Change',
message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n message: `Are you sure you want to change the ${los.escapedAliases.occupancy} type?\n
This change affects the additional fields associated with this record, and may also affect the available fees.`, This change affects the additional fields associated with this record, and may also affect the available fees.`,
contextualColorName: 'warning', contextualColorName: 'warning',
okButton: { okButton: {
text: 'Yes, Keep the Change', text: 'Yes, Keep the Change',
@ -645,8 +645,8 @@ declare const bulmaJS: BulmaJS
}) })
document document
.querySelector('.is-lot-view-button')! .querySelector('.is-lot-view-button')
.addEventListener('click', () => { ?.addEventListener('click', () => {
const lotId = ( const lotId = (
document.querySelector('#lotOccupancy--lotId') as HTMLInputElement document.querySelector('#lotOccupancy--lotId') as HTMLInputElement
).value ).value
@ -662,8 +662,8 @@ declare const bulmaJS: BulmaJS
}) })
document document
.querySelector('.is-clear-lot-button')! .querySelector('.is-clear-lot-button')
.addEventListener('click', () => { ?.addEventListener('click', () => {
if (lotNameElement.disabled) { if (lotNameElement.disabled) {
bulmaJS.alert({ bulmaJS.alert({
message: 'You need to unlock the field before clearing it.', message: 'You need to unlock the field before clearing it.',
@ -683,8 +683,8 @@ declare const bulmaJS: BulmaJS
los.initializeDatePickers(formElement) los.initializeDatePickers(formElement)
document document
.querySelector('#lotOccupancy--occupancyStartDateString')! .querySelector('#lotOccupancy--occupancyStartDateString')
.addEventListener('change', () => { ?.addEventListener('change', () => {
const endDatePicker = ( const endDatePicker = (
document.querySelector( document.querySelector(
'#lotOccupancy--occupancyEndDateString' '#lotOccupancy--occupancyEndDateString'

View File

@ -237,10 +237,17 @@ function renderLotOccupancyOccupants() {
if (isCreate) { if (isCreate) {
const lotOccupantTypeIdElement = document.querySelector('#lotOccupancy--lotOccupantTypeId'); const lotOccupantTypeIdElement = document.querySelector('#lotOccupancy--lotOccupantTypeId');
lotOccupantTypeIdElement.addEventListener('change', () => { lotOccupantTypeIdElement.addEventListener('change', () => {
var _a;
const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']"); const occupantFields = formElement.querySelectorAll("[data-table='LotOccupancyOccupant']");
for (const occupantField of occupantFields) { for (const occupantField of occupantFields) {
occupantField.disabled = lotOccupantTypeIdElement.value === ''; occupantField.disabled = lotOccupantTypeIdElement.value === '';
} }
let occupantCommentTitle = (_a = lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle) !== null && _a !== void 0 ? _a : '';
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment';
}
formElement.querySelector('#lotOccupancy--occupantCommentTitle').textContent = occupantCommentTitle;
}); });
} }
else { else {

View File

@ -392,6 +392,17 @@ if (isCreate) {
for (const occupantField of occupantFields) { for (const occupantField of occupantFields) {
occupantField.disabled = lotOccupantTypeIdElement.value === '' occupantField.disabled = lotOccupantTypeIdElement.value === ''
} }
let occupantCommentTitle =
lotOccupantTypeIdElement.selectedOptions[0].dataset
.occupantCommentTitle ?? ''
if (occupantCommentTitle === '') {
occupantCommentTitle = 'Comment'
}
formElement.querySelector(
'#lotOccupancy--occupantCommentTitle'
)!.textContent = occupantCommentTitle
}) })
} else { } else {
renderLotOccupancyOccupants() renderLotOccupancyOccupants()

File diff suppressed because one or more lines are too long

View File

@ -23,11 +23,11 @@
<% } %> <% } %>
<li class="is-active"> <li class="is-active">
<a href="#" aria-current="page"> <a href="#" aria-current="page">
<% if (isCreate) { %> <% if (isCreate) { %>
Create a New <%= configFunctions.getProperty("aliases.occupancy") %> Record Create a New <%= configFunctions.getProperty("aliases.occupancy") %> Record
<% } else { %> <% } else { %>
Update <%= configFunctions.getProperty("aliases.occupancy") %> Update <%= configFunctions.getProperty("aliases.occupancy") %>
<% } %> <% } %>
</a> </a>
</li> </li>
</ul> </ul>
@ -136,176 +136,176 @@
<div class="panel"> <div class="panel">
<div class="panel-block is-block"> <div class="panel-block is-block">
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<label class="label" for="lotOccupancy--occupancyTypeId"> <label class="label" for="lotOccupancy--occupancyTypeId">
<%= configFunctions.getProperty("aliases.occupancy") %> Type <%= configFunctions.getProperty("aliases.occupancy") %> Type
</label> </label>
<div class="field has-addons"> <div class="field has-addons">
<div class="control is-expanded"> <div class="control is-expanded">
<div class="select is-fullwidth"> <div class="select is-fullwidth">
<select <select
<% if (!isCreate) { %> <% if (!isCreate) { %>
class="is-readonly" class="is-readonly"
<% } %> <% } %>
id="lotOccupancy--occupancyTypeId" name="occupancyTypeId" id="lotOccupancy--occupancyTypeId" name="occupancyTypeId"
required accesskey="f" required accesskey="f"
<%= (isCreate ? " autofocus" : "") %>> <%= (isCreate ? " autofocus" : "") %>>
<% if (isCreate) { %> <% if (isCreate) { %>
<option value="">(No Type)</option> <option value="">(No Type)</option>
<% } %> <% } %>
<% let typeIsFound = false; %> <% let typeIsFound = false; %>
<% for (const occupancyType of occupancyTypes) { %> <% for (const occupancyType of occupancyTypes) { %>
<% <%
if (lotOccupancy.occupancyTypeId === occupancyType.occupancyTypeId) { if (lotOccupancy.occupancyTypeId === occupancyType.occupancyTypeId) {
typeIsFound = true; typeIsFound = true;
} }
%> %>
<option value="<%= occupancyType.occupancyTypeId %>" <option value="<%= occupancyType.occupancyTypeId %>"
<%= (lotOccupancy.occupancyTypeId === occupancyType.occupancyTypeId ? " selected" : "") %> <%= (lotOccupancy.occupancyTypeId === occupancyType.occupancyTypeId ? " selected" : "") %>
<%= (!isCreate && lotOccupancy.occupancyTypeId !== occupancyType.occupancyTypeId ? " disabled" : "") %>> <%= (!isCreate && lotOccupancy.occupancyTypeId !== occupancyType.occupancyTypeId ? " disabled" : "") %>>
<%= occupancyType.occupancyType %> <%= occupancyType.occupancyType %>
</option> </option>
<% } %> <% } %>
<% if (lotOccupancy.occupancyTypeId && !typeIsFound) { %> <% if (lotOccupancy.occupancyTypeId && !typeIsFound) { %>
<option value="<%= lotOccupancy.occupancyTypeId %>" selected> <option value="<%= lotOccupancy.occupancyTypeId %>" selected>
<%= lotOccupancy.occupancyType %> <%= lotOccupancy.occupancyType %>
</option> </option>
<% } %> <% } %>
</select> </select>
</div>
</div>
<div class="control is-hidden-print">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getProperty("aliases.occupancy") %> Type Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div> </div>
</div> </div>
<div class="control is-hidden-print">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getProperty("aliases.occupancy") %> Type Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
</div>
<input id="lotOccupancy--lotId" name="lotId" type="hidden" value="<%= lotOccupancy.lotId %>" /> <input id="lotOccupancy--lotId" name="lotId" type="hidden" value="<%= lotOccupancy.lotId %>" />
<label class="label" for="lotOccupancy--lotName"> <label class="label" for="lotOccupancy--lotName">
<%= configFunctions.getProperty("aliases.lot") %> <%= configFunctions.getProperty("aliases.lot") %>
</label> </label>
<div class="field has-addons"> <div class="field has-addons">
<div class="control is-expanded"> <div class="control is-expanded">
<input class="input is-clickable has-text-left <%= (isCreate ? "" : " is-readonly") %>" id="lotOccupancy--lotName" type="button" value="<%= lotOccupancy.lotName || "(No " + configFunctions.getProperty("aliases.lot") + ")" %>" <input class="input is-clickable has-text-left <%= (isCreate ? "" : " is-readonly") %>" id="lotOccupancy--lotName" type="button" value="<%= lotOccupancy.lotName || "(No " + configFunctions.getProperty("aliases.lot") + ")" %>"
<%= (configFunctions.getProperty("settings.lotOccupancy.lotIdIsRequired") ? " required" : "") %> <%= (configFunctions.getProperty("settings.lotOccupancy.lotIdIsRequired") ? " required" : "") %>
<%= (isCreate ? "" : " disabled readonly") %> /> <%= (isCreate ? "" : " disabled readonly") %> />
</div>
<div class="control is-hidden-print">
<button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<i class="fas fa-eraser" aria-hidden="true"></i>
</button>
</div>
<div class="control is-hidden-print">
<button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<i class="fas fa-unlock" aria-hidden="true"></i>
</button>
</div>
<div class="control is-hidden-print">
<button class="button is-lot-view-button" data-tooltip="Open <%= configFunctions.getProperty("aliases.lot") %>" type="button" aria-label="Open <%= configFunctions.getProperty("aliases.lot") %>">
<i class="fas fa-external-link-alt" aria-hidden="true"></i>
</button>
</div>
</div> </div>
</div> <div class="control is-hidden-print">
<div class="column is-3"> <button class="button is-clear-lot-button" data-tooltip="Clear" type="button" aria-label="Clear <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<div class="field"> <i class="fas fa-eraser" aria-hidden="true"></i>
<label class="label" for="lotOccupancy--occupancyStartDateString"><%= configFunctions.getProperty("aliases.occupancyStartDate") %></label> </button>
<div class="control has-icons-left">
<input class="input" id="lotOccupancy--occupancyStartDateString" name="occupancyStartDateString" type="date"
value="<%= lotOccupancy.occupancyStartDateString %>" required />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>
</div>
</div> </div>
<div class="field"> <div class="control is-hidden-print">
<label class="label" for="lotOccupancy--occupancyEndDateString">End Date</label> <button class="button is-unlock-field-button" data-tooltip="Unlock Field" type="button" aria-label="Unlock <%= configFunctions.getProperty("aliases.lot") %></button> Field">
<div class="control has-icons-left"> <i class="fas fa-unlock" aria-hidden="true"></i>
<input class="input" id="lotOccupancy--occupancyEndDateString" name="occupancyEndDateString" type="date" </button>
value="<%= lotOccupancy.occupancyEndDateString %>"
min="<%= lotOccupancy.occupancyStartDateString %>"
<%= (configFunctions.getProperty("settings.lotOccupancy.occupancyEndDateIsRequired") ? " required" : "") %> />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>
</div>
</div> </div>
</div> <div class="control is-hidden-print">
<div class="column"> <button class="button is-lot-view-button" data-tooltip="Open <%= configFunctions.getProperty("aliases.lot") %>" type="button" aria-label="Open <%= configFunctions.getProperty("aliases.lot") %>">
<div id="container--lotOccupancyFields"> <i class="fas fa-external-link-alt" aria-hidden="true"></i>
<% if (isCreate) { %> </button>
<div class="message is-info">
<p class="message-body">
Select the <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> type to load the available fields.
</p>
</div>
<% } else if (lotOccupancy.lotOccupancyFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> type has no additional fields.
</p>
</div>
<% } else { %>
<% let occupancyTypeFieldIds = ""; %>
<% for (const lotOccupancyField of lotOccupancy.lotOccupancyFields) { %>
<% occupancyTypeFieldIds += "," + lotOccupancyField.occupancyTypeFieldId; %>
<div class="field">
<label class="label" for="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>">
<%= lotOccupancyField.occupancyTypeField %>
</label>
<div class="control">
<% if (!lotOccupancyField.occupancyTypeFieldValues || lotOccupancyField.occupancyTypeFieldValues === "") { %>
<input class="input"
id="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
name="lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
type="text"
value="<%= lotOccupancyField.lotOccupancyFieldValue %>"
<% if (lotOccupancyField.pattern !== "") { %>
pattern="<%= lotOccupancyField.pattern %>"
<% } %>
minlength="<%= lotOccupancyField.minimumLength %>"
maxlength="<%= lotOccupancyField.maximumLength %>"
<%= lotOccupancyField.isRequired ? " required" : "" %> />
<% } else { %>
<%
const fieldValues = lotOccupancyField.occupancyTypeFieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
name="lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>">
<% if (!lotOccupancyField.isRequired || lotOccupancyField.lotOccupancyFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === lotOccupancyField.lotOccupancyFieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === lotOccupancyField.lotOccupancyFieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && lotOccupancyField.lotOccupancyFieldValue !== "") { %>
<option value="<%= lotOccupancyField.lotOccupancyFieldValue %>" selected>
<%= lotOccupancyField.lotOccupancyFieldValue %>
</option>
<% } %>
</select>
</div>
<% } %>
</div>
</div>
<% } %>
<input id="lotOccupancy--occupancyTypeFieldIds" name="occupancyTypeFieldIds" type="hidden" value="<%= occupancyTypeFieldIds.slice(1) %>" />
<% } %>
</div> </div>
</div> </div>
</div> </div>
<div class="column is-3">
<div class="field">
<label class="label" for="lotOccupancy--occupancyStartDateString"><%= configFunctions.getProperty("aliases.occupancyStartDate") %></label>
<div class="control has-icons-left">
<input class="input" id="lotOccupancy--occupancyStartDateString" name="occupancyStartDateString" type="date"
value="<%= lotOccupancy.occupancyStartDateString %>" required />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>
</div>
</div>
<div class="field">
<label class="label" for="lotOccupancy--occupancyEndDateString">End Date</label>
<div class="control has-icons-left">
<input class="input" id="lotOccupancy--occupancyEndDateString" name="occupancyEndDateString" type="date"
value="<%= lotOccupancy.occupancyEndDateString %>"
min="<%= lotOccupancy.occupancyStartDateString %>"
<%= (configFunctions.getProperty("settings.lotOccupancy.occupancyEndDateIsRequired") ? " required" : "") %> />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>
</div>
</div>
</div>
<div class="column">
<div id="container--lotOccupancyFields">
<% if (isCreate) { %>
<div class="message is-info">
<p class="message-body">
Select the <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> type to load the available fields.
</p>
</div>
<% } else if (lotOccupancy.lotOccupancyFields.length === 0) { %>
<div class="message is-info">
<p class="message-body">
The current <%= configFunctions.getProperty("aliases.occupancy").toLowerCase() %> type has no additional fields.
</p>
</div>
<% } else { %>
<% let occupancyTypeFieldIds = ""; %>
<% for (const lotOccupancyField of lotOccupancy.lotOccupancyFields) { %>
<% occupancyTypeFieldIds += "," + lotOccupancyField.occupancyTypeFieldId; %>
<div class="field">
<label class="label" for="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>">
<%= lotOccupancyField.occupancyTypeField %>
</label>
<div class="control">
<% if (!lotOccupancyField.occupancyTypeFieldValues || lotOccupancyField.occupancyTypeFieldValues === "") { %>
<input class="input"
id="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
name="lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
type="text"
value="<%= lotOccupancyField.lotOccupancyFieldValue %>"
<% if (lotOccupancyField.pattern !== "") { %>
pattern="<%= lotOccupancyField.pattern %>"
<% } %>
minlength="<%= lotOccupancyField.minimumLength %>"
maxlength="<%= lotOccupancyField.maximumLength %>"
<%= lotOccupancyField.isRequired ? " required" : "" %> />
<% } else { %>
<%
const fieldValues = lotOccupancyField.occupancyTypeFieldValues.split("\n");
let valueFound = false;
%>
<div class="select is-fullwidth">
<select id="lotOccupancy--lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>"
name="lotOccupancyFieldValue_<%= lotOccupancyField.occupancyTypeFieldId %>">
<% if (!lotOccupancyField.isRequired || lotOccupancyField.lotOccupancyFieldValue === "") { %>
<option value="">(Not Set)</option>
<% } %>
<% for (const fieldValue of fieldValues) { %>
<%
if (fieldValue === lotOccupancyField.lotOccupancyFieldValue) {
valueFound = true;
}
%>
<option value="<%= fieldValue %>"
<%= (fieldValue === lotOccupancyField.lotOccupancyFieldValue ? " selected" : "") %>>
<%= fieldValue %>
</option>
<% } %>
<% if (!valueFound && lotOccupancyField.lotOccupancyFieldValue !== "") { %>
<option value="<%= lotOccupancyField.lotOccupancyFieldValue %>" selected>
<%= lotOccupancyField.lotOccupancyFieldValue %>
</option>
<% } %>
</select>
</div>
<% } %>
</div>
</div>
<% } %>
<input id="lotOccupancy--occupancyTypeFieldIds" name="occupancyTypeFieldIds" type="hidden" value="<%= occupancyTypeFieldIds.slice(1) %>" />
<% } %>
</div>
</div>
</div>
</div> </div>
<% if (isCreate) { %> <% if (isCreate) { %>
<div class="panel-block is-block"> <div class="panel-block is-block">
@ -317,14 +317,19 @@
<%= configFunctions.getProperty("aliases.occupant") %> Type <%= configFunctions.getProperty("aliases.occupant") %> Type
</label> </label>
<div class="control"> <div class="control">
<div class="select is-fullwidth"> <div class="select is-fullwidth">
<select id="lotOccupancy--lotOccupantTypeId" name="lotOccupantTypeId"> <select id="lotOccupancy--lotOccupantTypeId" name="lotOccupantTypeId">
<option value="">(Select a Type to Create a <%= configFunctions.getProperty("aliases.occupant") %>)</option> <option value="" data-occupant-comment-title="Comment">
<% for (const lotOccupantType of lotOccupantTypes) { %> (Select a Type to Create a <%= configFunctions.getProperty("aliases.occupant") %>)
<option value="<%= lotOccupantType.lotOccupantTypeId %>"><%= lotOccupantType.lotOccupantType %></option> </option>
<% } %> <% for (const lotOccupantType of lotOccupantTypes) { %>
</select> <option value="<%= lotOccupantType.lotOccupantTypeId %>"
</div> data-occupant-comment-title="<%= lotOccupantType.occupantCommentTitle %>">
<%= lotOccupantType.lotOccupantType %>
</option>
<% } %>
</select>
</div>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
@ -391,7 +396,7 @@
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label class="label" for="lotOccupancy--occupantComment">Comment</label> <label class="label" id="lotOccupancy--occupantCommentTitle" for="lotOccupancy--occupantComment">Comment</label>
<div class="control"> <div class="control">
<textarea class="textarea" id="lotOccupancy--occupantComment" data-table="LotOccupancyOccupant" name="occupantComment" disabled></textarea> <textarea class="textarea" id="lotOccupancy--occupantComment" data-table="LotOccupancyOccupant" name="occupantComment" disabled></textarea>
</div> </div>