vc-create-dashboard 2.1.8 → 2.2.0

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@angular/common'), require('vcomply-editor'), require('ng2-date-picker'), require('@angular/forms'), require('nanoid'), require('@angular/platform-browser'), require('@angular/router')) :
3
- typeof define === 'function' && define.amd ? define('create-dashboard', ['exports', '@angular/core', '@angular/common/http', 'rxjs', 'rxjs/operators', 'moment', '@angular/common', 'vcomply-editor', 'ng2-date-picker', '@angular/forms', 'nanoid', '@angular/platform-browser', '@angular/router'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['create-dashboard'] = {}, global.ng.core, global.ng.common.http, global.rxjs, global.rxjs.operators, global.moment, global.ng.common, global.vcomplyEditor, global.ng2DatePicker, global.ng.forms, global.nanoid, global.ng.platformBrowser, global.ng.router));
5
- }(this, (function (exports, i0, i1, rxjs, operators, moment, common, vcomplyEditor, ng2DatePicker, forms, nanoid, platformBrowser, router) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@auth0/angular-jwt'), require('rxjs'), require('rxjs/operators'), require('moment'), require('@angular/common'), require('vcomply-editor'), require('ng2-date-picker'), require('@angular/forms'), require('nanoid'), require('@angular/platform-browser'), require('@angular/router')) :
3
+ typeof define === 'function' && define.amd ? define('create-dashboard', ['exports', '@angular/core', '@angular/common/http', '@auth0/angular-jwt', 'rxjs', 'rxjs/operators', 'moment', '@angular/common', 'vcomply-editor', 'ng2-date-picker', '@angular/forms', 'nanoid', '@angular/platform-browser', '@angular/router'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['create-dashboard'] = {}, global.ng.core, global.ng.common.http, global.angularJwt, global.rxjs, global.rxjs.operators, global.moment, global.ng.common, global.vcomplyEditor, global.ng2DatePicker, global.ng.forms, global.nanoid, global.ng.platformBrowser, global.ng.router));
5
+ }(this, (function (exports, i0, i1, angularJwt, rxjs, operators, moment, common, vcomplyEditor, ng2DatePicker, forms, nanoid, platformBrowser, router) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -465,8 +465,18 @@
465
465
  CreateDashboardService.prototype.updateDashboard = function (id, payload) {
466
466
  return this.http.put(this.env.dashboard + 'UpdateDashboard/' + id, payload, this.httpOptions).pipe(operators.retry(2));
467
467
  };
468
- CreateDashboardService.prototype.getSubscriptionList = function () {
469
- return this.http.get(this.env.OrganizationGet + 'subscriptionList', this.httpOptions).pipe(operators.retry(2));
468
+ CreateDashboardService.prototype.getUserInformation = function () {
469
+ return this.http.get(this.env.organizationGet + 'users&id=' + this._ID(), this.httpOptions).pipe(operators.retry(2));
470
+ };
471
+ CreateDashboardService.prototype._ID = function () {
472
+ var helper = new angularJwt.JwtHelperService();
473
+ var myRawToken = localStorage.getItem('currentUser') || '{}';
474
+ var isExpired = helper === null || helper === void 0 ? void 0 : helper.isTokenExpired(myRawToken);
475
+ if (isExpired === false) {
476
+ var tokenInfo = helper === null || helper === void 0 ? void 0 : helper.decodeToken(myRawToken);
477
+ return tokenInfo._id;
478
+ }
479
+ return '';
470
480
  };
471
481
  CreateDashboardService.prototype.checkDuplicateDashboardName = function (payload) {
472
482
  return this.http.post(this.env.dashboard + 'DuplicateDashboard', payload, this.httpOptions).pipe(operators.retry(2));
@@ -875,9 +885,13 @@
875
885
  this.getComplianceCategoryList();
876
886
  this.checkWhetherAllListsLoaded();
877
887
  this.getUsersList('');
878
- this.createDashboardService.getSubscriptionList().subscribe(function (res) {
879
- if (res[0].risk_flag) {
880
- _this.showRiskCategory = res[0].risk_flag;
888
+ this.createDashboardService.getUserInformation().subscribe(function (res) {
889
+ var quickLink = res.quick_link;
890
+ if (quickLink.risk) {
891
+ _this.showRiskCategory = true;
892
+ }
893
+ else {
894
+ _this.showRiskCategory = false;
881
895
  }
882
896
  }, function (error) { console.log(error); });
883
897
  this.setFrequency("2~1~0~0", 'import');
@@ -1215,6 +1229,14 @@
1215
1229
  switch (type) {
1216
1230
  case 'rc':
1217
1231
  this.dashboardForm.selectedResponsibilityCenters = this.setList(this.responsibilityCentersList, selectedItems, 'item_id');
1232
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1233
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1234
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1235
+ }
1236
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1237
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1238
+ }
1239
+ }
1218
1240
  break;
1219
1241
  case 'whoCanView':
1220
1242
  this.dashboardForm.selectedViewers = selectedItems;
@@ -1222,28 +1244,53 @@
1222
1244
  break;
1223
1245
  case 'responsibilityCategories':
1224
1246
  this.dashboardForm.selectedResponsibilityCategories = selectedItems;
1247
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1248
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1249
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1250
+ }
1251
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1252
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1253
+ }
1254
+ }
1225
1255
  break;
1226
1256
  case 'riskCategory':
1227
1257
  this.dashboardForm.selectedRiskCategories = selectedItems;
1258
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1259
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1260
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1261
+ }
1262
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1263
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1264
+ }
1265
+ }
1228
1266
  break;
1229
1267
  }
1230
1268
  this.activateSelector('', false);
1231
1269
  };
1232
1270
  CreateDashboardComponent.prototype.remove = function (type, event, removeIndex) {
1233
1271
  var _this = this;
1272
+ var _a, _b;
1234
1273
  switch (type) {
1235
1274
  case 'rc':
1236
1275
  var rcIndex = this.dashboardForm.selectedResponsibilityCenters.findIndex(function (rc) { return rc.rc_id == event.rc_id; });
1237
1276
  if (rcIndex !== -1) {
1238
1277
  var parentRc = this.dashboardForm.selectedResponsibilityCenters[rcIndex];
1239
1278
  this.dashboardForm.selectedResponsibilityCenters.splice(rcIndex, 1);
1240
- if ((parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids.length) > 0) {
1279
+ if (((_a = parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1241
1280
  parentRc.item_child_ids.forEach(function (childElement) {
1242
1281
  var removeIndex = _this.dashboardForm.selectedResponsibilityCenters.findIndex(function (removeElement) { return removeElement.rc_id == childElement; });
1243
1282
  _this.dashboardForm.selectedResponsibilityCenters.splice(removeIndex, 1);
1244
1283
  });
1245
1284
  }
1246
1285
  }
1286
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1287
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1288
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1289
+ }
1290
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1291
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1292
+ }
1293
+ }
1247
1294
  break;
1248
1295
  case 'whoCanView':
1249
1296
  var reviewerIndex = this.dashboardForm.selectedViewers.findIndex(function (viewer) { return viewer.member_id == event.member_id; });
@@ -1252,13 +1299,21 @@
1252
1299
  case 'responsibilityCategories':
1253
1300
  var CCcategoryIndex = this.dashboardForm.selectedResponsibilityCategories.findIndex(function (CCcategory) { return CCcategory.category_id == event.category_id; });
1254
1301
  this.dashboardForm.selectedResponsibilityCategories.splice(CCcategoryIndex, 1);
1302
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1303
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1304
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1305
+ }
1306
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1307
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1308
+ }
1309
+ }
1255
1310
  break;
1256
1311
  case 'riskCategory':
1257
1312
  var riskCategoryIndex = this.dashboardForm.selectedRiskCategories.findIndex(function (riskCategory) { return riskCategory.category_id == event.category_id; });
1258
1313
  if (riskCategoryIndex !== -1) {
1259
1314
  var parent = this.dashboardForm.selectedRiskCategories[riskCategoryIndex];
1260
1315
  this.dashboardForm.selectedRiskCategories.splice(riskCategoryIndex, 1);
1261
- if ((parent === null || parent === void 0 ? void 0 : parent.child_cat_ids.length) > 0) {
1316
+ if (((_b = parent === null || parent === void 0 ? void 0 : parent.child_cat_ids) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1262
1317
  parent.child_cat_ids.forEach(function (childElement) {
1263
1318
  var removeIndex = _this.dashboardForm.selectedRiskCategories.findIndex(function (removeElement) { return removeElement.category_id == childElement; });
1264
1319
  _this.dashboardForm.selectedRiskCategories.splice(removeIndex, 1);
@@ -1266,6 +1321,14 @@
1266
1321
  }
1267
1322
  }
1268
1323
  this.dashboardForm.selectedRiskCategories.splice(riskCategoryIndex, 1);
1324
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
1325
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
1326
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'COMPLIANCE'; });
1327
+ }
1328
+ else if (this.dashboardForm.selectedRiskCategories.length == 0) {
1329
+ this.selectedWidgets = this.selectedWidgets.filter(function (element) { return element.module_name != 'RISK'; });
1330
+ }
1331
+ }
1269
1332
  break;
1270
1333
  }
1271
1334
  };
@@ -1980,6 +2043,7 @@
1980
2043
  };
1981
2044
  ResponsibilityCenterComponent.prototype.selectRc = function (rc, mode) {
1982
2045
  var _this = this;
2046
+ var _a, _b;
1983
2047
  if (this.radioSelection) {
1984
2048
  if (mode) {
1985
2049
  this.selectedIds = [];
@@ -1993,7 +2057,7 @@
1993
2057
  var rcElement = this.responsibilityCentersList.findIndex(function (ele) { return ele.item_id == rc; });
1994
2058
  if (rcElement !== -1) {
1995
2059
  var parentRc = this.responsibilityCentersList[rcElement];
1996
- if ((parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids.length) > 0) {
2060
+ if (((_a = parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1997
2061
  parentRc.item_child_ids.forEach(function (childElement) {
1998
2062
  if (!_this.selectedIds.includes(childElement)) {
1999
2063
  _this.selectedIds.push(childElement);
@@ -2008,7 +2072,7 @@
2008
2072
  var rcElement = this.responsibilityCentersList.findIndex(function (ele) { return ele.item_id == rc; });
2009
2073
  if (rcElement !== -1) {
2010
2074
  var parentRc = this.responsibilityCentersList[rcElement];
2011
- if ((parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids.length) > 0) {
2075
+ if (((_b = parentRc === null || parentRc === void 0 ? void 0 : parentRc.item_child_ids) === null || _b === void 0 ? void 0 : _b.length) > 0) {
2012
2076
  parentRc.item_child_ids.forEach(function (childElement) {
2013
2077
  var removeIndex = _this.selectedIds.findIndex(function (removeElement) { return removeElement == childElement; });
2014
2078
  _this.selectedIds.splice(removeIndex, 1);
@@ -2141,12 +2205,13 @@
2141
2205
  };
2142
2206
  CategoriesComponent.prototype.selectCategory = function (mode, activeTab, category) {
2143
2207
  var _this = this;
2208
+ var _a, _b;
2144
2209
  if (mode) {
2145
2210
  this.selectedIds.push(category[this.categoryIdKey]);
2146
2211
  var rcElement = this.allCategories.findIndex(function (ele) { return ele.category_id == category[_this.categoryIdKey]; });
2147
2212
  if (rcElement !== -1) {
2148
2213
  var parentRc = this.allCategories[rcElement];
2149
- if ((parentRc === null || parentRc === void 0 ? void 0 : parentRc.child_cat_ids.length) > 0) {
2214
+ if (((_a = parentRc === null || parentRc === void 0 ? void 0 : parentRc.child_cat_ids) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2150
2215
  parentRc.child_cat_ids.forEach(function (childElement) {
2151
2216
  if (!_this.selectedIds.includes(childElement)) {
2152
2217
  _this.selectedIds.push(childElement);
@@ -2161,7 +2226,7 @@
2161
2226
  var rcElement = this.allCategories.findIndex(function (ele) { return ele.category_id == category[_this.categoryIdKey]; });
2162
2227
  if (rcElement !== -1) {
2163
2228
  var parentRc = this.allCategories[rcElement];
2164
- if ((parentRc === null || parentRc === void 0 ? void 0 : parentRc.child_cat_ids.length) > 0) {
2229
+ if (((_b = parentRc === null || parentRc === void 0 ? void 0 : parentRc.child_cat_ids) === null || _b === void 0 ? void 0 : _b.length) > 0) {
2165
2230
  parentRc.child_cat_ids.forEach(function (childElement) {
2166
2231
  var removeIndex = _this.selectedIds.findIndex(function (removeElement) { return removeElement == childElement; });
2167
2232
  _this.selectedIds.splice(removeIndex, 1);