From 0aa00e7f8d668d0892e8c6d111f4be712611d52c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 17 Jun 2020 19:44:32 +0000 Subject: [PATCH] --- wwwroot/js/app.ravLicense.js | 184 ++++++++++++++++++ .../js/templates/app.ravLicense.handlebars | 183 +++++++++++++++++ 2 files changed, 367 insertions(+) create mode 100644 wwwroot/js/app.ravLicense.js create mode 100644 wwwroot/js/templates/app.ravLicense.handlebars diff --git a/wwwroot/js/app.ravLicense.js b/wwwroot/js/app.ravLicense.js new file mode 100644 index 0000000..8b201d2 --- /dev/null +++ b/wwwroot/js/app.ravLicense.js @@ -0,0 +1,184 @@ +/* + * app.license.js + * License key generator + */ + +/*jslint browser : true, continue : true, + devel : true, indent : 2, maxerr : 50, + newcap : true, nomen : true, plusplus : true, + regexp : true, sloppy : true, vars : false, + white : true +*/ + +/*global $, app */ + +app.ravLicense = (function () { + 'use strict'; + //---------------- BEGIN MODULE SCOPE VARIABLES -------------- + var + + stateMap = {}, + configModule, initModule, onGenerate, onSelectAllAddOns; + //----------------- END MODULE SCOPE VARIABLES --------------- + + //------------------- BEGIN UTILITY METHODS ------------------ + //-------------------- END UTILITY METHODS ------------------- +/* + public class dtoRavLicense + { + [Required] + public string RegisteredTo { get; set; } + [Required] + public Guid DbId { get; set; } + [Required] + public long LicenseExpiration { get; set; } + [Required] + public long MaintenanceExpiration { get; set; } + [Required] + public List Features { get; set; } + [Required] + public long SiteId { get; set; } + } + public class dtoLicenseFeature + { + dtoLicenseFeature() + { + Count = 0; + } + //name of feature / product + public string Feature { get; set; } + //Optional count for items that require it + public long Count { get; set; } + } + +*/ + + //------------------- BEGIN EVENT HANDLERS ------------------- + onGenerate = function (event) { + + event.preventDefault(); + $.gevent.publish('app-clear-error'); + //get form data + var formData = $("form").serializeArray({ + checkboxesAsBools: true + }); + + var submitData = app.utilB.objectifyFormDataArray(formData); + + app.api.createRavLicense(submitData, function (res) { + if (res.error) { + $.gevent.publish('app-show-error', res.msg); + } else { + $('#key').val(res); + return false; + } + }); + + return false; //prevent default + }; + + + onSelectAllAddOns = function (event) { + event.preventDefault(); + $('#wbi').prop('checked', true); + $('#mbi').prop('checked', true); + $('#ri').prop('checked', true); + $('#qbi').prop('checked', true); + $('#qboi').prop('checked', true); + $('#pti').prop('checked', true); + $('#quickNotification').prop('checked', true); + $('#exportToXls').prop('checked', true); + $('#outlookSchedule').prop('checked', true); + $('#oli').prop('checked', true); + $('#importExportCSVDuplicate').prop('checked', true); + + + + return false; //prevent default + }; + + // onTemplates = function(event) { + // event.preventDefault(); + // alert("STUB: templates"); + + + // return false; //prevent default + // }; + + + //-------------------- END EVENT HANDLERS -------------------- + + //------------------- BEGIN PUBLIC METHODS ------------------- + //CONFIGMODULE + // + configModule = function (context) { + stateMap.context = context.context; + if (stateMap.context.params.id) { + stateMap.id = stateMap.context.params.id; + } + }; + + //INITMODULE + // + initModule = function ($container) { + if (typeof $container === 'undefined') { + $container = $('#app-shell-main-content'); + } + $container.html(Handlebars.templates['app.ravLicense']({})); + + + //case 3233 customer list + //Fill customer list combo + var customerList = {}; + + + //get customers + app.api.get('customer/list', function (res) { + if (res.error) { + $.gevent.publish('app-show-error', res.msg); + } else { + + var html = ''; + + for (var i = 0, len = res.length; i < len; ++i) { + html += (''); + customerList[res[i]['id']] = res[i]['name']; + } + $('#customerId').append(html); + } + }); + + + //Context menu + app.nav.contextClear(); + + ////app.nav.setContextTitle("License"); + + //make context menu + + + //Context menu + app.nav.contextClear(); + app.nav.contextAddButton('btn-generate', 'Make', 'key', onGenerate); + app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns); + // app.nav.contextAddLink("licenseRequests/", "Requests", "voice"); + app.nav.contextAddLink("licenseTemplates/", "", "layers"); + //case 3233 + app.nav.contextAddLink("licenses/", "List", ""); + + + //set all date inputs to today plus one year + var oneYearFromNow = moment().add(1, 'years').toISOString().substring(0, 10); + var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10); + $('input[type="date"]').val(oneYearFromNow); + $('#lockoutDate').val(oneMonthFromNow); + + }; + + // return public methods + return { + configModule: configModule, + initModule: initModule + }; + //------------------- END PUBLIC METHODS --------------------- +}()); \ No newline at end of file diff --git a/wwwroot/js/templates/app.ravLicense.handlebars b/wwwroot/js/templates/app.ravLicense.handlebars new file mode 100644 index 0000000..598ecbb --- /dev/null +++ b/wwwroot/js/templates/app.ravLicense.handlebars @@ -0,0 +1,183 @@ +
+
+
+ + +
+
+ +
+ +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+ + + +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ +