From ac702889b061e1850efb9ba2b09ce397459883cc Mon Sep 17 00:00:00 2001 From: mrevanzak Date: Mon, 4 Dec 2023 12:41:50 +0700 Subject: [PATCH] feat: verified order status --- apps/expo/src/app/(app)/order/[orderId].tsx | 72 ++++++++++++--------- apps/expo/src/app/(app)/order/index.tsx | 2 + packages/api/src/router/orders.ts | 25 ++----- packages/db/schema/log-orders.ts | 1 + packages/db/schema/orders.ts | 5 ++ 5 files changed, 53 insertions(+), 52 deletions(-) diff --git a/apps/expo/src/app/(app)/order/[orderId].tsx b/apps/expo/src/app/(app)/order/[orderId].tsx index e10ab7c..09743fc 100644 --- a/apps/expo/src/app/(app)/order/[orderId].tsx +++ b/apps/expo/src/app/(app)/order/[orderId].tsx @@ -4,6 +4,7 @@ import { AnimatedImage, BorderRadiuses, Button, + Colors, Spacings, Text, TouchableOpacity, @@ -56,29 +57,9 @@ export default function OrderDetailScreen() { }); const utils = api.useUtils(); - const confirmOrder = api.order.confirmOrder.useMutation(); - const onConfirmOrder = () => { - confirmOrder.mutate( - { - id: orderId as string, - }, - { - onSuccess: () => void utils.order.invalidate(), - }, - ); - }; - - const confirmDelivered = api.order.confirmDelivered.useMutation(); - const onConfirmDelivered = () => { - confirmDelivered.mutate( - { - id: orderId as string, - }, - { - onSuccess: () => void utils.order.invalidate(), - }, - ); - }; + const confirmOrder = api.order.confirmOrder.useMutation({ + onSuccess: () => void utils.order.invalidate(), + }); const getStatus = (status: z.infer) => { switch (status) { @@ -86,6 +67,8 @@ export default function OrderDetailScreen() { return "Pesanan dibuat"; case "payment": return "Pembayaran berhasil"; + case "verified": + return "Pembayaran diverifikasi"; case "confirmed": return "Pesanan dikonfirmasi"; case "shipped": @@ -98,15 +81,35 @@ export default function OrderDetailScreen() { }; const renderSellerAction = () => { - if (orders?.status === "payment") { + if (orders?.status === "verified") { return ( -