enh
This commit is contained in:
parent
31f011ba8c
commit
b812992419
21 changed files with 74 additions and 65 deletions
6
apps/admin-ui/.expo/types/router.d.ts
vendored
6
apps/admin-ui/.expo/types/router.d.ts
vendored
File diff suppressed because one or more lines are too long
|
|
@ -202,8 +202,6 @@ export default function Layout() {
|
|||
<Drawer.Screen name="products" options={{ title: "Products" }} />
|
||||
<Drawer.Screen name="prices-overview" options={{ title: "Prices Overview" }} />
|
||||
<Drawer.Screen name="product-groupings" options={{ title: "Product Groupings" }} />
|
||||
<Drawer.Screen name="create-product-group" options={{ title: "Create Product Group" }} />
|
||||
<Drawer.Screen name="edit-product-group/[id]" options={{ title: "Edit Product Group" }} />
|
||||
|
||||
|
||||
<Drawer.Screen
|
||||
|
|
@ -214,12 +212,10 @@ export default function Layout() {
|
|||
<Drawer.Screen name="coupons" options={{ title: "Coupons" }} />
|
||||
<Drawer.Screen name="slots" options={{ title: "Slots" }} />
|
||||
<Drawer.Screen name="vendor-snippets" options={{ title: "Vendor Snippets" }} />
|
||||
<Drawer.Screen name="delivery-sequences" options={{ title: "Delivery Sequences", headerShown: false }} />
|
||||
<Drawer.Screen name="stores" options={{ title: "Stores" }} />
|
||||
<Drawer.Screen name="address-management" options={{ title: "Address Management" }} />
|
||||
<Drawer.Screen name="product-tags" options={{ title: "Product Tags" }} />
|
||||
<Drawer.Screen name="order-details/[id]" options={{ title: "Order Details" }} />
|
||||
<Drawer.Screen name="orders" options={{ title: "Orders" }} />
|
||||
<Drawer.Screen name="rebalance-orders" options={{ title: "Rebalance Orders" }} />
|
||||
</Drawer>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ export default function Layout() {
|
|||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Dashboard Banners' }} />
|
||||
<Stack.Screen name="create-banner" options={{ title: 'Create Banner' }} />
|
||||
<Stack.Screen name="edit-banner" options={{ title: 'Edit Banner' }} />
|
||||
<Stack.Screen name="create" options={{ title: 'Create Banner' }} />
|
||||
<Stack.Screen name="edit/[id]" options={{ title: 'Edit Banner' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import { Stack } from 'expo-router';
|
||||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Create Banner' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|||
import { useRouter } from 'expo-router';
|
||||
import { FormikHelpers } from 'formik';
|
||||
import BannerForm, { BannerFormData } from '@/components/BannerForm';
|
||||
import { trpc } from '../../../../src/trpc-client';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
|
||||
export default function CreateBanner() {
|
||||
const router = useRouter();
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import { Stack } from 'expo-router';
|
||||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="[id]" options={{ title: 'Edit Banner' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|||
import { useRouter, useLocalSearchParams } from 'expo-router';
|
||||
import { FormikHelpers } from 'formik';
|
||||
import BannerForm, { BannerFormData } from '@/components/BannerForm';
|
||||
import { trpc } from '../../../../src/trpc-client';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
|
||||
interface Banner {
|
||||
id: number;
|
||||
|
|
@ -180,7 +180,7 @@ export default function DashboardBanners() {
|
|||
};
|
||||
|
||||
const handleEdit = (banner: Banner) => {
|
||||
router.push(`/dashboard-banners/edit-banner/${banner.id}` as any);
|
||||
router.push(`/dashboard-banners/edit/${banner.id}` as any);
|
||||
};
|
||||
|
||||
const handleDelete = (id: number) => {
|
||||
|
|
@ -207,7 +207,7 @@ export default function DashboardBanners() {
|
|||
};
|
||||
|
||||
const handleCreate = () => {
|
||||
router.push('/(drawer)/dashboard-banners/create-banner' as any);
|
||||
router.push('/dashboard-banners/create' as any);
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { MyText, tw } from 'common-ui';
|
|||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { theme } from 'common-ui/src/theme';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
import { useNavigationTarget } from 'common-ui/hooks/useNavigationTarget';
|
||||
|
||||
interface MenuItem {
|
||||
title: string;
|
||||
|
|
@ -16,6 +17,7 @@ interface MenuItem {
|
|||
iconColor?: string;
|
||||
iconBg?: string;
|
||||
badgeCount?: number;
|
||||
onPress?: () => void;
|
||||
}
|
||||
|
||||
interface MenuItemComponentProps {
|
||||
|
|
@ -28,7 +30,7 @@ const MenuItemComponent: React.FC<MenuItemComponentProps> = ({ item, router }) =
|
|||
return (
|
||||
<Pressable
|
||||
key={item.route}
|
||||
onPress={() => router.push(item.route as any)}
|
||||
onPress={() => item.onPress ? item.onPress() : router.push(item.route as any)}
|
||||
style={({ pressed }) => [
|
||||
tw`flex-row items-center p-4 bg-white border border-gray-100 rounded-xl mb-3 shadow-sm`,
|
||||
pressed && tw`bg-gray-50`,
|
||||
|
|
@ -55,28 +57,41 @@ const MenuItemComponent: React.FC<MenuItemComponentProps> = ({ item, router }) =
|
|||
|
||||
export default function Dashboard() {
|
||||
const router = useRouter();
|
||||
const { setNavigationTarget } = useNavigationTarget();
|
||||
|
||||
const { data: essentialsData } = trpc.admin.user.getEssentials.useQuery();
|
||||
|
||||
|
||||
const handleManageOrdersPress = () => {
|
||||
setNavigationTarget('/manage-orders/orders');
|
||||
router.push('/(drawer)/manage-orders');
|
||||
};
|
||||
|
||||
const handleDeliverySequencesPress = () => {
|
||||
setNavigationTarget('/manage-orders/delivery-sequences');
|
||||
router.push('/(drawer)/manage-orders');
|
||||
};
|
||||
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
title: 'Manage Orders',
|
||||
icon: 'shopping-bag',
|
||||
description: 'View and manage customer orders',
|
||||
route: '/(drawer)/orders',
|
||||
route: '/(drawer)/manage-orders',
|
||||
category: 'orders',
|
||||
iconColor: '#10B981',
|
||||
iconBg: '#D1FAE5',
|
||||
onPress: handleManageOrdersPress,
|
||||
},
|
||||
{
|
||||
title: 'Delivery Sequences',
|
||||
icon: 'alt-route',
|
||||
description: 'Plan and optimize delivery routes',
|
||||
route: '/(drawer)/delivery-sequences',
|
||||
route: '/manage-orders/delivery-sequences',
|
||||
category: 'orders',
|
||||
iconColor: '#8B5CF6',
|
||||
iconBg: '#EDE9FE',
|
||||
onPress: handleDeliverySequencesPress,
|
||||
},
|
||||
{
|
||||
title: 'Delivery Slots',
|
||||
|
|
@ -212,7 +227,7 @@ export default function Dashboard() {
|
|||
{quickActions.map((item) => (
|
||||
<Pressable
|
||||
key={item.route}
|
||||
onPress={() => router.push(item.route as any)}
|
||||
onPress={() => item.onPress ? item.onPress() : router.push(item.route as any)}
|
||||
style={({ pressed }) => [
|
||||
tw`bg-white rounded-xl p-3 shadow-sm border border-gray-100 items-center`,
|
||||
{ width: 'calc(25% - 9px)' },
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ export default function Layout() {
|
|||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Manage Orders' }} />
|
||||
<Stack.Screen name="delivery-sequences" options={{ title: 'Delivery Sequences' }} />
|
||||
<Stack.Screen name="orders" options={{ title: 'Orders' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@ import { Stack } from 'expo-router';
|
|||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Delivery Sequences' }} />
|
||||
<Stack>
|
||||
<Stack.Screen name="index" options={{ title: 'Delivery Sequences', headerShown: true }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ export default function DeliverySequences() {
|
|||
// Auto-select first slot if no slotId provided
|
||||
useEffect(() => {
|
||||
if (!slotId && slotsData?.slots && slotsData.slots.length > 0) {
|
||||
router.replace(`/delivery-sequences?slotId=${slotsData.slots[0].id}`);
|
||||
router.replace(`/manage-orders/delivery-sequences?slotId=${slotsData.slots[0].id}`);
|
||||
}
|
||||
}, [slotId, slotsData, router]);
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ export default function DeliverySequences() {
|
|||
value={selectedSlotId || ""}
|
||||
onValueChange={(val) => {
|
||||
if (val) {
|
||||
router.replace(`/delivery-sequences?slotId=${val}`);
|
||||
router.replace(`/manage-orders/delivery-sequences?slotId=${val}`);
|
||||
}
|
||||
}}
|
||||
placeholder="Select slot"
|
||||
|
|
@ -1,16 +1,28 @@
|
|||
import { View, TouchableOpacity, Alert } from 'react-native';
|
||||
import { MyText, BottomDropdown, tw, MyFlatList, useMarkDataFetchers } from 'common-ui';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { useFocusEffect } from '@react-navigation/native';
|
||||
import dayjs from 'dayjs';
|
||||
import { useState } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
import { useNavigationTarget } from 'common-ui/hooks/useNavigationTarget';
|
||||
|
||||
export default function ManageOrders() {
|
||||
const router = useRouter();
|
||||
const { getNavigationTarget } = useNavigationTarget();
|
||||
const [selectedSlotId, setSelectedSlotId] = useState<string | null>(null);
|
||||
const { data: slotsData, refetch } = trpc.admin.slots.getAll.useQuery();
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
const target = getNavigationTarget();
|
||||
if (target) {
|
||||
router.replace(target as any);
|
||||
}
|
||||
}, [router, getNavigationTarget])
|
||||
);
|
||||
|
||||
useMarkDataFetchers(() => {
|
||||
refetch();
|
||||
});
|
||||
|
|
@ -34,7 +46,7 @@ export default function ManageOrders() {
|
|||
Alert.alert('Flash Deliveries', 'Flash deliveries do not have delivery sequences. Use the Orders menu to manage flash deliveries.');
|
||||
return;
|
||||
}
|
||||
router.push(`/(drawer)/delivery-sequences?slotId=${selectedSlotId}`);
|
||||
router.push(`/manage-orders/delivery-sequences?slotId=${selectedSlotId}`);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -43,9 +55,9 @@ export default function ManageOrders() {
|
|||
color: 'bg-cyan-500',
|
||||
onPress: () => {
|
||||
if (selectedSlotId === 'flash') {
|
||||
router.push('/(drawer)/orders?filter=flash');
|
||||
router.push('/manage-orders/orders?filter=flash');
|
||||
} else {
|
||||
router.push('/(drawer)/orders');
|
||||
router.push('/manage-orders/orders');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
import { Stack } from 'expo-router';
|
||||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<Stack>
|
||||
<Stack.Screen name="index" options={{ title: 'Orders', headerShown: true }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState , useEffect } from 'react';
|
||||
import { View, TouchableOpacity, Alert, TextInput, ActivityIndicator, Linking } from 'react-native';
|
||||
import { AppContainer, MyText, tw, MyFlatList, BottomDialog, BottomDropdown, Checkbox, theme, MyTextInput } from 'common-ui';
|
||||
import { trpc } from '../../../src/trpc-client';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
import { useRouter, useLocalSearchParams } from 'expo-router';
|
||||
import dayjs from 'dayjs';
|
||||
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import { Stack } from 'expo-router';
|
||||
|
||||
export default function Layout() {
|
||||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Orders' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ export default function Layout() {
|
|||
return (
|
||||
<Stack screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="index" options={{ title: 'Product Groupings' }} />
|
||||
<Stack.Screen name="create" options={{ title: 'Create Product Group' }} />
|
||||
<Stack.Screen name="edit/[id]" options={{ title: 'Edit Product Group' }} />
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { AppContainer } from 'common-ui';
|
||||
import ProductGroupForm from '../../components/ProductGroupForm';
|
||||
import ProductGroupForm from '../../../components/ProductGroupForm';
|
||||
import { useRouter } from 'expo-router';
|
||||
|
||||
export default function CreateProductGroup() {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { AppContainer, MyText } from 'common-ui';
|
||||
import ProductGroupForm from '../../../components/ProductGroupForm';
|
||||
import ProductGroupForm from '../../../../components/ProductGroupForm';
|
||||
import { useRouter, useLocalSearchParams } from 'expo-router';
|
||||
import { trpc } from '../../../src/trpc-client';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
|
||||
export default function EditProductGroup() {
|
||||
const router = useRouter();
|
||||
|
|
@ -143,11 +143,11 @@ export default function ProductGroupings() {
|
|||
});
|
||||
|
||||
const handleCreate = () => {
|
||||
router.push("/(drawer)/create-product-group");
|
||||
router.push("/product-groupings/create");
|
||||
};
|
||||
|
||||
const handleEdit = (group: ProductGroup) => {
|
||||
router.push(`/(drawer)/edit-product-group/${group.id}`);
|
||||
router.push(`/product-groupings/edit/${group.id}`);
|
||||
};
|
||||
|
||||
const handleDelete = (id: number) => {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ export default function SlotDetails() {
|
|||
|
||||
{/* FAB for Edit Slot */}
|
||||
<MyTouchableOpacity
|
||||
onPress={() => router.push(`/edit-slot/${slot.id}` as any)}
|
||||
onPress={() => router.push(`/slots/edit/${slot.id}` as any)}
|
||||
activeOpacity={0.95}
|
||||
style={{ position: 'absolute', bottom: 32, right: 24, zIndex: 100 }}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue