@posiwise/admin-module 0.0.103 → 0.0.104

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.
@@ -6570,54 +6570,7 @@ class AddEditIncidentComponent extends AppBaseComponent {
6570
6570
  });
6571
6571
  this.currentIncident = history.state?.data;
6572
6572
  if (this.currentIncident) {
6573
- // const startedDate: Date = new Date(this.currentIncident?.started_at);
6574
- // const resolvedDate: Date = new Date(this.currentIncident?.resolved_at);
6575
- // const lastCheckedDate: Date = new Date(this.currentIncident?.last_check_at);
6576
- this.form.setValue({
6577
- id: this.currentIncident?.id,
6578
- description: this.currentIncident?.description,
6579
- service_impacted: this.currentIncident?.service_impacted,
6580
- url_impacted: this.currentIncident?.url_impacted,
6581
- resolved_at: this.currentIncident?.resolved_at
6582
- ? new Date(this.currentIncident?.resolved_at)
6583
- : '',
6584
- // ? {
6585
- // day: resolvedDate.getDate(),
6586
- // month: resolvedDate.getMonth() + 1,
6587
- // year: resolvedDate.getFullYear()
6588
- // }
6589
- // : {
6590
- // day: new Date().getDate(),
6591
- // month: new Date().getMonth() + 1,
6592
- // year: new Date().getFullYear()
6593
- // }
6594
- started_at: this.currentIncident?.started_at
6595
- ? new Date(this.currentIncident?.started_at)
6596
- : '',
6597
- // ? {
6598
- // day: startedDate.getDate(),
6599
- // month: startedDate.getMonth() + 1,
6600
- // year: startedDate.getFullYear()
6601
- // }
6602
- // : {
6603
- // day: new Date().getDate(),
6604
- // month: new Date().getMonth() + 1,
6605
- // year: new Date().getFullYear()
6606
- // },
6607
- last_check_at: this.currentIncident?.last_check_at
6608
- ? new Date(this.currentIncident?.last_check_at)
6609
- : ''
6610
- // ? {
6611
- // day: lastCheckedDate.getDate(),
6612
- // month: lastCheckedDate.getMonth() + 1,
6613
- // year: lastCheckedDate.getFullYear()
6614
- // }
6615
- // : {
6616
- // day: new Date().getDate(),
6617
- // month: new Date().getMonth() + 1,
6618
- // year: new Date().getFullYear()
6619
- // }
6620
- });
6573
+ this.getIncidentById();
6621
6574
  }
6622
6575
  }
6623
6576
  get f() {
@@ -6635,6 +6588,19 @@ class AddEditIncidentComponent extends AppBaseComponent {
6635
6588
  this.submitted = true;
6636
6589
  }
6637
6590
  }
6591
+ getIncidentById() {
6592
+ this.commonService.getIncidentById(this.id, this.subscriptionId).subscribe(response => {
6593
+ this.form.setValue({
6594
+ id: response.id,
6595
+ description: response?.description,
6596
+ service_impacted: response?.service_impacted,
6597
+ url_impacted: response?.url_impacted,
6598
+ resolved_at: response?.resolved_at ? new Date(response?.resolved_at) : '',
6599
+ started_at: response?.started_at ? new Date(response?.started_at) : '',
6600
+ last_check_at: response?.last_check_at ? new Date(response?.last_check_at) : ''
6601
+ });
6602
+ });
6603
+ }
6638
6604
  onAdd() {
6639
6605
  this.buttonBusy = true;
6640
6606
  try {
@@ -6730,7 +6696,6 @@ class AddFaqComponent extends AppBaseComponent {
6730
6696
  this.slug = PermissionService.selectedSubscription?.slug;
6731
6697
  this.subscriptionId = PermissionService.selectedSubscription?.id;
6732
6698
  this.getCategories();
6733
- this.currentFaq = history.state?.data;
6734
6699
  this.getFaqs();
6735
6700
  }
6736
6701
  get f() {
@@ -7104,9 +7069,6 @@ class EditFaqComponent extends AppBaseComponent {
7104
7069
  this.adminService = adminService;
7105
7070
  this.productService = productService;
7106
7071
  this.routers = ROUTERS;
7107
- this.faqs = [];
7108
- this.faqList = [];
7109
- this.backUpFAQ = [];
7110
7072
  this.submitted = false;
7111
7073
  this.isLoaded = true;
7112
7074
  this.isEdit = false;
@@ -7138,42 +7100,25 @@ class EditFaqComponent extends AppBaseComponent {
7138
7100
  this.id = +params['id'] || 0;
7139
7101
  });
7140
7102
  this.currentFaq = history.state?.data;
7141
- this.form.patchValue(history.state?.data);
7142
- this.getFaqs();
7103
+ this.getFaqCategories();
7104
+ this.getCurrentFaq();
7143
7105
  }
7144
7106
  get f() {
7145
7107
  return this.form.controls;
7146
7108
  }
7147
- getFaqs() {
7148
- this.isLoaded = false;
7109
+ getFaqCategories() {
7149
7110
  this.categories = [];
7150
- this.faqHashMap = {};
7151
- const params = {
7152
- subscription_id: this.subscriptionId,
7153
- feature_key: this.selectedFeatureKeys.join(',') || ''
7154
- };
7155
- this.commonService.getFaq({ ...params }).subscribe(response => {
7156
- this.isLoaded = true;
7157
- this.faqs = response.faqs;
7158
- this.allFaqs = response.faqs;
7159
- this.totalRecords = response.object_count;
7160
- this.totalRecordsUnFiltered = response.unfiltered_count;
7161
- this.faqs = this.faqs.map(x => {
7162
- x.isEdit = false;
7163
- return x;
7164
- });
7165
- this.backUpFAQ = [...this.faqs];
7166
- response?.available_category?.forEach(x => {
7167
- this.faqHashMap[x.key] = x;
7168
- });
7169
- this.categoryForBadges = response.available_category.map(x => x.key);
7170
- this.categories = response.available_category.map(element => {
7111
+ this.commonService.getFaqCategories(this.subscriptionId).subscribe(response => {
7112
+ this.categories = response.map(element => {
7171
7113
  return { label: element.name, value: element.key };
7172
7114
  });
7173
- this.allFaqs = this.faqs;
7174
- this.faqList = this.faqs;
7175
7115
  });
7176
7116
  }
7117
+ getCurrentFaq() {
7118
+ this.commonService
7119
+ .getFaqById(this.id, this.subscriptionId)
7120
+ .subscribe(data => this.form.patchValue({ ...data, id: this.id }));
7121
+ }
7177
7122
  onSubmit() {
7178
7123
  this.form.markAllAsTouched();
7179
7124
  if (this.form.valid) {
@@ -7185,7 +7130,6 @@ class EditFaqComponent extends AppBaseComponent {
7185
7130
  updateFaq() {
7186
7131
  this.buttonBusy = true;
7187
7132
  const data = {
7188
- id: this.currentFaq.id,
7189
7133
  ...this.form.value
7190
7134
  };
7191
7135
  this.adminService.putFaq(data, this.subscriptionId).subscribe({
@@ -7206,7 +7150,6 @@ class EditFaqComponent extends AppBaseComponent {
7206
7150
  this.allProducts = resp.products;
7207
7151
  this.productList = this.groupProducts(resp.products);
7208
7152
  this.productList.unshift({ label: 'Select Product', value: null });
7209
- this.form.get('product_id').setValue(this.productList[0].value);
7210
7153
  const featureKeys = Array.from(new Set(resp.products.map(item => item?.feature_key)));
7211
7154
  this.featureKeysList = featureKeys.map(element => {
7212
7155
  return {
@@ -7248,11 +7191,6 @@ class EditFaqComponent extends AppBaseComponent {
7248
7191
  }
7249
7192
  return [];
7250
7193
  }
7251
- onProductChange(event) {
7252
- this.searchText = '';
7253
- this.selectedFeatureKeys = event.value;
7254
- this.getFaqs();
7255
- }
7256
7194
  onChange(item) {
7257
7195
  this.isProductEnabled = item.value !== 'product';
7258
7196
  if (this.isProductEnabled) {
@@ -7262,15 +7200,6 @@ class EditFaqComponent extends AppBaseComponent {
7262
7200
  this.form.get('product_id');
7263
7201
  }
7264
7202
  }
7265
- onValueChange(faq, value) {
7266
- const data = {
7267
- id: faq.id,
7268
- visible: value
7269
- };
7270
- this.adminService.putFaq(data, this.subscriptionId).subscribe(() => {
7271
- this.toast.success(this.translation.translate('Admin.Faq.UpdatedMessage'));
7272
- });
7273
- }
7274
7203
  onPublicValueChange(faq, value) {
7275
7204
  const data = {
7276
7205
  id: faq.id,