This commit is contained in:
@@ -537,6 +537,33 @@ export default {
|
|||||||
|
|
||||||
return new Date(value) < new Date();
|
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
|
// Turn a decimal number into a local
|
||||||
// currency display
|
// currency display
|
||||||
|
|||||||
@@ -948,6 +948,64 @@ async function clickHandler(menuItem) {
|
|||||||
return;
|
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
|
//generate license from subscription values here
|
||||||
//copied from biz-license default record values
|
//copied from biz-license default record values
|
||||||
var l = {
|
var l = {
|
||||||
@@ -956,11 +1014,11 @@ async function clickHandler(menuItem) {
|
|||||||
created: window.$gz.locale.nowUTC8601String(),
|
created: window.$gz.locale.nowUTC8601String(),
|
||||||
active: false, //here, active means it's ready for pickup
|
active: false, //here, active means it's ready for pickup
|
||||||
customerId: null,
|
customerId: null,
|
||||||
pGroup: 1, //default v7 since manually probably most common
|
pGroup: m.vm.obj.pGroup,
|
||||||
regTo: null,
|
regTo: m.vm.obj.regTo,
|
||||||
key: null,
|
key: null,
|
||||||
fetchCode: null,
|
fetchCode: null,
|
||||||
fetchEmail: null,
|
fetchEmail: m.vm.obj.fetchEmail,
|
||||||
fetchedOn: null, //here, non null fetchedOn is read only
|
fetchedOn: null, //here, non null fetchedOn is read only
|
||||||
dbId: null,
|
dbId: null,
|
||||||
licenseExpire: null, //what it is in v8, "lockdate" in v7
|
licenseExpire: null, //what it is in v8, "lockdate" in v7
|
||||||
@@ -1010,9 +1068,6 @@ async function clickHandler(menuItem) {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
switch (m.vm.obj.pGroup) {
|
switch (m.vm.obj.pGroup) {
|
||||||
case 0:
|
|
||||||
case 4:
|
|
||||||
throw new Error("Invalid PGroup");
|
|
||||||
case 1: //v7
|
case 1: //v7
|
||||||
{
|
{
|
||||||
l = {};
|
l = {};
|
||||||
@@ -1020,55 +1075,33 @@ async function clickHandler(menuItem) {
|
|||||||
break;
|
break;
|
||||||
case 2: //Raven perpetual
|
case 2: //Raven perpetual
|
||||||
{
|
{
|
||||||
// var v = {
|
l.dbId = m.vm.obj.dbId;
|
||||||
// data: {
|
l.customerUsers=null;
|
||||||
// id: 0,
|
l.maxDataGB=null;
|
||||||
// created: window.$gz.locale.nowUTC8601String(),
|
//iterate items, count up users and find the furthest future expiry date
|
||||||
// active: false,
|
var newestDate = window.$gz.locale.nowUTC8601String();
|
||||||
// notificationSent: false,
|
var totalUserCount = 0;
|
||||||
// customerId: m.vm.obj.customerId,
|
m.vm.obj.items.forEach(z => {
|
||||||
// customerViz: null,
|
if (
|
||||||
// pGroup: 2,
|
z.active &&
|
||||||
// regTo: "Vicom Australia",
|
z.productId == RAVEN_PERPETUAL_PRODUCT_SOCKEYE_ID
|
||||||
// key: null,
|
) {
|
||||||
// fetchCode: null,
|
totalUserCount += z.quantity;
|
||||||
// fetchEmail: "mparsons@vicom.com.au",
|
|
||||||
// fetchedOn: null,
|
// // eslint-disable-next-line
|
||||||
// dbId: "mZaliiy+/TsHF9rcMpIGWO20Q5FhPD1ZdnWO2cMKMW8=",
|
// debugger;
|
||||||
// licenseExpire: "5555-01-02T00:00:00Z",
|
if (
|
||||||
// maintenanceExpire: "2024-03-21T07:00:00Z",
|
window.$gz.locale.d1IsBeforeD2FromUTC8601String(
|
||||||
// renewal: true,
|
newestDate,
|
||||||
// trialMode: false,
|
z.expireDate
|
||||||
// customerUsers: null,
|
)
|
||||||
// maxDataGB: null,
|
) {
|
||||||
// users: 19,
|
newestDate = z.expireDate;
|
||||||
// wbi: false,
|
}
|
||||||
// wbiExpires: null,
|
}
|
||||||
// mbi: false,
|
});
|
||||||
// mbiExpires: null,
|
l.users = totalUserCount;
|
||||||
// ri: false,
|
l.maintenanceExpire = newestDate;
|
||||||
// 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 = {};
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: //RavenSubscription
|
case 3: //RavenSubscription
|
||||||
@@ -1078,13 +1111,14 @@ async function clickHandler(menuItem) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.push({
|
console.log("license", l);
|
||||||
name: "license-edit",
|
// this.$router.push({
|
||||||
params: {
|
// name: "license-edit",
|
||||||
recordid: 0,
|
// params: {
|
||||||
obj: l
|
// recordid: 0,
|
||||||
}
|
// obj: l
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user