summaryrefslogtreecommitdiff
path: root/makima/frontend/src/routes
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-03-08 04:21:06 +0000
committersoryu <soryu@soryu.co>2026-03-08 04:21:06 +0000
commit1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3 (patch)
treeb9128fdc605ca1a2a1bb872c372383fe4a18523c /makima/frontend/src/routes
parent5739f1064059c9e33730a1238944f7f140b5b7b1 (diff)
parent90007a8359cf50923d55734bb8d4325307c75461 (diff)
downloadsoryu-1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3.tar.gz
soryu-1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3.zip
Merge remote-tracking branch 'origin/makima/soryu-co-soryu---makima--add-right-click-context-m-f42926a8' into makima/directive-soryu-co-soryu---makima-19fd3e1d-v1772943648
Diffstat (limited to 'makima/frontend/src/routes')
-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 aa14e68..5744bdd 100644
--- a/makima/frontend/src/routes/orders.tsx
+++ b/makima/frontend/src/routes/orders.tsx
@@ -6,7 +6,8 @@ import { OrderDetail } from "../components/orders/OrderDetail";
import { useOrders, useOrder } from "../hooks/useOrders";
import { useDirectives } from "../hooks/useDirectives";
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();
@@ -92,6 +93,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" },
@@ -123,6 +148,9 @@ export default function OrdersPage() {
onStatusFilter={setStatusFilter}
typeFilter={typeFilter}
onTypeFilter={setTypeFilter}
+ onChangeStatus={handleContextChangeStatus}
+ onDelete={handleContextDelete}
+ onGoToDirective={handleContextGoToDirective}
/>
</div>