f57a118b371d396d03c62c6e99c0881f1b786ad4
3 const th
= require('./template-helper');
4 const { sessionNavLinks
} = require('@squeep/authentication-module');
6 function renderAlmanacRow(entry
) {
7 const { event
, date
} = entry
;
10 \t<td>${th.timeElement(date, { title: 'Occurred' })}</td>
14 function almanacSection(almanac
) {
23 ${almanac.map((entry) => renderAlmanacRow(entry)).join('\n')}
29 function renderChoreRow(choreName
, choreDetails
) {
30 const { intervalMs
, nextSchedule
} = choreDetails
;
32 \t<td>${choreName}</td>
33 \t<td>${th.secondsToPeriod(Math.ceil(intervalMs / 1000))}</td>
34 \t<td>${th.timeElement(nextSchedule)}</td>
38 function choresSection(chores
) {
44 \t\t\t<th>Frequency</th>
45 \t\t\t<th>Next Run</th>
48 ${Object.entries(chores).map((chore) => renderChoreRow(...chore)).join('\n')}
57 * @param {Object[]} ctx.almanac
58 * @param {Object} ctx.chores
59 * @param {Object} options
60 * @param {Object} options.manager
61 * @param {String} options.manager.pageTitle
62 * @param {String[]} options.manager.footerEntries
63 * @param {String} options.adminContactHTML
66 module
.exports
= (ctx
, options
) => {
67 const pagePathLevel
= 1;
69 pageIdentifier: 'maintenance',
70 pageTitle: options
.manager
.pageTitle
+ ' - Maintenance',
71 logoUrl: options
.manager
.logoUrl
,
72 footerEntries: options
.manager
.footerEntries
,
74 th
.navLinks(pagePathLevel
, ctx
, htmlOptions
);
75 sessionNavLinks(pagePathLevel
, ctx
, htmlOptions
);
77 almanacSection(ctx
.almanac
|| []),
78 choresSection(ctx
.chores
|| {}),
80 return th
.htmlPage(pagePathLevel
, ctx
, htmlOptions
, content
);