Skip to content

Commit 661740b

Browse files
OBLS-308 Frontend for Pick up allocation (#347)
* OBLS-308 init pick up allocation * OBLS-308 distinguish picked lines * OBLS-308 copilot review * OBLS-308 add stock pick modal * Connecting PUA screens with REST API * OBLS-308 Handled manual allocation, grouped bins by display and locations, code refactor * OBLS-308 Adjusted pick stock modal to handle allocation quantity and statuses * OBLS-308 Adjusted to the latest backend changes * OBLS-308 Dislaying error from backend in alert * OBLS-308 Changed button labels * OBLS-308 Changed label in alert title --------- Co-authored-by: druchniewicz <druchniewicz@soldevelo.com>
1 parent a258f31 commit 661740b

File tree

10 files changed

+882
-8
lines changed

10 files changed

+882
-8
lines changed

src/Main.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SafeAreaView } from 'react-native';
77
import { Provider } from 'react-native-paper';
88
import SplashScreen from 'react-native-splash-screen';
99
import { connect } from 'react-redux';
10+
1011
import FullScreenLoadingIndicator from './components/FullScreenLoadingIndicator';
1112
import showPopup from './components/Popup';
1213
import { appConfig } from './constants';
@@ -35,6 +36,8 @@ import OutboundStockDetails from './screens/OutboundStockDetails';
3536
import OutboundStockList from './screens/OutboundStockList';
3637
import PackingLocationPage from './screens/PackingLocationPage';
3738
import PickOrderItem from './screens/PickList';
39+
import { PickUpEntryScreen } from './screens/PickUpAllocation/PickUpEntryScreen';
40+
import { PickUpOrderScreen } from './screens/PickUpAllocation/PickUpOrderScreen';
3841
import Placeholder from './screens/Placeholder';
3942
import ProductDetails from './screens/ProductDetails';
4043
import Products from './screens/Products';
@@ -47,15 +50,9 @@ import PutawayList from './screens/PutawayList';
4750
import Scan from './screens/Scan';
4851
import Settings from './screens/Settings';
4952
import ShipItemDetails from './screens/ShipItemDetails';
53+
import SortationContainerScreen from './screens/Sortation/SortationContainerScreen';
5054
import SortationEntryScreen from './screens/Sortation/SortationEntryScreen';
5155
import SortationQuantityScreen from './screens/Sortation/SortationQuantityScreen';
52-
import Transfer from './screens/Transfer';
53-
import Transfers from './screens/Transfers';
54-
import TransferDetails from './screens/TransfersDetails';
55-
import ViewAvailableItem from './screens/ViewAvailableItem';
56-
import ApiClient from './utils/ApiClient';
57-
import Theme from './utils/Theme';
58-
import SortationContainerScreen from './screens/Sortation/SortationContainerScreen';
5956
import SortationTaskSelectionListScreen from './screens/Sortation/SortationTaskSelectionListScreen';
6057
import PutawayEntryScreen from './screens/SortationPutaway/PutawayEntryScreen';
6158
import PutawayLocationScanScreen from './screens/SortationPutaway/PutawayLocationScanScreen';
@@ -71,6 +68,12 @@ import PickingPickStagingLocationScreen from './screens/Picking/PickingPickStagi
7168
import PickingMoveToStagingScreen from './screens/Picking/PickingMoveToStaging';
7269
import PickingStagingDropScreen from './screens/Picking/PickingStagingDrop';
7370
import { PickingProvider } from './screens/Picking/PickingContext';
71+
import Transfer from './screens/Transfer';
72+
import Transfers from './screens/Transfers';
73+
import TransferDetails from './screens/TransfersDetails';
74+
import ViewAvailableItem from './screens/ViewAvailableItem';
75+
import ApiClient from './utils/ApiClient';
76+
import Theme from './utils/Theme';
7477

7578
const Stack = createStackNavigator();
7679
export interface OwnProps {
@@ -350,6 +353,16 @@ class Main extends Component<Props, State> {
350353
component={PickingStagingDropScreen}
351354
options={{ title: 'Staging Location Drop' }}
352355
/>
356+
<Stack.Screen
357+
name="PickUpEntryScreen"
358+
component={PickUpEntryScreen}
359+
options={{ title: 'Pick Up Allocation' }}
360+
/>
361+
<Stack.Screen
362+
name="PickUpOrderScreen"
363+
component={PickUpOrderScreen}
364+
options={{ title: 'Pick Up Allocation' }}
365+
/>
353366
</Stack.Navigator>
354367
</NavigationContainer>
355368
</SafeAreaView>

src/apis/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export * from './lpn';
1010
export * from './transfers';
1111
export * from './others';
1212
export * from './picking';
13+
export * from './pua';

src/apis/pua.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import apiClient from '../utils/ApiClient';
2+
3+
export function getOutboundOrders() {
4+
let url =
5+
'/stockMovements?exclude=lineItems&direction=OUTBOUND&requisitionStatusCode=VERIFYING' +
6+
'&sort=dateCreated&order=asc&deliveryTypeCode=PICK_UP';
7+
if (global.location) {
8+
url += '&origin=' + global.location.id;
9+
}
10+
11+
return apiClient.get(url);
12+
}
13+
14+
export function getOutboundOrderDetails(id: string) {
15+
return apiClient.get(`/outbound-orders/${id}`);
16+
}
17+
18+
export function allocate(orderId: string, lineItemId: string, payload: any) {
19+
return apiClient.post(`/outbound-orders/${orderId}/items/${lineItemId}/allocations`, payload);
20+
}
21+
22+
export function updateOrderStatus(orderId: string, status: string) {
23+
return apiClient.post(`/stockMovements/${orderId}/status`, { status });
24+
}

src/data/location/Location.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface Location {
1818
hasPartialReceivingSupport: boolean;
1919
locationType: LocationType;
2020
locationNumber: string;
21+
isDisplay: boolean;
2122
}
2223

2324
export default Location;

src/screens/Dashboard/dashboardData.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ const dashboardEntries: DashboardEntry[] = [
4545
navigationScreenName: 'Orders',
4646
defaultVisible: false
4747
},
48+
{
49+
key: 'pickUpAllocation',
50+
screenName: 'Pick-Up Allocation',
51+
entryDescription: 'Manage pick-up allocations and tasks',
52+
icon: IconPicking,
53+
navigationScreenName: 'PickUpEntryScreen'
54+
},
4855
{
4956
key: 'packing',
5057
screenName: 'Packing',
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import React, { useCallback, useEffect, useState } from 'react';
2+
import { Alert, FlatList, TouchableOpacity, View } from 'react-native';
3+
import { Caption, Card, Chip, Divider, Paragraph, Title } from 'react-native-paper';
4+
5+
import { navigate } from '../../NavigationService';
6+
import styles from './styles';
7+
import { AllocationOrder } from './types';
8+
import { getOutboundOrders } from '../../apis/pua';
9+
import { useFocusEffect } from '@react-navigation/native';
10+
11+
export function PickUpEntryScreen() {
12+
const [orders, setOrders] = useState<any[]>([]);
13+
const [isLoading, setIsLoading] = useState<boolean>(false);
14+
15+
const fetchOrders = async () => {
16+
try {
17+
setIsLoading(true);
18+
const response = await getOutboundOrders();
19+
setOrders(response.data || []);
20+
} catch (error) {
21+
Alert.alert('Error', 'Failed to fetch orders data');
22+
} finally {
23+
setIsLoading(false);
24+
}
25+
};
26+
27+
// useFocusEffect usedto refresh when screen is focused after nagivation
28+
useFocusEffect(
29+
useCallback(() => {
30+
fetchOrders();
31+
}, [])
32+
);
33+
34+
return (
35+
<View style={styles.screenContainer}>
36+
<Title style={styles.titleText}>Outstanding Orders ({orders.length})</Title>
37+
<Paragraph style={styles.subtitleText}>
38+
Select an order from the list to start the pick-up allocation process.
39+
</Paragraph>
40+
41+
<Divider style={styles.sectionDivider} />
42+
43+
<FlatList
44+
data={orders}
45+
renderItem={({ item }) => <PickUpCard order={item} />}
46+
keyExtractor={(item: AllocationOrder) => item.id}
47+
numColumns={1}
48+
ItemSeparatorComponent={() => <View style={styles.itemSeparator} />}
49+
refreshing={isLoading}
50+
onRefresh={fetchOrders}
51+
/>
52+
</View>
53+
);
54+
}
55+
56+
function PickUpCard({ order }: { order: AllocationOrder }) {
57+
const onPress = () => navigate('PickUpOrderScreen', { orderId: order.id });
58+
59+
return (
60+
<TouchableOpacity activeOpacity={0.85} style={styles.cardTouchable} onPress={onPress}>
61+
<Card style={styles.card}>
62+
<Card.Content>
63+
<View style={styles.cardHeader}>
64+
<Chip icon="identifier" textStyle={styles.chipText} style={styles.chip}>
65+
{order.identifier}
66+
</Chip>
67+
<Chip icon="package" textStyle={styles.chipText} style={styles.chip}>
68+
{`Lines: ${order.lineItemCount}`}
69+
</Chip>
70+
</View>
71+
72+
<Divider style={styles.cardDivider} />
73+
74+
<Title>{order.name}</Title>
75+
<Caption>
76+
{`Order Date: ${new Date(order.dateTimeCreated).toLocaleDateString('en-US', {
77+
year: 'numeric',
78+
month: 'short',
79+
day: '2-digit',
80+
hour: '2-digit',
81+
minute: '2-digit'
82+
})}`}
83+
</Caption>
84+
</Card.Content>
85+
</Card>
86+
</TouchableOpacity>
87+
);
88+
}

0 commit comments

Comments
 (0)