vc-create-dashboard 2.8.27 → 2.8.28

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.
@@ -3146,25 +3146,25 @@ class CreateDashboardComponent {
3146
3146
  this.dashboardDescription = {
3147
3147
  placeholder: 'Description (Max limit: 250 characters)',
3148
3148
  mode: 'prime',
3149
- id: 'description'
3149
+ id: 'description',
3150
3150
  };
3151
3151
  this.responsibilityCategoriesTree = {
3152
3152
  regulations: {
3153
3153
  list: [],
3154
- selectedList: []
3154
+ selectedList: [],
3155
3155
  },
3156
3156
  standards: {
3157
3157
  list: [],
3158
- selectedList: []
3158
+ selectedList: [],
3159
3159
  },
3160
3160
  internalControls: {
3161
3161
  list: [],
3162
- selectedList: []
3162
+ selectedList: [],
3163
3163
  },
3164
3164
  others: {
3165
3165
  list: [],
3166
- selectedList: []
3167
- }
3166
+ selectedList: [],
3167
+ },
3168
3168
  };
3169
3169
  this.allComplianceCategories = [];
3170
3170
  this.allRiskCategories = [];
@@ -3186,16 +3186,41 @@ class CreateDashboardComponent {
3186
3186
  selectedFrequencyType: '',
3187
3187
  selectedFrequencies: [0],
3188
3188
  frequencyMessage: '',
3189
- frequencyDate: 1
3189
+ frequencyDate: 1,
3190
3190
  };
3191
3191
  this.openConfigureWidgets = false;
3192
3192
  this.selectedWidgets = [];
3193
3193
  this.displayedWidgets = [];
3194
3194
  this.responsibilityCentersList = [];
3195
3195
  this.datePickerOverlay = false;
3196
- this.dayNames = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
3197
- this.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
3198
- this.quarters = ['January, April, July, October', 'February, May, August, November', 'March, June, September, December'];
3196
+ this.dayNames = [
3197
+ 'Monday',
3198
+ 'Tuesday',
3199
+ 'Wednesday',
3200
+ 'Thursday',
3201
+ 'Friday',
3202
+ 'Saturday',
3203
+ 'Sunday',
3204
+ ];
3205
+ this.monthNames = [
3206
+ 'January',
3207
+ 'February',
3208
+ 'March',
3209
+ 'April',
3210
+ 'May',
3211
+ 'June',
3212
+ 'July',
3213
+ 'August',
3214
+ 'September',
3215
+ 'October',
3216
+ 'November',
3217
+ 'December',
3218
+ ];
3219
+ this.quarters = [
3220
+ 'January, April, July, October',
3221
+ 'February, May, August, November',
3222
+ 'March, June, September, December',
3223
+ ];
3199
3224
  this.categoryListLoaded = false;
3200
3225
  this.showRiskWidgets = false;
3201
3226
  this.showComplianceWidgets = false;
@@ -3203,23 +3228,23 @@ class CreateDashboardComponent {
3203
3228
  this.riskCategoryList = {
3204
3229
  strategic: {
3205
3230
  list: [],
3206
- selectedList: []
3231
+ selectedList: [],
3207
3232
  },
3208
3233
  operational: {
3209
3234
  list: [],
3210
- selectedList: []
3235
+ selectedList: [],
3211
3236
  },
3212
3237
  compliance: {
3213
3238
  list: [],
3214
- selectedList: []
3239
+ selectedList: [],
3215
3240
  },
3216
3241
  others: {
3217
3242
  list: [],
3218
- selectedList: []
3243
+ selectedList: [],
3219
3244
  },
3220
3245
  };
3221
3246
  this.fromDatePickerConfig = {
3222
- min: this.getCurrentDate()
3247
+ min: this.getCurrentDate(),
3223
3248
  };
3224
3249
  this.toDatePickerConfig = {};
3225
3250
  this.smileyMessage = '';
@@ -3237,7 +3262,7 @@ class CreateDashboardComponent {
3237
3262
  }
3238
3263
  ngOnInit() {
3239
3264
  var _a;
3240
- this.groupsEnabled = (_a = this.feature) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled("ff_groups_improvements");
3265
+ this.groupsEnabled = (_a = this.feature) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled('ff_groups_improvements');
3241
3266
  this.animation = true;
3242
3267
  setTimeout(() => {
3243
3268
  this.animation = false;
@@ -3246,7 +3271,7 @@ class CreateDashboardComponent {
3246
3271
  this.getCategoryList();
3247
3272
  this.getRCList();
3248
3273
  this.getComplianceCategoryList();
3249
- this.setFrequency("2~1~0~0", 'import');
3274
+ this.setFrequency('2~1~0~0', 'import');
3250
3275
  this.checkWhetherAllListsLoaded();
3251
3276
  this.getUsersList('');
3252
3277
  this.getGroupList();
@@ -3259,7 +3284,9 @@ class CreateDashboardComponent {
3259
3284
  else {
3260
3285
  this.showRiskCategory = false;
3261
3286
  }
3262
- }, error => { console.log(error); });
3287
+ }, (error) => {
3288
+ console.log(error);
3289
+ });
3263
3290
  }
3264
3291
  /**
3265
3292
  * Displays the listing pages the left side of policy form to set and edit the dropdown fields values
@@ -3301,7 +3328,7 @@ class CreateDashboardComponent {
3301
3328
  this.toDatePickerConfig = { min: minToDate };
3302
3329
  const fromDate = new Date(minToDate.split('-').reverse().join('-'));
3303
3330
  const toDate = new Date(this.dashboardForm.selectedToDate);
3304
- const inValidDate = (fromDate >= toDate) ? true : false;
3331
+ const inValidDate = fromDate >= toDate ? true : false;
3305
3332
  if (inValidDate) {
3306
3333
  this.dashboardForm.selectedToDate = undefined;
3307
3334
  this.hideToDate = true;
@@ -3329,15 +3356,20 @@ class CreateDashboardComponent {
3329
3356
  }
3330
3357
  getCurrentDate() {
3331
3358
  let today = new Date();
3332
- return today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
3359
+ return (today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear());
3333
3360
  }
3334
3361
  setToDate(data) {
3335
3362
  let today = new Date(data);
3336
- return today.getDate() + 1 + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
3363
+ return (today.getDate() +
3364
+ 1 +
3365
+ '-' +
3366
+ (today.getMonth() + 1) +
3367
+ '-' +
3368
+ today.getFullYear());
3337
3369
  }
3338
3370
  getFromDate(data) {
3339
3371
  let today = new Date(data);
3340
- return today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
3372
+ return (today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear());
3341
3373
  }
3342
3374
  /**
3343
3375
  * It takes a string, converts it to a date, then returns a string in the format of YYYY-MM-DD.
@@ -3346,7 +3378,11 @@ class CreateDashboardComponent {
3346
3378
  */
3347
3379
  getDateFormate(data) {
3348
3380
  let today = new Date(data);
3349
- return today.getFullYear() + '-' + String((today.getMonth() + 1)).padStart(2, '0') + '-' + String(today.getDate()).padStart(2, '0');
3381
+ return (today.getFullYear() +
3382
+ '-' +
3383
+ String(today.getMonth() + 1).padStart(2, '0') +
3384
+ '-' +
3385
+ String(today.getDate()).padStart(2, '0'));
3350
3386
  }
3351
3387
  configureDashboard() {
3352
3388
  let fieldsStatus = this.validateDashboard();
@@ -3355,13 +3391,26 @@ class CreateDashboardComponent {
3355
3391
  this.vLoader = true;
3356
3392
  const payload = {
3357
3393
  dashboard_name: this.dashboardForm.dashboardName,
3358
- dashboard_id: ''
3394
+ dashboard_id: '',
3359
3395
  };
3360
- this.createDashboardService.checkDuplicateDashboardName(payload).subscribe(res => {
3396
+ this.createDashboardService
3397
+ .checkDuplicateDashboardName(payload)
3398
+ .subscribe((res) => {
3361
3399
  if (!res) {
3362
3400
  this.vLoader = false;
3363
- this.showRiskWidgets = (this.isManageRisk && this.showRiskCategory && (this.dashboardForm.selectedRiskCategories.length > 0 || this.dashboardForm.selectedResponsibilityCenters.length > 0)) ? true : false;
3364
- this.showComplianceWidgets = (this.dashboardForm.selectedResponsibilityCategories.length > 0 || this.dashboardForm.selectedResponsibilityCenters.length > 0) ? true : false;
3401
+ this.showRiskWidgets =
3402
+ this.isManageRisk &&
3403
+ this.showRiskCategory &&
3404
+ (this.dashboardForm.selectedRiskCategories.length > 0 ||
3405
+ this.dashboardForm.selectedResponsibilityCenters.length > 0)
3406
+ ? true
3407
+ : false;
3408
+ this.showComplianceWidgets =
3409
+ this.dashboardForm.selectedResponsibilityCategories.length >
3410
+ 0 ||
3411
+ this.dashboardForm.selectedResponsibilityCenters.length > 0
3412
+ ? true
3413
+ : false;
3365
3414
  this.openConfigureWidgets = true;
3366
3415
  }
3367
3416
  else {
@@ -3369,7 +3418,7 @@ class CreateDashboardComponent {
3369
3418
  this.snackBar.show('A dashboard with this name already exists. Specify a different name for the dashboard.', 'alert');
3370
3419
  return;
3371
3420
  }
3372
- }, error => {
3421
+ }, (error) => {
3373
3422
  console.error(error);
3374
3423
  this.vLoader = false;
3375
3424
  });
@@ -3378,13 +3427,26 @@ class CreateDashboardComponent {
3378
3427
  this.vLoader = true;
3379
3428
  const payload = {
3380
3429
  dashboard_name: this.dashboardForm.dashboardName,
3381
- dashboard_id: this.dashboardId
3430
+ dashboard_id: this.dashboardId,
3382
3431
  };
3383
- this.createDashboardService.checkDuplicateDashboardName(payload).subscribe(res => {
3432
+ this.createDashboardService
3433
+ .checkDuplicateDashboardName(payload)
3434
+ .subscribe((res) => {
3384
3435
  if (!res) {
3385
3436
  this.vLoader = false;
3386
- this.showRiskWidgets = (this.isManageRisk && this.showRiskCategory && (this.dashboardForm.selectedRiskCategories.length > 0 || this.dashboardForm.selectedResponsibilityCenters.length > 0)) ? true : false;
3387
- this.showComplianceWidgets = (this.dashboardForm.selectedResponsibilityCategories.length > 0 || this.dashboardForm.selectedResponsibilityCenters.length > 0) ? true : false;
3437
+ this.showRiskWidgets =
3438
+ this.isManageRisk &&
3439
+ this.showRiskCategory &&
3440
+ (this.dashboardForm.selectedRiskCategories.length > 0 ||
3441
+ this.dashboardForm.selectedResponsibilityCenters.length > 0)
3442
+ ? true
3443
+ : false;
3444
+ this.showComplianceWidgets =
3445
+ this.dashboardForm.selectedResponsibilityCategories.length >
3446
+ 0 ||
3447
+ this.dashboardForm.selectedResponsibilityCenters.length > 0
3448
+ ? true
3449
+ : false;
3388
3450
  this.openConfigureWidgets = true;
3389
3451
  }
3390
3452
  else {
@@ -3392,7 +3454,7 @@ class CreateDashboardComponent {
3392
3454
  this.snackBar.show('A dashboard with this name already exists. Specify a different name for the dashboard.', 'alert');
3393
3455
  return;
3394
3456
  }
3395
- }, error => {
3457
+ }, (error) => {
3396
3458
  this.vLoader = false;
3397
3459
  console.error(error);
3398
3460
  });
@@ -3400,11 +3462,13 @@ class CreateDashboardComponent {
3400
3462
  }
3401
3463
  }
3402
3464
  /**
3403
- * Fetches organization users count api to get total number of pages
3404
- * @param Url contains prams
3405
- */
3465
+ * Fetches organization users count api to get total number of pages
3466
+ * @param Url contains prams
3467
+ */
3406
3468
  getOrganizationUsersCount(Url) {
3407
- this.createDashboardService.getOrganizationUsersCount(Url).subscribe(res => {
3469
+ this.createDashboardService
3470
+ .getOrganizationUsersCount(Url)
3471
+ .subscribe((res) => {
3408
3472
  this.totalList = res.total_members;
3409
3473
  if (res.total_members && res.limit_per_page > 1) {
3410
3474
  this.totalPages = res.create_page;
@@ -3415,9 +3479,9 @@ class CreateDashboardComponent {
3415
3479
  });
3416
3480
  }
3417
3481
  /**
3418
- * Get users list by making api call and pre selects all admins by adding to viewers
3419
- * @param url contains query params for organization users api
3420
- */
3482
+ * Get users list by making api call and pre selects all admins by adding to viewers
3483
+ * @param url contains query params for organization users api
3484
+ */
3421
3485
  getUsersList(url) {
3422
3486
  this.createDashboardService.getAllUsers().subscribe((res) => {
3423
3487
  this.usersList = res;
@@ -3448,7 +3512,9 @@ class CreateDashboardComponent {
3448
3512
  });
3449
3513
  }
3450
3514
  getComplianceCategoryList() {
3451
- this.createDashboardService.getComplianceCategoriesListFromGlobal().subscribe((res) => {
3515
+ this.createDashboardService
3516
+ .getComplianceCategoriesListFromGlobal()
3517
+ .subscribe((res) => {
3452
3518
  const data = res;
3453
3519
  this.allComplianceCategories = Object.assign(res);
3454
3520
  // cloneDeep(res);
@@ -3473,7 +3539,7 @@ class CreateDashboardComponent {
3473
3539
  });
3474
3540
  }
3475
3541
  saveSelectedCategory(event) {
3476
- console.log("event==>>>", event);
3542
+ console.log('event==>>>', event);
3477
3543
  }
3478
3544
  getCategoryList() {
3479
3545
  this.createDashboardService.getCategoryList().subscribe((res) => {
@@ -3482,17 +3548,22 @@ class CreateDashboardComponent {
3482
3548
  this.riskCategoryList.compliance.list = res.compliance_arr;
3483
3549
  this.riskCategoryList.others.list = res.others_arr;
3484
3550
  this.riskCategoryListLoaded = true;
3485
- this.allRiskCategories = [...new Set(this.allRiskCategories.concat(res.strategic_arr, res.operational_arr, res.compliance_arr, res.others_arr))];
3486
- }, err => {
3551
+ this.allRiskCategories = [
3552
+ ...new Set(this.allRiskCategories.concat(res.strategic_arr, res.operational_arr, res.compliance_arr, res.others_arr)),
3553
+ ];
3554
+ }, (err) => {
3487
3555
  console.error(err);
3488
3556
  this.riskCategoryListLoaded = true;
3489
3557
  });
3490
3558
  }
3491
3559
  /**
3492
- * It is to ensure whether all required lists on Policy from is loaded from the api call or not
3493
- */
3560
+ * It is to ensure whether all required lists on Policy from is loaded from the api call or not
3561
+ */
3494
3562
  checkWhetherAllListsLoaded() {
3495
- if (this.rcListLoaded && this.complianceCategoriesListLoaded && this.riskCategoryListLoaded && this.userListLoaded) {
3563
+ if (this.rcListLoaded &&
3564
+ this.complianceCategoriesListLoaded &&
3565
+ this.riskCategoryListLoaded &&
3566
+ this.userListLoaded) {
3496
3567
  if (this.mode === 'EDIT') {
3497
3568
  this.editDashboard();
3498
3569
  }
@@ -3523,7 +3594,7 @@ class CreateDashboardComponent {
3523
3594
  subWidgetObject._id = '';
3524
3595
  subWidgetObject.widget_name = subWidget.title;
3525
3596
  subWidgetObject.widget_code = subWidget.id;
3526
- subWidgetObject.state = (subWidget.value) ? 'ACTIVE' : 'INACTIVE';
3597
+ subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
3527
3598
  obj.sub_widgets.push(Object.assign(subWidgetObject));
3528
3599
  });
3529
3600
  }
@@ -3548,7 +3619,7 @@ class CreateDashboardComponent {
3548
3619
  subWidgetObject._id = '';
3549
3620
  subWidgetObject.widget_name = subWidget.title;
3550
3621
  subWidgetObject.widget_code = subWidget.id;
3551
- subWidgetObject.state = (subWidget.value) ? 'ACTIVE' : 'INACTIVE';
3622
+ subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
3552
3623
  obj.sub_widgets.push(subWidgetObject);
3553
3624
  });
3554
3625
  }
@@ -3562,7 +3633,9 @@ class CreateDashboardComponent {
3562
3633
  this.selectedWidgets[index].sub_widgets.forEach((subWidgetData) => {
3563
3634
  const elementIndex = element.subWidgets.findIndex((ele) => ele.id == subWidgetData.widget_code);
3564
3635
  if (elementIndex != -1) {
3565
- subWidgetData.state = (element.subWidgets[elementIndex].value) ? 'ACTIVE' : 'INACTIVE';
3636
+ subWidgetData.state = element.subWidgets[elementIndex].value
3637
+ ? 'ACTIVE'
3638
+ : 'INACTIVE';
3566
3639
  }
3567
3640
  });
3568
3641
  }
@@ -3595,9 +3668,13 @@ class CreateDashboardComponent {
3595
3668
  paginationFilter(event) {
3596
3669
  if (event) {
3597
3670
  this.getUsersList({
3598
- p: this.paginationService.currentPage === 1 ? '' : this.paginationService.currentPage,
3671
+ p: this.paginationService.currentPage === 1
3672
+ ? ''
3673
+ : this.paginationService.currentPage,
3599
3674
  type: 'all_except_executive',
3600
- q: (!this.paginationService.searchValue) ? '' : this.paginationService.searchValue,
3675
+ q: !this.paginationService.searchValue
3676
+ ? ''
3677
+ : this.paginationService.searchValue,
3601
3678
  });
3602
3679
  }
3603
3680
  }
@@ -3611,17 +3688,16 @@ class CreateDashboardComponent {
3611
3688
  });
3612
3689
  }
3613
3690
  /**
3614
- * #### Description
3615
- *
3616
- * Returns the unique array of object based on unique key
3617
- * @param array
3618
- * @param key
3619
- * @returns
3620
- */
3691
+ * #### Description
3692
+ *
3693
+ * Returns the unique array of object based on unique key
3694
+ * @param array
3695
+ * @param key
3696
+ * @returns
3697
+ */
3621
3698
  uniqueByProp(array, key) {
3622
3699
  return Array.from(array
3623
- .reduce((acc, item) => (item && item[key] && acc.set(item[key], item),
3624
- acc), new Map())
3700
+ .reduce((acc, item) => (item && item[key] && acc.set(item[key], item), acc), new Map())
3625
3701
  .values());
3626
3702
  }
3627
3703
  saveSelectedList(type, selectedItems) {
@@ -3747,20 +3823,20 @@ class CreateDashboardComponent {
3747
3823
  return data;
3748
3824
  }
3749
3825
  /**
3750
- * Returns id's from a particular list elements
3751
- * @param list actual selected list
3752
- * @param key contains key to extract id from the list
3753
- */
3826
+ * Returns id's from a particular list elements
3827
+ * @param list actual selected list
3828
+ * @param key contains key to extract id from the list
3829
+ */
3754
3830
  returnIds(list, key) {
3755
- return list === null || list === void 0 ? void 0 : list.map(ele => {
3831
+ return list === null || list === void 0 ? void 0 : list.map((ele) => {
3756
3832
  if (ele[key]) {
3757
3833
  return ele[key];
3758
3834
  }
3759
3835
  });
3760
3836
  }
3761
3837
  /**
3762
- * Validates the data submitted on create dashboard form
3763
- */
3838
+ * Validates the data submitted on create dashboard form
3839
+ */
3764
3840
  validateDashboard() {
3765
3841
  var _a, _b, _c;
3766
3842
  setTimeout(() => {
@@ -3770,12 +3846,17 @@ class CreateDashboardComponent {
3770
3846
  const re = /&nbsp;|<br>/g;
3771
3847
  this.dashboardForm.dashboardName = event.replace(re, '').trim();
3772
3848
  const description = this.dashboardForm.dashboardDescriptionText;
3773
- this.dashboardForm.dashboardDescriptionText = description.replace(re, '').trim();
3774
- if (!this.dashboardForm.dashboardName || this.dashboardForm.dashboardName.trim() == ''
3775
- || (this.dashboardForm.dashboardName.length > 30)
3776
- || (this.textCount.transform((_a = this.dashboardForm) === null || _a === void 0 ? void 0 : _a.dashboardDescriptionText) > 250)
3777
- || (((_b = this.dashboardForm) === null || _b === void 0 ? void 0 : _b.selectedFromDate) && (!((_c = this.dashboardForm) === null || _c === void 0 ? void 0 : _c.selectedToDate)))
3778
- || (this.dashboardForm.selectedResponsibilityCenters.length == 0 &&
3849
+ this.dashboardForm.dashboardDescriptionText = description
3850
+ .replace(re, '')
3851
+ .trim();
3852
+ if (!this.dashboardForm.dashboardName ||
3853
+ this.dashboardForm.dashboardName.trim() == '' ||
3854
+ this.dashboardForm.dashboardName.length > 30 ||
3855
+ this.textCount.transform((_a = this.dashboardForm) === null || _a === void 0 ? void 0 : _a.dashboardDescriptionText) >
3856
+ 250 ||
3857
+ (((_b = this.dashboardForm) === null || _b === void 0 ? void 0 : _b.selectedFromDate) &&
3858
+ !((_c = this.dashboardForm) === null || _c === void 0 ? void 0 : _c.selectedToDate)) ||
3859
+ (this.dashboardForm.selectedResponsibilityCenters.length == 0 &&
3779
3860
  this.dashboardForm.selectedResponsibilityCategories.length == 0 &&
3780
3861
  this.dashboardForm.selectedRiskCategories.length == 0)) {
3781
3862
  return false;
@@ -3785,9 +3866,9 @@ class CreateDashboardComponent {
3785
3866
  }
3786
3867
  }
3787
3868
  /**
3788
- * Makes an api call to create a policy
3789
- * @param dashboard contains dashboardForm data
3790
- */
3869
+ * Makes an api call to create a policy
3870
+ * @param dashboard contains dashboardForm data
3871
+ */
3791
3872
  submitDashboard() {
3792
3873
  this.submitted = false;
3793
3874
  const valid = this.validateDashboard();
@@ -3801,21 +3882,27 @@ class CreateDashboardComponent {
3801
3882
  description: [
3802
3883
  {
3803
3884
  content: dashboard.dashboardDescriptionText,
3804
- attachments: []
3805
- }
3885
+ attachments: [],
3886
+ },
3806
3887
  ],
3807
3888
  visible_to_users: this.returnIds(dashboard.selectedViewers, 'member_id'),
3808
3889
  visible_to_groups: this.returnIds(dashboard.selectedGroup, 'group_id'),
3809
3890
  responsibility_center: this.returnIds(dashboard.selectedResponsibilityCenters, 'item_id'),
3810
3891
  responsibility_category: this.returnIds(dashboard.selectedResponsibilityCategories, 'category_id'),
3811
3892
  risk_category: this.returnIds(dashboard.selectedRiskCategories, 'category_id'),
3812
- display_criteria: (dashboard.displayCriteria === 'and') ? 'BOTH_RC_AND_CATEGORY' : 'RC_OR_CATEGORY',
3893
+ display_criteria: dashboard.displayCriteria === 'and'
3894
+ ? 'BOTH_RC_AND_CATEGORY'
3895
+ : 'RC_OR_CATEGORY',
3813
3896
  timeframe: {
3814
- start_date: (dashboard.selectedFromDate) ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate) : '',
3815
- end_date: (dashboard.selectedToDate) ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedToDate) : '',
3897
+ start_date: dashboard.selectedFromDate
3898
+ ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate)
3899
+ : '',
3900
+ end_date: dashboard.selectedToDate
3901
+ ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedToDate)
3902
+ : '',
3816
3903
  },
3817
3904
  email_summary: this.setFrequency('', 'export'),
3818
- widget_details: dashboard.configureWidget
3905
+ widget_details: dashboard.configureWidget,
3819
3906
  };
3820
3907
  if (this.mode == 'CREATE') {
3821
3908
  this.createDashboardService.submitDashboard(payload).subscribe((res) => {
@@ -3827,7 +3914,7 @@ class CreateDashboardComponent {
3827
3914
  this.isSmiley = false;
3828
3915
  this.close.emit({ mode: 'created', id: res._id });
3829
3916
  }, 3000);
3830
- }, err => {
3917
+ }, (err) => {
3831
3918
  if (err.status === 409) {
3832
3919
  this.snackBar.show('A dashboard with this name already exists. Specify a different name for the dashboard.', 'alert');
3833
3920
  this.vLoader = false;
@@ -3841,7 +3928,9 @@ class CreateDashboardComponent {
3841
3928
  }
3842
3929
  if (this.mode === 'EDIT') {
3843
3930
  payload.widget_update_flag = true;
3844
- this.createDashboardService.updateDashboard(this.dashboardId, payload).subscribe({
3931
+ this.createDashboardService
3932
+ .updateDashboard(this.dashboardId, payload)
3933
+ .subscribe({
3845
3934
  next: (res) => {
3846
3935
  this.vLoader = false;
3847
3936
  // this.snackBar.show('The dashboard has been updated','info');
@@ -3856,7 +3945,7 @@ class CreateDashboardComponent {
3856
3945
  console.error(error);
3857
3946
  this.vLoader = false;
3858
3947
  this.snackBar.show('OOPS! Something went wrong and the page could not be loaded. Could you please try one more time?', 'alert');
3859
- }
3948
+ },
3860
3949
  });
3861
3950
  }
3862
3951
  }
@@ -3865,9 +3954,12 @@ class CreateDashboardComponent {
3865
3954
  this.createDashboardService.fetchDashboard(this.dashboardId).subscribe((res) => {
3866
3955
  const data = res;
3867
3956
  this.listDetails.nonRemovableUsersList = [res.created_by];
3868
- data.visible_to_groups = ((data === null || data === void 0 ? void 0 : data.visible_to_groups) && data.visible_to_groups.length) ? data.visible_to_groups : [];
3957
+ data.visible_to_groups =
3958
+ (data === null || data === void 0 ? void 0 : data.visible_to_groups) && data.visible_to_groups.length
3959
+ ? data.visible_to_groups
3960
+ : [];
3869
3961
  this.populateDashboardForm(data);
3870
- }, error => {
3962
+ }, (error) => {
3871
3963
  console.error(error);
3872
3964
  });
3873
3965
  }
@@ -3875,24 +3967,35 @@ class CreateDashboardComponent {
3875
3967
  populateDashboardForm(data) {
3876
3968
  var _a, _b, _c, _d, _e, _f, _g, _h;
3877
3969
  try {
3878
- console.log(" datattttta ===> ", data, this.groupList);
3879
- this.dashboardForm.dashboardName = data === null || data === void 0 ? void 0 : data.dashboard_name,
3880
- this.dashboardForm.dashboardDescriptionText = (_b = (_a = data === null || data === void 0 ? void 0 : data.description[0]) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : "",
3881
- this.dashboardForm.selectedViewers = this.setList(this.usersList, data === null || data === void 0 ? void 0 : data.visible_to_users, 'member_id');
3970
+ console.log(' datattttta ===> ', data, this.groupList);
3971
+ (this.dashboardForm.dashboardName = data === null || data === void 0 ? void 0 : data.dashboard_name),
3972
+ (this.dashboardForm.dashboardDescriptionText =
3973
+ (_b = (_a = data === null || data === void 0 ? void 0 : data.description[0]) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : ''),
3974
+ (this.dashboardForm.selectedViewers = this.setList(this.usersList, data === null || data === void 0 ? void 0 : data.visible_to_users, 'member_id'));
3882
3975
  this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
3883
- data.visible_to_groups = ((data === null || data === void 0 ? void 0 : data.visible_to_groups) && (data === null || data === void 0 ? void 0 : data.visible_to_groups.length)) ? data === null || data === void 0 ? void 0 : data.visible_to_groups : [];
3976
+ data.visible_to_groups =
3977
+ (data === null || data === void 0 ? void 0 : data.visible_to_groups) && (data === null || data === void 0 ? void 0 : data.visible_to_groups.length)
3978
+ ? data === null || data === void 0 ? void 0 : data.visible_to_groups
3979
+ : [];
3884
3980
  this.dashboardForm.selectedGroup = this.setList(this.groupList, (_c = data === null || data === void 0 ? void 0 : data.visible_to_groups) !== null && _c !== void 0 ? _c : [], 'group_id');
3885
3981
  this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
3886
3982
  this.dashboardForm.selectedResponsibilityCenters = this.setList(this.responsibilityCentersList, data === null || data === void 0 ? void 0 : data.responsibility_center, 'item_id');
3887
3983
  this.dashboardForm.selectedResponsibilityCategories = this.setList(this.allComplianceCategories, data === null || data === void 0 ? void 0 : data.responsibility_category, 'category_id');
3888
3984
  this.dashboardForm.selectedRiskCategories = this.setList(this.allRiskCategories, data === null || data === void 0 ? void 0 : data.risk_category, 'category_id');
3889
- this.dashboardForm.displayCriteria = ((data === null || data === void 0 ? void 0 : data.display_criteria) === "BOTH_RC_AND_CATEGORY") ? 'and' : 'or';
3890
- this.dashboardForm.selectedFromDate = ((_d = data === null || data === void 0 ? void 0 : data.timeframe) === null || _d === void 0 ? void 0 : _d.start_date) ? new Date((_e = data === null || data === void 0 ? void 0 : data.timeframe) === null || _e === void 0 ? void 0 : _e.start_date) : undefined;
3891
- this.dashboardForm.selectedToDate = ((_f = data === null || data === void 0 ? void 0 : data.timeframe) === null || _f === void 0 ? void 0 : _f.end_date) ? new Date((_g = data === null || data === void 0 ? void 0 : data.timeframe) === null || _g === void 0 ? void 0 : _g.end_date) : undefined;
3985
+ this.dashboardForm.displayCriteria =
3986
+ (data === null || data === void 0 ? void 0 : data.display_criteria) === 'BOTH_RC_AND_CATEGORY' ? 'and' : 'or';
3987
+ this.dashboardForm.selectedFromDate = ((_d = data === null || data === void 0 ? void 0 : data.timeframe) === null || _d === void 0 ? void 0 : _d.start_date)
3988
+ ? new Date((_e = data === null || data === void 0 ? void 0 : data.timeframe) === null || _e === void 0 ? void 0 : _e.start_date)
3989
+ : undefined;
3990
+ this.dashboardForm.selectedToDate = ((_f = data === null || data === void 0 ? void 0 : data.timeframe) === null || _f === void 0 ? void 0 : _f.end_date)
3991
+ ? new Date((_g = data === null || data === void 0 ? void 0 : data.timeframe) === null || _g === void 0 ? void 0 : _g.end_date)
3992
+ : undefined;
3892
3993
  this.vLoader = false;
3893
3994
  this.dashboardForm.configureWidget = data.widget_details;
3894
- this.selectedWidgets = data.widget_details.length > 0 ? [...new Set(data.widget_details)] : [];
3895
- this.displayedWidgets = data.all_widgets.length > 0 ? [...new Set(data.all_widgets)] : [];
3995
+ this.selectedWidgets =
3996
+ data.widget_details.length > 0 ? [...new Set(data.widget_details)] : [];
3997
+ this.displayedWidgets =
3998
+ data.all_widgets.length > 0 ? [...new Set(data.all_widgets)] : [];
3896
3999
  this.setFrequency(data === null || data === void 0 ? void 0 : data.email_summary, 'import');
3897
4000
  let minToDate = this.setToDate((_h = data === null || data === void 0 ? void 0 : data.timeframe) === null || _h === void 0 ? void 0 : _h.start_date);
3898
4001
  this.toDatePickerConfig = { min: minToDate };
@@ -3902,7 +4005,7 @@ class CreateDashboardComponent {
3902
4005
  }, 20);
3903
4006
  }
3904
4007
  catch (error) {
3905
- console.log("populate dashboard error =>", error);
4008
+ console.log('populate dashboard error =>', error);
3906
4009
  }
3907
4010
  }
3908
4011
  setFrequency(event, mode) {
@@ -3916,10 +4019,14 @@ class CreateDashboardComponent {
3916
4019
  case 'monthly':
3917
4020
  const monthlyValueData = (_d = (_c = this.dashboardForm) === null || _c === void 0 ? void 0 : _c.selectedFrequencies) === null || _d === void 0 ? void 0 : _d.map((ele) => Number(ele) + 1);
3918
4021
  const monthlyValue = monthlyValueData === null || monthlyValueData === void 0 ? void 0 : monthlyValueData.join();
3919
- return '3~' + ((_e = this.dashboardForm) === null || _e === void 0 ? void 0 : _e.frequencyDate) + '~' + monthlyValue + '~0';
4022
+ return ('3~' + ((_e = this.dashboardForm) === null || _e === void 0 ? void 0 : _e.frequencyDate) + '~' + monthlyValue + '~0');
3920
4023
  case 'quarterly':
3921
4024
  const quarterlyValueData = Number(this.dashboardForm.selectedFrequencies) + 1;
3922
- return '7~' + this.dashboardForm.frequencyDate + '~' + quarterlyValueData + '~0';
4025
+ return ('7~' +
4026
+ this.dashboardForm.frequencyDate +
4027
+ '~' +
4028
+ quarterlyValueData +
4029
+ '~0');
3923
4030
  }
3924
4031
  }
3925
4032
  if (mode === 'import') {
@@ -3927,61 +4034,70 @@ class CreateDashboardComponent {
3927
4034
  switch (val[0]) {
3928
4035
  case '2':
3929
4036
  {
3930
- let stringVal = "Every ";
4037
+ let stringVal = 'Every ';
3931
4038
  this.dashboardForm.selectedFrequencyType = 'weekly';
3932
4039
  this.dashboardForm.selectedFrequencies = (_g = (_f = val[1]) === null || _f === void 0 ? void 0 : _f.split(',')) === null || _g === void 0 ? void 0 : _g.map((element) => Number(element) - 1);
3933
4040
  (_h = this.dashboardForm.selectedFrequencies) === null || _h === void 0 ? void 0 : _h.forEach((dayIndex, index) => {
3934
- stringVal += index === 0 ? this.dayNames[dayIndex] : ', ' + this.dayNames[dayIndex];
4041
+ stringVal +=
4042
+ index === 0
4043
+ ? this.dayNames[dayIndex]
4044
+ : ', ' + this.dayNames[dayIndex];
3935
4045
  });
3936
4046
  this.dashboardForm.frequencyMessage = stringVal;
3937
4047
  }
3938
4048
  break;
3939
4049
  case '3':
3940
4050
  {
3941
- let stringVal = "every ";
4051
+ let stringVal = 'every ';
3942
4052
  this.dashboardForm.selectedFrequencyType = 'monthly';
3943
4053
  this.dashboardForm.frequencyDate = val[1];
3944
4054
  this.dashboardForm.selectedFrequencies = (_k = (_j = val[2]) === null || _j === void 0 ? void 0 : _j.split(',')) === null || _k === void 0 ? void 0 : _k.map((element) => Number(element) - 1);
3945
4055
  this.dashboardForm.selectedFrequencies.forEach((monthIndex, index) => {
3946
- stringVal += index === 0 ? this.monthNames[monthIndex] : ', ' + this.monthNames[monthIndex];
4056
+ stringVal +=
4057
+ index === 0
4058
+ ? this.monthNames[monthIndex]
4059
+ : ', ' + this.monthNames[monthIndex];
3947
4060
  });
3948
4061
  let monthDateName;
3949
- if (this.dashboardForm.frequencyDate == "1") {
4062
+ if (this.dashboardForm.frequencyDate == '1') {
3950
4063
  monthDateName = '1st';
3951
4064
  }
3952
- else if (this.dashboardForm.frequencyDate == "2") {
4065
+ else if (this.dashboardForm.frequencyDate == '2') {
3953
4066
  monthDateName = '2nd';
3954
4067
  }
3955
- else if (this.dashboardForm.frequencyDate == "3") {
4068
+ else if (this.dashboardForm.frequencyDate == '3') {
3956
4069
  monthDateName = '3rd';
3957
4070
  }
3958
4071
  else {
3959
4072
  monthDateName = this.dashboardForm.frequencyDate + 'th';
3960
4073
  }
3961
- this.dashboardForm.frequencyMessage = monthDateName + ' of ' + stringVal;
4074
+ this.dashboardForm.frequencyMessage =
4075
+ monthDateName + ' of ' + stringVal;
3962
4076
  }
3963
4077
  break;
3964
4078
  case '7':
3965
4079
  {
3966
- let stringVal = "every ";
4080
+ let stringVal = 'every ';
3967
4081
  this.dashboardForm.selectedFrequencyType = 'quarterly';
3968
4082
  this.dashboardForm.frequencyDate = val[1];
3969
- this.dashboardForm.selectedFrequencies = Number(val[2].split(',')[0]) - 1;
4083
+ this.dashboardForm.selectedFrequencies =
4084
+ Number(val[2].split(',')[0]) - 1;
3970
4085
  stringVal += this.quarters[this.dashboardForm.selectedFrequencies];
3971
4086
  let monthDateName;
3972
- if (this.dashboardForm.frequencyDate == "1") {
4087
+ if (this.dashboardForm.frequencyDate == '1') {
3973
4088
  monthDateName = '1st';
3974
4089
  }
3975
- else if (this.dashboardForm.frequencyDate == "2") {
4090
+ else if (this.dashboardForm.frequencyDate == '2') {
3976
4091
  monthDateName = '2nd';
3977
4092
  }
3978
- else if (this.dashboardForm.frequencyDate == "3") {
4093
+ else if (this.dashboardForm.frequencyDate == '3') {
3979
4094
  monthDateName = '3rd';
3980
4095
  }
3981
4096
  else {
3982
4097
  monthDateName = this.dashboardForm.frequencyDate + 'th';
3983
4098
  }
3984
- this.dashboardForm.frequencyMessage = monthDateName + ' of ' + stringVal;
4099
+ this.dashboardForm.frequencyMessage =
4100
+ monthDateName + ' of ' + stringVal;
3985
4101
  }
3986
4102
  break;
3987
4103
  }
@@ -3993,7 +4109,7 @@ class CreateDashboardComponent {
3993
4109
  }
3994
4110
  setPermission(roleActions) {
3995
4111
  var _a;
3996
- let ifExistRisk = roleActions === null || roleActions === void 0 ? void 0 : roleActions.find((el) => el.moduleName == "risk");
4112
+ let ifExistRisk = roleActions === null || roleActions === void 0 ? void 0 : roleActions.find((el) => el.moduleName == 'risk');
3997
4113
  (_a = ifExistRisk === null || ifExistRisk === void 0 ? void 0 : ifExistRisk.subModule) === null || _a === void 0 ? void 0 : _a.forEach((module) => {
3998
4114
  var _a;
3999
4115
  (_a = module === null || module === void 0 ? void 0 : module.permissions) === null || _a === void 0 ? void 0 : _a.forEach((permission) => {
@@ -4002,7 +4118,6 @@ class CreateDashboardComponent {
4002
4118
  if ((permission === null || permission === void 0 ? void 0 : permission.defaultPermission) == 1 || (permission === null || permission === void 0 ? void 0 : permission.enable) == 1) {
4003
4119
  this.isManageRisk = true;
4004
4120
  }
4005
- ;
4006
4121
  break;
4007
4122
  }
4008
4123
  }
@@ -4692,15 +4807,14 @@ class FormGroupComponent {
4692
4807
  this.dashboardDescription = {
4693
4808
  placeholder: 'Description (Max limit: 250 characters)',
4694
4809
  mode: 'prime',
4695
- id: 'description'
4810
+ id: 'description',
4696
4811
  };
4697
4812
  this.fromDatePickerConfig = {
4698
- min: this.getCurrentDate()
4813
+ min: this.getCurrentDate(),
4699
4814
  };
4700
4815
  this.toDatePickerConfig = {};
4701
4816
  }
4702
- ngOnInit() {
4703
- }
4817
+ ngOnInit() { }
4704
4818
  openFromDatePicker() {
4705
4819
  this.fromDatePicker.api.open();
4706
4820
  this.datePickerOverlay = true;
@@ -4753,7 +4867,9 @@ class FormGroupComponent {
4753
4867
  let allFieldsValid = true;
4754
4868
  this.dashboardNameError = '';
4755
4869
  this.dashboardDescriptionError = '';
4756
- if (this.dashboardName === null || this.dashboardName === undefined || this.dashboardName === '') {
4870
+ if (this.dashboardName === null ||
4871
+ this.dashboardName === undefined ||
4872
+ this.dashboardName === '') {
4757
4873
  this.dashboardNameError = this.fieldEmptyErrorMessage;
4758
4874
  allFieldsValid = false;
4759
4875
  }
@@ -4761,19 +4877,22 @@ class FormGroupComponent {
4761
4877
  this.dashboardNameError = this.fieldLimitExceededErrorMessage.replace('XYZ', '30');
4762
4878
  allFieldsValid = false;
4763
4879
  }
4764
- else if (this.dashboardDescriptionText === null || this.dashboardDescriptionText === undefined || this.dashboardDescriptionText === '') {
4880
+ else if (this.dashboardDescriptionText === null ||
4881
+ this.dashboardDescriptionText === undefined ||
4882
+ this.dashboardDescriptionText === '') {
4765
4883
  this.dashboardDescriptionError = this.fieldEmptyErrorMessage;
4766
4884
  allFieldsValid = false;
4767
4885
  }
4768
4886
  else if (this.dashboardDescriptionText.length > 250) {
4769
- this.dashboardDescriptionError = this.fieldLimitExceededErrorMessage.replace('XYZ', '250');
4887
+ this.dashboardDescriptionError =
4888
+ this.fieldLimitExceededErrorMessage.replace('XYZ', '250');
4770
4889
  allFieldsValid = false;
4771
4890
  }
4772
4891
  return allFieldsValid;
4773
4892
  }
4774
4893
  getCurrentDate() {
4775
4894
  let today = new Date();
4776
- return today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
4895
+ return (today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear());
4777
4896
  }
4778
4897
  displayCriteriaSelected(event, selection) {
4779
4898
  this.displayCriteria = selection;