This commit is contained in:
@@ -537,6 +537,33 @@ export default {
|
||||
|
||||
return new Date(value) < new Date();
|
||||
},
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// parse UTC ISO 8601 strings, compare
|
||||
// if(d1 is less than d2 )
|
||||
d1IsBeforeD2FromUTC8601String(d1, d2) {
|
||||
if (!d1 || d1 == "" || !d2 == null || d2 == "") {
|
||||
throw new Error("isD1BeforeD2 empty value");
|
||||
}
|
||||
//instantiate a luxon date object from val which is assumed to be an iso string
|
||||
const d1Date = window.$gz.DateTime.fromISO(d1);
|
||||
if (!d1Date.isValid) {
|
||||
throw new Error("locale::isD1BeforeD2, d1 not valid:", {
|
||||
d1: d1,
|
||||
d1Date: d1Date
|
||||
});
|
||||
}
|
||||
const d2Date = window.$gz.DateTime.fromISO(d2);
|
||||
if (!d2Date.isValid) {
|
||||
throw new Error("locale::isD1BeforeD2, d2 not valid:", {
|
||||
d2: d2,
|
||||
d2Date: d2Date
|
||||
});
|
||||
}
|
||||
|
||||
return d1Date < d2Date;
|
||||
},
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Turn a decimal number into a local
|
||||
// currency display
|
||||
|
||||
@@ -948,6 +948,64 @@ async function clickHandler(menuItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m.vm.obj.fetchEmail == null) {
|
||||
throw new Error("Email address Required");
|
||||
}
|
||||
|
||||
if (m.vm.obj.regTo == null) {
|
||||
throw new Error("Registered to Required");
|
||||
}
|
||||
|
||||
if (m.vm.obj.pGroup == 0 || m.vm.obj.pGroup == 4) {
|
||||
throw new Error("Invalid product group");
|
||||
}
|
||||
|
||||
if (m.vm.obj.items.length == 0) {
|
||||
throw new Error("No subscription items to license");
|
||||
}
|
||||
|
||||
if (
|
||||
(m.vm.obj.pGroup == 2 || m.vm.obj.pGroup == 3) &&
|
||||
m.vm.obj.dbId == null
|
||||
) {
|
||||
throw new Error("DB ID Required");
|
||||
}
|
||||
|
||||
const RAVEN_PERPETUAL_PRODUCT_SOCKEYE_ID = 4;
|
||||
// const RAVEN_SUBSCRIPTION_MONTHLY_PRODUCT_SOCKEYE_ID = 22;
|
||||
// const RAVEN_SUBSCRIPTION_YEARLY_PRODUCT_SOCKEYE_ID = 24;
|
||||
// const PRODUCT_INTERNAL_ID = [
|
||||
// { id: 19, name: "AyaNova Lite ", active: true },
|
||||
// {
|
||||
// id: 4,
|
||||
// name:
|
||||
// "AyaNova perpetual single user license includes one year maintenance plan ",
|
||||
// active: true
|
||||
// },
|
||||
// { id: 22, name: "AyaNova subscription one user monthly ", active: true },
|
||||
// { id: 24, name: "AyaNova subscription one user yearly ", active: true },
|
||||
// { id: 23, name: "Custom 539230073 ", active: true },
|
||||
// { id: 21, name: "Custom 733918243 ", active: true },
|
||||
// { id: 10, name: "Export to XLS ", active: true },
|
||||
// { id: 11, name: "Importexport.csv duplicate ", active: true },
|
||||
// { id: 14, name: "Key Administration ", active: true },
|
||||
// { id: 13, name: "MBI ", active: true },
|
||||
// { id: 16, name: "OLI ", active: true },
|
||||
// { id: 18, name: "Outlook Schedule Export ", active: true },
|
||||
// { id: 15, name: "PTI ", active: true },
|
||||
// { id: 8, name: "QBI ", active: true },
|
||||
// { id: 6, name: "QBOI ", active: true },
|
||||
// { id: 5, name: "Quick Notification ", active: true },
|
||||
// { id: 3, name: "RI ", active: true },
|
||||
// { id: 7, name: "Single ", active: true },
|
||||
// { id: 9, name: "Up to 10 ", active: true },
|
||||
// { id: 17, name: "Up to 15 ", active: true },
|
||||
// { id: 12, name: "Up to 20 ", active: true },
|
||||
// { id: 2, name: "Up to 5 ", active: true },
|
||||
// { id: 20, name: "Up to 999 ", active: true },
|
||||
// { id: 1, name: "WBI ", active: true }
|
||||
// ];
|
||||
|
||||
//generate license from subscription values here
|
||||
//copied from biz-license default record values
|
||||
var l = {
|
||||
@@ -956,11 +1014,11 @@ async function clickHandler(menuItem) {
|
||||
created: window.$gz.locale.nowUTC8601String(),
|
||||
active: false, //here, active means it's ready for pickup
|
||||
customerId: null,
|
||||
pGroup: 1, //default v7 since manually probably most common
|
||||
regTo: null,
|
||||
pGroup: m.vm.obj.pGroup,
|
||||
regTo: m.vm.obj.regTo,
|
||||
key: null,
|
||||
fetchCode: null,
|
||||
fetchEmail: null,
|
||||
fetchEmail: m.vm.obj.fetchEmail,
|
||||
fetchedOn: null, //here, non null fetchedOn is read only
|
||||
dbId: null,
|
||||
licenseExpire: null, //what it is in v8, "lockdate" in v7
|
||||
@@ -1010,9 +1068,6 @@ async function clickHandler(menuItem) {
|
||||
|
||||
*/
|
||||
switch (m.vm.obj.pGroup) {
|
||||
case 0:
|
||||
case 4:
|
||||
throw new Error("Invalid PGroup");
|
||||
case 1: //v7
|
||||
{
|
||||
l = {};
|
||||
@@ -1020,55 +1075,33 @@ async function clickHandler(menuItem) {
|
||||
break;
|
||||
case 2: //Raven perpetual
|
||||
{
|
||||
// var v = {
|
||||
// data: {
|
||||
// id: 0,
|
||||
// created: window.$gz.locale.nowUTC8601String(),
|
||||
// active: false,
|
||||
// notificationSent: false,
|
||||
// customerId: m.vm.obj.customerId,
|
||||
// customerViz: null,
|
||||
// pGroup: 2,
|
||||
// regTo: "Vicom Australia",
|
||||
// key: null,
|
||||
// fetchCode: null,
|
||||
// fetchEmail: "mparsons@vicom.com.au",
|
||||
// fetchedOn: null,
|
||||
// dbId: "mZaliiy+/TsHF9rcMpIGWO20Q5FhPD1ZdnWO2cMKMW8=",
|
||||
// licenseExpire: "5555-01-02T00:00:00Z",
|
||||
// maintenanceExpire: "2024-03-21T07:00:00Z",
|
||||
// renewal: true,
|
||||
// trialMode: false,
|
||||
// customerUsers: null,
|
||||
// maxDataGB: null,
|
||||
// users: 19,
|
||||
// wbi: false,
|
||||
// wbiExpires: null,
|
||||
// mbi: false,
|
||||
// mbiExpires: null,
|
||||
// ri: false,
|
||||
// riExpires: null,
|
||||
// qbi: false,
|
||||
// qbiExpires: null,
|
||||
// qboi: false,
|
||||
// qboiExpires: null,
|
||||
// pti: false,
|
||||
// ptiExpires: null,
|
||||
// quickNotification: false,
|
||||
// quickNotificationExpires: null,
|
||||
// exportToXLS: false,
|
||||
// exportToXLSExpires: null,
|
||||
// outlookSchedule: false,
|
||||
// outlookScheduleExpires: null,
|
||||
// oli: false,
|
||||
// oliExpires: null,
|
||||
// importExportCSVDuplicate: false,
|
||||
// importExportCSVDuplicateExpires: null,
|
||||
// wiki: null,
|
||||
// tags: []
|
||||
// }
|
||||
// };
|
||||
l = {};
|
||||
l.dbId = m.vm.obj.dbId;
|
||||
l.customerUsers=null;
|
||||
l.maxDataGB=null;
|
||||
//iterate items, count up users and find the furthest future expiry date
|
||||
var newestDate = window.$gz.locale.nowUTC8601String();
|
||||
var totalUserCount = 0;
|
||||
m.vm.obj.items.forEach(z => {
|
||||
if (
|
||||
z.active &&
|
||||
z.productId == RAVEN_PERPETUAL_PRODUCT_SOCKEYE_ID
|
||||
) {
|
||||
totalUserCount += z.quantity;
|
||||
|
||||
// // eslint-disable-next-line
|
||||
// debugger;
|
||||
if (
|
||||
window.$gz.locale.d1IsBeforeD2FromUTC8601String(
|
||||
newestDate,
|
||||
z.expireDate
|
||||
)
|
||||
) {
|
||||
newestDate = z.expireDate;
|
||||
}
|
||||
}
|
||||
});
|
||||
l.users = totalUserCount;
|
||||
l.maintenanceExpire = newestDate;
|
||||
}
|
||||
break;
|
||||
case 3: //RavenSubscription
|
||||
@@ -1078,13 +1111,14 @@ async function clickHandler(menuItem) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.$router.push({
|
||||
name: "license-edit",
|
||||
params: {
|
||||
recordid: 0,
|
||||
obj: l
|
||||
}
|
||||
});
|
||||
console.log("license", l);
|
||||
// this.$router.push({
|
||||
// name: "license-edit",
|
||||
// params: {
|
||||
// recordid: 0,
|
||||
// obj: l
|
||||
// }
|
||||
// });
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user