@idsoftsource/initial-process 4.1.0 → 4.1.1

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.
@@ -3466,12 +3466,26 @@ class PreviewComponent {
3466
3466
  error: () => { this.professionTypes = []; this.recomputeProfessionGroupAndTypeOptions(); }
3467
3467
  });
3468
3468
  }
3469
- // getProfession returns the group/type under `ProfessionGroupAssignmentType`/`assignmentType`;
3469
+ // exp.professionId / m.professionId are the saved UserProfession record's own id
3470
+ // (set via onCertificationProfessionChange/onSkillProfessionChange/onToolProfessionChange,
3471
+ // sourced from userProfessionOptions with bindValue="id") — NOT the master profession-type
3472
+ // id. Look up that saved record to get its master professionId link plus group/type.
3473
+ getUserProfessionMeta(userProfessionId) {
3474
+ const match = userProfessionId
3475
+ ? this.userProfessionOptions.find((o) => o.id === userProfessionId)
3476
+ : null;
3477
+ return {
3478
+ professionId: match?.professionId ?? null,
3479
+ professionGroup: match?.professionGroup ?? '',
3480
+ residentialCommercial: match?.residentialCommercial ?? '',
3481
+ };
3482
+ }
3483
+ // getProfession returns the group/type under `group`/`assignmentType`;
3470
3484
  // normalize them onto `professionGroup`/`professionAssignmentType`, the fields the table and manual rows use.
3471
3485
  mapProfessionTypes(items) {
3472
3486
  return items.map((p) => ({
3473
3487
  ...p,
3474
- professionGroup: p.professionGroup ?? p.ProfessionGroupAssignmentType ?? '',
3488
+ professionGroup: p.professionGroup ?? p.group ?? '',
3475
3489
  professionAssignmentType: p.professionAssignmentType ?? p.assignmentType ?? '',
3476
3490
  }));
3477
3491
  }
@@ -7257,7 +7271,8 @@ class PreviewComponent {
7257
7271
  issuedBy: exp.issuingOrganization,
7258
7272
  documentTypeName: exp.name,
7259
7273
  userProfessionId: exp.professionId ?? null,
7260
- // professionName: exp.professionName ?? '',
7274
+ professionName: exp.professionName ?? '',
7275
+ ...this.getUserProfessionMeta(exp.professionId),
7261
7276
  issueDate: this.formatDate(exp.issueDate),
7262
7277
  expiryDate: this.formatDate(exp.expiryDate),
7263
7278
  status: exp.credentialId ? RequestedStatus.InReview : RequestedStatus.SaveasDraft,
@@ -7288,6 +7303,9 @@ class PreviewComponent {
7288
7303
  // emailId,
7289
7304
  issuedBy: exp.issuingAuthority,
7290
7305
  documentTypeName: exp.name,
7306
+ userProfessionId: exp.professionId ?? null,
7307
+ professionName: exp.professionName ?? '',
7308
+ ...this.getUserProfessionMeta(exp.professionId),
7291
7309
  issueDate: this.formatDate(exp.issueDate),
7292
7310
  expiryDate: this.formatDate(exp.expiryDate),
7293
7311
  status: exp.licenseNumber ? RequestedStatus.InReview : RequestedStatus.SaveasDraft,
@@ -7318,7 +7336,8 @@ class PreviewComponent {
7318
7336
  skillSetId: null,
7319
7337
  skillSetName: exp,
7320
7338
  userProfessionId: m.professionId ?? null,
7321
- // professionName: m.professionName ?? '',
7339
+ professionName: m.professionName ?? '',
7340
+ ...this.getUserProfessionMeta(m.professionId),
7322
7341
  notes: m.notes ?? "",
7323
7342
  year: m.year ?? 0,
7324
7343
  starRating: m.starRating ?? 0,
@@ -7344,7 +7363,8 @@ class PreviewComponent {
7344
7363
  toolId: null,
7345
7364
  toolName: exp,
7346
7365
  userProfessionId: m.professionId ?? null,
7347
- // professionName: m.professionName ?? '',
7366
+ professionName: m.professionName ?? '',
7367
+ ...this.getUserProfessionMeta(m.professionId),
7348
7368
  starRating: m.starRating ?? 0,
7349
7369
  year: m.year ?? 0,
7350
7370
  make: null,
@@ -9330,6 +9350,19 @@ class CertificationComponent {
9330
9350
  }
9331
9351
  });
9332
9352
  }
9353
+ // certificateForm's "professionId" holds the saved UserProfession record's own id
9354
+ // (see onCertificationProfessionChange), so group/type/master-professionId come from
9355
+ // userProfessionOptions (the user's saved professions), not the master profession-type catalog.
9356
+ getUserProfessionMeta(userProfessionId) {
9357
+ const match = userProfessionId
9358
+ ? this.userProfessionOptions.find((o) => o.id === userProfessionId)
9359
+ : null;
9360
+ return {
9361
+ professionId: match?.professionId ?? null,
9362
+ professionGroup: match?.professionGroup ?? '',
9363
+ residentialCommercial: match?.residentialCommercial ?? '',
9364
+ };
9365
+ }
9333
9366
  onCertificationProfessionChange(item) {
9334
9367
  this.certificateForm.patchValue({
9335
9368
  professionId: item?.id ?? null,
@@ -9633,7 +9666,8 @@ class CertificationComponent {
9633
9666
  expiryDate: fullValue.expiryDate ? fullValue.expiryDate.toISOString() : null,
9634
9667
  notes: fullValue.notes,
9635
9668
  userProfessionId: fullValue.professionId ?? null,
9636
- // professionName: fullValue.professionName ?? '',
9669
+ professionName: fullValue.professionName ?? '',
9670
+ ...this.getUserProfessionMeta(fullValue.professionId),
9637
9671
  fileId: this.model?.fileId || null,
9638
9672
  fileUrl: this.model?.fileUrl || null,
9639
9673
  fileName: this.model?.fileName || null,
@@ -10605,6 +10639,19 @@ class SkillsComponent {
10605
10639
  }
10606
10640
  this.searchSkillQry = null;
10607
10641
  }
10642
+ // The tab's "professionId" control actually holds the saved UserProfession record's
10643
+ // own id (see createGroup/AddGroup), so group/type/master-professionId come from
10644
+ // userProfessionOptions (the user's saved professions), not the master profession-type catalog.
10645
+ getUserProfessionMeta(userProfessionId) {
10646
+ const match = userProfessionId
10647
+ ? this.userProfessionOptions.find((o) => o.id === userProfessionId)
10648
+ : null;
10649
+ return {
10650
+ professionId: match?.professionId ?? null,
10651
+ professionGroup: match?.professionGroup ?? '',
10652
+ residentialCommercial: match?.residentialCommercial ?? '',
10653
+ };
10654
+ }
10608
10655
  onProfessionChange(profession) {
10609
10656
  // profession.id is the saved UserProfession record's own id (used to stamp
10610
10657
  // userProfessionId onto new skill rows); profession.professionId is the link
@@ -10685,13 +10732,14 @@ class SkillsComponent {
10685
10732
  if (this.tab.invalid)
10686
10733
  return;
10687
10734
  this.userSkillSetModels = (this.tab.value || []).map((v) => {
10688
- const { professionId, professionName: _professionName, ...rest } = v;
10735
+ const { professionId, professionName, ...rest } = v;
10689
10736
  return {
10690
10737
  ...rest,
10691
10738
  starRating: v.starRating ?? 0,
10692
10739
  year: v.year ?? 0,
10693
10740
  userProfessionId: professionId ?? null,
10694
- // professionName: v.professionName ?? '',
10741
+ professionName: professionName ?? '',
10742
+ ...this.getUserProfessionMeta(professionId),
10695
10743
  };
10696
10744
  });
10697
10745
  if (this.model?.id) {
@@ -10719,7 +10767,6 @@ class SkillsComponent {
10719
10767
  ...this.model,
10720
10768
  ...formValue,
10721
10769
  };
10722
- delete payload.professionName;
10723
10770
  delete payload.forUser;
10724
10771
  this.userSkillSetService.updateUserSkillSet([payload]).subscribe((response) => {
10725
10772
  this.showLoader = false;
@@ -11945,6 +11992,19 @@ class ToolsComponent {
11945
11992
  this.cdr.detectChanges();
11946
11993
  }
11947
11994
  }
11995
+ // The tab's "professionId" control actually holds the saved UserProfession record's
11996
+ // own id (see createGroup/AddGroup), so group/type/master-professionId come from
11997
+ // userProfessionOptions (the user's saved professions), not the master professionTypes catalog.
11998
+ getUserProfessionMeta(userProfessionId) {
11999
+ const match = userProfessionId
12000
+ ? this.userProfessionOptions.find((o) => o.id === userProfessionId)
12001
+ : null;
12002
+ return {
12003
+ professionId: match?.professionId ?? null,
12004
+ professionGroup: match?.professionGroup ?? '',
12005
+ residentialCommercial: match?.residentialCommercial ?? '',
12006
+ };
12007
+ }
11948
12008
  onProfessionChange(profession) {
11949
12009
  // profession.id is the saved UserProfession record's own id (used to stamp
11950
12010
  // userProfessionId onto new tool rows); profession.professionId is the link
@@ -12025,13 +12085,14 @@ class ToolsComponent {
12025
12085
  return;
12026
12086
  }
12027
12087
  this.userToolModels = (this.tab?.value || []).map((v) => {
12028
- const { professionId, professionName: _professionName, ...rest } = v;
12088
+ const { professionId, professionName, ...rest } = v;
12029
12089
  return {
12030
12090
  ...rest,
12031
12091
  starRating: v.starRating ?? 0,
12032
12092
  year: v.year ?? 0,
12033
12093
  userProfessionId: professionId ?? null,
12034
- // professionName: v.professionName ?? '',
12094
+ professionName: professionName ?? '',
12095
+ ...this.getUserProfessionMeta(professionId),
12035
12096
  };
12036
12097
  });
12037
12098
  if (this.model?.id) {
@@ -12060,7 +12121,6 @@ class ToolsComponent {
12060
12121
  ...formValue,
12061
12122
  isOpen: false
12062
12123
  };
12063
- delete updatedTool.professionName;
12064
12124
  delete updatedTool.forUser;
12065
12125
  this.userToolService.updateUserTool([updatedTool]).subscribe((response) => {
12066
12126
  this.showLoader = false;
@@ -36476,12 +36536,12 @@ class ProfessionComponent {
36476
36536
  error: () => { this.professionTypes = []; this.recomputeProfessionGroupAndTypeOptions(); }
36477
36537
  });
36478
36538
  }
36479
- // getProfession returns the group/type under `ProfessionGroupAssignmentType`/`assignmentType`;
36539
+ // getProfession returns the group/type under `group`/`assignmentType`;
36480
36540
  // normalize them onto `professionGroup`/`professionAssignmentType`, the fields the table and manual rows use.
36481
36541
  mapProfessionTypes(items) {
36482
36542
  return items.map((p) => ({
36483
36543
  ...p,
36484
- professionGroup: p.professionGroup ?? p.ProfessionGroupAssignmentType ?? '',
36544
+ professionGroup: p.professionGroup ?? p.group ?? '',
36485
36545
  professionAssignmentType: p.professionAssignmentType ?? p.assignmentType ?? '',
36486
36546
  }));
36487
36547
  }