@fayz-ai/plugin-orders 0.12.27 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OrderDetailRoute-LTPDQXQU.js +193 -0
- package/dist/OrderDetailRoute-LTPDQXQU.js.map +1 -0
- package/dist/OrdersPage-5326V62H.js +291 -0
- package/dist/OrdersPage-5326V62H.js.map +1 -0
- package/dist/chunk-YVC7R552.js +6 -0
- package/dist/chunk-YVC7R552.js.map +1 -0
- package/dist/context.d.ts +0 -46
- package/dist/context.d.ts.map +1 -1
- package/dist/data/core-supabase.d.ts.map +1 -1
- package/dist/index.d.ts +4 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +891 -934
- package/dist/index.js.map +1 -1
- package/dist/lib/detail-slot.d.ts +13 -0
- package/dist/lib/detail-slot.d.ts.map +1 -0
- package/dist/lib/list-query.d.ts +21 -0
- package/dist/lib/list-query.d.ts.map +1 -0
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/views/OrderDetailRoute.d.ts +12 -0
- package/dist/views/OrderDetailRoute.d.ts.map +1 -0
- package/dist/views/OrdersPage.d.ts +1 -7
- package/dist/views/OrdersPage.d.ts.map +1 -1
- package/dist/views/OrdersScreen.d.ts.map +1 -1
- package/package.json +7 -9
- package/dist/OrdersPage-QV2YWARF.js +0 -483
- package/dist/OrdersPage-QV2YWARF.js.map +0 -1
- package/dist/chunk-TYS3LCKX.js +0 -57
- package/dist/chunk-TYS3LCKX.js.map +0 -1
- package/dist/lib/floor-plan-id.d.ts +0 -13
- package/dist/lib/floor-plan-id.d.ts.map +0 -1
- package/dist/views/CommercialOrdersScreen.d.ts +0 -3
- package/dist/views/CommercialOrdersScreen.d.ts.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A product that owns part of the orders (a shop, with shipments and a
|
|
4
|
+
* checkout) registers its own detail page under this id. It must render
|
|
5
|
+
* `fallback` for any order it does not own.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ORDER_DETAIL_COMPONENT_ID = "orders.detail";
|
|
8
|
+
export interface OrderDetailSlotProps {
|
|
9
|
+
orderId: string;
|
|
10
|
+
onBack: () => void;
|
|
11
|
+
fallback: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=detail-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detail-slot.d.ts","sourceRoot":"","sources":["../../src/lib/detail-slot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,kBAAkB,CAAA;AAExD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OrderQuery } from '../types';
|
|
2
|
+
export interface OrdersListFilters {
|
|
3
|
+
/** One of PERIOD_PRESETS, `custom` (uses from/to) or `all`. */
|
|
4
|
+
preset: string;
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
status?: string;
|
|
8
|
+
channel?: string;
|
|
9
|
+
fulfillment?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const PERIOD_PRESETS: {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
/** A preset as local calendar days. `null` for `all`, `custom` and anything unknown. */
|
|
16
|
+
export declare function periodRange(preset: string, now?: Date): {
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
} | null;
|
|
20
|
+
export declare function toOrderQuery(filters: OrdersListFilters, search: string, page: number, pageSize: number, now?: Date): OrderQuery;
|
|
21
|
+
//# sourceMappingURL=list-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-query.d.ts","sourceRoot":"","sources":["../../src/lib/list-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,cAAc;;;GAK1B,CAAA;AAOD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYjG;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAa,GAC3F,UAAU,CAmBZ"}
|
package/dist/types.d.ts
CHANGED
|
@@ -97,9 +97,17 @@ export interface UpdateOrderStatusInput {
|
|
|
97
97
|
status: OrderStatus;
|
|
98
98
|
}
|
|
99
99
|
export interface OrderQuery {
|
|
100
|
-
kind?: OrderKind | OrderKind[];
|
|
101
|
-
status?: OrderStatus | OrderStatus[];
|
|
100
|
+
kind?: OrderKind | OrderKind[] | (string & {}) | string[];
|
|
101
|
+
status?: OrderStatus | OrderStatus[] | (string & {}) | string[];
|
|
102
102
|
source?: string;
|
|
103
|
+
/** Sales channel as `orders.channel` holds it (balcao · shop · delivery…). */
|
|
104
|
+
channel?: string;
|
|
105
|
+
/** unfulfilled · partially_fulfilled · fulfilled */
|
|
106
|
+
fulfillmentStatus?: string;
|
|
107
|
+
/** Kinds left out — the sales list drops `purchase`, which shares the table. */
|
|
108
|
+
excludeKinds?: string[];
|
|
109
|
+
/** `false` skips the lines — a list row does not draw them. Default true. */
|
|
110
|
+
withItems?: boolean;
|
|
103
111
|
tableId?: string;
|
|
104
112
|
assigneeId?: string;
|
|
105
113
|
dateRange?: {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAA;AACvH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;AAC3H,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;AAC3I,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,CAAA;AAEvE,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,CAAA;AAc1G,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,CAIxD,CAAA;AASD,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAavF;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM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
|
+
export interface OrderDetailRouteOptions {
|
|
3
|
+
editRoute?: (orderId: string) => string;
|
|
4
|
+
canEditOrder?: (order: {
|
|
5
|
+
status?: string;
|
|
6
|
+
}) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function OrderDetailRoute({ id, options }: {
|
|
9
|
+
id?: string;
|
|
10
|
+
options: OrderDetailRouteOptions;
|
|
11
|
+
}): React.JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=OrderDetailRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderDetailRoute.d.ts","sourceRoot":"","sources":["../../src/views/OrderDetailRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAA;CACvD;AAsFD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,uBAAuB,CAAA;CAAE,4BA0BlG"}
|
|
@@ -4,16 +4,10 @@ import { type ResolvedOrdersConfig } from '../context';
|
|
|
4
4
|
import type { OrdersDataProvider } from '../data/types';
|
|
5
5
|
import type { OrdersUIState } from '../store';
|
|
6
6
|
import type { PluginRegistryDef } from '@fayz-ai/core';
|
|
7
|
-
export declare function OrdersPage({ config, provider, store
|
|
7
|
+
export declare function OrdersPage({ config, provider, store }: {
|
|
8
8
|
config: ResolvedOrdersConfig;
|
|
9
9
|
provider: OrdersDataProvider;
|
|
10
10
|
store: StoreApi<OrdersUIState>;
|
|
11
11
|
registries?: PluginRegistryDef[];
|
|
12
|
-
/**
|
|
13
|
-
* Which vocabulary the screen speaks (#334, #336). The restaurant watches a
|
|
14
|
-
* service in progress; a salon or a clinic looks a Venda up and asks whether
|
|
15
|
-
* it produced a Título. Same archetype, same board, different columns.
|
|
16
|
-
*/
|
|
17
|
-
variant?: 'restaurant' | 'commercial';
|
|
18
12
|
}): React.JSX.Element;
|
|
19
13
|
//# sourceMappingURL=OrdersPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrdersPage.d.ts","sourceRoot":"","sources":["../../src/views/OrdersPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"OrdersPage.d.ts","sourceRoot":"","sources":["../../src/views/OrdersPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IACtD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;IAC9B,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACjC,qBAMA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrdersScreen.d.ts","sourceRoot":"","sources":["../../src/views/OrdersScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"OrdersScreen.d.ts","sourceRoot":"","sources":["../../src/views/OrdersScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA+CzB,wBAAgB,YAAY,sBAsN3B"}
|
package/package.json
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
"name": "@fayz-ai/plugin-orders",
|
|
3
3
|
"fayz": {
|
|
4
4
|
"status": "beta",
|
|
5
|
-
"dependencies": [
|
|
6
|
-
"menu"
|
|
7
|
-
]
|
|
5
|
+
"dependencies": []
|
|
8
6
|
},
|
|
9
|
-
"version": "0.
|
|
7
|
+
"version": "0.13.0",
|
|
10
8
|
"description": "Fayz SDK — plugin-orders plugin",
|
|
11
9
|
"type": "module",
|
|
12
10
|
"sideEffects": false,
|
|
@@ -30,11 +28,11 @@
|
|
|
30
28
|
"sonner": "^2.0.7"
|
|
31
29
|
},
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"@fayz-ai/core": "^0.
|
|
34
|
-
"@fayz-ai/sdk": "^0.
|
|
35
|
-
"@fayz-ai/admin": "^0.
|
|
36
|
-
"@fayz-ai/plugin-financial": "^0.
|
|
37
|
-
"@fayz-ai/ui": "^0.
|
|
31
|
+
"@fayz-ai/core": "^0.44.0",
|
|
32
|
+
"@fayz-ai/sdk": "^0.43.2",
|
|
33
|
+
"@fayz-ai/admin": "^0.44.0",
|
|
34
|
+
"@fayz-ai/plugin-financial": "^0.23.0",
|
|
35
|
+
"@fayz-ai/ui": "^0.44.0"
|
|
38
36
|
},
|
|
39
37
|
"devDependencies": {
|
|
40
38
|
"@types/react": "^18.3.0",
|
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import { mapToKanbanColumn, getNextStatus, ADVANCE_VERB, KANBAN_COLUMNS } from './chunk-TYS3LCKX.js';
|
|
2
|
-
import { createPluginContext, formatCurrency, orderKindColumn, orderChannelColumn, OrderListView, useOrdersPaymentStatus, PaymentStatusBadge, OrderAmount, OrderDetailRail, PageActions, adminNavigateTo, RecordPickerModal } from '@fayz-ai/admin';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Clock, Bike, MapPin, LayoutGrid, Settings, Plus } from 'lucide-react';
|
|
5
|
-
import { Button } from '@fayz-ai/ui';
|
|
6
|
-
import { useTranslation, getComponent } from '@fayz-ai/core';
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var ctx = createPluginContext("OrdersPage");
|
|
10
|
-
var OrdersContextProvider = ctx.ContextProvider;
|
|
11
|
-
var useOrdersConfig = ctx.useConfig;
|
|
12
|
-
ctx.useProvider;
|
|
13
|
-
var useOrdersStore = ctx.useStore;
|
|
14
|
-
|
|
15
|
-
// src/lib/floor-plan-id.ts
|
|
16
|
-
var FLOOR_PLAN_COMPONENT_ID = "tables.floor-plan";
|
|
17
|
-
function AddItemsBlock({ orderId, onDone }) {
|
|
18
|
-
const t = useTranslation();
|
|
19
|
-
const config = useOrdersConfig();
|
|
20
|
-
const addOrderItem = useOrdersStore((s) => s.addOrderItem);
|
|
21
|
-
const money = React.useCallback(
|
|
22
|
-
(v) => formatCurrency(v, config.currency),
|
|
23
|
-
[config.currency]
|
|
24
|
-
);
|
|
25
|
-
const [open, setOpen] = React.useState(false);
|
|
26
|
-
const lookup = config.menuItemLookup;
|
|
27
|
-
if (!lookup) return null;
|
|
28
|
-
const search = async (term) => term ? lookup.search(term) : await lookup.list?.() ?? lookup.search("");
|
|
29
|
-
return /* @__PURE__ */ jsxs("div", { className: "border-t pt-3", children: [
|
|
30
|
-
/* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "w-full", onClick: () => setOpen(true), children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Plus, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
32
|
-
" ",
|
|
33
|
-
t("orders.detail.addItem")
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
RecordPickerModal,
|
|
37
|
-
{
|
|
38
|
-
open,
|
|
39
|
-
onClose: () => setOpen(false),
|
|
40
|
-
title: t("orders.detail.addItem"),
|
|
41
|
-
placeholder: t("orders.detail.searchMenu"),
|
|
42
|
-
confirmLabel: t("orders.detail.addItem"),
|
|
43
|
-
search,
|
|
44
|
-
rowKey: (row) => row.id,
|
|
45
|
-
renderRow: (row) => ({
|
|
46
|
-
title: row.label,
|
|
47
|
-
subtitle: row.subtitle,
|
|
48
|
-
value: row.price != null ? money(row.price) : void 0
|
|
49
|
-
}),
|
|
50
|
-
onConfirm: (rows) => {
|
|
51
|
-
void (async () => {
|
|
52
|
-
for (const row of rows) {
|
|
53
|
-
await addOrderItem(orderId, {
|
|
54
|
-
productId: row.id,
|
|
55
|
-
name: row.label,
|
|
56
|
-
quantity: 1,
|
|
57
|
-
unitPrice: row.price ?? 0
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
onDone();
|
|
61
|
-
})();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
] });
|
|
66
|
-
}
|
|
67
|
-
function serviceOf(order) {
|
|
68
|
-
return order.kind === "dine_in" ? "salao" : "delivery";
|
|
69
|
-
}
|
|
70
|
-
var COLUMN_COLOR = {
|
|
71
|
-
new: "bg-violet-500",
|
|
72
|
-
confirmed: "bg-blue-500",
|
|
73
|
-
preparing: "bg-amber-500",
|
|
74
|
-
ready: "bg-emerald-500",
|
|
75
|
-
out: "bg-cyan-500",
|
|
76
|
-
completed: "bg-gray-400",
|
|
77
|
-
cancelled: "bg-red-500"
|
|
78
|
-
};
|
|
79
|
-
function labelOfColumn(id, service, t) {
|
|
80
|
-
if (service === "salao") {
|
|
81
|
-
if (id === "out") return t("orders.kanban.column.served");
|
|
82
|
-
if (id === "confirmed") {
|
|
83
|
-
const open = t("orders.kanban.column.open");
|
|
84
|
-
return open === "orders.kanban.column.open" ? t("orders.kanban.column.confirmed") : open;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return t(`orders.kanban.column.${id}`);
|
|
88
|
-
}
|
|
89
|
-
function timeAgo(dateStr) {
|
|
90
|
-
const diff = Math.floor((Date.now() - new Date(dateStr).getTime()) / 6e4);
|
|
91
|
-
if (diff < 1) return "agora";
|
|
92
|
-
if (diff === 1) return "1min";
|
|
93
|
-
return `${diff}min`;
|
|
94
|
-
}
|
|
95
|
-
function OrdersScreen() {
|
|
96
|
-
const t = useTranslation();
|
|
97
|
-
const config = useOrdersConfig();
|
|
98
|
-
const activeOrders = useOrdersStore((s) => s.activeOrders);
|
|
99
|
-
const loading = useOrdersStore((s) => s.activeOrdersLoading);
|
|
100
|
-
const fetchActiveOrders = useOrdersStore((s) => s.fetchActiveOrders);
|
|
101
|
-
const advanceOrderStatus = useOrdersStore((s) => s.advanceOrderStatus);
|
|
102
|
-
const selectOrder = useOrdersStore((s) => s.selectOrder);
|
|
103
|
-
const selectedOrderId = useOrdersStore((s) => s.selectedOrderId);
|
|
104
|
-
const cancelOrder = useOrdersStore((s) => s.cancelOrder);
|
|
105
|
-
React.useEffect(() => {
|
|
106
|
-
void fetchActiveOrders();
|
|
107
|
-
}, [fetchActiveOrders]);
|
|
108
|
-
const orderIds = React.useMemo(() => activeOrders.map((o) => o.id), [activeOrders]);
|
|
109
|
-
const { byOrder: paymentByOrder } = useOrdersPaymentStatus(orderIds);
|
|
110
|
-
const translated = t("orders.kanban.newOrder");
|
|
111
|
-
const createLabel = !translated || translated === "orders.kanban.newOrder" ? "Criar pedido" : translated;
|
|
112
|
-
const statusLabel = React.useCallback((status) => {
|
|
113
|
-
const key = `orders.kanban.column.${mapToKanbanColumn(status)}`;
|
|
114
|
-
const label = t(key);
|
|
115
|
-
return label === key ? status : label;
|
|
116
|
-
}, [t]);
|
|
117
|
-
const money = React.useCallback(
|
|
118
|
-
(value) => formatCurrency(value, config.currency),
|
|
119
|
-
[config.currency]
|
|
120
|
-
);
|
|
121
|
-
const columns = React.useMemo(() => [
|
|
122
|
-
{
|
|
123
|
-
key: "reference",
|
|
124
|
-
header: t("orders.list.column.order"),
|
|
125
|
-
render: (o) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: o.referenceNumber })
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
key: "customer",
|
|
129
|
-
header: t("orders.list.column.customer"),
|
|
130
|
-
render: (o) => o.partyName ?? o.tableName ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" })
|
|
131
|
-
},
|
|
132
|
-
// A lista responde "quanto" e nao respondia "recebido?" — que e a coluna
|
|
133
|
-
// que o caixa procura ao conferir o dia.
|
|
134
|
-
{
|
|
135
|
-
key: "payment",
|
|
136
|
-
header: "Recebimento",
|
|
137
|
-
render: (o) => {
|
|
138
|
-
const p = paymentByOrder.get(o.id);
|
|
139
|
-
if (!p || p.status === "none") return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
140
|
-
return /* @__PURE__ */ jsx(
|
|
141
|
-
PaymentStatusBadge,
|
|
142
|
-
{
|
|
143
|
-
status: p.status,
|
|
144
|
-
totalAmount: p.amount,
|
|
145
|
-
paidAmount: p.paid,
|
|
146
|
-
formatCurrency: money
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
// `Canal` is #324's orders.channel where the archetype already carries it;
|
|
152
|
-
// until the app's extension is migrated it is the order's `source`, which is
|
|
153
|
-
// the same fact under the old name.
|
|
154
|
-
orderChannelColumn((o) => o.channel ?? o.source),
|
|
155
|
-
{
|
|
156
|
-
key: "total",
|
|
157
|
-
header: t("orders.list.column.total"),
|
|
158
|
-
align: "right",
|
|
159
|
-
render: (o) => money(o.total)
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
key: "status",
|
|
163
|
-
header: t("orders.list.column.status"),
|
|
164
|
-
render: (o) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-sm", children: [
|
|
165
|
-
/* @__PURE__ */ jsx("span", { className: `h-2 w-2 rounded-full ${COLUMN_COLOR[mapToKanbanColumn(o.status)] ?? "bg-muted-foreground/40"}` }),
|
|
166
|
-
t(`orders.kanban.column.${mapToKanbanColumn(o.status)}`)
|
|
167
|
-
] })
|
|
168
|
-
}
|
|
169
|
-
], [t, money, paymentByOrder]);
|
|
170
|
-
const makeBoard = React.useCallback((service) => ({
|
|
171
|
-
// O salão não tem "Novo": ninguém aceita uma comanda. A entrega recebe um
|
|
172
|
-
// pedido de fora e a primeira decisão é confirmá-lo; no salão a comanda
|
|
173
|
-
// nasce do garçom que já a abriu, e a coluna Novo ficava vazia entre nove
|
|
174
|
-
// comandas confirmadas — uma coluna que só ocupa a largura das outras.
|
|
175
|
-
columns: (service === "salao" ? KANBAN_COLUMNS.filter((id) => id !== "new") : KANBAN_COLUMNS).map((id) => ({
|
|
176
|
-
id,
|
|
177
|
-
label: labelOfColumn(id, service, t),
|
|
178
|
-
color: COLUMN_COLOR[id]
|
|
179
|
-
})),
|
|
180
|
-
// The status is DERIVED from the document status plus the lines' execution
|
|
181
|
-
// state, and it is not stored. columnOf receives the already-derived value.
|
|
182
|
-
columnOf: (o) => {
|
|
183
|
-
if (serviceOf(o) !== service) return null;
|
|
184
|
-
const column = mapToKanbanColumn(o.status);
|
|
185
|
-
return service === "salao" && column === "new" ? "confirmed" : column;
|
|
186
|
-
},
|
|
187
|
-
canAdvance: (o) => getNextStatus(o.kind, o.status) !== null,
|
|
188
|
-
// O destino do cartão enquanto a escrita está no ar. O padrão do quadro é a
|
|
189
|
-
// próxima coluna DECLARADA, e aqui isso mentiria: o salão não tem a coluna
|
|
190
|
-
// Novo, então quem sai de Aberta iria parar em Preparando por engano de
|
|
191
|
-
// contagem. Quem sabe o próximo estado é o fluxo, e ele é daqui.
|
|
192
|
-
nextColumnOf: (o) => {
|
|
193
|
-
const next = getNextStatus(o.kind, o.status);
|
|
194
|
-
if (!next) return null;
|
|
195
|
-
const column = mapToKanbanColumn(next);
|
|
196
|
-
return service === "salao" && column === "new" ? "confirmed" : column;
|
|
197
|
-
},
|
|
198
|
-
onAdvance: (o) => advanceOrderStatus(o.id),
|
|
199
|
-
// O verbo do PASSO, não o do quadro. "Avançar" descreve o movimento no
|
|
200
|
-
// diagrama; quem está no salão confirma, prepara, serve ou despacha — e é
|
|
201
|
-
// essa palavra que decide o clique sem abrir o pedido. A chave por estado
|
|
202
|
-
// vem primeiro para o app traduzir; o `ADVANCE_VERB` é o padrão, e o
|
|
203
|
-
// "Avançar" antigo continua sendo o último recurso de um estado que nenhum
|
|
204
|
-
// dos dois nomeia.
|
|
205
|
-
advanceLabel: (o) => {
|
|
206
|
-
const next = getNextStatus(o.kind, o.status);
|
|
207
|
-
if (!next) return t("orders.kanban.advance");
|
|
208
|
-
const key = `orders.advance.${next}`;
|
|
209
|
-
const translated2 = t(key);
|
|
210
|
-
return translated2 !== key ? translated2 : ADVANCE_VERB[next] ?? t("orders.kanban.advance");
|
|
211
|
-
},
|
|
212
|
-
emptyColumn: t("orders.kanban.noOrders"),
|
|
213
|
-
card: (o) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
214
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
215
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-bold", children: o.referenceNumber }),
|
|
216
|
-
/* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium", children: t(`orders.source.${o.source}`) !== `orders.source.${o.source}` ? t(`orders.source.${o.source}`) : o.source })
|
|
217
|
-
] }),
|
|
218
|
-
o.partyName && /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: o.partyName }),
|
|
219
|
-
o.tableName && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: o.tableName }),
|
|
220
|
-
o.items.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-0.5", children: o.items.map((item) => /* @__PURE__ */ jsxs("p", { className: "truncate text-xs text-muted-foreground", children: [
|
|
221
|
-
item.quantity,
|
|
222
|
-
"x ",
|
|
223
|
-
item.name
|
|
224
|
-
] }, item.id)) }),
|
|
225
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between gap-2 border-t pt-2", children: [
|
|
226
|
-
/* @__PURE__ */ jsx(OrderAmount, { value: o.total, summary: paymentByOrder.get(o.id), formatCurrency: money }),
|
|
227
|
-
/* @__PURE__ */ jsxs("span", { className: "inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-foreground", children: [
|
|
228
|
-
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
229
|
-
timeAgo(o.createdAt)
|
|
230
|
-
] })
|
|
231
|
-
] })
|
|
232
|
-
] })
|
|
233
|
-
}), [t, money, advanceOrderStatus, paymentByOrder]);
|
|
234
|
-
const salaoBoard = React.useMemo(() => makeBoard("salao"), [makeBoard]);
|
|
235
|
-
const deliveryBoard = React.useMemo(() => makeBoard("delivery"), [makeBoard]);
|
|
236
|
-
const FloorPlan = getComponent(FLOOR_PLAN_COMPONENT_ID);
|
|
237
|
-
const showFloor = !!FloorPlan && config.floorView !== false;
|
|
238
|
-
const inspect = config.detailRail === "inspect";
|
|
239
|
-
const showDelivery = !config.deliveryRoute && config.modules.delivery !== false;
|
|
240
|
-
const isDelivery = config.pinnedView === "delivery";
|
|
241
|
-
const offeredViews = [
|
|
242
|
-
"list",
|
|
243
|
-
...config.boardView !== false ? ["quadro"] : [],
|
|
244
|
-
...showFloor ? ["salao"] : [],
|
|
245
|
-
...showDelivery ? ["delivery"] : []
|
|
246
|
-
];
|
|
247
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
248
|
-
/* @__PURE__ */ jsx(
|
|
249
|
-
OrderDetailRail,
|
|
250
|
-
{
|
|
251
|
-
orderId: selectedOrderId,
|
|
252
|
-
onClose: () => selectOrder(null),
|
|
253
|
-
fullPageHref: config.orderRoute,
|
|
254
|
-
onActionDone: () => {
|
|
255
|
-
void fetchActiveOrders();
|
|
256
|
-
},
|
|
257
|
-
children: inspect ? void 0 : (order, reload) => (
|
|
258
|
-
// Uma comanda fechada ou cancelada é decisão já tomada: nada mais entra
|
|
259
|
-
// nela. É a mesma regra que governa o botão de editar.
|
|
260
|
-
config.canEditOrder?.({ status: order.status }) === false ? null : /* @__PURE__ */ jsx(AddItemsBlock, { orderId: order.id, onDone: () => {
|
|
261
|
-
reload();
|
|
262
|
-
void fetchActiveOrders();
|
|
263
|
-
} })
|
|
264
|
-
),
|
|
265
|
-
actions: inspect ? void 0 : (order) => {
|
|
266
|
-
const verbs = [];
|
|
267
|
-
const row = activeOrders.find((o) => o.id === order.id);
|
|
268
|
-
const next = row ? getNextStatus(row.kind, row.status) : null;
|
|
269
|
-
if (next) {
|
|
270
|
-
verbs.push({
|
|
271
|
-
id: "advance",
|
|
272
|
-
label: `${t("orders.kanban.advance")} \xB7 ${statusLabel(next)}`,
|
|
273
|
-
variant: "default",
|
|
274
|
-
// The panel stays open and re-reads the order: advancing is usually
|
|
275
|
-
// done twice in a row, and it is the only way to see that the state
|
|
276
|
-
// you asked for is the state it now has.
|
|
277
|
-
keepOpen: true,
|
|
278
|
-
onSelect: (o) => advanceOrderStatus(o.id)
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
if (order.status && !["cancelled", "completed"].includes(order.status)) {
|
|
282
|
-
verbs.push({
|
|
283
|
-
id: "cancel",
|
|
284
|
-
label: t("orders.detail.cancel"),
|
|
285
|
-
variant: "destructive",
|
|
286
|
-
confirm: t("orders.detail.cancelConfirm").replace("{reference}", order.referenceNumber),
|
|
287
|
-
onSelect: (o) => cancelOrder(o.id)
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
return verbs;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
/* @__PURE__ */ jsx(
|
|
295
|
-
OrderListView,
|
|
296
|
-
{
|
|
297
|
-
title: t("orders.kanban.title"),
|
|
298
|
-
viewKey: config.pinnedView ? void 0 : "orders",
|
|
299
|
-
views: config.pinnedView ? [config.pinnedView] : offeredViews,
|
|
300
|
-
defaultView: config.pinnedView ?? "list",
|
|
301
|
-
boards: {
|
|
302
|
-
quadro: { label: "Quadro", config: salaoBoard, icon: LayoutGrid },
|
|
303
|
-
...showFloor && FloorPlan ? { salao: { label: "Sal\xE3o", render: () => /* @__PURE__ */ jsx(FloorPlan, {}), icon: MapPin } } : {},
|
|
304
|
-
...showDelivery || config.pinnedView === "delivery" ? { delivery: { label: "Delivery", config: deliveryBoard, icon: Bike } } : {}
|
|
305
|
-
},
|
|
306
|
-
columns,
|
|
307
|
-
rows: activeOrders,
|
|
308
|
-
loading,
|
|
309
|
-
empty: t("orders.kanban.noOrders"),
|
|
310
|
-
searchText: (o) => [o.referenceNumber, o.partyName, o.tableName, o.source].filter(Boolean).join(" "),
|
|
311
|
-
searchPlaceholder: t("orders.list.searchPlaceholder"),
|
|
312
|
-
pageSize: 25,
|
|
313
|
-
onRowClick: (o) => selectOrder(o.id),
|
|
314
|
-
selectedRowId: selectedOrderId,
|
|
315
|
-
actions: config.createRoute || isDelivery ? /* @__PURE__ */ jsx(
|
|
316
|
-
PageActions,
|
|
317
|
-
{
|
|
318
|
-
actions: [
|
|
319
|
-
// `utility`: a engrenagem é botão PRÓPRIO ao lado do "Novo Pedido",
|
|
320
|
-
// não item dentro do caret dele — a mesma forma que o Financeiro e o
|
|
321
|
-
// CRM usam (ModuleActionBar.settingsPath). Configurar não é uma
|
|
322
|
-
// maneira de criar pedido, e escondê-la sob o botão de criar era
|
|
323
|
-
// dizer que é.
|
|
324
|
-
...isDelivery ? [{
|
|
325
|
-
id: "delivery-settings",
|
|
326
|
-
label: t("orders.delivery.settings"),
|
|
327
|
-
icon: Settings,
|
|
328
|
-
intent: "utility",
|
|
329
|
-
testId: "delivery-settings",
|
|
330
|
-
onSelect: () => adminNavigateTo("/settings/orders-delivery")
|
|
331
|
-
}] : [],
|
|
332
|
-
...config.createRoute ? [{
|
|
333
|
-
id: "new-order",
|
|
334
|
-
label: createLabel,
|
|
335
|
-
icon: Plus,
|
|
336
|
-
intent: "primary",
|
|
337
|
-
creates: true,
|
|
338
|
-
testId: "orders-create",
|
|
339
|
-
onSelect: () => adminNavigateTo(config.createRoute)
|
|
340
|
-
}] : []
|
|
341
|
-
]
|
|
342
|
-
}
|
|
343
|
-
) : void 0
|
|
344
|
-
}
|
|
345
|
-
)
|
|
346
|
-
] });
|
|
347
|
-
}
|
|
348
|
-
function paymentOf(order) {
|
|
349
|
-
return order.metadata?.paymentStatus ?? "none";
|
|
350
|
-
}
|
|
351
|
-
var PAYMENT_LABEL = {
|
|
352
|
-
none: "Sem t\xEDtulo",
|
|
353
|
-
pending: "Em aberto",
|
|
354
|
-
partial: "Parcial",
|
|
355
|
-
paid: "Pago",
|
|
356
|
-
overdue: "Vencido",
|
|
357
|
-
cancelled: "Cancelado"
|
|
358
|
-
};
|
|
359
|
-
var PAYMENT_TONE = {
|
|
360
|
-
// "Sem título" is the one that has to catch the eye: it is the gap.
|
|
361
|
-
none: "bg-red-100 text-red-800",
|
|
362
|
-
pending: "bg-amber-100 text-amber-800",
|
|
363
|
-
partial: "bg-blue-100 text-blue-800",
|
|
364
|
-
paid: "bg-emerald-100 text-emerald-800",
|
|
365
|
-
overdue: "bg-red-100 text-red-800",
|
|
366
|
-
cancelled: "bg-gray-100 text-gray-700"
|
|
367
|
-
};
|
|
368
|
-
var STATUS_LABEL = {
|
|
369
|
-
draft: "Rascunho",
|
|
370
|
-
scheduled: "Agendado",
|
|
371
|
-
confirmed: "Confirmado",
|
|
372
|
-
in_progress: "Em andamento",
|
|
373
|
-
completed: "Conclu\xEDdo",
|
|
374
|
-
cancelled: "Cancelado",
|
|
375
|
-
no_show: "N\xE3o compareceu",
|
|
376
|
-
invoiced: "Faturado",
|
|
377
|
-
paid: "Pago",
|
|
378
|
-
open: "Aberto"
|
|
379
|
-
};
|
|
380
|
-
function CommercialOrdersScreen() {
|
|
381
|
-
const config = useOrdersConfig();
|
|
382
|
-
const orders = useOrdersStore((s) => s.orders);
|
|
383
|
-
const loading = useOrdersStore((s) => s.ordersLoading);
|
|
384
|
-
const fetchOrders = useOrdersStore((s) => s.fetchOrders);
|
|
385
|
-
const selectOrder = useOrdersStore((s) => s.selectOrder);
|
|
386
|
-
React.useEffect(() => {
|
|
387
|
-
void fetchOrders({ limit: 200, offset: 0 });
|
|
388
|
-
}, [fetchOrders]);
|
|
389
|
-
const money = React.useCallback(
|
|
390
|
-
(value) => formatCurrency(value, config.currency),
|
|
391
|
-
[config.currency]
|
|
392
|
-
);
|
|
393
|
-
const hasAssignee = React.useMemo(
|
|
394
|
-
() => (orders ?? []).some((o) => Boolean(o.assigneeName)),
|
|
395
|
-
[orders]
|
|
396
|
-
);
|
|
397
|
-
const columns = React.useMemo(() => [
|
|
398
|
-
{
|
|
399
|
-
key: "document",
|
|
400
|
-
header: "Documento",
|
|
401
|
-
render: (o) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: o.referenceNumber })
|
|
402
|
-
},
|
|
403
|
-
orderKindColumn((o) => o.kind),
|
|
404
|
-
{
|
|
405
|
-
key: "party",
|
|
406
|
-
header: "Cliente",
|
|
407
|
-
render: (o) => o.partyName ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" })
|
|
408
|
-
},
|
|
409
|
-
// Só quando ALGUÉM é: "Profissional" é vocabulário de salão, e num produto
|
|
410
|
-
// onde ninguém atende a venda (bilheteria, loja) a coluna existia para
|
|
411
|
-
// mostrar um traço em toda linha. Uma coluna que nunca tem valor não é uma
|
|
412
|
-
// informação faltando — é largura roubada das que têm.
|
|
413
|
-
...hasAssignee ? [{
|
|
414
|
-
key: "assignee",
|
|
415
|
-
header: "Profissional",
|
|
416
|
-
render: (o) => o.assigneeName ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" })
|
|
417
|
-
}] : [],
|
|
418
|
-
orderChannelColumn((o) => o.metadata?.channel),
|
|
419
|
-
{ key: "total", header: "Total", align: "right", render: (o) => money(o.total) },
|
|
420
|
-
{
|
|
421
|
-
key: "status",
|
|
422
|
-
header: "Estado",
|
|
423
|
-
render: (o) => STATUS_LABEL[o.status] ?? o.status
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
key: "invoice",
|
|
427
|
-
header: "T\xEDtulo",
|
|
428
|
-
render: (o) => {
|
|
429
|
-
const state = paymentOf(o);
|
|
430
|
-
return /* @__PURE__ */ jsx("span", { className: `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${PAYMENT_TONE[state]}`, children: PAYMENT_LABEL[state] });
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
], [money, hasAssignee]);
|
|
434
|
-
return /* @__PURE__ */ jsx(
|
|
435
|
-
OrderListView,
|
|
436
|
-
{
|
|
437
|
-
title: config.labels.pageTitle,
|
|
438
|
-
viewKey: "commercial-orders",
|
|
439
|
-
views: ["list", "board"],
|
|
440
|
-
defaultView: "list",
|
|
441
|
-
board: {
|
|
442
|
-
columns: [
|
|
443
|
-
{ id: "open", label: "Em aberto", color: "bg-blue-500" },
|
|
444
|
-
{ id: "no_invoice", label: "Sem t\xEDtulo", color: "bg-red-500" },
|
|
445
|
-
{ id: "paid", label: "Pago", color: "bg-emerald-500" },
|
|
446
|
-
{ id: "cancelled", label: "Cancelado", color: "bg-gray-400" }
|
|
447
|
-
],
|
|
448
|
-
columnOf: (o) => {
|
|
449
|
-
if (o.status === "cancelled") return "cancelled";
|
|
450
|
-
const state = paymentOf(o);
|
|
451
|
-
if (state === "paid") return "paid";
|
|
452
|
-
if (state === "none") return "no_invoice";
|
|
453
|
-
return "open";
|
|
454
|
-
},
|
|
455
|
-
emptyColumn: "Nada aqui",
|
|
456
|
-
card: (o) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
457
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
458
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-bold", children: o.referenceNumber }),
|
|
459
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: new Date(o.createdAt).toLocaleDateString("pt-BR") })
|
|
460
|
-
] }),
|
|
461
|
-
o.partyName && /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: o.partyName }),
|
|
462
|
-
o.assigneeName && /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: o.assigneeName }),
|
|
463
|
-
/* @__PURE__ */ jsx("div", { className: "mt-3 border-t pt-2 text-sm font-bold", children: money(o.total) })
|
|
464
|
-
] })
|
|
465
|
-
},
|
|
466
|
-
columns,
|
|
467
|
-
rows: orders,
|
|
468
|
-
loading,
|
|
469
|
-
empty: "Nenhum pedido ainda.",
|
|
470
|
-
searchText: (o) => [o.referenceNumber, o.partyName, o.assigneeName].filter(Boolean).join(" "),
|
|
471
|
-
searchPlaceholder: hasAssignee ? "Buscar por documento, cliente ou profissional\u2026" : "Buscar por documento ou cliente\u2026",
|
|
472
|
-
pageSize: 25,
|
|
473
|
-
onRowClick: (o) => selectOrder(o.id)
|
|
474
|
-
}
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
function OrdersPage({ config, provider, store, variant = "restaurant" }) {
|
|
478
|
-
return /* @__PURE__ */ jsx(OrdersContextProvider, { config, provider, store, children: variant === "commercial" ? /* @__PURE__ */ jsx(CommercialOrdersScreen, {}) : /* @__PURE__ */ jsx(OrdersScreen, {}) });
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
export { OrdersPage };
|
|
482
|
-
//# sourceMappingURL=OrdersPage-QV2YWARF.js.map
|
|
483
|
-
//# sourceMappingURL=OrdersPage-QV2YWARF.js.map
|