feat: update changes
This commit is contained in:
+24
@@ -165,6 +165,30 @@ export class WelcomeKitDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
canUpdateStatus(status: string): boolean {
|
||||
return status === 'DISPATCHED' || status === 'IN_TRANSIT';
|
||||
}
|
||||
|
||||
updateStatus(dispatch: any, newStatus: string) {
|
||||
const label = newStatus === 'DELIVERED' ? 'Delivered' : 'Returned';
|
||||
const confirmed = confirm(`Are you sure you want to mark this as ${label}? This action cannot be undone from the UI.`);
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
this.clientsService.updateWelcomeKitStatus(dispatch.id, newStatus).subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open(`Welcome Kit marked as ${label} successfully`, 'Close', { duration: 3000 });
|
||||
this.fetchData();
|
||||
},
|
||||
error: () => {
|
||||
this.isLoading = false;
|
||||
this.snackBar.open(`Failed to mark Welcome Kit as ${label}`, 'Close', { duration: 3000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDisplayAddress(dispatch: any): string {
|
||||
const address = dispatch.deliveryAddress || '';
|
||||
const name = this.welcomeKitsData?.clientName || '';
|
||||
|
||||
Reference in New Issue
Block a user