vcomply-workflow-engine 2.6.4 → 2.6.7

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.
@@ -3760,7 +3760,7 @@
3760
3760
  };
3761
3761
  WorkflowComplianceComponent.prototype.saveSelectedList = function (type, selectedItems) {
3762
3762
  var _this = this;
3763
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
3763
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
3764
3764
  switch (type) {
3765
3765
  case 'assignors':
3766
3766
  if (this.invalidType === 'whom') {
@@ -3832,35 +3832,37 @@
3832
3832
  this.responsibilityForm.program_selected_ids = __spreadArray(__spreadArray([], __read(new Set(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories))), __read(new Set([(_j = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _j === void 0 ? void 0 : _j.category_id])));
3833
3833
  }
3834
3834
  else {
3835
- ((_l = Object.keys((_k = this.responsibilityForm) === null || _k === void 0 ? void 0 : _k.assessment)) === null || _l === void 0 ? void 0 : _l.length) ? this.getProgramDetails(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program._id) : null;
3835
+ if ((_k = this.responsibilityForm) === null || _k === void 0 ? void 0 : _k.assessment) {
3836
+ ((_m = Object.keys((_l = this.responsibilityForm) === null || _l === void 0 ? void 0 : _l.assessment)) === null || _m === void 0 ? void 0 : _m.length) ? this.getProgramDetails(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program._id) : null;
3837
+ }
3836
3838
  this.responsibilityForm.category = (selectedItems.categories) ? selectedItems.categories : [];
3837
3839
  this.responsibilityForm.program = [];
3838
3840
  this.responsibilityForm.category_id = '';
3839
3841
  this.responsibilityForm.program_selected_ids = [];
3840
3842
  this.responsibilityForm.customTags = [];
3841
3843
  this.responsibilityForm.program = (selectedItems.program) ? [selectedItems.program] : [];
3842
- var categoryId = (_m = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories) === null || _m === void 0 ? void 0 : _m.toString();
3843
- if ((_o = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories) === null || _o === void 0 ? void 0 : _o.length) {
3844
- this.responsibilityForm.category_id = ((_p = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _p === void 0 ? void 0 : _p.category_id) + ',' + categoryId;
3844
+ var categoryId = (_o = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories) === null || _o === void 0 ? void 0 : _o.toString();
3845
+ if ((_p = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories) === null || _p === void 0 ? void 0 : _p.length) {
3846
+ this.responsibilityForm.category_id = ((_q = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _q === void 0 ? void 0 : _q.category_id) + ',' + categoryId;
3845
3847
  }
3846
3848
  else {
3847
- this.responsibilityForm.category_id = (_r = (_q = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _q === void 0 ? void 0 : _q.category_id) === null || _r === void 0 ? void 0 : _r.toString();
3849
+ this.responsibilityForm.category_id = (_s = (_r = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _r === void 0 ? void 0 : _r.category_id) === null || _s === void 0 ? void 0 : _s.toString();
3848
3850
  }
3849
- this.responsibilityForm.program_selected_ids = __spreadArray(__spreadArray([], __read(new Set(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories))), __read(new Set([(_s = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _s === void 0 ? void 0 : _s.category_id])));
3850
- var programCustomTags = ((_t = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _t === void 0 ? void 0 : _t.custom_tags) ? JSON.parse((_u = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _u === void 0 ? void 0 : _u.custom_tags) : [];
3851
+ this.responsibilityForm.program_selected_ids = __spreadArray(__spreadArray([], __read(new Set(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.categories))), __read(new Set([(_t = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _t === void 0 ? void 0 : _t.category_id])));
3852
+ var programCustomTags = ((_u = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _u === void 0 ? void 0 : _u.custom_tags) ? JSON.parse((_v = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _v === void 0 ? void 0 : _v.custom_tags) : [];
3851
3853
  programCustomTags === null || programCustomTags === void 0 ? void 0 : programCustomTags.forEach(function (tag) {
3852
- var tagData = JSON === null || JSON === void 0 ? void 0 : JSON.parse(tag);
3854
+ var tagData = typeof tag === "string" ? JSON.parse(tag) : tag;
3853
3855
  var index = _this.responsibilityForm.customTags.findIndex(function (tagElement) { return tagElement.tag_name == tagData.tag_name; });
3854
3856
  if (index == -1) {
3855
3857
  _this.responsibilityForm.customTags.push(tagData);
3856
3858
  }
3857
3859
  });
3858
- this.responsibilityForm.formatAndEvidence.evidenceRequired = ((_v = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _v === void 0 ? void 0 : _v.evidence_upload_flag) ? true : false;
3859
- if ((_w = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _w === void 0 ? void 0 : _w.evidence_upload_flag) {
3860
+ this.responsibilityForm.formatAndEvidence.evidenceRequired = ((_w = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _w === void 0 ? void 0 : _w.evidence_upload_flag) ? true : false;
3861
+ if ((_x = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _x === void 0 ? void 0 : _x.evidence_upload_flag) {
3860
3862
  this.moreOptions.FORMATE_EVIDENCE = true;
3861
3863
  }
3862
- if (!(((_x = this.selectedProgram) === null || _x === void 0 ? void 0 : _x.programType) === 0 && ((_z = (_y = this.selectedProgram) === null || _y === void 0 ? void 0 : _y.name) === null || _z === void 0 ? void 0 : _z.toLowerCase()) === 'uncategorized')) {
3863
- if ((_0 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _0 === void 0 ? void 0 : _0._id) {
3864
+ if (!(((_y = this.selectedProgram) === null || _y === void 0 ? void 0 : _y.programType) === 0 && ((_0 = (_z = this.selectedProgram) === null || _z === void 0 ? void 0 : _z.name) === null || _0 === void 0 ? void 0 : _0.toLowerCase()) === 'uncategorized')) {
3865
+ if ((_1 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.program) === null || _1 === void 0 ? void 0 : _1._id) {
3864
3866
  this.filterListsAccordingToProgram(selectedItems.program._id);
3865
3867
  }
3866
3868
  else {
@@ -3912,10 +3914,10 @@
3912
3914
  this.responsibilityForm.riskMatrix = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.riskMatrix;
3913
3915
  break;
3914
3916
  case 'formate_evidence':
3915
- this.responsibilityForm.formatAndEvidence.formatRequired = (_1 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.isFormateUploaded) !== null && _1 !== void 0 ? _1 : false;
3916
- this.responsibilityForm.formatAndEvidence.formatFiles = (_2 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.files) !== null && _2 !== void 0 ? _2 : [];
3917
- this.responsibilityForm.formatAndEvidence.formatLinks = (_3 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.links) !== null && _3 !== void 0 ? _3 : [];
3918
- this.responsibilityForm.formatAndEvidence.evidenceRequired = (_4 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.isEvidenceRequired) !== null && _4 !== void 0 ? _4 : false;
3917
+ this.responsibilityForm.formatAndEvidence.formatRequired = (_2 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.isFormateUploaded) !== null && _2 !== void 0 ? _2 : false;
3918
+ this.responsibilityForm.formatAndEvidence.formatFiles = (_3 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.files) !== null && _3 !== void 0 ? _3 : [];
3919
+ this.responsibilityForm.formatAndEvidence.formatLinks = (_4 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.links) !== null && _4 !== void 0 ? _4 : [];
3920
+ this.responsibilityForm.formatAndEvidence.evidenceRequired = (_5 = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.isEvidenceRequired) !== null && _5 !== void 0 ? _5 : false;
3919
3921
  break;
3920
3922
  case 'reviewFrequency':
3921
3923
  this.responsibilityForm.reviewers.reviewFrequency = {
@@ -25660,18 +25662,23 @@
25660
25662
  WorkflowProgramComponent.prototype.fetchUsersAssociatedWithRoles = function () {
25661
25663
  var _this = this;
25662
25664
  var _a, _b;
25665
+ var loggedInUser = this.currentUser();
25663
25666
  var roleIds = (_b = (_a = this.controls.program_roles) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.map(function (ele) { return ele === null || ele === void 0 ? void 0 : ele._id; });
25664
25667
  // if (fetchAll) {
25665
25668
  this.programService.fetchAllRoleUsers(roleIds).subscribe({
25666
25669
  next: function (res) {
25667
- var _a, _b, _c, _d, _e, _f;
25670
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25671
+ var isUserFind = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.some(function (res) { return (res === null || res === void 0 ? void 0 : res.member_id) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.member_id); });
25672
+ if (!isUserFind) {
25673
+ (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.push(loggedInUser);
25674
+ res.total_items = (res === null || res === void 0 ? void 0 : res.total_items) + 1;
25675
+ }
25668
25676
  _this.lists.OWNERS = res;
25669
25677
  _this.lists.APPROVERS = res;
25670
- console.log("resdef", res === null || res === void 0 ? void 0 : res.data);
25671
- if (!((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.map(function (ele) { return ele === null || ele === void 0 ? void 0 : ele.member_id; })) === null || _b === void 0 ? void 0 : _b.includes((_d = (_c = _this.controls.program_approver) === null || _c === void 0 ? void 0 : _c.value[0]) === null || _d === void 0 ? void 0 : _d.member_id))) {
25678
+ if (!((_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.map(function (ele) { return ele === null || ele === void 0 ? void 0 : ele.member_id; })) === null || _d === void 0 ? void 0 : _d.includes((_f = (_e = _this.controls.program_approver) === null || _e === void 0 ? void 0 : _e.value[0]) === null || _f === void 0 ? void 0 : _f.member_id))) {
25672
25679
  _this.setFormField('program_approver', []);
25673
25680
  }
25674
- if ((_f = (_e = _this.controls) === null || _e === void 0 ? void 0 : _e.all_user_in_role) === null || _f === void 0 ? void 0 : _f.value) {
25681
+ if ((_h = (_g = _this.controls) === null || _g === void 0 ? void 0 : _g.all_user_in_role) === null || _h === void 0 ? void 0 : _h.value) {
25675
25682
  _this.setFormField('program_owners', res === null || res === void 0 ? void 0 : res.data);
25676
25683
  }
25677
25684
  else {