@optimiser/common 1.0.267 → 1.0.268
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.js +27 -16
- package/package.json +1 -1
package/dist/lib/utility.js
CHANGED
|
@@ -391,14 +391,15 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
391
391
|
Width: 100
|
|
392
392
|
};
|
|
393
393
|
pageData.Fields.splice(0, 0, idObject);
|
|
394
|
+
//Code added by Brijesh on 25Apr2022, condition added for objectschema =PromoCodeTransaction and grouped then not condition
|
|
394
395
|
//By Kashish : To handle System Info Fields in Grid
|
|
395
|
-
if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) &&
|
|
396
|
+
if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && ["Session", "PromoCodeTransaction", "Task"].includes(pageData.ObjectName) == false)
|
|
396
397
|
pageData.Fields.push(createdByObj);
|
|
397
|
-
if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && pageData.ObjectName
|
|
398
|
+
if (!pageData.Fields.find(function (x) { return x.Name == 'CreatedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && ["Session", "PromoCodeTransaction"].includes(pageData.ObjectName) == false)
|
|
398
399
|
pageData.Fields.push(createdDateObj);
|
|
399
|
-
if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && pageData.ObjectName
|
|
400
|
+
if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedBy'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && ["Session", "PromoCodeTransaction"].includes(pageData.ObjectName) == false)
|
|
400
401
|
pageData.Fields.push(modByObj);
|
|
401
|
-
if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && pageData.ObjectName
|
|
402
|
+
if (!pageData.Fields.find(function (x) { return x.Name == 'ModifiedDate'; }) && !['CompanySessionLogList', 'CompanyTransactionLogsList'].includes(pageData.PageName) && ["Session", "PromoCodeTransaction"].includes(pageData.ObjectName) == false)
|
|
402
403
|
pageData.Fields.push(modDateObj);
|
|
403
404
|
}
|
|
404
405
|
if (pageData.Fields && pageData.Type == "ObjectDetail") {
|
|
@@ -2039,6 +2040,15 @@ function FilterConditions(condition, match, fields) {
|
|
|
2039
2040
|
if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
|
|
2040
2041
|
fldName += '_SearchValue';
|
|
2041
2042
|
}
|
|
2043
|
+
//added by nirbhay on 25.04.22 to add dropdown in any type of fields for filter
|
|
2044
|
+
if (field.Schema.SearchType) {
|
|
2045
|
+
fldName = field.UniqueID;
|
|
2046
|
+
if (field.Schema.SearchType == 'dropdown') {
|
|
2047
|
+
if (field.Schema.LookupObject && obj.Value && (field.Schema.SelectKeyType == undefined || field.Schema.SelectKeyType == 'objectid')) {
|
|
2048
|
+
obj.Value = new mongodb_1.ObjectId(obj.Value);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2042
2052
|
switch (field.Schema.UIDataType) {
|
|
2043
2053
|
case "int":
|
|
2044
2054
|
obj.Value = parseInt(obj.Value);
|
|
@@ -2078,6 +2088,9 @@ function FilterConditions(condition, match, fields) {
|
|
|
2078
2088
|
case "EQUAL":
|
|
2079
2089
|
if (obj.Value === '')
|
|
2080
2090
|
matchValue = { '$in': [null, ''] };
|
|
2091
|
+
else if (field.Schema.SearchType == 'dropdown') {
|
|
2092
|
+
matchValue = { '$eq': obj.Value };
|
|
2093
|
+
}
|
|
2081
2094
|
else if (["date", "datetime"].includes(field.Schema.UIDataType)) {
|
|
2082
2095
|
matchValue = { '$gte': moment_1.default(obj.Value).startOf('day').toDate(), '$lte': moment_1.default(obj.Value).endOf('day').toDate() };
|
|
2083
2096
|
}
|
|
@@ -2107,6 +2120,9 @@ function FilterConditions(condition, match, fields) {
|
|
|
2107
2120
|
case "NOT_EQUAL":
|
|
2108
2121
|
if (obj.Value === '')
|
|
2109
2122
|
matchValue = { '$nin': [null, ''] };
|
|
2123
|
+
else if (field.Schema.SearchType == 'dropdown') {
|
|
2124
|
+
matchValue = { '$ne': obj.Value };
|
|
2125
|
+
}
|
|
2110
2126
|
else if (["int", "decimal", "percent", "time"].includes(field.Schema.UIDataType)) {
|
|
2111
2127
|
matchValue = { '$ne': obj.Value };
|
|
2112
2128
|
}
|
|
@@ -2170,18 +2186,13 @@ function GirdHeaderFilters(filters, fields) {
|
|
|
2170
2186
|
if (field) {
|
|
2171
2187
|
var matchValue = null;
|
|
2172
2188
|
var fldName = field.UniqueID;
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
}
|
|
2181
|
-
else {
|
|
2182
|
-
fldName += '_SearchValue';
|
|
2183
|
-
matchValue = { '$regex': obj.Value.trim().replace(/[-[\]{}()*+?.,\\/^$|#\s]/g, "\\$&"), '$options': 'i' };
|
|
2184
|
-
}
|
|
2189
|
+
//added by nirbhay on 25.04.22 to add dropdown in any type of fields for filter
|
|
2190
|
+
if (field.Schema.SearchType == 'dropdown') {
|
|
2191
|
+
matchValue = { '$eq': bson_1.EJSON.parse(JSON.stringify(obj.Value)) };
|
|
2192
|
+
}
|
|
2193
|
+
else if (["lookup", "multilookup"].includes(field.Schema.UIDataType)) {
|
|
2194
|
+
fldName += '_SearchValue';
|
|
2195
|
+
matchValue = { '$regex': obj.Value.trim().replace(/[-[\]{}()*+?.,\\/^$|#\s]/g, "\\$&"), '$options': 'i' };
|
|
2185
2196
|
}
|
|
2186
2197
|
else if (["dropdown", "multiselect"].includes(field.Schema.UIDataType)) {
|
|
2187
2198
|
if (field.Schema.LookupObject) {
|