diff --git a/apps/admin-ui/components/OrderOptionsMenu.tsx b/apps/admin-ui/components/OrderOptionsMenu.tsx index 424b48e..d771738 100644 --- a/apps/admin-ui/components/OrderOptionsMenu.tsx +++ b/apps/admin-ui/components/OrderOptionsMenu.tsx @@ -103,6 +103,18 @@ export function OrderOptionsMenu({ } }; + const handleOpenInMaps = () => { + if (order.latitude && order.longitude) { + const url = `https://www.google.com/maps/search/?api=1&query=${order.latitude},${order.longitude}`; + Linking.openURL(url); + } else { + Alert.alert('No location coordinates available'); + } + }; + + const hasCoordinates = order.latitude !== null && order.latitude !== undefined && + order.longitude !== null && order.longitude !== undefined; + return ( @@ -257,6 +269,29 @@ export function OrderOptionsMenu({ + {hasCoordinates && ( + { + handleOpenInMaps(); + onClose(); + }} + > + + + + + + Open in Maps + + + View delivery location on Google Maps + + + + + )} + { diff --git a/apps/backend/src/trpc/apis/admin-apis/apis/order.ts b/apps/backend/src/trpc/apis/admin-apis/apis/order.ts index 875018e..707f642 100644 --- a/apps/backend/src/trpc/apis/admin-apis/apis/order.ts +++ b/apps/backend/src/trpc/apis/admin-apis/apis/order.ts @@ -10,6 +10,8 @@ import { refunds, coupons, couponUsage, + complaints, + payments, } from "@/src/db/schema"; import { eq, and, gte, lt, desc, SQL, inArray } from "drizzle-orm"; import dayjs from "dayjs"; @@ -1001,3 +1003,16 @@ export const orderRouter = router({ // {"id": "order_Rhh00qJNdjUp8o", "notes": {"retry": "true", "customerOrderId": "14"}, "amount": 21000, "entity": "order", "status": "created", "receipt": "order_14_retry", "attempts": 0, "currency": "INR", "offer_id": null, "signature": "6df20655021f1d6841340f2a2ef2ef9378cb3d43495ab09e85f08aea1a851583", "amount_due": 21000, "created_at": 1763575791, "payment_id": "pay_Rhh15cLL28YM7j", "amount_paid": 0} type RefundStatus = "success" | "pending" | "failed" | "none" | "na"; + +export async function deleteOrderById(orderId: number): Promise { + await db.transaction(async (tx) => { + await tx.delete(orderItems).where(eq(orderItems.orderId, orderId)); + await tx.delete(orderStatus).where(eq(orderStatus.orderId, orderId)); + await tx.delete(payments).where(eq(payments.orderId, orderId)); + await tx.delete(refunds).where(eq(refunds.orderId, orderId)); + await tx.delete(couponUsage).where(eq(couponUsage.orderId, orderId)); + await tx.delete(complaints).where(eq(complaints.orderId, orderId)); + await tx.delete(orders).where(eq(orders.id, orderId)); + }); +} + diff --git a/apps/info-site/public/logo.png b/apps/info-site/public/logo.png new file mode 100644 index 0000000..806f530 Binary files /dev/null and b/apps/info-site/public/logo.png differ