summaryrefslogtreecommitdiff
path: root/makima/frontend/src/routes/orders.tsx
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-03-09 16:53:49 +0000
committerGitHub <noreply@github.com>2026-03-09 16:53:49 +0000
commitafaae8aba719bf74404a64b57426ecc6a7e70775 (patch)
tree81c17946d8f0347c7cebf83ecd731d205983cfc7 /makima/frontend/src/routes/orders.tsx
parentef643072234477685614ed281e34ef77e45caad4 (diff)
parente11e7225861c3063f08461ac01005f3315d41be5 (diff)
downloadsoryu-afaae8aba719bf74404a64b57426ecc6a7e70775.tar.gz
soryu-afaae8aba719bf74404a64b57426ecc6a7e70775.zip
Merge pull request #87 from soryu-co/makima/directive-soryu-co-soryu---makima-19fd3e1d-v1772943648
feat: compact order header & add context menus to orders/directives
Diffstat (limited to 'makima/frontend/src/routes/orders.tsx')
-rw-r--r--makima/frontend/src/routes/orders.tsx30
1 files changed, 29 insertions, 1 deletions
diff --git a/makima/frontend/src/routes/orders.tsx b/makima/frontend/src/routes/orders.tsx
index 06e091a..cc1e1ad 100644
--- a/makima/frontend/src/routes/orders.tsx
+++ b/makima/frontend/src/routes/orders.tsx
@@ -7,7 +7,8 @@ import { useOrders, useOrder } from "../hooks/useOrders";
import { useDirectives } from "../hooks/useDirectives";
import { useDogs } from "../hooks/useDogs";
import { useAuth } from "../contexts/AuthContext";
-import type { OrderStatus, OrderType, OrderPriority } from "../lib/api";
+import { updateOrder, deleteOrder } from "../lib/api";
+import type { Order, OrderStatus, OrderType, OrderPriority } from "../lib/api";
export default function OrdersPage() {
const { isAuthenticated, isAuthConfigured, isLoading: authLoading } = useAuth();
@@ -94,6 +95,30 @@ export default function OrdersPage() {
await refreshList();
};
+ const handleContextChangeStatus = async (order: Order, status: OrderStatus) => {
+ try {
+ await updateOrder(order.id, { status });
+ await refreshList();
+ } catch (e) {
+ console.error("Failed to change status:", e);
+ }
+ };
+
+ const handleContextDelete = async (order: Order) => {
+ if (!window.confirm("Delete this order?")) return;
+ try {
+ await deleteOrder(order.id);
+ if (order.id === selectedId) navigate("/orders");
+ await refreshList();
+ } catch (e) {
+ console.error("Failed to delete:", e);
+ }
+ };
+
+ const handleContextGoToDirective = (order: Order) => {
+ if (order.directiveId) navigate("/directives/" + order.directiveId);
+ };
+
const priorityOptions: { value: OrderPriority; label: string }[] = [
{ value: "critical", label: "Critical" },
{ value: "high", label: "High" },
@@ -125,6 +150,9 @@ export default function OrdersPage() {
onStatusFilter={setStatusFilter}
typeFilter={typeFilter}
onTypeFilter={setTypeFilter}
+ onChangeStatus={handleContextChangeStatus}
+ onDelete={handleContextDelete}
+ onGoToDirective={handleContextGoToDirective}
/>
</div>