date field restrictions
parent
9a153bb238
commit
9bfed5aa4d
|
|
@ -20,6 +20,7 @@ export default async function handler(
|
|||
|
||||
const contract: Partial<Contract> = {
|
||||
isPreneed: false,
|
||||
|
||||
contractStartDate: dateToInteger(startDate),
|
||||
contractStartDateString: dateToString(startDate),
|
||||
purchaserCity: getConfigProperty('settings.cityDefault'),
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
message: "Contract Updated Successfully",
|
||||
message: 'Contract Updated Successfully',
|
||||
contextualColorName: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Saving Contract",
|
||||
title: 'Error Saving Contract',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
});
|
||||
|
|
@ -83,7 +83,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
else {
|
||||
bulmaJS.confirm({
|
||||
title: "Copy Contract Record as New",
|
||||
title: 'Copy Contract Record as New',
|
||||
message: 'Are you sure you want to copy this record to a new record?',
|
||||
contextualColorName: 'info',
|
||||
okButton: {
|
||||
|
|
@ -116,7 +116,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
bulmaJS.confirm({
|
||||
title: "Delete Contract Record",
|
||||
title: 'Delete Contract Record',
|
||||
message: 'Are you sure you want to delete this record?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
|
|
@ -329,7 +329,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const burialSiteId = document.querySelector('#contract--burialSiteId').value;
|
||||
if (burialSiteId === '') {
|
||||
bulmaJS.alert({
|
||||
message: "No burial site selected.",
|
||||
message: 'No burial site selected.',
|
||||
contextualColorName: 'info'
|
||||
});
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
});
|
||||
}
|
||||
else {
|
||||
burialSiteNameElement.value = "(No Burial Site)";
|
||||
burialSiteNameElement.value = '(No Burial Site)';
|
||||
document.querySelector('#contract--burialSiteId').value = '';
|
||||
setUnsavedChanges();
|
||||
}
|
||||
|
|
@ -359,6 +359,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const endDateElement = document.querySelector('#contract--contractEndDateString');
|
||||
endDateElement.min = document.querySelector('#contract--contractStartDateString').value;
|
||||
});
|
||||
sunrise.initializeMinDateUpdate(document.querySelector('#contract--contractStartDateString'), document.querySelector('#contract--contractEndDateString'));
|
||||
sunrise.initializeUnlockFieldButtons(formElement);
|
||||
if (isCreate) {
|
||||
/*
|
||||
|
|
@ -382,5 +383,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
setUnsavedChanges();
|
||||
});
|
||||
sunrise.initializeMinDateUpdate(document.querySelector('#contract--birthDateString'), document.querySelector('#contract--deathDateString'));
|
||||
sunrise.initializeMinDateUpdate(document.querySelector('#contract--deathDateString'), document.querySelector('#contract--funeralDateString'));
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@
|
|||
import type { BulmaJS } from '@cityssm/bulma-js/types.js'
|
||||
import type { cityssmGlobal } from '@cityssm/bulma-webapp-js/src/types.js'
|
||||
|
||||
import type {
|
||||
BurialSite,
|
||||
ContractTypeField
|
||||
} from '../../types/record.types.js'
|
||||
import type { BurialSite, ContractTypeField } from '../../types/record.types.js'
|
||||
|
||||
import type { Sunrise } from './types.js'
|
||||
|
||||
|
|
@ -71,13 +68,13 @@ declare const exports: Record<string, unknown>
|
|||
)
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
message: "Contract Updated Successfully",
|
||||
message: 'Contract Updated Successfully',
|
||||
contextualColorName: 'success'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
bulmaJS.alert({
|
||||
title: "Error Saving Contract",
|
||||
title: 'Error Saving Contract',
|
||||
message: responseJSON.errorMessage ?? '',
|
||||
contextualColorName: 'danger'
|
||||
})
|
||||
|
|
@ -136,7 +133,7 @@ declare const exports: Record<string, unknown>
|
|||
})
|
||||
} else {
|
||||
bulmaJS.confirm({
|
||||
title: "Copy Contract Record as New",
|
||||
title: 'Copy Contract Record as New',
|
||||
message: 'Are you sure you want to copy this record to a new record?',
|
||||
contextualColorName: 'info',
|
||||
okButton: {
|
||||
|
|
@ -179,7 +176,7 @@ declare const exports: Record<string, unknown>
|
|||
}
|
||||
|
||||
bulmaJS.confirm({
|
||||
title: "Delete Contract Record",
|
||||
title: 'Delete Contract Record',
|
||||
message: 'Are you sure you want to delete this record?',
|
||||
contextualColorName: 'warning',
|
||||
okButton: {
|
||||
|
|
@ -384,7 +381,8 @@ declare const exports: Record<string, unknown>
|
|||
function selectExistingBurialSite(selectClickEvent: Event): void {
|
||||
selectClickEvent.preventDefault()
|
||||
|
||||
const selectedBurialSiteElement = selectClickEvent.currentTarget as HTMLElement
|
||||
const selectedBurialSiteElement =
|
||||
selectClickEvent.currentTarget as HTMLElement
|
||||
|
||||
renderSelectedBurialSiteAndClose(
|
||||
selectedBurialSiteElement.dataset.burialSiteId ?? '',
|
||||
|
|
@ -530,7 +528,7 @@ declare const exports: Record<string, unknown>
|
|||
|
||||
if (burialSiteId === '') {
|
||||
bulmaJS.alert({
|
||||
message: "No burial site selected.",
|
||||
message: 'No burial site selected.',
|
||||
contextualColorName: 'info'
|
||||
})
|
||||
} else {
|
||||
|
|
@ -547,7 +545,7 @@ declare const exports: Record<string, unknown>
|
|||
contextualColorName: 'info'
|
||||
})
|
||||
} else {
|
||||
burialSiteNameElement.value = "(No Burial Site)"
|
||||
burialSiteNameElement.value = '(No Burial Site)'
|
||||
;(
|
||||
document.querySelector('#contract--burialSiteId') as HTMLInputElement
|
||||
).value = ''
|
||||
|
|
@ -572,6 +570,15 @@ declare const exports: Record<string, unknown>
|
|||
).value
|
||||
})
|
||||
|
||||
sunrise.initializeMinDateUpdate(
|
||||
document.querySelector(
|
||||
'#contract--contractStartDateString'
|
||||
) as HTMLInputElement,
|
||||
document.querySelector(
|
||||
'#contract--contractEndDateString'
|
||||
) as HTMLInputElement
|
||||
)
|
||||
|
||||
sunrise.initializeUnlockFieldButtons(formElement)
|
||||
|
||||
if (isCreate) {
|
||||
|
|
@ -605,5 +612,15 @@ declare const exports: Record<string, unknown>
|
|||
|
||||
setUnsavedChanges()
|
||||
})
|
||||
|
||||
sunrise.initializeMinDateUpdate(
|
||||
document.querySelector('#contract--birthDateString') as HTMLInputElement,
|
||||
document.querySelector('#contract--deathDateString') as HTMLInputElement
|
||||
)
|
||||
|
||||
sunrise.initializeMinDateUpdate(
|
||||
document.querySelector('#contract--deathDateString') as HTMLInputElement,
|
||||
document.querySelector('#contract--funeralDateString') as HTMLInputElement
|
||||
)
|
||||
}
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -99,8 +99,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
clickEvent.preventDefault();
|
||||
if (currentMarker !== undefined) {
|
||||
const mapCoordinates = currentMarker.getLatLng();
|
||||
options.latitudeElement.value = mapCoordinates.lat.toFixed(coordinatePrecision);
|
||||
options.longitudeElement.value = mapCoordinates.lng.toFixed(coordinatePrecision);
|
||||
options.latitudeElement.value =
|
||||
mapCoordinates.lat.toFixed(coordinatePrecision);
|
||||
options.longitudeElement.value =
|
||||
mapCoordinates.lng.toFixed(coordinatePrecision);
|
||||
options.callbackFunction(mapCoordinates.lat, mapCoordinates.lng);
|
||||
}
|
||||
closeModalFunction();
|
||||
|
|
@ -267,6 +269,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function getWorkOrderURL(workOrderId = '', edit = false, time = false) {
|
||||
return getRecordURL('workOrders', workOrderId, edit, time);
|
||||
}
|
||||
/*
|
||||
* Date Fields
|
||||
*/
|
||||
function initializeMinDateUpdate(minDateElement, valueDateElement) {
|
||||
valueDateElement.min = minDateElement.value;
|
||||
minDateElement.addEventListener('change', () => {
|
||||
valueDateElement.min = minDateElement.value;
|
||||
});
|
||||
}
|
||||
/*
|
||||
* Settings
|
||||
*/
|
||||
|
|
@ -295,7 +306,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
getCemeteryURL,
|
||||
getContractURL,
|
||||
getFuneralHomeURL,
|
||||
getWorkOrderURL
|
||||
getWorkOrderURL,
|
||||
initializeMinDateUpdate
|
||||
};
|
||||
exports.sunrise = sunrise;
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -173,8 +173,10 @@ declare const exports: Record<string, unknown> & {
|
|||
if (currentMarker !== undefined) {
|
||||
const mapCoordinates = currentMarker.getLatLng() as Leaflet.LatLng
|
||||
|
||||
options.latitudeElement.value = mapCoordinates.lat.toFixed(coordinatePrecision)
|
||||
options.longitudeElement.value = mapCoordinates.lng.toFixed(coordinatePrecision)
|
||||
options.latitudeElement.value =
|
||||
mapCoordinates.lat.toFixed(coordinatePrecision)
|
||||
options.longitudeElement.value =
|
||||
mapCoordinates.lng.toFixed(coordinatePrecision)
|
||||
|
||||
options.callbackFunction(mapCoordinates.lat, mapCoordinates.lng)
|
||||
}
|
||||
|
|
@ -440,6 +442,21 @@ declare const exports: Record<string, unknown> & {
|
|||
return getRecordURL('workOrders', workOrderId, edit, time)
|
||||
}
|
||||
|
||||
/*
|
||||
* Date Fields
|
||||
*/
|
||||
|
||||
function initializeMinDateUpdate(
|
||||
minDateElement: HTMLInputElement,
|
||||
valueDateElement: HTMLInputElement
|
||||
): void {
|
||||
valueDateElement.min = minDateElement.value
|
||||
|
||||
minDateElement.addEventListener('change', () => {
|
||||
valueDateElement.min = minDateElement.value
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Settings
|
||||
*/
|
||||
|
|
@ -479,7 +496,9 @@ declare const exports: Record<string, unknown> & {
|
|||
getCemeteryURL,
|
||||
getContractURL,
|
||||
getFuneralHomeURL,
|
||||
getWorkOrderURL
|
||||
getWorkOrderURL,
|
||||
|
||||
initializeMinDateUpdate
|
||||
}
|
||||
|
||||
exports.sunrise = sunrise
|
||||
|
|
|
|||
|
|
@ -36,4 +36,5 @@ export interface Sunrise {
|
|||
getContractURL: (contractId?: number | string, edit?: boolean, time?: boolean) => string;
|
||||
getFuneralHomeURL: (funeralHomeId?: number | string, edit?: boolean, time?: boolean) => string;
|
||||
getWorkOrderURL: (workOrderId?: number | string, edit?: boolean, time?: boolean) => string;
|
||||
initializeMinDateUpdate: (minDateElement: HTMLInputElement, valueDateElement: HTMLInputElement) => void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,4 +82,9 @@ export interface Sunrise {
|
|||
edit?: boolean,
|
||||
time?: boolean
|
||||
) => string
|
||||
|
||||
initializeMinDateUpdate: (
|
||||
minDateElement: HTMLInputElement,
|
||||
valueDateElement: HTMLInputElement
|
||||
) => void
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
});
|
||||
}
|
||||
const workOrderOpenDateStringElement = document.querySelector('#workOrderEdit--workOrderOpenDateString');
|
||||
function editMilestone(clickEvent) {
|
||||
clickEvent.preventDefault();
|
||||
const workOrderMilestoneId = Number.parseInt(clickEvent.currentTarget.closest('.container--milestone').dataset.workOrderMilestoneId ?? '', 10);
|
||||
|
|
@ -319,6 +320,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
workOrderMilestoneDateStringElement = modalElement.querySelector('#milestoneEdit--workOrderMilestoneDateString');
|
||||
workOrderMilestoneDateStringElement.value =
|
||||
workOrderMilestone.workOrderMilestoneDateString ?? '';
|
||||
workOrderMilestoneDateStringElement.min =
|
||||
workOrderOpenDateStringElement.value;
|
||||
if (workOrderMilestone.workOrderMilestoneTime) {
|
||||
;
|
||||
modalElement.querySelector('#milestoneEdit--workOrderMilestoneTimeString').value = workOrderMilestone.workOrderMilestoneTimeString ?? '';
|
||||
|
|
@ -484,6 +487,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
}
|
||||
workOrderMilestoneDateStringElement = modalElement.querySelector('#milestoneAdd--workOrderMilestoneDateString');
|
||||
workOrderMilestoneDateStringElement.valueAsDate = new Date();
|
||||
workOrderMilestoneDateStringElement.min =
|
||||
workOrderOpenDateStringElement.value;
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
addCloseModalFunction = closeModalFunction;
|
||||
|
|
|
|||
|
|
@ -420,6 +420,10 @@ declare const exports: Record<string, unknown>
|
|||
})
|
||||
}
|
||||
|
||||
const workOrderOpenDateStringElement = document.querySelector(
|
||||
'#workOrderEdit--workOrderOpenDateString'
|
||||
) as HTMLInputElement
|
||||
|
||||
function editMilestone(clickEvent: Event): void {
|
||||
clickEvent.preventDefault()
|
||||
|
||||
|
|
@ -522,6 +526,9 @@ declare const exports: Record<string, unknown>
|
|||
workOrderMilestoneDateStringElement.value =
|
||||
workOrderMilestone.workOrderMilestoneDateString ?? ''
|
||||
|
||||
workOrderMilestoneDateStringElement.min =
|
||||
workOrderOpenDateStringElement.value
|
||||
|
||||
if (workOrderMilestone.workOrderMilestoneTime) {
|
||||
;(
|
||||
modalElement.querySelector(
|
||||
|
|
@ -559,7 +566,7 @@ declare const exports: Record<string, unknown>
|
|||
conflictingMilestonePanelElement
|
||||
)
|
||||
},
|
||||
|
||||
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
}
|
||||
|
|
@ -770,6 +777,9 @@ declare const exports: Record<string, unknown>
|
|||
) as HTMLInputElement
|
||||
|
||||
workOrderMilestoneDateStringElement.valueAsDate = new Date()
|
||||
|
||||
workOrderMilestoneDateStringElement.min =
|
||||
workOrderOpenDateStringElement.value
|
||||
},
|
||||
onshown(modalElement, closeModalFunction) {
|
||||
addCloseModalFunction = closeModalFunction
|
||||
|
|
@ -800,7 +810,7 @@ declare const exports: Record<string, unknown>
|
|||
conflictingMilestonePanelElement
|
||||
)
|
||||
},
|
||||
|
||||
|
||||
onremoved() {
|
||||
bulmaJS.toggleHtmlClipped()
|
||||
;(
|
||||
|
|
|
|||
|
|
@ -382,10 +382,11 @@
|
|||
<div class="field">
|
||||
<label class="label" for="contract--funeralTimeString">Time</label>
|
||||
<div class="control has-icons-left">
|
||||
<input class="input" id="contract--funeralTimeString" name="funeralTimeString" type="time" value="<%= contract.funeralTimeString %>" />
|
||||
<input class="input" id="contract--funeralTimeString" name="funeralTimeString" type="time" value="<%= contract.funeralTimeString %>" step="900" />
|
||||
<span class="icon is-left">
|
||||
<i class="fas fa-clock" aria-hidden="true"></i>
|
||||
</span>
|
||||
<p class="help">15 minute intervals</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -623,6 +624,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
const todayDateString = dateTimeFunctions.dateToString(new Date());
|
||||
%>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
|
|
@ -631,7 +635,8 @@
|
|||
</label>
|
||||
<div class="control has-icons-left">
|
||||
<input class="input" id="contract--birthDateString" name="birthDateString" type="date"
|
||||
value="<%= contract.birthDateString %>" />
|
||||
value="<%= contract.birthDateString %>"
|
||||
max="<%= todayDateString %>" />
|
||||
<span class="icon is-left">
|
||||
<i class="fas fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
|
@ -659,7 +664,8 @@
|
|||
</label>
|
||||
<div class="control has-icons-left">
|
||||
<input class="input" id="contract--deathDateString" name="deathDateString" type="date"
|
||||
value="<%= contract.deathDateString %>" />
|
||||
value="<%= contract.deathDateString %>"
|
||||
max="<%= todayDateString %>" />
|
||||
<span class="icon is-left">
|
||||
<i class="fas fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue