ordering-ui-react-native 0.12.8 → 0.12.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/assets/images/business_list_banner.jpg +0 -0
- package/src/components/Account/index.tsx +2 -2
- package/src/config.json +2 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
- package/themes/business/src/components/OrdersOption/index.tsx +30 -23
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +7 -0
- package/themes/original/src/components/BusinessesListing/styles.tsx +6 -1
- package/themes/original/src/components/OrderProgress/index.tsx +208 -0
- package/themes/original/src/components/OrderProgress/styles.tsx +30 -0
- package/themes/original/src/components/ProductForm/index.tsx +159 -56
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/single-business/src/components/ActiveOrders/index.tsx +20 -19
- package/themes/single-business/src/components/BusinessProductsListing/index.tsx +4 -4
- package/themes/single-business/src/components/Cart/index.tsx +39 -47
- package/themes/single-business/src/components/Cart/styles.tsx +1 -0
- package/themes/single-business/src/components/LoginForm/index.tsx +147 -89
- package/themes/single-business/src/components/LoginForm/styles.tsx +33 -28
- package/themes/single-business/src/components/OrderDetails/index.tsx +32 -12
- package/themes/single-business/src/components/OrdersOption/index.tsx +50 -50
- package/themes/single-business/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/single-business/src/components/PreviousOrders/index.tsx +97 -83
- package/themes/single-business/src/components/PromotionCard/index.tsx +10 -2
- package/themes/single-business/src/components/Promotions/index.tsx +1 -1
- package/themes/single-business/src/components/ReviewOrder/index.tsx +299 -274
- package/themes/single-business/src/components/ReviewOrder/styles.tsx +23 -26
- package/themes/single-business/src/components/UpsellingProducts/index.tsx +230 -189
- package/themes/single-business/src/components/UpsellingProducts/styles.tsx +24 -18
- package/themes/single-business/src/types/index.tsx +10 -2
|
@@ -73,21 +73,32 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
73
73
|
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
74
74
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
75
75
|
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
76
|
+
const [isReviewedOrders, setIsReviewedOrders] = useState<Array<any>>([])
|
|
76
77
|
|
|
77
78
|
const handleClickViewOrder = (uuid: string) => {
|
|
78
79
|
onNavigationRedirect &&
|
|
79
80
|
onNavigationRedirect('OrderDetails', { orderId: uuid });
|
|
80
81
|
};
|
|
81
82
|
|
|
83
|
+
const handleReviewState = (orderId: any) => {
|
|
84
|
+
if (!orderId || isReviewedOrders.includes(orderId)) return
|
|
85
|
+
setIsReviewedOrders([ ...isReviewedOrders, orderId ])
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
const handleClickOrderReview = (order: any) => {
|
|
83
89
|
onNavigationRedirect &&
|
|
84
90
|
onNavigationRedirect('ReviewOrder', {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
order: {
|
|
92
|
+
id: order?.id,
|
|
93
|
+
business_id: order?.business_id,
|
|
94
|
+
logo: order.business?.logo,
|
|
95
|
+
driver: order?.driver,
|
|
96
|
+
products: order?.products,
|
|
97
|
+
review: order?.review,
|
|
98
|
+
user_review: order?.user_review
|
|
99
|
+
},
|
|
100
|
+
handleReviewState: handleReviewState
|
|
101
|
+
});
|
|
91
102
|
};
|
|
92
103
|
|
|
93
104
|
const formatDate = (date: string, option?: any) => {
|
|
@@ -100,82 +111,85 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
100
111
|
};
|
|
101
112
|
|
|
102
113
|
return (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
114
|
+
orders.length === 0 ? null : (
|
|
115
|
+
<View style={{ marginBottom: 30 }}>
|
|
116
|
+
{orders.map((order: any) => (
|
|
117
|
+
<TouchableOpacity
|
|
118
|
+
onPress={() => handleClickViewOrder(order?.uuid)}
|
|
119
|
+
activeOpacity={0.7}
|
|
120
|
+
style={{ flexDirection: 'row' }}
|
|
121
|
+
key={order.id}>
|
|
122
|
+
<Card>
|
|
123
|
+
{/* {!!order.business?.logo && (
|
|
124
|
+
<Logo>
|
|
125
|
+
<OIcon
|
|
126
|
+
url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
|
|
127
|
+
style={styles.logo}
|
|
128
|
+
/>
|
|
129
|
+
</Logo>
|
|
130
|
+
)} */}
|
|
131
|
+
<Information>
|
|
132
|
+
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
133
|
+
{`${t('ORDER_NO', 'Order No')}.${order.id}`}
|
|
134
|
+
</OText>
|
|
135
|
+
<OText
|
|
136
|
+
size={10}
|
|
137
|
+
lineHeight={21}
|
|
138
|
+
color={theme.colors.textSecondary}
|
|
139
|
+
style={{ marginVertical: 3 }}
|
|
140
|
+
numberOfLines={1}>
|
|
141
|
+
{order?.delivery_datetime_utc
|
|
142
|
+
? formatDate(order?.delivery_datetime_utc)
|
|
143
|
+
: formatDate(order?.delivery_datetime, { utc: false })}
|
|
144
|
+
</OText>
|
|
145
|
+
<OText
|
|
146
|
+
color={theme.colors.primary}
|
|
147
|
+
size={10}
|
|
148
|
+
lineHeight={15}
|
|
149
|
+
numberOfLines={1}>
|
|
150
|
+
{getOrderStatus(order.status)?.value}
|
|
151
|
+
</OText>
|
|
152
|
+
</Information>
|
|
153
|
+
<Status>
|
|
154
|
+
<OButton
|
|
155
|
+
text={t('REORDER', 'Reorder')}
|
|
156
|
+
imgRightSrc={''}
|
|
157
|
+
textStyle={styles.buttonText}
|
|
158
|
+
style={
|
|
159
|
+
reorderLoading && order.id === reorderSelected
|
|
160
|
+
? styles.reorderLoading
|
|
161
|
+
: styles.reorderbutton
|
|
162
|
+
}
|
|
163
|
+
onClick={() => handleReorderClick(order.id)}
|
|
164
|
+
isLoading={reorderLoading && order.id === reorderSelected}
|
|
165
|
+
/>
|
|
166
|
+
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
167
|
+
!order.review && !isReviewedOrders.includes(order?.id) &&
|
|
168
|
+
(
|
|
169
|
+
<TouchableOpacity
|
|
170
|
+
onPress={() => handleClickOrderReview(order)}
|
|
171
|
+
style={styles.reviewButton}>
|
|
172
|
+
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
173
|
+
{t('REVIEW', 'Review')}
|
|
174
|
+
</OText>
|
|
175
|
+
</TouchableOpacity>
|
|
176
|
+
)}
|
|
177
|
+
</Status>
|
|
178
|
+
</Card>
|
|
179
|
+
</TouchableOpacity>
|
|
180
|
+
))}
|
|
181
|
+
{pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
182
|
+
<WrappButton>
|
|
183
|
+
<OButton
|
|
184
|
+
onClick={loadMoreOrders}
|
|
185
|
+
text={t('LOAD_MORE_ORDERS', 'Load more orders')}
|
|
186
|
+
imgRightSrc={null}
|
|
187
|
+
textStyle={{ color: theme.colors.white }}
|
|
188
|
+
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
189
|
+
/>
|
|
190
|
+
</WrappButton>
|
|
191
|
+
)}
|
|
192
|
+
</View>
|
|
193
|
+
)
|
|
180
194
|
);
|
|
181
195
|
};
|
|
@@ -19,8 +19,8 @@ export const PromotionCard = (props: any) => {
|
|
|
19
19
|
onPromotionClick,
|
|
20
20
|
} = props
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
const [{ optimizeImage }] = useUtils();
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const [{ optimizeImage, parseDate }] = useUtils();
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<>
|
|
@@ -75,6 +75,14 @@ export const PromotionCard = (props: any) => {
|
|
|
75
75
|
{promotion?.description}
|
|
76
76
|
</OText>
|
|
77
77
|
)}
|
|
78
|
+
<OText
|
|
79
|
+
size={16}
|
|
80
|
+
numberOfLines={1}
|
|
81
|
+
ellipsizeMode='tail'
|
|
82
|
+
style={styles.textStyle}
|
|
83
|
+
>
|
|
84
|
+
{`Expires ${parseDate(promotion?.end)}`}
|
|
85
|
+
</OText>
|
|
78
86
|
</>
|
|
79
87
|
)}
|
|
80
88
|
</WrapContent>
|