More subscription license work

This commit is contained in:
2022-08-23 00:25:27 +00:00
parent e01bfd1625
commit fbca9f167d
2 changed files with 280 additions and 190 deletions

View File

@@ -19,7 +19,8 @@ app.ravLicense = (function () {
configModule, configModule,
initModule, initModule,
onGenerate, onGenerate,
onRevoke; onRevoke,
onPerpetualChanged;
//----------------- END MODULE SCOPE VARIABLES --------------- //----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------ //------------------- BEGIN UTILITY METHODS ------------------
@@ -67,10 +68,24 @@ app.ravLicense = (function () {
var submitData = app.utilB.objectifyFormDataArray(formData); var submitData = app.utilB.objectifyFormDataArray(formData);
//do features separately, above can't deal with multi select and we need to add schedtechs anyway //do features separately, above can't deal with multi select and we need to add schedtechs anyway
let features = []; let features = [];
if ($("#perpetual").prop("checked")) {
features.push({ features.push({
Feature: "ServiceTechs", Feature: "ServiceTechs",
Count: Number($("#techcount").val()) Count: Number($("#techcount").val())
}); });
} else {
features.push({
Feature: "ActiveInternalUsers",
Count: Number($("#subusercount").val())
});
features.push({
Feature: "ActiveCustomerUsers",
Count: Number($("#subcustcount").val())
});
}
let options = $("#options").val(); let options = $("#options").val();
for (let i = 0; i < options.length; i++) { for (let i = 0; i < options.length; i++) {
@@ -107,6 +122,15 @@ app.ravLicense = (function () {
return false; //prevent default return false; //prevent default
}; };
onPerpetualChanged = function (event) {
event.preventDefault();
$("#perpettechcountblock").toggleClass("d-none");
$("#subusercountblock").toggleClass("d-none");
$("#subcustcountblock").toggleClass("d-none");
return false; //prevent default
};
// onSelectAllAddOns = function (event) { // onSelectAllAddOns = function (event) {
// event.preventDefault(); // event.preventDefault();
// $('#wbi').prop('checked', true); // $('#wbi').prop('checked', true);
@@ -185,17 +209,23 @@ app.ravLicense = (function () {
"key", "key",
onGenerate onGenerate
); );
// app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns); // app.nav.contextAddButton('btn-select-all-addons', 'All', 'check-all', onSelectAllAddOns);
// app.nav.contextAddLink("licenseRequests/", "Requests", "voice"); // app.nav.contextAddLink("licenseRequests/", "Requests", "voice");
// app.nav.contextAddLink("licenseTemplates/", "", "layers"); // app.nav.contextAddLink("licenseTemplates/", "", "layers");
//case 3233 //case 3233
app.nav.contextAddLink( app.nav.contextAddLink(
"ravLicenses/" + stateMap.id + "/" + stateMap.context.params.cust_id, "ravLicenses/" +
stateMap.id +
"/" +
stateMap.context.params.cust_id,
"Licenses", "Licenses",
"ticket" "ticket"
); //from here to new license ); //from here to new license
app.nav.contextAddButton("btn-revoke", "Revoke", "nuke", onRevoke);
//set all date inputs to today plus one year //set all date inputs to today plus one year
var oneYearFromNow = moment() var oneYearFromNow = moment()
.add(1, "years") .add(1, "years")
@@ -208,6 +238,7 @@ app.ravLicense = (function () {
//$('#lockoutDate').val(oneMonthFromNow); //$('#lockoutDate').val(oneMonthFromNow);
// bind actions // bind actions
$("#btn-revoke").bind("click", onRevoke); $("#btn-revoke").bind("click", onRevoke);
$("#perpetual").bind("change", onPerpetualChanged);
}; };
// return public methods // return public methods

View File

@@ -2,82 +2,141 @@
<form id="frm" method="post" action="index.html"> <form id="frm" method="post" action="index.html">
<div class="row"> <div class="row">
<input id="siteId" name="siteId" type="hidden" value=""> <input id="siteId" name="siteId" type="hidden" value="" />
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="registeredTo">Registered to</label> <label for="registeredTo">Registered to</label>
<input class="form-control" type="text" id="registeredTo" name="registeredTo" value=""> <input
class="form-control"
type="text"
id="registeredTo"
name="registeredTo"
value=""
/>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="dbId">dbId</label> <label for="dbId">dbId</label>
<input class="form-control" type="text" id="dbId" name="dbId" value=""> <input
class="form-control"
type="text"
id="dbId"
name="dbId"
value=""
/>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="maintenanceExpirationDate">Support expires</label> <label for="maintenanceExpirationDate">Support expires</label>
<input class="form-control" type="date" id="maintenanceExpirationDate" <input
name="maintenanceExpirationDate" value=""> class="form-control"
type="date"
id="maintenanceExpirationDate"
name="maintenanceExpirationDate"
value=""
/>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-check"> <div class="form-check">
<label class="form-check-label" for="licenseExpires"> <label class="form-check-label" for="licenseExpires">
<input class="form-check-input" type="checkbox" name="licenseExpires" id="licenseExpires"> <input
class="form-check-input"
type="checkbox"
name="licenseExpires"
id="licenseExpires"
/>
Temporary key / expires Temporary key / expires
</label> </label>
<input class="form-control" type="date" id="licenseExpirationDate" name="licenseExpirationDate" <input
value=""> class="form-control"
type="date"
id="licenseExpirationDate"
name="licenseExpirationDate"
value=""
/>
</div> </div>
</div> </div>
<div class="col-sm-6">
<div class="form-group">
<label for="techcount">Scheduleable users</label>
<input class="form-control" type="number" id="techcount" name="techcount" value="1">
</div>
</div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-check"> <div class="form-check">
<label class="form-check-label" for="perpetual"> <label class="form-check-label" for="perpetual">
<input class="form-check-input" type="checkbox" name="perpetual" id="perpetual"> <input
class="form-check-input"
type="checkbox"
name="perpetual"
id="perpetual"
/>
Perpetual license Perpetual license
</label> </label>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div id="perpettechcountblock" class="col-sm-6 d-none">
<div class="form-group"> <div class="form-group">
<label for="registeredTo">Subscription: 100 block Customer contacts</label> <label for="techcount">Scheduleable users</label>
<input class="form-control" type="number" id="subcustcount" name="subcustcount" value="1"> <input
class="form-control"
type="number"
id="techcount"
name="techcount"
value="1"
/>
</div>
</div>
<div id="subusercountblock" class="col-sm-6">
<div class="form-group">
<label for="subusercount">Internal users</label>
<input
class="form-control"
type="number"
id="subusercount"
name="subusercount"
value="1"
/>
</div>
</div>
<div id="subcustcountblock" class="col-sm-6">
<div class="form-group">
<label for="registeredTo">Customer users</label>
<input
class="form-control"
type="number"
id="subcustcount"
name="subcustcount"
value="100"
/>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="options">Additional features</label> <label for="options">Additional features</label>
<select class="form-control" name="options" id="options" multiple> <select
class="form-control"
name="options"
id="options"
multiple
>
<option value="TrialMode">TrialMode</option> <option value="TrialMode">TrialMode</option>
<option value="XXXXX">XXXXX</option> <option value="future1">future1</option>
<option value="XXXXXX">XXXXXX</option> <option value="future2">future2</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="app-frm-buttons"> {{!-- <div class="app-frm-buttons">
<button id="btn-revoke" class="btn btn-warning">Revoke</button> <button id="btn-revoke" class="btn btn-warning">Revoke</button>
</div> </div> --}}
</form> </form>
</div> </div>