@posiwise/smart-crm 0.0.72 → 0.0.73

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.
@@ -1405,30 +1405,9 @@ class SmartCrmCompaniesComponent extends AppBaseComponent {
1405
1405
  /** Function to call account default values */
1406
1406
  accountDefaultValues(id) {
1407
1407
  this.crmService.getCrmAccountDefaultValues(id).subscribe(response => {
1408
- const { status } = response;
1409
- status.forEach(val => {
1410
- const data = {
1411
- label: val,
1412
- value: val
1413
- };
1414
- this.status.push(data);
1415
- });
1416
- const { priority } = response;
1417
- priority.forEach(val => {
1418
- const data = {
1419
- label: val,
1420
- value: val
1421
- };
1422
- this.priority.push(data);
1423
- });
1424
- const { source } = response;
1425
- source.forEach(val => {
1426
- const data = {
1427
- label: val.name,
1428
- value: val.id
1429
- };
1430
- this.source.push(data);
1431
- });
1408
+ this.status = (response.status ?? []).map(val => ({ label: val, value: val }));
1409
+ this.priority = (response.priority ?? []).map(val => ({ label: val, value: val }));
1410
+ this.source = (response.source ?? []).map(val => ({ label: val.name, value: val.id }));
1432
1411
  this.cdr.markForCheck();
1433
1412
  });
1434
1413
  }
@@ -1494,14 +1473,7 @@ class SmartCrmCompaniesComponent extends AppBaseComponent {
1494
1473
  /** Function to call accounts size */
1495
1474
  getAllOrganizationSize() {
1496
1475
  this.commonService.getOrganizationSizes().subscribe(response => {
1497
- const organizationSizes = response.organization_sizes;
1498
- organizationSizes.forEach(val => {
1499
- const data = {
1500
- label: val.name,
1501
- value: val.id
1502
- };
1503
- this.organizationSizes.push(data);
1504
- });
1476
+ this.organizationSizes = (response.organization_sizes ?? []).map(val => ({ label: val.name, value: val.id }));
1505
1477
  this.cdr.markForCheck();
1506
1478
  });
1507
1479
  }
@@ -1509,13 +1481,7 @@ class SmartCrmCompaniesComponent extends AppBaseComponent {
1509
1481
  getIndustries() {
1510
1482
  this.commonService.getOrganizationIndustries().subscribe(response => {
1511
1483
  this.allIndustries = response.organization_industries;
1512
- this.allIndustries.forEach(val => {
1513
- const industries = {
1514
- label: val.name,
1515
- value: val.id
1516
- };
1517
- this.searchOptions.push(industries);
1518
- });
1484
+ this.searchOptions = this.allIndustries.map(val => ({ label: val.name, value: val.id }));
1519
1485
  this.cdr.markForCheck();
1520
1486
  });
1521
1487
  }
@@ -2207,13 +2173,7 @@ class SmartCrmStagesComponent extends AppBaseComponent {
2207
2173
  this.categories = response?.crm_opportunity_categories?.map(category => {
2208
2174
  return category?.name;
2209
2175
  });
2210
- response?.crm_opportunity_categories.forEach(val => {
2211
- const data = {
2212
- label: val.name,
2213
- value: val.id
2214
- };
2215
- this.availableCategories.push(data);
2216
- });
2176
+ this.availableCategories = (response?.crm_opportunity_categories ?? []).map(val => ({ label: val.name, value: val.id }));
2217
2177
  this.cdr.markForCheck();
2218
2178
  });
2219
2179
  }
@@ -2582,14 +2542,10 @@ class SmartCrmStageDetailsComponent extends AppBaseComponent {
2582
2542
  /** Function to get all categories */
2583
2543
  getAllOpportunityCategories() {
2584
2544
  this.crmService.getAllOpportunityCategories(this.subscriptionId).subscribe(response => {
2585
- const categories = response?.crm_opportunity_categories ?? [];
2586
- categories.forEach(val => {
2587
- const data = {
2588
- label: val.name,
2589
- value: val.id
2590
- };
2591
- this.categories.push(data);
2592
- });
2545
+ this.categories = (response?.crm_opportunity_categories ?? []).map(val => ({
2546
+ label: val.name,
2547
+ value: val.id
2548
+ }));
2593
2549
  this.cdr.markForCheck();
2594
2550
  });
2595
2551
  }
@@ -2849,14 +2805,7 @@ class SmartCrmContactDetailsComponent extends AppBaseComponent {
2849
2805
  getDefaultValues(id) {
2850
2806
  this.crmService.getCrmContactDefaultValues(id).subscribe(res => {
2851
2807
  this.potentials = res['potential'];
2852
- const label = res['labels'];
2853
- label.forEach(val => {
2854
- const data = {
2855
- label: val,
2856
- value: val
2857
- };
2858
- this.labels.push(data);
2859
- });
2808
+ this.labels = (res['labels'] ?? []).map(val => ({ label: val, value: val }));
2860
2809
  this.cdr.markForCheck();
2861
2810
  });
2862
2811
  }
@@ -2945,14 +2894,7 @@ class SmartCrmContactInfoComponent extends AppBaseComponent {
2945
2894
  }
2946
2895
  getDefaultValues(id) {
2947
2896
  this.crmService.getCrmContactDefaultValues(id).subscribe(res => {
2948
- const label = res['labels'];
2949
- label.forEach(val => {
2950
- const data = {
2951
- label: val,
2952
- value: val
2953
- };
2954
- this.labels.push(data);
2955
- });
2897
+ this.labels = (res['labels'] ?? []).map(val => ({ label: val, value: val }));
2956
2898
  this.cdr.markForCheck();
2957
2899
  });
2958
2900
  }
@@ -3586,14 +3528,7 @@ class SmartCrmContactComponent extends AppBaseComponent {
3586
3528
  { label: 'Select Priority', value: null },
3587
3529
  ...(res['potential'] ?? []).map(item => ({ label: item, value: item }))
3588
3530
  ];
3589
- const label = res['labels'];
3590
- label.forEach(val => {
3591
- const data = {
3592
- label: val,
3593
- value: val
3594
- };
3595
- this.labels.push(data);
3596
- });
3531
+ this.labels = (res['labels'] ?? []).map(val => ({ label: val, value: val }));
3597
3532
  this.getTableState();
3598
3533
  this.cdr.markForCheck();
3599
3534
  });
@@ -4588,14 +4523,7 @@ class SmartCrmLeadsDetailsComponent extends AppBaseComponent {
4588
4523
  getDefaultValues(id) {
4589
4524
  this.crmService.getCrmContactDefaultValues(id).subscribe(res => {
4590
4525
  this.potentials = res['potential'];
4591
- const label = res['labels'];
4592
- label.forEach(val => {
4593
- const data = {
4594
- label: val,
4595
- value: val
4596
- };
4597
- this.labels.push(data);
4598
- });
4526
+ this.labels = (res['labels'] ?? []).map(val => ({ label: val, value: val }));
4599
4527
  this.cdr.markForCheck();
4600
4528
  });
4601
4529
  }
@@ -4963,30 +4891,9 @@ class SmartCrmCommunicationsDetailsComponent extends AppBaseComponent {
4963
4891
  accountDefaultValues(id) {
4964
4892
  this.crmService.getCrmAccountDefaultValues(id).subscribe(response => {
4965
4893
  this.getAccountSize();
4966
- const { status } = response;
4967
- status.forEach(val => {
4968
- const data = {
4969
- label: val,
4970
- value: val
4971
- };
4972
- this.status.push(data);
4973
- });
4974
- const { priority } = response;
4975
- priority.forEach(val => {
4976
- const data = {
4977
- label: val,
4978
- value: val
4979
- };
4980
- this.priority.push(data);
4981
- });
4982
- const { source } = response;
4983
- source.forEach(val => {
4984
- const data = {
4985
- label: val.name,
4986
- value: val.id
4987
- };
4988
- this.source.push(data);
4989
- });
4894
+ this.status = (response.status ?? []).map(val => ({ label: val, value: val }));
4895
+ this.priority = (response.priority ?? []).map(val => ({ label: val, value: val }));
4896
+ this.source = (response.source ?? []).map(val => ({ label: val.name, value: val.id }));
4990
4897
  this.cdr.markForCheck();
4991
4898
  });
4992
4899
  }
@@ -4996,35 +4903,14 @@ class SmartCrmCommunicationsDetailsComponent extends AppBaseComponent {
4996
4903
  if (this.id) {
4997
4904
  this.getCommunicationDetails(this.id);
4998
4905
  }
4999
- const organizationSizes = res.organization_sizes;
5000
- organizationSizes.forEach(val => {
5001
- const data = {
5002
- label: val.name,
5003
- value: val.id
5004
- };
5005
- this.organizationSizes.push(data);
5006
- });
4906
+ this.organizationSizes = (res.organization_sizes ?? []).map(val => ({ label: val.name, value: val.id }));
5007
4907
  this.cdr.markForCheck();
5008
4908
  });
5009
4909
  }
5010
4910
  getDefaultValues(id) {
5011
4911
  this.crmService.getCrmContactDefaultValues(id).subscribe(res => {
5012
- const label = res['labels'];
5013
- const contactSource = res['source'];
5014
- label.forEach(val => {
5015
- const data = {
5016
- label: val,
5017
- value: val
5018
- };
5019
- this.labels.push(data);
5020
- });
5021
- contactSource.forEach(val => {
5022
- const data = {
5023
- label: val.name,
5024
- value: val.id
5025
- };
5026
- this.contactSource.push(data);
5027
- });
4912
+ this.labels = (res['labels'] ?? []).map(val => ({ label: val, value: val }));
4913
+ this.contactSource = (res['source'] ?? []).map(val => ({ label: val.name, value: val.id }));
5028
4914
  this.cdr.markForCheck();
5029
4915
  });
5030
4916
  }
@@ -5776,15 +5662,12 @@ class SmartCrmOpportunitiesDetailsComponent extends AppBaseComponent {
5776
5662
  getAllOpportunityCategories() {
5777
5663
  this.crmService.getAllOpportunityCategories(this.subscriptionId).subscribe(response => {
5778
5664
  const categories = response?.crm_opportunity_categories ?? [];
5779
- categories.forEach(val => {
5780
- const data = {
5781
- label: val.name,
5782
- value: val.id
5783
- };
5784
- this.categories.push(data);
5785
- });
5786
- this.getValues();
5665
+ this.categories = categories.map(val => ({
5666
+ label: val.name,
5667
+ value: val.id
5668
+ }));
5787
5669
  this.cdr.markForCheck();
5670
+ this.getValues();
5788
5671
  });
5789
5672
  }
5790
5673
  getValues() {