X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Ftemplate%2Fadmin-ticket-html.js;fp=src%2Ftemplate%2Fadmin-ticket-html.js;h=492c40d1dfc3d4fba87a0936cff1883359ed8cc1;hp=0000000000000000000000000000000000000000;hb=b0103b0d496262c438b40bc20304081dbfe41e73;hpb=8ed81748bce7cea7904cac7225b20a60cafdfc16
diff --git a/src/template/admin-ticket-html.js b/src/template/admin-ticket-html.js
new file mode 100644
index 0000000..492c40d
--- /dev/null
+++ b/src/template/admin-ticket-html.js
@@ -0,0 +1,98 @@
+'use strict';
+
+/**
+ * This renders the interface for submitting a ticket proffer to a third-party.
+ */
+
+const th = require('./template-helper');
+
+
+function renderProfileOption(profile) {
+ return ``;
+}
+
+function renderScopeCheckboxTR(scope) {
+ const defaultChecked = ['read'];
+ const checked = defaultChecked.includes(scope) ? ' checked' : '';
+ return `
+\t |
+\t${scope} |
+
`;
+}
+
+function mainContent(ctx) {
+ const profileOptions = th.indented(4, (ctx?.profilesScopes?.profiles || []).map((profile) => renderProfileOption(profile)))
+ .join('\n');
+ const elideScopes = ['profile', 'email'];
+ const allScopes = Object.keys(ctx?.profilesScopes?.scopeIndex || {});
+ const displayScopes = (allScopes).filter((scope) => !elideScopes.includes(scope));
+ const scopesCheckboxRows = th.indented(4, displayScopes.map((scope) => renderScopeCheckboxTR(scope)))
+ .join('\n');
+ return ``;
+}
+
+
+/**
+ *
+ * @param {Object} ctx
+ * @param {Object} ctx.profilesScopes.scopeIndex
+ * @param {String[]} ctx.profileScopes.profiles
+ * @param {Object} options
+ * @param {Object} options.manager
+ * @param {String} options.manager.pageTitle
+ * @param {String} options.manager.logoUrl
+ * @param {String[]} options.manager.footerEntries
+ * @returns {String}
+ */
+module.exports = (ctx, options) => {
+ const htmlOptions = {
+ pageTitle: options.manager.pageTitle + ' - Ticket Proffer',
+ logoUrl: options.manager.logoUrl,
+ footerEntries: options.manager.footerEntries,
+ navLinks: [
+ {
+ text: 'Admin',
+ href: '../admin/',
+ },
+ ],
+ errorContent: ['Unable to send ticket.'],
+ };
+ const content = [
+ mainContent(ctx),
+ ];
+ return th.htmlPage(2, ctx, htmlOptions, content);
+};
\ No newline at end of file