From f9161b49f49dcf3c7bca3e15efdd32aad3ae1601 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 6 Nov 2025 10:28:04 +0700 Subject: [PATCH] fix: Select defaults + confirm responsive pattern + convert to AlertDialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Fixed Select Field Default Value ✅ Problem: Select shows empty even with default/saved value Solution: Ensure select always has value const selectValue = (value || field.value || field.default) as string; handleFieldChange(field.id, val)} > diff --git a/admin-spa/src/routes/Orders/Detail.tsx b/admin-spa/src/routes/Orders/Detail.tsx index 4784a75..14cd6fc 100644 --- a/admin-spa/src/routes/Orders/Detail.tsx +++ b/admin-spa/src/routes/Orders/Detail.tsx @@ -6,7 +6,16 @@ import { formatRelativeOrDate } from '@/lib/dates'; import { formatMoney } from '@/lib/currency'; import { ArrowLeft, Printer, ExternalLink, Loader2, Ticket, FileText, Pencil, RefreshCw } from 'lucide-react'; import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select'; -import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle +} from '@/components/ui/alert-dialog'; import { Button } from '@/components/ui/button'; import { showErrorToast, showSuccessToast, getPageLoadErrorMessage } from '@/lib/errorHandling'; import { ErrorCard } from '@/components/ErrorCard'; @@ -254,33 +263,33 @@ export default function OrderShow() { {__('Retry Payment')} - - - - {__('Retry Payment')} - + + + + {__('Retry Payment')} + {__('Are you sure you want to retry payment processing for this order?')}
{__('This will create a new payment transaction.')} -
-
- - - - -
-
+ + + + )} diff --git a/admin-spa/src/routes/Orders/index.tsx b/admin-spa/src/routes/Orders/index.tsx index c94c96f..86cdb7d 100644 --- a/admin-spa/src/routes/Orders/index.tsx +++ b/admin-spa/src/routes/Orders/index.tsx @@ -6,7 +6,16 @@ import { ErrorCard } from '@/components/ErrorCard'; import { getPageLoadErrorMessage } from '@/lib/errorHandling'; import { __ } from '@/lib/i18n'; import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'; -import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle +} from '@/components/ui/alert-dialog'; import { Button } from '@/components/ui/button'; import { Checkbox } from '@/components/ui/checkbox'; import { toast } from 'sonner'; @@ -435,34 +444,33 @@ export default function Orders() { {/* Delete Confirmation Dialog */} - - - - {__('Delete Orders')} - + + + + {__('Delete Orders')} + {__('Are you sure you want to delete')} {selectedIds.length} {selectedIds.length === 1 ? __('order') : __('orders')}?
{__('This action cannot be undone.')} -
-
- - - - -
-
+ + + + ); } \ No newline at end of file