zet-lib 1.5.25 → 1.5.26

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.
Files changed (2) hide show
  1. package/lib/zRoute.js +28 -12
  2. package/package.json +1 -1
package/lib/zRoute.js CHANGED
@@ -1152,19 +1152,35 @@ zRoute.dataTableFilter = (MYMODEL, relations, filter) => {
1152
1152
  };
1153
1153
 
1154
1154
  zRoute.approval_history_data = (arr = []) => {
1155
- let myvalue = "";
1156
- let APPROVAL_LEVELS = myCache.get("APPROVAL_LEVELS");
1157
- let USERS = Util.arrayToObject(myCache.get("zuser_created_by_1"), "id");
1158
- myvalue = "";
1159
- if (arr && arr.length > 0) {
1160
- arr.map((item) => {
1161
- myvalue += `[${APPROVAL_LEVELS[item.status].name} By:${
1162
- USERS[item.user_id].zname
1163
- }(${item.created_at}) (${item.text})] `;
1164
- });
1155
+ try {
1156
+ let myvalue = "";
1157
+ let APPROVAL_LEVELS = myCache.get("APPROVAL_LEVELS");
1158
+ let USERS = Util.arrayToObject(myCache.get("zuser_created_by_1"), "id");
1159
+ myvalue = "";
1160
+ if (arr && arr.length > 0) {
1161
+ arr = arr.reverse();
1162
+ arr.map((item) => {
1163
+ let statusName = ' '
1164
+ if (item.status == 6) {
1165
+ statusName = "Comment"
1166
+ } else if (item.status == 4) {
1167
+ statusName = "Reject"
1168
+ } else if (item.status == 3) {
1169
+ statusName = "Approve"
1170
+ } else {
1171
+ statusName = APPROVAL_LEVELS[item.status] ? APPROVAL_LEVELS[item.status].name : ''
1172
+ }
1173
+ myvalue += `${statusName} By:${
1174
+ USERS[item.user_id].zname || ''
1175
+ }&nbsp;-&nbsp;(${item.time ? Util.dateFormat(item.time, "DD MMM YYYY HH:mm") : ''}) (${item.comments ? item.comments : item.text || ''}) <br>`;
1176
+ });
1177
+ }
1178
+ return myvalue;
1179
+ } catch (e) {
1180
+ console.log(e)
1181
+ return '';
1165
1182
  }
1166
- return myvalue;
1167
- };
1183
+ }
1168
1184
 
1169
1185
  zRoute.dataTableData = (
1170
1186
  key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.5.25",
3
+ "version": "1.5.26",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"