@idsoftsource/initial-process 0.1.5 → 0.1.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.
|
@@ -4961,6 +4961,9 @@ class ProvidersService {
|
|
|
4961
4961
|
createProviderUserMapping(model) {
|
|
4962
4962
|
return this.http.post(this.baseUrl, model);
|
|
4963
4963
|
}
|
|
4964
|
+
updateProviderUserMapping(model) {
|
|
4965
|
+
return this.http.put(this.baseUrl, model);
|
|
4966
|
+
}
|
|
4964
4967
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ProvidersService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4965
4968
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ProvidersService, providedIn: 'root' });
|
|
4966
4969
|
}
|
|
@@ -4981,7 +4984,9 @@ class RoleSelectComponent {
|
|
|
4981
4984
|
tokenService;
|
|
4982
4985
|
fb;
|
|
4983
4986
|
previewUrl = null;
|
|
4987
|
+
isMappingCreated = false;
|
|
4984
4988
|
initialSelectedJobValue;
|
|
4989
|
+
previousEmployeeType;
|
|
4985
4990
|
selectedTab;
|
|
4986
4991
|
industries = [];
|
|
4987
4992
|
selectedIndustries = [];
|
|
@@ -5153,13 +5158,13 @@ class RoleSelectComponent {
|
|
|
5153
5158
|
return;
|
|
5154
5159
|
this.userDetails = data;
|
|
5155
5160
|
this.previewUrl = this.cloudfrontUrl + data.headshotUrl;
|
|
5156
|
-
|
|
5157
|
-
this.jobTitles = (data.userJobTitle || []).map((t) => ({
|
|
5158
|
-
text: t,
|
|
5159
|
-
value: t
|
|
5160
|
-
}));
|
|
5161
|
+
this.previousEmployeeType = data.employeeType; // 🔑 store old value
|
|
5161
5162
|
this.jobTitles = UserJobTitlesList;
|
|
5162
|
-
const selectedJobTitles =
|
|
5163
|
+
const selectedJobTitles = UserJobTitlesList
|
|
5164
|
+
.filter(j => (data.userJobTitle || [])
|
|
5165
|
+
.map((t) => t.trim().toLowerCase())
|
|
5166
|
+
.includes(j.text.trim().toLowerCase()))
|
|
5167
|
+
.map(j => j.value);
|
|
5163
5168
|
const selectedIds = this.industries
|
|
5164
5169
|
.filter(i => data.userIndustryNames.includes(i.industryName))
|
|
5165
5170
|
.map(i => i.id);
|
|
@@ -5361,13 +5366,16 @@ class RoleSelectComponent {
|
|
|
5361
5366
|
saveProviderUserMapping() {
|
|
5362
5367
|
const form = this.userForm.value;
|
|
5363
5368
|
const saved = profileSignal();
|
|
5369
|
+
const currentEmployeeType = this.selectedJobValue;
|
|
5364
5370
|
const model = {
|
|
5365
5371
|
providerId: this.providerId,
|
|
5366
5372
|
userId: this.userId,
|
|
5367
5373
|
userName: `${form.firstName} ${form.lastName}`.trim(),
|
|
5368
5374
|
emailId: form.email,
|
|
5369
5375
|
phoneNumber: form.phoneNumber,
|
|
5370
|
-
headshotUrl: saved?.userDetail?.headshotUrl ||
|
|
5376
|
+
headshotUrl: saved?.userDetail?.headshotUrl ||
|
|
5377
|
+
this.user?.headshotUrl ||
|
|
5378
|
+
this.previewUrl,
|
|
5371
5379
|
address1: form.address1,
|
|
5372
5380
|
address2: form.address2,
|
|
5373
5381
|
city: form.city,
|
|
@@ -5376,18 +5384,31 @@ class RoleSelectComponent {
|
|
|
5376
5384
|
county: form.county,
|
|
5377
5385
|
country: form.country,
|
|
5378
5386
|
category: UserCategory.ManuallyAdded,
|
|
5379
|
-
employeeType:
|
|
5387
|
+
employeeType: currentEmployeeType,
|
|
5380
5388
|
status: ProviderUserMappingStatus.WaitingForApproval
|
|
5381
5389
|
};
|
|
5382
|
-
this.
|
|
5383
|
-
|
|
5384
|
-
|
|
5390
|
+
this.showLoader = true;
|
|
5391
|
+
let apiCall$;
|
|
5392
|
+
if (!this.isMappingCreated) {
|
|
5393
|
+
apiCall$ = this.provideruser.createProviderUserMapping(model);
|
|
5394
|
+
}
|
|
5395
|
+
else if (this.previousEmployeeType !== currentEmployeeType) {
|
|
5396
|
+
apiCall$ = this.provideruser.updateProviderUserMapping(model);
|
|
5397
|
+
}
|
|
5398
|
+
else {
|
|
5399
|
+
this.showLoader = false;
|
|
5400
|
+
this.store.nextStep();
|
|
5401
|
+
return;
|
|
5402
|
+
}
|
|
5403
|
+
apiCall$.subscribe({
|
|
5385
5404
|
next: (res) => {
|
|
5386
5405
|
this.showLoader = false;
|
|
5387
5406
|
if (res?.failed) {
|
|
5388
5407
|
this.userError = res.failures?.[0]?.message;
|
|
5389
5408
|
return;
|
|
5390
5409
|
}
|
|
5410
|
+
this.isMappingCreated = true;
|
|
5411
|
+
this.previousEmployeeType = currentEmployeeType;
|
|
5391
5412
|
this.store.nextStep();
|
|
5392
5413
|
},
|
|
5393
5414
|
error: (err) => {
|