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.
Files changed (30) hide show
  1. package/package.json +2 -1
  2. package/src/assets/images/business_list_banner.jpg +0 -0
  3. package/src/components/Account/index.tsx +2 -2
  4. package/src/config.json +2 -2
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  6. package/themes/business/src/components/OrdersOption/index.tsx +30 -23
  7. package/themes/original/index.tsx +2 -0
  8. package/themes/original/src/components/BusinessesListing/index.tsx +7 -0
  9. package/themes/original/src/components/BusinessesListing/styles.tsx +6 -1
  10. package/themes/original/src/components/OrderProgress/index.tsx +208 -0
  11. package/themes/original/src/components/OrderProgress/styles.tsx +30 -0
  12. package/themes/original/src/components/ProductForm/index.tsx +159 -56
  13. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  14. package/themes/single-business/src/components/ActiveOrders/index.tsx +20 -19
  15. package/themes/single-business/src/components/BusinessProductsListing/index.tsx +4 -4
  16. package/themes/single-business/src/components/Cart/index.tsx +39 -47
  17. package/themes/single-business/src/components/Cart/styles.tsx +1 -0
  18. package/themes/single-business/src/components/LoginForm/index.tsx +147 -89
  19. package/themes/single-business/src/components/LoginForm/styles.tsx +33 -28
  20. package/themes/single-business/src/components/OrderDetails/index.tsx +32 -12
  21. package/themes/single-business/src/components/OrdersOption/index.tsx +50 -50
  22. package/themes/single-business/src/components/OrdersOption/styles.tsx +1 -1
  23. package/themes/single-business/src/components/PreviousOrders/index.tsx +97 -83
  24. package/themes/single-business/src/components/PromotionCard/index.tsx +10 -2
  25. package/themes/single-business/src/components/Promotions/index.tsx +1 -1
  26. package/themes/single-business/src/components/ReviewOrder/index.tsx +299 -274
  27. package/themes/single-business/src/components/ReviewOrder/styles.tsx +23 -26
  28. package/themes/single-business/src/components/UpsellingProducts/index.tsx +230 -189
  29. package/themes/single-business/src/components/UpsellingProducts/styles.tsx +24 -18
  30. 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
- order: {
86
- id: order?.id,
87
- business_id: order?.business_id,
88
- logo: order.business?.logo,
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
- <View style={{ marginBottom: 30 }}>
104
- {orders.map((order: any) => (
105
- <TouchableOpacity
106
- onPress={() => handleClickViewOrder(order?.uuid)}
107
- activeOpacity={0.7}
108
- style={{ flexDirection: 'row' }}
109
- key={order.id}>
110
- <Card>
111
- {/* {!!order.business?.logo && (
112
- <Logo>
113
- <OIcon
114
- url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
115
- style={styles.logo}
116
- />
117
- </Logo>
118
- )} */}
119
- <Information>
120
- <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
121
- {`${t('ORDER_NO', 'Order No')}.${order.id}`}
122
- </OText>
123
- <OText
124
- size={10}
125
- lineHeight={21}
126
- color={theme.colors.textSecondary}
127
- style={{ marginVertical: 3 }}
128
- numberOfLines={1}>
129
- {order?.delivery_datetime_utc
130
- ? formatDate(order?.delivery_datetime_utc)
131
- : formatDate(order?.delivery_datetime, { utc: false })}
132
- </OText>
133
- <OText
134
- color={theme.colors.primary}
135
- size={10}
136
- lineHeight={15}
137
- numberOfLines={1}>
138
- {getOrderStatus(order.status)?.value}
139
- </OText>
140
- </Information>
141
- <Status>
142
- <OButton
143
- text={t('REORDER', 'Reorder')}
144
- imgRightSrc={''}
145
- textStyle={styles.buttonText}
146
- style={
147
- reorderLoading && order.id === reorderSelected
148
- ? styles.reorderLoading
149
- : styles.reorderbutton
150
- }
151
- onClick={() => handleReorderClick(order.id)}
152
- isLoading={reorderLoading && order.id === reorderSelected}
153
- />
154
- {allowedOrderStatus.includes(parseInt(order?.status)) &&
155
- !order.review && (
156
- <TouchableOpacity
157
- onPress={() => handleClickOrderReview(order)}
158
- style={styles.reviewButton}>
159
- <OText size={10} color={theme.colors.primary} numberOfLines={1}>
160
- {t('REVIEW', 'Review')}
161
- </OText>
162
- </TouchableOpacity>
163
- )}
164
- </Status>
165
- </Card>
166
- </TouchableOpacity>
167
- ))}
168
- {pagination.totalPages && pagination.currentPage < pagination.totalPages && (
169
- <WrappButton>
170
- <OButton
171
- onClick={loadMoreOrders}
172
- text={t('LOAD_MORE_ORDERS', 'Load more orders')}
173
- imgRightSrc={null}
174
- textStyle={{ color: theme.colors.white }}
175
- style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
176
- />
177
- </WrappButton>
178
- )}
179
- </View>
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 [theme] = useTheme();
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>
@@ -12,7 +12,7 @@ const PromotionsUI = (props: any) => {
12
12
  const { offersState, loadMoreOffers } = props
13
13
 
14
14
  const [, t] = useLanguage();
15
- const [theme] = useTheme();
15
+ const theme = useTheme();
16
16
  const { height } = useWindowDimensions();
17
17
 
18
18
  return (