Added length of appointment to config + fixed appointments not showing in scheduling modal + added appointment confirmation template. BOD-141 BOD-149 BOD-148
This commit is contained in:
@@ -1,13 +1,73 @@
|
||||
const path = require("path");
|
||||
const moment = require("moment");
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
`.env.${process.env.NODE_ENV || "development"}`
|
||||
),
|
||||
});
|
||||
|
||||
var _ = require("lodash");
|
||||
const Handlebars = require("handlebars");
|
||||
|
||||
Handlebars.registerHelper("moment", function (context, block) {
|
||||
if (context && context.hash) {
|
||||
block = _.cloneDeep(context);
|
||||
context = undefined;
|
||||
}
|
||||
var date = moment(context);
|
||||
|
||||
if (block.hash.timezone) {
|
||||
date.tz(block.hash.timezone);
|
||||
}
|
||||
|
||||
var hasFormat = false;
|
||||
|
||||
// Reset the language back to default before doing anything else
|
||||
date.locale("en");
|
||||
|
||||
for (var i in block.hash) {
|
||||
if (i === "format") {
|
||||
hasFormat = true;
|
||||
} else if (date[i]) {
|
||||
date = date[i](block.hash[i]);
|
||||
} else {
|
||||
console.log('moment.js does not support "' + i + '"');
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFormat) {
|
||||
date = date.format(block.hash.format);
|
||||
}
|
||||
return date;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("duration", function (context, block) {
|
||||
if (context && context.hash) {
|
||||
block = _.cloneDeep(context);
|
||||
context = 0;
|
||||
}
|
||||
var duration = moment.duration(context);
|
||||
var hasFormat = false;
|
||||
|
||||
// Reset the language back to default before doing anything else
|
||||
duration = duration.lang("en");
|
||||
|
||||
for (var i in block.hash) {
|
||||
if (i === "format") {
|
||||
hasFormat = true;
|
||||
} else if (duration[i]) {
|
||||
duration = duration[i](block.hash[i]);
|
||||
} else {
|
||||
console.log('moment.js duration does not support "' + i + '"');
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFormat) {
|
||||
duration = duration.format(block.hash.format);
|
||||
}
|
||||
return duration;
|
||||
});
|
||||
|
||||
exports.render = (req, res) => {
|
||||
//Perform request validation
|
||||
let view;
|
||||
|
||||
Reference in New Issue
Block a user