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 2742d8a7..81a9baaa 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 @@ -57,36 +57,124 @@ export class PacketStatusComponent implements OnInit { search() { this.data = null; this.errorMessage = ''; + + console.log('========== PACKET STATUS SEARCH START =========='); + console.log('Registration ID:', this.id); + if (this.id.length == 0) { + this.error = true; + + console.log('ERROR: Registration ID is empty'); + } else { + this.error = false; + + console.log('Calling getPacketStatus API...'); + this.dataStorageService .getPacketStatus( this.id, this.headerService.getUserPreferredLanguage() ) .subscribe(response => { + + console.log('========== PACKET STATUS API RESPONSE =========='); + console.log('Full API Response:', response); + if (response['errors']) { + + console.log('API returned errors:', response['errors']); + this.error = true; this.statusCheck = ''; this.errorMessage = this.serverMessage[response['errors'][0].errorCode]; + + console.log('Error Message:', this.errorMessage); + } else { - this.data = response['response']['packetStatusUpdateList']; + + this.data = + response['response']['packetStatusUpdateList']; + + console.log('========== PACKET STATUS LIST =========='); + console.log('Total Records:', this.data?.length); + console.log('Full packetStatusUpdateList:', this.data); + this.error = false; this.showDetails = true; + if (this.data && this.data.length > 0) { + + console.log('========== ALL STATUS RECORDS =========='); + + this.data.forEach((item, index) => { + + console.log( + 'INDEX:', + index, + '| STATUS:', + item.statusCode, + '| SUB STATUS:', + item.subStatusCode, + '| TRANSACTION:', + item.transactionTypeCode, + '| DATE:', + item.createdDateTimes + ); + + }); + + console.log('========== FIRST RECORD =========='); + console.log('First Record:', this.data[0]); + + console.log('========== LAST RECORD =========='); + console.log( + 'Last Record:', + this.data[this.data.length - 1] + ); + const latestStatus = this.data[this.data.length - 1].statusCode; + + console.log('========== LATEST STATUS =========='); + console.log('Latest Status:', latestStatus); + if (latestStatus.includes('FAILED')) { + this.statusCheck = this.messages.statuscheckFailed; + + console.log( + 'FINAL STATUS CHECK: FAILED' + ); + } else { + this.statusCheck = this.messages.statuscheckCompleted; + + console.log( + 'FINAL STATUS CHECK: COMPLETED' + ); } + + console.log( + 'StatusCheck displayed in UI:', + this.statusCheck + ); + + } else { + + console.log( + 'WARNING: packetStatusUpdateList is empty' + ); + } + + console.log('========== PACKET STATUS SEARCH END =========='); } }); }