@optimiser/common 1.0.272 → 1.0.275
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/utility.d.ts +1 -1
- package/dist/lib/utility.js +34 -28
- package/package.json +1 -1
package/dist/lib/utility.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare function MakeUserPasswordInvalid(options: AnyObjectInterface): void;
|
|
|
76
76
|
declare function ConvertJsonToXLXS(data: AnyObjectInterface, params: AnyObjectInterface | undefined, filePath: string): Promise<void>;
|
|
77
77
|
declare function SendResetPasswordMail(db: Db, userDetails: AnyObjectInterface, type?: string): Promise<unknown>;
|
|
78
78
|
declare function SendMailToSupport(mailData: AnyObjectInterface, callback: callBackInterface): void;
|
|
79
|
-
declare function MailTemplateStructure(content: string): string;
|
|
79
|
+
declare function MailTemplateStructure(content: string, HasDontReplyContent?: boolean): string;
|
|
80
80
|
declare function SendMailToCustomer(mailData: AnyObjectInterface, callback: callBackInterface): void;
|
|
81
81
|
declare function parseMSPCookie(cookie: AnyObjectInterface): any;
|
|
82
82
|
declare function isEmptyObj(object: AnyObjectInterface): boolean;
|
package/dist/lib/utility.js
CHANGED
|
@@ -2039,7 +2039,7 @@ function FilterConditions(condition, match, fields) {
|
|
|
2039
2039
|
if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
|
|
2040
2040
|
fldName += '_SearchValue';
|
|
2041
2041
|
}
|
|
2042
|
-
//added by nirbhay on 25.04.22 to add dropdown in any type of fields for filter
|
|
2042
|
+
//added by nirbhay on 25.04.22 to add dropdown and multiselect in any type of fields for filter
|
|
2043
2043
|
if (field.Schema.SearchType) {
|
|
2044
2044
|
fldName = field.UniqueID;
|
|
2045
2045
|
if (field.Schema.SearchType == 'dropdown') {
|
|
@@ -2047,6 +2047,13 @@ function FilterConditions(condition, match, fields) {
|
|
|
2047
2047
|
obj.Value = new mongodb_1.ObjectId(obj.Value);
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
+
else if (field.Schema.SearchType == 'multiselect') {
|
|
2051
|
+
if (field.Schema.LookupObject && obj.Value && obj.Value.length && (field.Schema.SelectKeyType == undefined || field.Schema.SelectKeyType == 'objectid')) {
|
|
2052
|
+
for (var j = 0; j < obj.Value.length; j++) {
|
|
2053
|
+
obj.Value[j] = new mongodb_1.ObjectId(obj.Value[j]);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2050
2057
|
}
|
|
2051
2058
|
switch (field.Schema.UIDataType) {
|
|
2052
2059
|
case "int":
|
|
@@ -2085,7 +2092,7 @@ function FilterConditions(condition, match, fields) {
|
|
|
2085
2092
|
case "CONTAINS":
|
|
2086
2093
|
if (obj.Value === '')
|
|
2087
2094
|
matchValue = { '$in': [null, ''] };
|
|
2088
|
-
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
|
|
2095
|
+
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType) || field.Schema.SearchType == 'multiselect') {
|
|
2089
2096
|
matchValue = { '$in': obj.Value };
|
|
2090
2097
|
}
|
|
2091
2098
|
else
|
|
@@ -2094,7 +2101,7 @@ function FilterConditions(condition, match, fields) {
|
|
|
2094
2101
|
case "NOT_CONTAINS":
|
|
2095
2102
|
if (obj.Value === '')
|
|
2096
2103
|
matchValue = { '$nin': [null, ''] };
|
|
2097
|
-
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
|
|
2104
|
+
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType) || field.Schema.SearchType == 'multiselect') {
|
|
2098
2105
|
matchValue = { '$nin': obj.Value };
|
|
2099
2106
|
}
|
|
2100
2107
|
else
|
|
@@ -2106,9 +2113,9 @@ function FilterConditions(condition, match, fields) {
|
|
|
2106
2113
|
else if (field.Schema.SearchType == 'dropdown') {
|
|
2107
2114
|
matchValue = { '$eq': obj.Value };
|
|
2108
2115
|
}
|
|
2109
|
-
else if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2110
|
-
|
|
2111
|
-
}
|
|
2116
|
+
// else if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2117
|
+
// matchValue = { '$gte': moment(obj.Value).startOf('day').toDate(), '$lte': moment(obj.Value).endOf('day').toDate() };
|
|
2118
|
+
// }
|
|
2112
2119
|
else if (["int", "decimal", "percent"].includes(field.Schema.UIDataType)) {
|
|
2113
2120
|
matchValue = { '$eq': obj.Value };
|
|
2114
2121
|
}
|
|
@@ -2146,33 +2153,29 @@ function FilterConditions(condition, match, fields) {
|
|
|
2146
2153
|
break;
|
|
2147
2154
|
case "GREATER_THAN":
|
|
2148
2155
|
if (obj.Value) {
|
|
2149
|
-
if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2150
|
-
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
matchValue = { '$gt': obj.Value };
|
|
2156
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2157
|
+
// matchValue = { '$gt': moment(obj.Value).endOf('day').toDate() };
|
|
2158
|
+
// } else
|
|
2159
|
+
matchValue = { '$gt': obj.Value };
|
|
2154
2160
|
}
|
|
2155
2161
|
break;
|
|
2156
2162
|
case "LESS_THAN":
|
|
2157
|
-
if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2158
|
-
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
matchValue = { '$lt': obj.Value };
|
|
2163
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2164
|
+
// matchValue = { '$lt': moment(obj.Value).startOf('day').toDate() }
|
|
2165
|
+
// } else
|
|
2166
|
+
matchValue = { '$lt': obj.Value };
|
|
2162
2167
|
break;
|
|
2163
2168
|
case "GREATER_OR_EQUAL":
|
|
2164
|
-
if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2165
|
-
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
matchValue = { '$gte': obj.Value };
|
|
2169
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2170
|
+
// matchValue = { '$gte': moment(obj.Value).startOf('day').toDate() }
|
|
2171
|
+
// } else
|
|
2172
|
+
matchValue = { '$gte': obj.Value };
|
|
2169
2173
|
break;
|
|
2170
2174
|
case "LESS_OR_EQUAL":
|
|
2171
|
-
if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2172
|
-
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
matchValue = { '$lte': obj.Value };
|
|
2175
|
+
// if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2176
|
+
// matchValue = { '$lte': moment(obj.Value).endOf('day').toDate() }
|
|
2177
|
+
// } else
|
|
2178
|
+
matchValue = { '$lte': obj.Value };
|
|
2176
2179
|
break;
|
|
2177
2180
|
case "STARTS_WITH":
|
|
2178
2181
|
matchValue = { '$regex': '^' + obj.Value, '$options': 'i' };
|
|
@@ -2207,6 +2210,9 @@ function GirdHeaderFilters(filters, fields) {
|
|
|
2207
2210
|
if (field.Schema.SearchType == 'dropdown') {
|
|
2208
2211
|
matchValue = { '$eq': bson_1.EJSON.parse(JSON.stringify(obj.Value)) };
|
|
2209
2212
|
}
|
|
2213
|
+
else if (field.Schema.SearchType == 'multiselect') {
|
|
2214
|
+
matchValue = { '$in': bson_1.EJSON.parse(JSON.stringify(obj.Value)) };
|
|
2215
|
+
}
|
|
2210
2216
|
else if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
|
|
2211
2217
|
fldName += '_SearchValue';
|
|
2212
2218
|
matchValue = { '$regex': obj.Value.trim().replace(/[-[\]{}()*+?.,\\/^$|#\s]/g, "\\$&"), '$options': 'i' };
|
|
@@ -3151,8 +3157,8 @@ function SendMailToSupport(mailData, callback) {
|
|
|
3151
3157
|
});
|
|
3152
3158
|
}
|
|
3153
3159
|
exports.SendMailToSupport = SendMailToSupport;
|
|
3154
|
-
function MailTemplateStructure(content) {
|
|
3155
|
-
return "<html xmlns:v=\"urn:schemas-microsoft-com:vml\">\n <head>\n <style> v:* { behavior: url(#default#VML); }</style >\n </head>\n <body style='background-color: #fff;'>\n <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n <!-- <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fff;\"> -->\n <tr>\n <td align=\"center\" valign=\"top\">\n <table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fff;\">\n <tr>\n <td align=\"left\" valign=\"top\" bgcolor=\"#ffffff\" style=\"padding-top:16px; padding-bottom:12px; padding-left: 20px; padding-right: 20px; background-color: #fff; border-bottom: 1px solid #fff;\">\n <img src=\"https://platform.optimiser.com/images/MainLogo.png\" alt=\"Optimiser\"/>\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" bgcolor=\"#fff\" style=\"background-color: #fff; text-align: left; padding-right: 0px; padding-left: 0px; font-size:16px; font-family:Arial, Helvetica, sans-serif; color:#000000;\">\n " + content + "\n <p style=\"margin-bottom: 1em;\">\n Thanks,<br>\n " + constants_1.default.ProjectName + " team\n </p>\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" bgcolor=\"##075DA8\" style=\" border-top: 1px solid #dee2e6; background-color: #075DA8
|
|
3160
|
+
function MailTemplateStructure(content, HasDontReplyContent) {
|
|
3161
|
+
return "<html xmlns:v=\"urn:schemas-microsoft-com:vml\">\n <head>\n <style> v:* { behavior: url(#default#VML); }</style >\n </head>\n <body style='background-color: #fff;'>\n <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n <!-- <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fff;\"> -->\n <tr>\n <td align=\"center\" valign=\"top\">\n <table width=\"650\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fff;\">\n <tr>\n <td align=\"left\" valign=\"top\" bgcolor=\"#ffffff\" style=\"padding-top:16px; padding-bottom:12px; padding-left: 20px; padding-right: 20px; background-color: #fff; border-bottom: 1px solid #fff;\">\n <img src=\"https://platform.optimiser.com/images/MainLogo.png\" alt=\"Optimiser\"/>\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" bgcolor=\"#fff\" style=\"background-color: #fff; text-align: left; padding-right: 0px; padding-left: 0px; font-size:16px; font-family:Arial, Helvetica, sans-serif; color:#000000;\">\n " + content + "\n <p style=\"margin-bottom: 1em;\">\n Thanks,<br>\n " + constants_1.default.ProjectName + " team\n </p>\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" bgcolor=\"##075DA8\" style=\" border-top: 1px solid #dee2e6; background-color: #075DA8;\">\n <p style=\"font-size:13px; font-family:Arial, Helvetica, sans-serif; color:#fff; margin:1.8em; font-weight:normal;\">\n <a href=\"https://www.optimiser.com/\" style=\"color:#fff; text-decoration:underline; \">www.optimiser.com</a> | <a href=\"mailto:support@optimiser.com\" style=\"color:#fff; text-decoration:underline; \">support@optimiser.com</a> | \n +44 (0)203 972 1666\n </p>\n </td>\n </tr>\n " + (HasDontReplyContent ? "<tr>\n <td align=\"center\" valign=\"top\" bgcolor=\"#fff\" style=\"margin-top: 1em;background-color: #fff; text-align: left; padding-right: 0px; padding-left: 0px; font-size:13px; font-family:Arial, Helvetica, sans-serif; color:#000000;\">\n <p style=\"margin-top: 1em;\">\n ##DonotReplyContent##\n </p>\n </td>\n </tr>" : '') + "\n \n </table>\n </td>\n </tr>\n </table>\n </body>";
|
|
3156
3162
|
/* `<body style='background-color: #eee;'>
|
|
3157
3163
|
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="background:#eee;">
|
|
3158
3164
|
<tr>
|