ordering-ui-react-native 0.14.85 → 0.14.88
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 +1 -1
- package/src/utils/index.tsx +194 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +6 -7
- package/themes/original/index.tsx +4 -0
- package/themes/original/src/components/Checkout/index.tsx +13 -0
- package/themes/original/src/components/OrderProgress/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +13 -12
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +75 -73
- package/themes/original/src/components/ReviewDriver/index.tsx +314 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +322 -186
- package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
- package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
- package/themes/original/src/components/SingleProductReview/index.tsx +162 -0
- package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/themes/original/src/types/index.tsx +29 -2
package/package.json
CHANGED
package/src/utils/index.tsx
CHANGED
|
@@ -191,3 +191,197 @@ export const transformCountryCode = (countryCode : number) => {
|
|
|
191
191
|
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
|
192
192
|
return R * c
|
|
193
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* function to manage review comment list
|
|
197
|
+
* @param {number} param0 type of reviews to return
|
|
198
|
+
* @returns object with reviews dictionary
|
|
199
|
+
*/
|
|
200
|
+
export const reviewCommentList = (type: string) => {
|
|
201
|
+
const [, t] = useLanguage()
|
|
202
|
+
|
|
203
|
+
const reviews: any = {
|
|
204
|
+
order: {
|
|
205
|
+
1: {
|
|
206
|
+
title: t('QUICK_COMMENT_TITLE_1', "What went wrong?"),
|
|
207
|
+
list: [
|
|
208
|
+
{ key: 0, content: t('QUICK_COMMENT_1_0', "Not handled with care") },
|
|
209
|
+
{ key: 1, content: t('QUICK_COMMENT_1_1', "Poor communication") },
|
|
210
|
+
{ key: 2, content: t('QUICK_COMMENT_1_2', "COVID-19 issue") },
|
|
211
|
+
{ key: 3, content: t('QUICK_COMMENT_1_3', "Didn't follow instructions") },
|
|
212
|
+
{ key: 4, content: t('QUICK_COMMENT_1_4', "Rude") },
|
|
213
|
+
{ key: 5, content: t('QUICK_COMMENT_1_5', "Not on-time") },
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
2: {
|
|
217
|
+
title: t('QUICK_COMMENT_TITLE_2', "What went wrong?"),
|
|
218
|
+
list: [
|
|
219
|
+
{ key: 0, content: t('QUICK_COMMENT_2_0', "Not handled with care") },
|
|
220
|
+
{ key: 1, content: t('QUICK_COMMENT_2_1', "Poor communication") },
|
|
221
|
+
{ key: 2, content: t('QUICK_COMMENT_2_2', "COVID-19 issue") },
|
|
222
|
+
{ key: 3, content: t('QUICK_COMMENT_2_3', "Didn't follow instructions") },
|
|
223
|
+
{ key: 4, content: t('QUICK_COMMENT_2_4', "Rude") },
|
|
224
|
+
{ key: 5, content: t('QUICK_COMMENT_2_5', "Not on-time") },
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
3: {
|
|
228
|
+
title: t('QUICK_COMMENT_TITLE_3', "What could have been better?"),
|
|
229
|
+
list: [
|
|
230
|
+
{ key: 0, content: t('QUICK_COMMENT_3_0', "Not handled with care") },
|
|
231
|
+
{ key: 1, content: t('QUICK_COMMENT_3_1', "Poor communication") },
|
|
232
|
+
{ key: 2, content: t('QUICK_COMMENT_3_2', "COVID-19 issue") },
|
|
233
|
+
{ key: 3, content: t('QUICK_COMMENT_3_3', "Didn't follow instructions") },
|
|
234
|
+
{ key: 4, content: t('QUICK_COMMENT_3_4', "Rude") },
|
|
235
|
+
{ key: 5, content: t('QUICK_COMMENT_3_5', "Not on-time") },
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
4: {
|
|
239
|
+
title: t('QUICK_COMMENT_TITLE_4', " Tell us more"),
|
|
240
|
+
list: [
|
|
241
|
+
{ key: 0, content: t('QUICK_COMMENT_4_0', "Not handled with care") },
|
|
242
|
+
{ key: 1, content: t('QUICK_COMMENT_4_1', "Poor communication") },
|
|
243
|
+
{ key: 2, content: t('QUICK_COMMENT_4_2', "COVID-19 issue") },
|
|
244
|
+
{ key: 3, content: t('QUICK_COMMENT_4_3', "Didn't follow instructions") },
|
|
245
|
+
{ key: 4, content: t('QUICK_COMMENT_4_4', "Rude") },
|
|
246
|
+
{ key: 5, content: t('QUICK_COMMENT_4_5', "Not on-time") },
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
5: {
|
|
250
|
+
title: t('QUICK_COMMENT_TITLE_5', "What went well?"),
|
|
251
|
+
list: [
|
|
252
|
+
{ key: 0, content: t('QUICK_COMMENT_5_0', "Good communication") },
|
|
253
|
+
{ key: 1, content: t('QUICK_COMMENT_5_1', "Followed instructions") },
|
|
254
|
+
{ key: 2, content: t('QUICK_COMMENT_5_2', "Friendly") },
|
|
255
|
+
{ key: 3, content: t('QUICK_COMMENT_5_3', 'Handled with care') },
|
|
256
|
+
{ key: 4, content: t('QUICK_COMMENT_5_4', "Above and beyond") },
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
customer: {
|
|
261
|
+
1: {
|
|
262
|
+
title: t('CUSTOMER_QUICK_COMMENT_TITLE_1', "What went wrong?"),
|
|
263
|
+
list: [
|
|
264
|
+
{ key: 0, content: t('CUSTOMER_QUICK_COMMENT_1_0', "Poor communication") },
|
|
265
|
+
{ key: 1, content: t('CUSTOMER_QUICK_COMMENT_1_1', "Wrong address") },
|
|
266
|
+
{ key: 2, content: t('CUSTOMER_QUICK_COMMENT_1_2', "COVID-19 issue") },
|
|
267
|
+
{ key: 3, content: t('CUSTOMER_QUICK_COMMENT_1_3', "Didn't follow instructions") },
|
|
268
|
+
{ key: 4, content: t('CUSTOMER_QUICK_COMMENT_1_4', "Rude") },
|
|
269
|
+
{ key: 5, content: t('CUSTOMER_QUICK_COMMENT_1_5', "Not on-time") },
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
2: {
|
|
273
|
+
title: t('CUSTOMER_QUICK_COMMENT_TITLE_2', "What went wrong?"),
|
|
274
|
+
list: [
|
|
275
|
+
{ key: 0, content: t('CUSTOMER_QUICK_COMMENT_2_0', "Poor communication") },
|
|
276
|
+
{ key: 1, content: t('CUSTOMER_QUICK_COMMENT_2_1', "Wrong address") },
|
|
277
|
+
{ key: 2, content: t('CUSTOMER_QUICK_COMMENT_2_2', "COVID-19 issue") },
|
|
278
|
+
{ key: 3, content: t('CUSTOMER_QUICK_COMMENT_2_3', "Didn't follow instructions") },
|
|
279
|
+
{ key: 4, content: t('CUSTOMER_QUICK_COMMENT_2_4', "Rude") },
|
|
280
|
+
{ key: 5, content: t('CUSTOMER_QUICK_COMMENT_2_5', "Not on-time") },
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
3: {
|
|
284
|
+
title: t('CUSTOMER_QUICK_COMMENT_TITLE_3', "What could have been better?"),
|
|
285
|
+
list: [
|
|
286
|
+
{ key: 0, content: t('CUSTOMER_QUICK_COMMENT_3_0', "Poor communication") },
|
|
287
|
+
{ key: 1, content: t('CUSTOMER_QUICK_COMMENT_3_1', "Wrong address") },
|
|
288
|
+
{ key: 2, content: t('CUSTOMER_QUICK_COMMENT_3_2', "COVID-19 issue") },
|
|
289
|
+
{ key: 3, content: t('CUSTOMER_QUICK_COMMENT_3_3', "Didn't follow instructions") },
|
|
290
|
+
{ key: 4, content: t('CUSTOMER_QUICK_COMMENT_3_4', "Rude") },
|
|
291
|
+
{ key: 5, content: t('CUSTOMER_QUICK_COMMENT_3_5', "Not on-time") },
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
4: {
|
|
295
|
+
title: t('CUSTOMER_QUICK_COMMENT_TITLE_4', " Tell us more"),
|
|
296
|
+
list: [
|
|
297
|
+
{ key: 0, content: t('CUSTOMER_QUICK_COMMENT_4_0', "Poor communication") },
|
|
298
|
+
{ key: 1, content: t('CUSTOMER_QUICK_COMMENT_4_1', "Wrong address") },
|
|
299
|
+
{ key: 2, content: t('CUSTOMER_QUICK_COMMENT_4_2', "COVID-19 issue") },
|
|
300
|
+
{ key: 3, content: t('CUSTOMER_QUICK_COMMENT_4_3', "Didn't follow instructions") },
|
|
301
|
+
{ key: 4, content: t('CUSTOMER_QUICK_COMMENT_4_4', "Rude") },
|
|
302
|
+
{ key: 5, content: t('CUSTOMER_QUICK_COMMENT_4_5', "Not on-time") },
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
5: {
|
|
306
|
+
title: t('CUSTOMER_QUICK_COMMENT_TITLE_5', "What went well?"),
|
|
307
|
+
list: [
|
|
308
|
+
{ key: 0, content: t('CUSTOMER_QUICK_COMMENT_5_0', "Good communication") },
|
|
309
|
+
{ key: 1, content: t('CUSTOMER_QUICK_COMMENT_5_1', "Friendly") },
|
|
310
|
+
{ key: 2, content: t('CUSTOMER_QUICK_COMMENT_5_2', "Above and beyond") },
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
driver: {
|
|
315
|
+
1: {
|
|
316
|
+
title: t('DRIVER_QUICK_COMMENT_TITLE_1', "What went wrong?"),
|
|
317
|
+
list: [
|
|
318
|
+
{ key: 0, content: t('DRIVER_QUICK_COMMENT_1_0', "Not handled with care") },
|
|
319
|
+
{ key: 1, content: t('DRIVER_QUICK_COMMENT_1_1', "Poor communication") },
|
|
320
|
+
{ key: 2, content: t('DRIVER_QUICK_COMMENT_1_2', "COVID-19 issue") },
|
|
321
|
+
{ key: 3, content: t('DRIVER_QUICK_COMMENT_1_3', "Didn't follow instructions") },
|
|
322
|
+
{ key: 4, content: t('DRIVER_QUICK_COMMENT_1_4', "Rude") },
|
|
323
|
+
{ key: 5, content: t('DRIVER_QUICK_COMMENT_1_5', "Not on-time") },
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
2: {
|
|
327
|
+
title: t('DRIVER_QUICK_COMMENT_TITLE_2', "What went wrong?"),
|
|
328
|
+
list: [
|
|
329
|
+
{ key: 0, content: t('DRIVER_QUICK_COMMENT_2_0', "Not handled with care") },
|
|
330
|
+
{ key: 1, content: t('DRIVER_QUICK_COMMENT_2_1', "Poor communication") },
|
|
331
|
+
{ key: 2, content: t('DRIVER_QUICK_COMMENT_2_2', "COVID-19 issue") },
|
|
332
|
+
{ key: 3, content: t('DRIVER_QUICK_COMMENT_2_3', "Didn't follow instructions") },
|
|
333
|
+
{ key: 4, content: t('DRIVER_QUICK_COMMENT_2_4', "Rude") },
|
|
334
|
+
{ key: 5, content: t('DRIVER_QUICK_COMMENT_2_5', "Not on-time") },
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
3: {
|
|
338
|
+
title: t('DRIVER_QUICK_COMMENT_TITLE_3', "What could have been better?"),
|
|
339
|
+
list: [
|
|
340
|
+
{ key: 0, content: t('DRIVER_QUICK_COMMENT_3_0', "Not handled with care") },
|
|
341
|
+
{ key: 1, content: t('DRIVER_QUICK_COMMENT_3_1', "Poor communication") },
|
|
342
|
+
{ key: 2, content: t('DRIVER_QUICK_COMMENT_3_2', "COVID-19 issue") },
|
|
343
|
+
{ key: 3, content: t('DRIVER_QUICK_COMMENT_3_3', "Didn't follow instructions") },
|
|
344
|
+
{ key: 4, content: t('DRIVER_QUICK_COMMENT_3_4', "Rude") },
|
|
345
|
+
{ key: 5, content: t('DRIVER_QUICK_COMMENT_3_5', "Not on-time") },
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
4: {
|
|
349
|
+
title: t('DRIVER_QUICK_COMMENT_TITLE_4', " Tell us more"),
|
|
350
|
+
list: [
|
|
351
|
+
{ key: 0, content: t('DRIVER_QUICK_COMMENT_4_0', "Not handled with care") },
|
|
352
|
+
{ key: 1, content: t('DRIVER_QUICK_COMMENT_4_1', "Poor communication") },
|
|
353
|
+
{ key: 2, content: t('DRIVER_QUICK_COMMENT_4_2', "COVID-19 issue") },
|
|
354
|
+
{ key: 3, content: t('DRIVER_QUICK_COMMENT_4_3', "Didn't follow instructions") },
|
|
355
|
+
{ key: 4, content: t('DRIVER_QUICK_COMMENT_4_4', "Rude") },
|
|
356
|
+
{ key: 5, content: t('DRIVER_QUICK_COMMENT_4_5', "Not on-time") },
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
5: {
|
|
360
|
+
title: t('DRIVER_QUICK_COMMENT_TITLE_5', "What went well?"),
|
|
361
|
+
list: [
|
|
362
|
+
{ key: 0, content: t('DRIVER_QUICK_COMMENT_5_0', "Good communication") },
|
|
363
|
+
{ key: 1, content: t('DRIVER_QUICK_COMMENT_5_1', "Followed instructions") },
|
|
364
|
+
{ key: 2, content: t('DRIVER_QUICK_COMMENT_5_2', "Friendly") },
|
|
365
|
+
{ key: 3, content: t('DRIVER_QUICK_COMMENT_5_3', 'Handled with care') },
|
|
366
|
+
{ key: 4, content: t('DRIVER_QUICK_COMMENT_5_4', "Above and beyond") },
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
product: {
|
|
371
|
+
like: [
|
|
372
|
+
{ key: 0, content: t('QUICK_COMMENT_LIKE_0', "Tasty") },
|
|
373
|
+
{ key: 1, content: t('QUICK_COMMENT_LIKE_1', "Good price") },
|
|
374
|
+
{ key: 2, content: t('QUICK_COMMENT_LIKE_2', "Good portion size") },
|
|
375
|
+
{ key: 3, content: t('QUICK_COMMENT_LIKE_3', "Packed well") },
|
|
376
|
+
],
|
|
377
|
+
dislike: [
|
|
378
|
+
{ key: 0, content: t('QUICK_COMMENT_DISLIKE_0', "Not tasty") },
|
|
379
|
+
{ key: 1, content: t('QUICK_COMMENT_DISLIKE_1', "High price") },
|
|
380
|
+
{ key: 2, content: t('QUICK_COMMENT_DISLIKE_2', "Bad portion size") },
|
|
381
|
+
{ key: 3, content: t('QUICK_COMMENT_DISLIKE_3', "Not packed well") },
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return reviews[type]
|
|
387
|
+
}
|
|
@@ -20,6 +20,8 @@ import { FloatingButton } from '../FloatingButton'
|
|
|
20
20
|
import LinearGradient from 'react-native-linear-gradient'
|
|
21
21
|
import Alert from '../../providers/AlertProvider'
|
|
22
22
|
|
|
23
|
+
import { reviewCommentList } from '../../../../../src/utils'
|
|
24
|
+
|
|
23
25
|
import {
|
|
24
26
|
Content,
|
|
25
27
|
ActionButtonWrapper,
|
|
@@ -101,11 +103,8 @@ const ReviewCustomerUI = (props: ReviewCustomerParams) => {
|
|
|
101
103
|
{ key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
|
|
102
104
|
]
|
|
103
105
|
|
|
104
|
-
const commentsList =
|
|
105
|
-
|
|
106
|
-
{ key: 1, content: t('EXCELLENT_COMMUNICATION', "Excellent communication") },
|
|
107
|
-
{ key: 2, content: t('CORDIAL_SERVICE', 'Cordial service') }
|
|
108
|
-
]
|
|
106
|
+
const commentsList = reviewCommentList('customer')
|
|
107
|
+
|
|
109
108
|
const isSelectedComment = (commentKey: number) => {
|
|
110
109
|
const found = comments.find((comment: any) => comment?.key === commentKey)
|
|
111
110
|
return found
|
|
@@ -251,10 +250,10 @@ const ReviewCustomerUI = (props: ReviewCustomerParams) => {
|
|
|
251
250
|
size={12}
|
|
252
251
|
style={{ marginTop: 30 }}
|
|
253
252
|
>
|
|
254
|
-
{
|
|
253
|
+
{commentsList[reviewState?.qualification || 1]?.title}
|
|
255
254
|
</OText>
|
|
256
255
|
<CommentsButtonGroup>
|
|
257
|
-
{commentsList
|
|
256
|
+
{commentsList[reviewState?.qualification || 1]?.list?.map(commentItem => (
|
|
258
257
|
<OButton
|
|
259
258
|
key={commentItem.key}
|
|
260
259
|
text={commentItem.content}
|
|
@@ -20,6 +20,8 @@ import { BusinessPreorder } from './src/components/BusinessPreorder';
|
|
|
20
20
|
import { BusinessMenuList } from './src/components/BusinessMenuList';
|
|
21
21
|
import { UserProfileForm } from './src/components/UserProfileForm';
|
|
22
22
|
import { ReviewOrder } from './src/components/ReviewOrder';
|
|
23
|
+
import { ReviewProducts } from './src/components/ReviewProducts';
|
|
24
|
+
import { ReviewDriver } from './src/components/ReviewDriver';
|
|
23
25
|
import { UserProfile } from './src/components/UserProfile';
|
|
24
26
|
import { MessageListing } from './src/components/MessageListing';
|
|
25
27
|
import { Help } from './src/components/Help';
|
|
@@ -82,6 +84,8 @@ export {
|
|
|
82
84
|
BusinessPreorder,
|
|
83
85
|
UserProfileForm,
|
|
84
86
|
ReviewOrder,
|
|
87
|
+
ReviewProducts,
|
|
88
|
+
ReviewDriver,
|
|
85
89
|
BusinessMenuList,
|
|
86
90
|
UserProfile,
|
|
87
91
|
MessageListing,
|
|
@@ -667,6 +667,19 @@ const CheckoutUI = (props: any) => {
|
|
|
667
667
|
setShowGateway={setShowGateway}
|
|
668
668
|
/>
|
|
669
669
|
)}
|
|
670
|
+
{webviewPaymethod?.gateway === 'square' && showGateway.open && (
|
|
671
|
+
<PaymentOptionsWebView
|
|
672
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
673
|
+
uri={`https://test-square-f50f7.web.app`}
|
|
674
|
+
user={user}
|
|
675
|
+
token={token}
|
|
676
|
+
cart={cart}
|
|
677
|
+
currency={currency}
|
|
678
|
+
webviewPaymethod={webviewPaymethod}
|
|
679
|
+
setShowGateway={setShowGateway}
|
|
680
|
+
locationId={'L1NGAY5M6KJRX'}
|
|
681
|
+
/>
|
|
682
|
+
)}
|
|
670
683
|
</>
|
|
671
684
|
)
|
|
672
685
|
}
|
|
@@ -139,7 +139,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
139
139
|
return (
|
|
140
140
|
<>
|
|
141
141
|
{orderList?.loading && (
|
|
142
|
-
<Placeholder Animation={Fade} height={
|
|
142
|
+
<Placeholder Animation={Fade} height={158}>
|
|
143
143
|
<PlaceholderLine height={60} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
144
144
|
<PlaceholderLine height={20} style={{ marginBottom: 10 }} />
|
|
145
145
|
<PlaceholderLine height={40} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
@@ -935,28 +935,29 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
935
935
|
style={{
|
|
936
936
|
width: isSoldOut || maxProductQuantity <= 0 ? '60%' : '40%',
|
|
937
937
|
}}>
|
|
938
|
-
{productCart &&
|
|
939
|
-
!isSoldOut &&
|
|
940
|
-
maxProductQuantity > 0 &&
|
|
938
|
+
{((productCart &&
|
|
941
939
|
auth &&
|
|
942
|
-
orderState.options?.address_id && (
|
|
940
|
+
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
943
941
|
<OButton
|
|
944
942
|
onClick={() => handleSaveProduct()}
|
|
945
943
|
imgRightSrc=""
|
|
946
944
|
text={`${orderState.loading
|
|
947
945
|
? t('LOADING', 'Loading')
|
|
948
|
-
:
|
|
949
|
-
? t('
|
|
950
|
-
:
|
|
946
|
+
: (isSoldOut || maxProductQuantity <= 0)
|
|
947
|
+
? t('SOLD_OUT', 'Sold out')
|
|
948
|
+
: editMode
|
|
949
|
+
? t('UPDATE', 'Update')
|
|
950
|
+
: t('ADD', 'Add')
|
|
951
951
|
}`}
|
|
952
|
+
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
952
953
|
textStyle={{
|
|
953
|
-
color:
|
|
954
|
+
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
954
955
|
fontSize: orderState.loading || editMode ? 10 : 14
|
|
955
956
|
}}
|
|
956
957
|
style={{
|
|
957
|
-
backgroundColor:
|
|
958
|
-
borderColor:
|
|
959
|
-
opacity:
|
|
958
|
+
backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.lightGray : theme.colors.primary,
|
|
959
|
+
borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.white : theme.colors.primary,
|
|
960
|
+
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
960
961
|
borderRadius: 7.6,
|
|
961
962
|
height: 44,
|
|
962
963
|
shadowOpacity: 0,
|
|
@@ -976,7 +977,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
976
977
|
) : (
|
|
977
978
|
<OButton onClick={navigation.navigate('AddressList')} />
|
|
978
979
|
))}
|
|
979
|
-
{
|
|
980
|
+
{!auth && (
|
|
980
981
|
<OButton
|
|
981
982
|
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
982
983
|
onClick={() => handleRedirectLogin()}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ProductOptionSuboption as ProductSubOptionController
|
|
6
6
|
} from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native';
|
|
8
|
-
import { StyleSheet } from 'react-native'
|
|
8
|
+
import { StyleSheet, View } from 'react-native'
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
Container,
|
|
@@ -52,81 +52,83 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
52
52
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
53
53
|
const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
|
|
54
54
|
return (
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
{(
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
<View>
|
|
56
|
+
<Container onPress={() => handleSuboptionClick()}>
|
|
57
|
+
<IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
|
|
58
|
+
{((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
|
|
59
|
+
state?.selected ? (
|
|
60
|
+
<OIcon src={theme.images.general.check_act} color={theme.colors.primary} width={16} />
|
|
61
|
+
) : (
|
|
62
|
+
<OIcon src={theme.images.general.check_nor} color={theme.colors.disabled} width={16} />
|
|
63
|
+
)
|
|
60
64
|
) : (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
state?.selected ? (
|
|
66
|
+
<OIcon src={theme.images.general.radio_act} color={theme.colors.primary} width={16} />
|
|
67
|
+
) : (
|
|
68
|
+
<OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
|
|
69
|
+
)
|
|
70
|
+
)}
|
|
71
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={10} style={{ flex: 1 }}>
|
|
72
|
+
{suboption?.name}
|
|
73
|
+
</OText>
|
|
74
|
+
</IconControl>
|
|
75
|
+
<QuantityControl>
|
|
76
|
+
{option?.allow_suboption_quantity && state?.selected && (
|
|
77
|
+
<>
|
|
78
|
+
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
79
|
+
<OIcon
|
|
80
|
+
src={theme.images.general.minus}
|
|
81
|
+
width={16}
|
|
82
|
+
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
83
|
+
/>
|
|
84
|
+
</Checkbox>
|
|
85
|
+
<OText size={12} mLeft={5} mRight={5}>
|
|
86
|
+
{state.quantity}
|
|
87
|
+
</OText>
|
|
88
|
+
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
89
|
+
<OIcon
|
|
90
|
+
src={theme.images.general.plus}
|
|
91
|
+
width={16}
|
|
92
|
+
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
93
|
+
/>
|
|
94
|
+
</Checkbox>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</QuantityControl>
|
|
98
|
+
<PositionControl>
|
|
99
|
+
{option?.with_half_option && state?.selected && (
|
|
100
|
+
<>
|
|
101
|
+
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
102
|
+
<OIcon
|
|
103
|
+
src={theme.images.general.half_l}
|
|
104
|
+
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
105
|
+
width={16}
|
|
106
|
+
style={styles.inverse}
|
|
107
|
+
/>
|
|
108
|
+
</Circle>
|
|
109
|
+
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
110
|
+
<OIcon
|
|
111
|
+
src={theme.images.general.half_f}
|
|
112
|
+
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
113
|
+
width={16}
|
|
114
|
+
/>
|
|
115
|
+
</Circle>
|
|
116
|
+
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
117
|
+
<OIcon
|
|
118
|
+
src={theme.images.general.half_r}
|
|
119
|
+
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
120
|
+
width={16}
|
|
121
|
+
/>
|
|
122
|
+
</Circle>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
125
|
+
</PositionControl>
|
|
126
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
127
|
+
+ {parsePrice(price)}
|
|
72
128
|
</OText>
|
|
73
|
-
</
|
|
129
|
+
</Container>
|
|
74
130
|
{showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
|
|
75
|
-
|
|
76
|
-
{option?.allow_suboption_quantity && state?.selected && (
|
|
77
|
-
<>
|
|
78
|
-
<Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
|
|
79
|
-
<OIcon
|
|
80
|
-
src={theme.images.general.minus}
|
|
81
|
-
width={16}
|
|
82
|
-
color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
83
|
-
/>
|
|
84
|
-
</Checkbox>
|
|
85
|
-
<OText size={12} mLeft={5} mRight={5}>
|
|
86
|
-
{state.quantity}
|
|
87
|
-
</OText>
|
|
88
|
-
<Checkbox disabled={disabled || disableIncrement} onPress={increment}>
|
|
89
|
-
<OIcon
|
|
90
|
-
src={theme.images.general.plus}
|
|
91
|
-
width={16}
|
|
92
|
-
color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
|
|
93
|
-
/>
|
|
94
|
-
</Checkbox>
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</QuantityControl>
|
|
98
|
-
<PositionControl>
|
|
99
|
-
{option?.with_half_option && state?.selected && (
|
|
100
|
-
<>
|
|
101
|
-
<Circle disabled={disabled} onPress={() => changePosition('left')}>
|
|
102
|
-
<OIcon
|
|
103
|
-
src={theme.images.general.half_l}
|
|
104
|
-
color={state.selected && state.position === 'left' ? theme.colors.primary : '#cbcbcb'}
|
|
105
|
-
width={16}
|
|
106
|
-
style={styles.inverse}
|
|
107
|
-
/>
|
|
108
|
-
</Circle>
|
|
109
|
-
<Circle disabled={disabled} onPress={() => changePosition('whole')}>
|
|
110
|
-
<OIcon
|
|
111
|
-
src={theme.images.general.half_f}
|
|
112
|
-
color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}
|
|
113
|
-
width={16}
|
|
114
|
-
/>
|
|
115
|
-
</Circle>
|
|
116
|
-
<Circle disabled={disabled} onPress={() => changePosition('right')}>
|
|
117
|
-
<OIcon
|
|
118
|
-
src={theme.images.general.half_r}
|
|
119
|
-
color={state.selected && state.position === 'right' ? theme.colors.primary : '#cbcbcb'}
|
|
120
|
-
width={16}
|
|
121
|
-
/>
|
|
122
|
-
</Circle>
|
|
123
|
-
</>
|
|
124
|
-
)}
|
|
125
|
-
</PositionControl>
|
|
126
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
|
|
127
|
-
+ {parsePrice(price)}
|
|
128
|
-
</OText>
|
|
129
|
-
</Container>
|
|
131
|
+
</View>
|
|
130
132
|
)
|
|
131
133
|
}
|
|
132
134
|
|