diff --git a/admin-ui/src/app/core/services/data-storage.service.ts b/admin-ui/src/app/core/services/data-storage.service.ts index 3852b10..b45d473 100644 --- a/admin-ui/src/app/core/services/data-storage.service.ts +++ b/admin-ui/src/app/core/services/data-storage.service.ts @@ -356,6 +356,13 @@ export class DataStorageService { ); } + sentPacketToPerso(data: FormData) { + return this.http.post( + this.BASE_URL + 'admin' + '/packetstatusupdate/sentToPerso', + data + ); + } + getCreateUpdateSteps(entity: string) { return this.http.get(`./assets/create-update-steps/${entity}-steps.json`); } diff --git a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.html b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.html index dee76bf..9f39379 100644 --- a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.html +++ b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.html @@ -10,6 +10,9 @@ + {{errorMessage | translate}} diff --git a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts index b070c2e..06fd82b 100644 --- a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts +++ b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts @@ -21,6 +21,7 @@ export class PacketStatusComponent implements OnInit { // status: 'Completed' // } ]; + showSendToPerso: boolean = false; roles: string[] = []; showDetails = false; showTimeline = false; @@ -97,6 +98,9 @@ export class PacketStatusComponent implements OnInit { this.error = false; this.showDetails = true; console.log("Final status is ", this.statusCheck) + + this.showSendToPerso = this.data.some(item =>item.transactionTypeCode === 'PRINT_SERVICE' && + item.statusCode === 'PROCESSED' || item.statusCode === 'COMPLETED'); } }); } @@ -131,6 +135,34 @@ export class PacketStatusComponent implements OnInit { }); } + sentToPerso(){ + if (!this.id) { + this.error = true; + this.errorMessage = 'Invalid packet id'; + return; + } + + const formData = new FormData(); + formData.append('rid', this.id); + formData.append('langCode', this.headerService.getUserPreferredLanguage()); + + this.dataStorageService.sentPacketToPerso(formData).subscribe({ + next: (response) => { + console.log('Sent Packet to Perso API Response:', response); + this.error = false; + const res: any = response; + if (res && res.response && res.response.message) { + const message = res.response.message; + if(message.startsWith('Card details sent')){ + this.showPopup('Success', res.response.message, 'Close', 'success'); + } else { + this.showPopup('Error', res.response.message, 'Close', 'error'); + } + } + } + }); + } + showPopup(title: string, message: string, buttonText: string, type: 'success' | 'error') { this.popupTitle = title; this.popupMessage = message; diff --git a/admin-ui/src/assets/i18n/eng.json b/admin-ui/src/assets/i18n/eng.json index 3906018..b666561 100644 --- a/admin-ui/src/assets/i18n/eng.json +++ b/admin-ui/src/assets/i18n/eng.json @@ -494,6 +494,7 @@ "viewMore": "View More", "viewLess": "View Less", "resume": "Resume", + "sentToPerso": "Send to Perso", "errorMessages": { "title": "Error", "message": "RID Not Found",