From c2da432272bcb192e98ce1efd77a86bd7886dcc9 Mon Sep 17 00:00:00 2001
From: Dhaarani <55541808+DhaaraniCIT@users.noreply.github.com>
Date: Tue, 4 Jun 2024 16:58:04 +0530
Subject: [PATCH] memo field fix (#833)
* memo field fix
* default field fix
---
.../core/models/common/advanced-settings.model.ts | 7 +++++--
.../netsuite-advanced-settings.model.ts | 3 ++-
...iness-central-advanced-settings.component.html | 3 ++-
...usiness-central-advanced-settings.component.ts | 12 ++++++++++--
.../netsuite-advanced-settings.component.html | 3 ++-
.../netsuite-advanced-settings.component.ts | 12 ++++++++++--
.../qbo-clone-settings.component.html | 3 ++-
.../qbo-clone-settings.component.ts | 12 ++++++++++--
.../qbo-advanced-settings.component.html | 3 ++-
.../qbo-advanced-settings.component.ts | 15 ++++++++++++---
.../configuration-multi-select.component.html | 5 ++++-
.../configuration-multi-select.component.ts | 8 +++++++-
.../configuration-select-field.component.html | 9 ++++++++-
13 files changed, 76 insertions(+), 19 deletions(-)
diff --git a/src/app/core/models/common/advanced-settings.model.ts b/src/app/core/models/common/advanced-settings.model.ts
index 93d5d81ca..3cd38bcdb 100644
--- a/src/app/core/models/common/advanced-settings.model.ts
+++ b/src/app/core/models/common/advanced-settings.model.ts
@@ -72,7 +72,7 @@ export class AdvancedSettingsModel {
return ['employee_email', 'merchant', 'purpose', 'category', 'spent_on', 'report_number', 'expense_link'];
}
- static formatMemoPreview(memoStructure: string[], defaultMemoOptions: string[]): string {
+ static formatMemoPreview(memoStructure: string[], defaultMemoOptions: string[]): [string, string[]] {
const time = Date.now();
const today = new Date(time);
@@ -87,19 +87,22 @@ export class AdvancedSettingsModel {
};
let memoPreviewText = '';
const memo: string[] = [];
+ const originMemo: string[] = [];
memoStructure.forEach((field, index) => {
if (field in previewValues) {
const defaultIndex = defaultMemoOptions.indexOf(memoStructure[index]);
memo[defaultIndex] = previewValues[field];
+ originMemo[defaultIndex] = field;
}
});
+ memoStructure = originMemo.filter(item => item.trim() !== '');
memo.forEach((field, index) => {
memoPreviewText += field;
if (index + 1 !== memo.length) {
memoPreviewText = memoPreviewText + ' - ';
}
});
- return memoPreviewText;
+ return [memoPreviewText, memoStructure];
}
static filterAdminEmails = (emailToSearch: string[], adminEmails: EmailOption[]) => {
diff --git a/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts b/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts
index e97a6e902..7dbcbfb69 100644
--- a/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts
+++ b/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts
@@ -5,6 +5,7 @@ import { NetsuiteDefaultLevelOptions, NetsuitePaymentSyncDirection, QBOPaymentSy
import { AdvancedSettingValidatorRule, AdvancedSettingsModel } from "../../common/advanced-settings.model";
import { HelperUtility } from "../../common/helper.model";
import { brandingConfig } from "src/app/branding/branding-config";
+import { environment } from "src/environments/environment";
export type NetsuiteAdvancedSettingConfiguration = {
@@ -65,7 +66,7 @@ export type NetsuiteAdvancedSettingAddEmailModel = {
export class NetsuiteAdvancedSettingModel extends HelperUtility {
static getDefaultMemoOptions(): string[] {
- return ['employee_email', 'purpose', 'category', 'spent_on', 'report_number'];
+ return ['employee_email', 'merchant', 'purpose', 'category', 'spent_on', 'report_number'];
}
static getPaymentSyncOptions(): SelectFormOption[] {
diff --git a/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.html b/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.html
index a339cc4c7..4896cfb85 100644
--- a/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.html
+++ b/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.html
@@ -61,7 +61,8 @@
[options]="defaultMemoOptions"
[iconPath]="'list'"
[placeholder]="'Set description'"
- [formControllerName]="'memoStructure'">
+ [formControllerName]="'memoStructure'"
+ (changeInMultiSelect)="onMultiSelectChange()">
Preview of the Description Field
diff --git a/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.ts b/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.ts
index e94d2f1ea..40c59247d 100644
--- a/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.ts
+++ b/src/app/integrations/business-central/business-central-shared/business-central-advanced-settings/business-central-advanced-settings.component.ts
@@ -98,12 +98,20 @@ export class BusinessCentralAdvancedSettingsComponent implements OnInit {
this.helper.handleSkipExportFormInAdvancedSettingsUpdates(this.skipExportForm, formWatcher, this.advancedSettingForm);
}
+ onMultiSelectChange() {
+ const memo = this.advancedSettingForm.controls.memoStructure.value;
+ const changedMemo = AdvancedSettingsModel.formatMemoPreview(memo, this.defaultMemoOptions)[1];
+ this.advancedSettingForm.controls.memoStructure.patchValue(changedMemo);
+ }
+
private createMemoStructureWatcher(): void {
this.memoStructure = this.advancedSettingForm.value.memoStructure;
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ const memo = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoPreviewText = memo[0];
+ this.advancedSettingForm.controls.memoStructure.patchValue(memo[1]);
this.advancedSettingForm.controls.memoStructure.valueChanges.subscribe((memoChanges) => {
this.memoStructure = memoChanges;
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions)[0];
});
}
diff --git a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html
index 3b0daf026..5d24a940e 100644
--- a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html
+++ b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html
@@ -121,7 +121,8 @@
[options]="defaultMemoOptions"
[iconPath]="'list'"
[placeholder]="'Set description'"
- [formControllerName]="'memoStructure'">
+ [formControllerName]="'memoStructure'"
+ (changeInMultiSelect)="onMultiSelectChange()">
{{brandingContent.previewDescriptionFieldLabel}}
diff --git a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.ts b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.ts
index 96bf31b8d..b8b90dd88 100644
--- a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.ts
+++ b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.ts
@@ -194,11 +194,19 @@ export class NetsuiteAdvancedSettingsComponent implements OnInit {
return this.workspaceGeneralSettings.reimbursable_expenses_object && this.workspaceGeneralSettings.reimbursable_expenses_object !== NetsuiteReimbursableExpensesObject.JOURNAL_ENTRY;
}
+ onMultiSelectChange() {
+ const memo = this.advancedSettingForm.controls.memoStructure.value;
+ const changedMemo = AdvancedSettingsModel.formatMemoPreview(memo, this.defaultMemoOptions)[1];
+ this.advancedSettingForm.controls.memoStructure.patchValue(changedMemo);
+ }
+
private createMemoStructureWatcher(): void {
this.memoStructure = this.advancedSetting.configuration.memo_structure;
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ const memo: [string, string[]] = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoPreviewText = memo[0];
+ this.advancedSettingForm.controls.memoStructure.patchValue(memo[1]);
this.advancedSettingForm.controls.memoStructure.valueChanges.subscribe((memoChanges) => {
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(memoChanges, this.defaultMemoOptions);
+ this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(memoChanges, this.defaultMemoOptions)[0];
});
}
diff --git a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
index 983d98b4c..03eb51cf2 100644
--- a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
+++ b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
@@ -495,7 +495,8 @@
[iconPath]="'list'"
[placeholder]="'Set description'"
[formControllerName]="'memoStructure'"
- [isCloneSettingView]="true">
+ [isCloneSettingView]="true"
+ (changeInMultiSelect)="onMultiSelectChange()">
diff --git a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
index 35dcaaa02..0e88629b1 100644
--- a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
+++ b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
@@ -340,11 +340,19 @@ export class QboCloneSettingsComponent implements OnInit {
});
}
+ onMultiSelectChange() {
+ const memo = this.advancedSettingForm.controls.memoStructure.value;
+ const changedMemo = AdvancedSettingsModel.formatMemoPreview(memo, this.defaultMemoOptions)[1];
+ this.advancedSettingForm.controls.memoStructure.patchValue(changedMemo);
+ }
+
private createMemoStructureWatcher(): void {
this.memoStructure = this.cloneSetting.advanced_configurations.workspace_general_settings.memo_structure;
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ const memo = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoPreviewText = memo[0];
+ this.advancedSettingForm.controls.memoStructure.patchValue(memo[1]);
this.advancedSettingForm.controls.memoStructure.valueChanges.subscribe((memoChanges) => {
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(memoChanges, this.defaultMemoOptions);
+ this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(memoChanges, this.defaultMemoOptions)[0];
});
}
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.html b/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.html
index ee79cf9b1..7b1b963ba 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.html
+++ b/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.html
@@ -126,7 +126,8 @@
[options]="defaultMemoOptions"
[iconPath]="'list'"
[placeholder]="'Set description'"
- [formControllerName]="'memoStructure'">
+ [formControllerName]="'memoStructure'"
+ (changeInMultiSelect)="onMultiSelectChange()">
{{brandingContent.previewDescriptionFieldLabel}}
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.ts b/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.ts
index ffba14ea7..db7be59e0 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.ts
+++ b/src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.ts
@@ -170,14 +170,23 @@ export class QboAdvancedSettingsComponent implements OnInit {
return !this.workspaceGeneralSettings.import_vendors_as_merchants && (this.workspaceGeneralSettings.corporate_credit_card_expenses_object === QBOCorporateCreditCardExpensesObject.CREDIT_CARD_PURCHASE || this.workspaceGeneralSettings.corporate_credit_card_expenses_object === QBOCorporateCreditCardExpensesObject.DEBIT_CARD_EXPENSE || this.workspaceGeneralSettings.name_in_journal_entry === NameInJournalEntry.MERCHANT);
}
+ onMultiSelectChange() {
+ const memo = this.advancedSettingForm.controls.memoStructure.value;
+ const changedMemo = AdvancedSettingsModel.formatMemoPreview(memo, this.defaultMemoOptions)[1];
+ this.advancedSettingForm.controls.memoStructure.patchValue(changedMemo);
+ }
+
private createMemoStructureWatcher(): void {
- this.memoStructure = this.advancedSetting.workspace_general_settings.memo_structure;
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoStructure = this.advancedSettingForm.value.memoStructure;
+ const memo = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions);
+ this.memoPreviewText = memo[0];
+ this.advancedSettingForm.controls.memoStructure.patchValue(memo[1]);
this.advancedSettingForm.controls.memoStructure.valueChanges.subscribe((memoChanges) => {
- this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(memoChanges, this.defaultMemoOptions);
+ this.memoPreviewText = AdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultMemoOptions)[0];
});
}
+
skipExportWatcher(): void {
const skipExportFormWatcherFields: SkipExportValidatorRule = {
condition1: ['operator1', 'value1'],
diff --git a/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.html b/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.html
index 511d50962..97e22195b 100644
--- a/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.html
+++ b/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.html
@@ -9,7 +9,10 @@
-
+
0" class="tw-flex">
{{ name | titlecase | snakeCaseToSpaceCase }},
diff --git a/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.ts b/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.ts
index 99a9c9138..d1642cff0 100644
--- a/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.ts
+++ b/src/app/shared/components/configuration/configuration-multi-select/configuration-multi-select.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { brandingConfig } from 'src/app/branding/branding-config';
@@ -31,6 +31,8 @@ export class ConfigurationMultiSelectComponent implements OnInit {
@Input() isCloneSettingView: boolean;
+ @Output() changeInMultiSelect = new EventEmitter();
+
currentlyDragging: string | null;
selected: any[];
@@ -43,6 +45,10 @@ export class ConfigurationMultiSelectComponent implements OnInit {
private formBuilder: FormBuilder
) { }
+ onMultiSelectChange() {
+ this.changeInMultiSelect.emit();
+ }
+
// DragStart(memo: string) {
// This.currentlyDragging = memo;
// }
diff --git a/src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html b/src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html
index 2af0f8aca..45e220d4e 100644
--- a/src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html
+++ b/src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html
@@ -145,9 +145,16 @@
+
+
+ {{ brandingConfig.brandId === 'co' ? (option.name | sentenceCase) : (option.name)}}
+
+
- {{ item.name }}
+ {{ brandingConfig.brandId === 'co' ? (item.name | sentenceCase) : (item.name)}}