feat: Remove enabled checkbox + group payments by provider

1. Remove Enable/Disable Checkbox 
   - Already controlled by toggle in main UI
   - Skip rendering 'enabled' field in GenericGatewayForm
   - Cleaner form, less redundancy

2. Use Field Default as Default Value 
   - Already working: field.value ?? field.default
   - Backend sends current value, falls back to default
   - No changes needed

3. Group Online Payments by Provider 
   - Installed @radix-ui/react-accordion
   - Created accordion.tsx component
   - Group by gateway.title (provider name)
   - Show provider with method count
   - Expand to see individual methods

   Structure:
   TriPay (3 payment methods)
     ├─ BNI Virtual Account
     ├─ Mandiri Virtual Account
     └─ BCA Virtual Account

   PayPal (1 payment method)
     └─ PayPal

Benefits:
- Cleaner UI with less clutter
- Easy to find specific provider
- Shows method count at a glance
- Multiple providers can be expanded
- Better organization for many gateways

Files Modified:
- GenericGatewayForm.tsx: Skip enabled field
- Payments.tsx: Accordion grouping by provider
- accordion.tsx: New component (shadcn pattern)

Next: Dialog/Drawer responsive pattern
This commit is contained in:
dwindown
2025-11-06 10:12:57 +07:00
parent 1f88120c9d
commit 349b16d1e4
5 changed files with 208 additions and 56 deletions

View File

@@ -127,6 +127,11 @@ export function GenericGatewayForm({ gateway, onSave, onCancel, hideFooter = fal
switch (field.type) {
case 'checkbox':
// Skip "enabled" field - already controlled by toggle in main UI
if (field.id === 'enabled') {
return null;
}
// WooCommerce uses "yes"/"no" strings, convert to boolean
const isChecked = value === 'yes' || value === true;
return (