feat: Update Orders to follow CRUD pattern SOP
Following PROJECT_SOP.md section 5.7 CRUD Module Pattern: **Backend (NavigationRegistry.php):** - Added Orders submenu: All orders | New - Prepared for future tabs (Drafts, Recurring) **Frontend (Orders/index.tsx):** - Removed 'New order' button from toolbar - Kept bulk actions (Delete) in toolbar - Filters remain in toolbar **Result:** - Orders now consistent with Products pattern - Follows industry standard (Shopify, WooCommerce) - Submenu for main actions, toolbar for filters/bulk actions **Next:** - Implement variable product handling in OrderForm
This commit is contained in:
@@ -245,12 +245,6 @@ export default function Orders() {
|
|||||||
<div className="hidden md:block rounded-lg border border-border p-4 bg-card">
|
<div className="hidden md:block rounded-lg border border-border p-4 bg-card">
|
||||||
<div className="flex flex-col lg:flex-row lg:justify-between lg:items-center gap-3">
|
<div className="flex flex-col lg:flex-row lg:justify-between lg:items-center gap-3">
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<button
|
|
||||||
className="border rounded-md px-3 py-2 text-sm bg-black text-white disabled:opacity-50"
|
|
||||||
onClick={() => nav('/orders/new')}
|
|
||||||
>
|
|
||||||
{__('New order')}
|
|
||||||
</button>
|
|
||||||
{selectedIds.length > 0 && (
|
{selectedIds.length > 0 && (
|
||||||
<button
|
<button
|
||||||
className="border rounded-md px-3 py-2 text-sm bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 inline-flex items-center gap-2"
|
className="border rounded-md px-3 py-2 text-sm bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 inline-flex items-center gap-2"
|
||||||
|
|||||||
@@ -117,7 +117,11 @@ class NavigationRegistry {
|
|||||||
'label' => __('Orders', 'woonoow'),
|
'label' => __('Orders', 'woonoow'),
|
||||||
'path' => '/orders',
|
'path' => '/orders',
|
||||||
'icon' => 'receipt-text',
|
'icon' => 'receipt-text',
|
||||||
'children' => [], // Orders has no submenu by design
|
'children' => [
|
||||||
|
['label' => __('All orders', 'woonoow'), 'mode' => 'spa', 'path' => '/orders'],
|
||||||
|
['label' => __('New', 'woonoow'), 'mode' => 'spa', 'path' => '/orders/new'],
|
||||||
|
// Future: Drafts, Recurring, etc.
|
||||||
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'key' => 'products',
|
'key' => 'products',
|
||||||
|
|||||||
Reference in New Issue
Block a user