sunrise-cms/handlers/contracts-get/view.js

17 lines
818 B
JavaScript

import getBurialSiteContract from '../../database/getBurialSiteContract.js';
import { getConfigProperty } from '../../helpers/config.helpers.js';
import { getContractTypePrintsById } from '../../helpers/functions.cache.js';
export default async function handler(request, response) {
const burialSiteContract = await getBurialSiteContract(request.params.burialSiteContractId);
if (burialSiteContract === undefined) {
response.redirect(`${getConfigProperty('reverseProxy.urlPrefix')}/contracts/?error=burialSiteContractIdNotFound`);
return;
}
const contractTypePrints = await getContractTypePrintsById(burialSiteContract.contractTypeId);
response.render('burialSiteContract-view', {
headTitle: 'Contract View',
burialSiteContract,
contractTypePrints
});
}