diff --git a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html
index 2849a272..7258a3dc 100644
--- a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html
+++ b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.html
@@ -23,13 +23,12 @@
{{'person
{{data.maskRequiredLabel[langCode]}}
-
+
diff --git a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts
index 029fb8fc..59a0fefd 100644
--- a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts
+++ b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts
@@ -47,7 +47,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
formatLabels: any;
formatCheckBoxClicked: boolean = false;
isLoading: boolean = true;
- selectedOprionsFormOptions: object = {};
+ selectedOptionsFromOptions: object = {};
sitealignment:string = localStorage.getItem('direction');
constructor(private autoLogout: AutoLogoutService, private interactionService: InteractionService,
@@ -151,6 +151,76 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
});
}
+ createDefaultValue(data: any) {
+ let value = "";
+ if (this.userInfo[data.attributeName]) {
+ this.userInfo[data.attributeName].forEach(eachItem => {
+ if (eachItem.language === this.langCode) {
+ value = eachItem.value
+ }
+ });
+ } else {
+ value = this.createCheckedVal(data);
+ }
+ return value
+ }
+
+ // Method to create preview data with formates
+ createCheckedVal(data:any){
+ let finalvalue = "";
+
+ data.formatOption[this.langCode].forEach(item => {
+ if (item.value !== data.attributeName && item.checked) {
+ if (this.userInfo[item.value])
+ if (typeof this.userInfo[item.value] === "string") {
+ finalvalue += this.userInfo[item.value]
+ } else {
+ this.userInfo[item.value].forEach(eachVal => {
+ if (eachVal.language === this.langCode)
+ data.attributeName === 'fullAddress' ? finalvalue += eachVal.value + ", " : finalvalue += eachVal.value + " ";
+ });
+ }
+ }
+ })
+
+ return finalvalue.replace(/[, \s]+$/, "");
+ }
+
+ // Method to Uncheck default value checkbox
+ checkDefaultVal(data: any, $event:any) {
+ let unCheckedValues = 0;
+ let unCheckFullAddress = () => {
+ data.formatOption[this.langCode].forEach(item => {
+ if (item.value === data.attributeName) {
+ item['checked'] = false;
+ }
+ })
+ }
+
+ for (let item of data.formatOption[this.langCode]) {
+ if (!item.checked && item.value !== data.attributeName) {
+ unCheckFullAddress();
+ break;
+ } else {
+ item.checked = true;
+ }
+ }
+
+ for (let eachItem of data.formatOption[this.langCode]) {
+ if (!eachItem.checked) {
+ unCheckedValues += 1
+ }
+ }
+ if (unCheckedValues === data.formatOption[this.langCode].length) {
+ data.checked = false;
+ delete this.dataDisplay[data.attributeName];
+ data.formatOption[this.langCode].forEach(item => {
+ item.checked = true;
+ })
+ $event.closeMenu();
+ }
+ }
+
captureCheckboxValue($event: any, data: any, type: any) {
this.buildHTML = "";
if (type === "datacheck") {
@@ -166,39 +236,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
}
} else {
if (data.formatRequired) {
- if (data.attributeName === "fullAddress") {
- this.fullAddress = ""
- this.schema.forEach(item => {
- if (item.attributeName === data.attributeName) {
- this.formatLabels = item.formatOption[this.langCode]
- }
- })
-
- this.formatLabels.forEach(item => {
- if (this.userInfo[item.value] !== undefined) {
- if (typeof this.userInfo[item.value] !== "string") {
- this.userInfo[item.value].forEach(eachLang => {
- if (eachLang.language === this.langCode) {
- this.fullAddress = eachLang.value + ", " + this.fullAddress;
- }
- })
- } else {
- this.fullAddress = this.fullAddress + this.userInfo[item.value];
- }
- }
- })
-
- if (this.fullAddress.endsWith(', ')) {
- this.fullAddress = this.fullAddress.replace(/^./, "");
- };
- value = this.fullAddress;
- } else {
- this.userInfo[data.attributeName].forEach(eachItem => {
- if (eachItem.language === this.langCode) {
- value = eachItem.value
- }
- });
- }
+ value = this.createDefaultValue(data)
} else {
this.userInfo[data.attributeName].forEach(eachItem => {
if (eachItem.language === this.langCode) {
@@ -219,7 +257,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
if (item.attributeName === data.attributeName) {
let newItem = { ...item, checked: !item.checked }
if (!newItem.checked && newItem['formatOption']) {
- newItem['formatOption'][this.langCode] = this.selectedOprionsFormOptions[data.attributeName]
+ newItem['formatOption'][this.langCode] = this.selectedOptionsFromOptions[data.attributeName]
}
return newItem
} else {
@@ -238,8 +276,6 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
this.dataDisplay[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": $event.checked, "value": value };
} else {
let value = "";
- let allValue = "";
- let self = this;
if (typeof this.userInfo[data.attributeName] === "string") {
data.formatOption[this.langCode].forEach(item => {
item.checked = !item.checked
@@ -247,7 +283,6 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
value = moment(this.userInfo[data.attributeName]).format(item["value"]);
}
})
-
} else {
this.schema = this.schema.map(item => {
if (data['attributeName'] === item['attributeName']) {
@@ -262,78 +297,14 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
return item
})
-
- if (data.attributeName === "fullAddress") {
- let selectedValuesCount = 0;
- if (type["value"] !== 'fullAddress') {
- this.schema.map(eachItem => {
- if (data['attributeName'] === eachItem['attributeName']) {
- eachItem['formatOption'][this.langCode].forEach((item) => {
- if (item.checked) {
- if (self.userInfo[item.value] !== undefined) {
- if (item.value === "postalCode") {
- allValue = allValue + self.userInfo[item.value];
- } else {
- this.userInfo[item.value].forEach(eachLang => {
- if (eachLang.language === this.langCode) {
- allValue = allValue + eachLang.value + ", ";
- }
- })
- }
- }
- }
- return "";
- });
- }
- });
-
- let unCheckFullAddress = () => {
- data.formatOption[this.langCode].forEach(item => {
- if (item.value === "fullAddress") {
- item['checked'] = false;
- }
- })
- }
-
- for (let item of data.formatOption[this.langCode]) {
- if (!item.checked && item.value !== "fullAddress") {
- unCheckFullAddress();
- break;
- } else {
- item.checked = true;
- }
- }
-
- allValue = allValue.replace(/,(\s+)?$/, "");
- value = allValue;
- } else {
- value = this.fullAddress
- data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
- })
- }
-
- for (let eachItem of data.formatOption[this.langCode]) {
- if (!eachItem.checked) {
- selectedValuesCount += 1
- }
- }
-
- if (selectedValuesCount === data.formatOption[this.langCode].length) {
- data.checked = false;
- delete this.dataDisplay[data.attributeName];
- data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
- })
- $event.closeMenu();
- }
- } else {
- data.checked = false;
- delete this.dataDisplay[data.attributeName];
+ if (type.value === data.attributeName) {
+ value = this.createDefaultValue(data)
data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
+ item.checked = true
})
- $event.closeMenu();
+ } else {
+ value = this.createCheckedVal(data);
+ this.checkDefaultVal(data, $event);
}
}
if (data.checked) {
@@ -355,7 +326,7 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy {
let formatOptions = data['formatOption'][this.langCode].map(eachItem => {
return { ...eachItem }
})
- this.selectedOprionsFormOptions[data['attributeName']] = formatOptions;
+ this.selectedOptionsFromOptions[data['attributeName']] = formatOptions;
}
}
}
diff --git a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html
index 5ac58125..a81de76a 100644
--- a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html
+++ b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.html
@@ -58,8 +58,8 @@ {{'sharew
|
-
- {{sharableAttributes['name']['value']}}
+
+ {{sharableAttributes['fullName']['value']}}
|
|
diff --git a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts
index 34e70ca5..8a416c06 100644
--- a/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts
+++ b/resident-ui/src/app/feature/uinservices/sharewithpartner/sharewithpartner.component.ts
@@ -39,7 +39,6 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
showAcknowledgement: boolean = false;
aidStatus: any;
clickEventSubscription: Subscription;
- buildHTML: any;
userInfo: any;
message: any;
formatData: any;
@@ -61,6 +60,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
isLoading: boolean = true;
selectedOprionsFormOptions: object = {};
sitealignment:string = localStorage.getItem('direction');
+ selectedFormats:string = "";
private keyboardRef: MatKeyboardRef;
@ViewChildren('keyboardRef', { read: ElementRef })
@@ -213,8 +213,84 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
});
}
+ // Method to create default format preview data
+ createDefaultValue(data: any) {
+ let value = "";
+ if (this.userInfo[data.attributeName]) {
+ this.userInfo[data.attributeName].forEach(eachItem => {
+ if (eachItem.language === this.langCode) {
+ value = eachItem.value
+ }
+ });
+ } else {
+ value = this.createCheckedVal(data);
+ }
+ return value
+ }
+
+ // Method to create preview data with formates
+ createCheckedVal(data:any){
+ let finalvalue = "";
+ this.selectedFormats = "";
+ data.formatOption[this.langCode].forEach(item => {
+ if (item.value !== data.attributeName && item.checked) {
+ if (this.userInfo[item.value])
+ if (typeof this.userInfo[item.value] === "string") {
+ finalvalue += this.userInfo[item.value]
+ } else {
+ this.userInfo[item.value].forEach(eachVal => {
+ if (eachVal.language === this.langCode)
+ data.attributeName === 'fullAddress' ? finalvalue += eachVal.value + ", " : finalvalue += eachVal.value + " ";
+ });
+ }
+ }
+ })
+
+ data.formatOption[this.langCode].forEach(item =>{
+ if (item.checked && item.value !== 'fullAddress') {
+ this.selectedFormats += item.value + ",";
+ }
+ })
+ this.selectedFormats = this.selectedFormats.replace(/.$/, '');
+ return finalvalue.replace(/[, \s]+$/, "");
+ }
+
+ // Method to Uncheck default value checkbox
+ checkDefaultVal(data: any, $event:any) {
+ let unCheckedValues = 0;
+ let unCheckFullAddress = () => {
+ data.formatOption[this.langCode].forEach(item => {
+ if (item.value === data.attributeName) {
+ item['checked'] = false;
+ }
+ })
+ }
+
+ for (let item of data.formatOption[this.langCode]) {
+ if (!item.checked && item.value !== data.attributeName) {
+ unCheckFullAddress();
+ break;
+ } else {
+ item.checked = true;
+ }
+ }
+
+ for (let eachItem of data.formatOption[this.langCode]) {
+ if (!eachItem.checked) {
+ unCheckedValues += 1
+ }
+ }
+ if (unCheckedValues === data.formatOption[this.langCode].length) {
+ data.checked = false;
+ delete this.sharableAttributes[data.attributeName];
+ data.formatOption[this.langCode].forEach(item => {
+ item.checked = true;
+ })
+ $event.closeMenu();
+ }
+ }
+
captureCheckboxValue($event: any, data: any, type: string) {
- this.buildHTML = "";
if (type === "datacheck") {
if (data.attributeName.toString() in this.sharableAttributes) {
delete this.sharableAttributes[data.attributeName];
@@ -227,49 +303,17 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
value = this.userInfo[data.attributeName];
}
} else {
- if (data.formatRequired) {
- if (data.attributeName === "fullAddress") {
- this.fullAddress = ""
-
- this.schema.forEach(item => {
- if (item.attributeName === data.attributeName) {
- this.formatLabels = item.formatOption[this.langCode]
- }
- })
-
- this.formatLabels.forEach(item => {
- if (this.userInfo[item.value] !== undefined) {
- if (typeof this.userInfo[item.value] !== "string") {
- this.userInfo[item.value].forEach(eachLang => {
- if (eachLang.language === this.langCode) {
- this.fullAddress = this.fullAddress + ", " + eachLang.value
- }
- })
- } else {
- this.fullAddress = this.fullAddress +", " + this.userInfo[item.value]
- }
- }
- })
-
-
- this.fullAddress = this.fullAddress.replace(/^./, "");
- value = this.fullAddress
- } else {
- this.userInfo['fullName'].forEach(item =>{
- if(item.language === this.langCode){
- value = item.value
- }
- });
+ if (data.formatRequired) {
+ value = this.createDefaultValue(data)
+ } else {
+ this.userInfo[data.attributeName].forEach(item =>{
+ if(item.language === this.langCode){
+ value = item.value
}
- } else {
- this.userInfo[data.attributeName].forEach(item =>{
- if(item.language === this.langCode){
- value = item.value
- }
- });
- }
+ });
+ }
}
-
+
if (data.formatRequired) {
this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": data['defaultFormat'], "value": value };
} else {
@@ -300,15 +344,13 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": !this.sharableAttributes[data.attributeName]['isMasked'], "value": value };
} else {
let value = "";
- let allValues = "";
- let self = this;
- let selectedFormats = "";
+
if (typeof this.userInfo[data.attributeName] === "string") {
data.formatOption[this.langCode].forEach(eachItem => {
eachItem.checked = !eachItem.checked
if (eachItem.checked) {
value = moment(this.userInfo[data.attributeName]).format(eachItem["value"]);
- selectedFormats = type['label']
+ this.selectedFormats = type['label']
}
})
} else {
@@ -325,90 +367,18 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
return eachItem
})
- if (data.attributeName === "fullAddress") {
- let selectedValuesCount = 0;
- if (type["value"] !== 'fullAddress') {
- this.schema.map(eachItem => {
- if (data['attributeName'] === eachItem['attributeName']) {
- eachItem['formatOption'][this.langCode].forEach((item) => {
- if (item.checked) {
- if (self.userInfo[item.value] !== undefined) {
- if (item.value === "postalCode") {
- allValues = allValues + self.userInfo[item.value];
- } else {
- this.userInfo[item.value].forEach(eachLang => {
- if (eachLang.language === this.langCode) {
- allValues = allValues + eachLang.value + ", ";
- }
- })
- }
- }
- }
- return "";
- });
- }
- });
-
- let unCheckFullAddress = () =>{
- data.formatOption[this.langCode].forEach(eachItem =>{
- if(eachItem.value === "fullAddress"){
- eachItem['checked'] = false;
- }
- })
- }
-
- for(let item of data.formatOption[this.langCode]){
- if(!item.checked && item.value !== "fullAddress"){
- unCheckFullAddress();
- break;
- }else{
- item.checked = true;
- }
- }
-
- data.formatOption[this.langCode].forEach(item =>{
- if (item.checked && item.value !== 'fullAddress') {
- selectedFormats += item.value + ",";
- }
- })
-
- selectedFormats = selectedFormats.replace(/.$/, '');
- allValues = allValues.replace(/,(\s+)?$/, "");
- value = allValues;
- } else {
- value = this.fullAddress
- data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
- })
- selectedFormats = data.defaultFormat;
- }
-
- for (let eachItem of data.formatOption[this.langCode]) {
- if (!eachItem.checked) {
- selectedValuesCount += 1
- }
- }
-
- if (selectedValuesCount === data.formatOption[this.langCode].length) {
- data.checked = false;
- delete this.sharableAttributes[data.attributeName];
- data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
- })
- $event.closeMenu();
- }
-
- } else {
- data.checked = false;
- delete this.sharableAttributes[data.attributeName];
+ if (type['value'] === data.attributeName) {
+ value = this.createDefaultValue(data)
data.formatOption[this.langCode].forEach(item => {
- item.checked = true;
+ item.checked = true
})
- $event.closeMenu();
+ } else {
+ value = this.createCheckedVal(data);
+ this.checkDefaultVal(data, $event);
}
}
if (data.checked) {
- this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": selectedFormats, "value": value };
+ this.sharableAttributes[data.attributeName] = { "label": data.label[this.langCode], "attributeName": data['attributeName'], "isMasked": false, "format": this.selectedFormats, "value": value };
}
}
}
@@ -428,17 +398,6 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
}
}
- let row = "";
- let rowImage = ""
-
- for (const key in this.sharableAttributes) {
- if (key === "photo") {
- rowImage = " | ";
- } else {
- row = row + "" + this.sharableAttributes[key].attributeName + ": | " + this.sharableAttributes[key].value + " | ";
- }
- }
- this.buildHTML = ``;
}
captureDropDownValue(event: any) {
@@ -492,7 +451,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
this.router.navigate(["uinservices/dashboard"])
} else {
this.isLoading = false;
- this.showErrorPopup(response["errors"])
+ this.showErrorPopup(response.body["errors"])
}
},
err => {
@@ -555,7 +514,7 @@ export class SharewithpartnerComponent implements OnInit, OnDestroy {
return dialogRef;
}
- showErrorPopup(message: string) {
+ showErrorPopup(message: any) {
let errorCode = message[0]['errorCode']
setTimeout(() => {
this.dialog
|