ordering-ui-react-native 0.22.75 → 0.22.76-release
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 +5 -7
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +40 -39
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/context/OfflineActions/index.tsx +236 -0
- package/src/providers/AlertProvider.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
- package/themes/business/src/components/BusinessController/index.tsx +8 -3
- package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
- package/themes/business/src/components/Chat/index.tsx +15 -3
- package/themes/business/src/components/DriverMap/index.tsx +44 -33
- package/themes/business/src/components/FloatingButton/index.tsx +3 -2
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
- package/themes/business/src/components/LoginForm/index.tsx +123 -98
- package/themes/business/src/components/LogoutButton/index.tsx +13 -4
- package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
- package/themes/business/src/components/MapView/index.tsx +68 -142
- package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
- package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
- package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
- package/themes/business/src/components/OrderSummary/index.tsx +271 -176
- package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
- package/themes/business/src/components/OrdersOption/index.tsx +207 -144
- package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
- package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
- package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
- package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
- package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
- package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
- package/themes/business/src/config/currency.tsx +1010 -0
- package/themes/business/src/hooks/useLocation.tsx +16 -12
- package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
- package/themes/business/src/types/index.tsx +26 -4
- package/themes/business/src/utils/index.tsx +26 -2
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +223 -219
- package/themes/original/src/components/AddressForm/index.tsx +56 -17
- package/themes/original/src/components/AppleLogin/index.tsx +3 -4
- package/themes/original/src/components/BusinessController/index.tsx +4 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -3
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
- package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
- package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
- package/themes/original/src/components/Cart/index.tsx +43 -12
- package/themes/original/src/components/Checkout/index.tsx +126 -98
- package/themes/original/src/components/FloatingButton/index.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +2 -1
- package/themes/original/src/components/GoogleMap/index.tsx +3 -2
- package/themes/original/src/components/Help/functions.tsx +76 -0
- package/themes/original/src/components/Help/index.tsx +74 -29
- package/themes/original/src/components/Help/styles.tsx +4 -1
- package/themes/original/src/components/HelpOptions/index.tsx +53 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +36 -11
- package/themes/original/src/components/LastOrder/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +11 -5
- package/themes/original/src/components/MessageListing/index.tsx +1 -1
- package/themes/original/src/components/Messages/index.tsx +562 -555
- package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
- package/themes/original/src/components/MomentOption/index.tsx +141 -61
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/MomentSelector/index.tsx +5 -2
- package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/NavBar/index.tsx +6 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
- package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
- package/themes/original/src/components/OrderDetails/index.tsx +44 -20
- package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
- package/themes/original/src/components/OrderProgress/index.tsx +5 -4
- package/themes/original/src/components/OrderSummary/index.tsx +32 -11
- package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
- package/themes/original/src/components/OrdersOption/index.tsx +325 -325
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
- package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/SignupForm/index.tsx +40 -24
- package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
- package/themes/original/src/components/TaxInformation/index.tsx +3 -2
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
- package/themes/original/src/components/UserDetails/index.tsx +17 -16
- package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
- package/themes/original/src/components/UserVerification/index.tsx +18 -5
- package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
- package/themes/original/src/components/shared/OInput.tsx +97 -97
- package/themes/original/src/components/shared/OModal.tsx +7 -2
- package/themes/original/src/providers/AlertProvider.tsx +1 -1
- package/themes/original/src/types/index.tsx +700 -695
- package/themes/original/src/utils/index.tsx +50 -34
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
- package/themes/original/src/components/HelpGuide/index.tsx +0 -68
- package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
- package/themes/original/src/components/HelpOrder/index.tsx +0 -71
- package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
|
@@ -11,6 +11,7 @@ import { OrdersList } from './OrderList';
|
|
|
11
11
|
import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
|
|
12
12
|
import { ReviewCustomer } from '../ReviewCustomer';
|
|
13
13
|
import { GoogleMap } from '../GoogleMap';
|
|
14
|
+
import { useOfflineActions } from '../../../../../src/context/OfflineActions';
|
|
14
15
|
|
|
15
16
|
export const PreviousOrders = (props: any) => {
|
|
16
17
|
const {
|
|
@@ -32,7 +33,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
32
33
|
const [, t] = useLanguage();
|
|
33
34
|
const theme = useTheme();
|
|
34
35
|
const [{ configs }] = useConfig();
|
|
35
|
-
|
|
36
|
+
const [{ isNetConnected, canSaveChangesOffline }] = useOfflineActions()
|
|
36
37
|
|
|
37
38
|
// const [, setCurrentTime] = useState()
|
|
38
39
|
const [openModal, setOpenModal] = useState(false)
|
|
@@ -41,12 +42,14 @@ export const PreviousOrders = (props: any) => {
|
|
|
41
42
|
const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
|
|
42
43
|
|
|
43
44
|
const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
44
|
-
const viewMapStatus = [9, 18, 19, 23]
|
|
45
|
+
const viewMapStatus = [9, 18, 19, 23, 26]
|
|
46
|
+
const deliveryTypes = [1, 7]
|
|
45
47
|
const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
|
|
46
|
-
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
|
|
48
|
+
const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23, 26]
|
|
47
49
|
const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
|
|
48
50
|
const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
|
|
49
51
|
const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
|
|
52
|
+
const disabledActionsByInternet = !isNetConnected && canSaveChangesOffline === false
|
|
50
53
|
|
|
51
54
|
const handlePressOrder = (order: any) => {
|
|
52
55
|
if (order?.locked && isLogisticOrder) return
|
|
@@ -172,7 +175,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
172
175
|
}
|
|
173
176
|
)
|
|
174
177
|
}
|
|
175
|
-
{_ordersGrouped[k][0]?.status === 0 && (
|
|
178
|
+
{_ordersGrouped[k][0]?.status === 0 && !disabledActionsByInternet && (
|
|
176
179
|
<AcceptOrRejectOrderStyle>
|
|
177
180
|
{!isHideRejectButtons && (
|
|
178
181
|
<OButton
|
|
@@ -208,7 +211,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
208
211
|
/>
|
|
209
212
|
</AcceptOrRejectOrderStyle>
|
|
210
213
|
)}
|
|
211
|
-
{_ordersGrouped[k][0]?.status === 7 && (
|
|
214
|
+
{_ordersGrouped[k][0]?.status === 7 && !disabledActionsByInternet && (
|
|
212
215
|
<View>
|
|
213
216
|
<OButton
|
|
214
217
|
text={t('READY_FOR_PICKUP', 'Ready for pickup')}
|
|
@@ -226,7 +229,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
226
229
|
</View>
|
|
227
230
|
)}
|
|
228
231
|
{(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
|
|
229
|
-
_ordersGrouped[k][0]?.delivery_type
|
|
232
|
+
deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !disabledActionsByInternet &&
|
|
230
233
|
(
|
|
231
234
|
<AcceptOrRejectOrderStyle>
|
|
232
235
|
<OButton
|
|
@@ -244,7 +247,8 @@ export const PreviousOrders = (props: any) => {
|
|
|
244
247
|
/>
|
|
245
248
|
</AcceptOrRejectOrderStyle>
|
|
246
249
|
)}
|
|
247
|
-
{_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type
|
|
250
|
+
{_ordersGrouped[k][0]?.status === 3 && deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady &&
|
|
251
|
+
!disabledActionsByInternet &&
|
|
248
252
|
(
|
|
249
253
|
<AcceptOrRejectOrderStyle>
|
|
250
254
|
<OButton
|
|
@@ -282,6 +286,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
282
286
|
)}
|
|
283
287
|
{_ordersGrouped[k][0]?.status === 4 &&
|
|
284
288
|
![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
|
|
289
|
+
!disabledActionsByInternet &&
|
|
285
290
|
(
|
|
286
291
|
<AcceptOrRejectOrderStyle>
|
|
287
292
|
{!isHideRejectButtons && (
|
|
@@ -316,6 +321,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
316
321
|
)}
|
|
317
322
|
{!_ordersGrouped[k][0]?.user_review &&
|
|
318
323
|
pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
|
|
324
|
+
!disabledActionsByInternet &&
|
|
319
325
|
(
|
|
320
326
|
<OButton
|
|
321
327
|
text={t('REVIEW_CUSTOMER', 'Review customer')}
|
|
@@ -332,74 +338,76 @@ export const PreviousOrders = (props: any) => {
|
|
|
332
338
|
})}
|
|
333
339
|
/>
|
|
334
340
|
)}
|
|
335
|
-
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
|
|
336
|
-
|
|
337
|
-
|
|
341
|
+
{!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
|
|
342
|
+
!disabledActionsByInternet && (
|
|
343
|
+
<AcceptOrRejectOrderStyle>
|
|
344
|
+
{!isHideRejectButtons && isEnabledOrderNotReady && (
|
|
345
|
+
<OButton
|
|
346
|
+
text={t('PICKUP_FAILED', 'Pickup failed')}
|
|
347
|
+
bgColor={theme.colors.danger100}
|
|
348
|
+
borderColor={theme.colors.danger100}
|
|
349
|
+
imgRightSrc={null}
|
|
350
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
351
|
+
parentStyle={{ width: '45%' }}
|
|
352
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
353
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
354
|
+
action: 'pickupFailed',
|
|
355
|
+
order: _ordersGrouped[k][0],
|
|
356
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
357
|
+
handleChangeOrderStatus
|
|
358
|
+
})}
|
|
359
|
+
/>
|
|
360
|
+
)}
|
|
338
361
|
<OButton
|
|
339
|
-
text={t('
|
|
340
|
-
bgColor={theme.colors.
|
|
341
|
-
borderColor={theme.colors.
|
|
362
|
+
text={t('PICKUP_COMPLETE', 'Pickup complete')}
|
|
363
|
+
bgColor={theme.colors.success100}
|
|
364
|
+
borderColor={theme.colors.success100}
|
|
342
365
|
imgRightSrc={null}
|
|
343
366
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
344
|
-
parentStyle={{ width: '45%' }}
|
|
345
|
-
textStyle={{ color: theme.colors.
|
|
346
|
-
onClick={() =>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
handleChangeOrderStatus
|
|
351
|
-
})}
|
|
367
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
368
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
369
|
+
onClick={() => handleChangeOrderStatus(
|
|
370
|
+
9,
|
|
371
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
372
|
+
)}
|
|
352
373
|
/>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
374
|
+
</AcceptOrRejectOrderStyle>
|
|
375
|
+
)}
|
|
376
|
+
{!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) &&
|
|
377
|
+
!disabledActionsByInternet && (
|
|
378
|
+
<AcceptOrRejectOrderStyle>
|
|
379
|
+
{!isHideRejectButtons && (
|
|
380
|
+
<OButton
|
|
381
|
+
text={t('DELIVERY_FAILED', 'Delivery Failed')}
|
|
382
|
+
bgColor={theme.colors.danger100}
|
|
383
|
+
borderColor={theme.colors.danger100}
|
|
384
|
+
imgRightSrc={null}
|
|
385
|
+
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
386
|
+
parentStyle={{ width: '45%' }}
|
|
387
|
+
textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
|
|
388
|
+
onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
|
|
389
|
+
action: 'deliveryFailed',
|
|
390
|
+
order: _ordersGrouped[k][0],
|
|
391
|
+
ids: _ordersGrouped[k].map((o: any) => o.id),
|
|
392
|
+
handleChangeOrderStatus
|
|
393
|
+
})}
|
|
394
|
+
/>
|
|
365
395
|
)}
|
|
366
|
-
/>
|
|
367
|
-
</AcceptOrRejectOrderStyle>
|
|
368
|
-
)}
|
|
369
|
-
{!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
|
|
370
|
-
<AcceptOrRejectOrderStyle>
|
|
371
|
-
{!isHideRejectButtons && (
|
|
372
396
|
<OButton
|
|
373
|
-
text={t('
|
|
374
|
-
bgColor={theme.colors.
|
|
375
|
-
borderColor={theme.colors.
|
|
397
|
+
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
398
|
+
bgColor={theme.colors.success100}
|
|
399
|
+
borderColor={theme.colors.success100}
|
|
376
400
|
imgRightSrc={null}
|
|
377
401
|
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
378
|
-
parentStyle={{ width: '45%' }}
|
|
379
|
-
textStyle={{ color: theme.colors.
|
|
380
|
-
onClick={() =>
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
handleChangeOrderStatus
|
|
385
|
-
})}
|
|
402
|
+
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
403
|
+
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
404
|
+
onClick={() => handleChangeOrderStatus(
|
|
405
|
+
11,
|
|
406
|
+
_ordersGrouped[k].map((o: any) => o.id),
|
|
407
|
+
)}
|
|
386
408
|
/>
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
text={t('DELIVERY_COMPLETE', 'Delivery complete')}
|
|
390
|
-
bgColor={theme.colors.success100}
|
|
391
|
-
borderColor={theme.colors.success100}
|
|
392
|
-
imgRightSrc={null}
|
|
393
|
-
style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
|
|
394
|
-
parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
|
|
395
|
-
textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
|
|
396
|
-
onClick={() => handleChangeOrderStatus(
|
|
397
|
-
11,
|
|
398
|
-
_ordersGrouped[k].map((o: any) => o.id),
|
|
399
|
-
)}
|
|
400
|
-
/>
|
|
401
|
-
</AcceptOrRejectOrderStyle>
|
|
402
|
-
)}
|
|
409
|
+
</AcceptOrRejectOrderStyle>
|
|
410
|
+
)}
|
|
403
411
|
</OrdersGroupedItem>
|
|
404
412
|
))}
|
|
405
413
|
</View>
|
|
@@ -10,6 +10,7 @@ export const Card = styled.View`
|
|
|
10
10
|
export const Logo = styled.View`
|
|
11
11
|
height: 65px;
|
|
12
12
|
width: 65px;
|
|
13
|
+
align-self: ${({ hasExternalAndGroup }: any) => hasExternalAndGroup ? 'center' : 'auto'};
|
|
13
14
|
`;
|
|
14
15
|
|
|
15
16
|
export const Information = styled.View`
|
|
@@ -17,7 +18,7 @@ export const Information = styled.View`
|
|
|
17
18
|
justify-content: flex-start;
|
|
18
19
|
margin-horizontal: 5px;
|
|
19
20
|
flex: 1;
|
|
20
|
-
max-height: 60px;
|
|
21
|
+
max-height: ${({ hasExternalAndGroup }: any) => hasExternalAndGroup ? '75px' : '60px'};
|
|
21
22
|
`;
|
|
22
23
|
|
|
23
24
|
export const MyOrderOptions = styled.View`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { OText } from '../shared'
|
|
4
|
+
|
|
5
|
+
export const MessageAlert = ({ message, resetMsg }: any) => {
|
|
6
|
+
const theme = useTheme()
|
|
7
|
+
|
|
8
|
+
const [text, setText] = useState(message)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setText(message)
|
|
12
|
+
}, [message])
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (text) {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
setText(null)
|
|
18
|
+
resetMsg()
|
|
19
|
+
}, 2000);
|
|
20
|
+
}
|
|
21
|
+
}, [text])
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
text ? (
|
|
25
|
+
<OText
|
|
26
|
+
size={14}
|
|
27
|
+
color={theme.colors.danger500}
|
|
28
|
+
>
|
|
29
|
+
{text}
|
|
30
|
+
</OText>
|
|
31
|
+
) : null
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { StarPRNT } from 'react-native-star-prnt';
|
|
3
|
+
import { ActivityIndicator, Dimensions, SafeAreaView, StyleSheet, View } from 'react-native';
|
|
3
4
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
4
5
|
import { useLanguage } from 'ordering-components/native'
|
|
5
6
|
import { useTheme } from 'styled-components/native'
|
|
@@ -20,47 +21,36 @@ import {
|
|
|
20
21
|
import { Container } from '../../layouts/Container'
|
|
21
22
|
import { OText, OInput, OIcon, OButton } from '../shared'
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{ nickname: 'SM-S230i', model: 'SM-S230i', emulation: 'EscosMobile', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
35
|
-
{ nickname: 'SM-T300i/T300', model: 'SM-T300i/T300', emulation: 'EscPosMobile', portName1: 'BT:SMT300i/T300', type: 1, ip: '', printMode: 'append' },
|
|
36
|
-
{ nickname: 'SM-T400i', model: 'SM-T400i', emulation: 'EscosMobile', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
37
|
-
{ nickname: 'SM-L200', model: 'SM-L200', emulation: 'StarPRNT', portName1: 'BT:SML200', type: 1, ip: '', printMode: 'append' },
|
|
38
|
-
{ nickname: 'SM-L300', model: 'SM-L300', emulation: 'StarPRNT', portName1: 'BT:SML300', type: 1, ip: '', printMode: 'append' },
|
|
39
|
-
{ nickname: 'BSC10', model: 'BSC10', emulation: 'EscPos', portName1: 'BT:BSC10', type: 1, ip: '', printMode: 'append' },
|
|
40
|
-
{ nickname: 'SM-S210i StarPRNT', model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS210i', type: 1, ip: '', printMode: 'append' },
|
|
41
|
-
{ nickname: 'SM-S220i StarPRNT', model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS220i', type: 1, ip: '', printMode: 'append' },
|
|
42
|
-
{ nickname: 'SM-S230i StarPRNT', model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMS230i', type: 1, ip: '', printMode: 'append' },
|
|
43
|
-
{ nickname: 'SM-T300i/T300 StarPRNT', model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT300i', type: 1, ip: '', printMode: 'append' },
|
|
44
|
-
{ nickname: 'SM-T400i StarPRNT', model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', portName1: 'BT:SMT400i', type: 1, ip: '', printMode: 'append' },
|
|
45
|
-
]
|
|
24
|
+
import { PRINTERS } from './printerList'
|
|
25
|
+
import { MessageAlert } from './MessageAlert'
|
|
26
|
+
|
|
27
|
+
const printerList = PRINTERS.map(printer => ({
|
|
28
|
+
...printer,
|
|
29
|
+
ip: '',
|
|
30
|
+
type: 1,
|
|
31
|
+
nickname: printer.model,
|
|
32
|
+
portName1: `BT:${printer.model.split(' ')[0]}`,
|
|
33
|
+
bt: `BT:${printer.model.split(' ')[0]}`
|
|
34
|
+
}))
|
|
46
35
|
|
|
47
36
|
export const PrinterEdition = (props: any) => {
|
|
48
|
-
const {
|
|
49
|
-
printer,
|
|
50
|
-
onClose
|
|
51
|
-
} = props
|
|
37
|
+
const { printer, onClose } = props
|
|
52
38
|
|
|
53
39
|
const HEIGHT_SCREEN = Dimensions.get('window').height
|
|
54
40
|
const [, t] = useLanguage()
|
|
55
41
|
const theme = useTheme()
|
|
56
|
-
const {
|
|
42
|
+
const { control, setValue, watch } = useForm()
|
|
43
|
+
|
|
44
|
+
const [currentPrinter, setCurrentPrinter] = useState(printer)
|
|
45
|
+
const [discoverPort, setDiscoverPort] = useState({ loading: false, msg: null })
|
|
57
46
|
|
|
58
47
|
const watchIp = watch('ip')
|
|
48
|
+
const watchBt = watch('bt')
|
|
59
49
|
const watchNickname = watch('nickname')
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
50
|
+
const errorIP = !/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(watchIp)
|
|
51
|
+
const errorBT = !/^[^\n]*$/i.test(watchBt) || !watchBt
|
|
52
|
+
const isErrorInput = currentPrinter?.type === 2 ? errorIP : errorBT
|
|
53
|
+
const isErrorNickname = watchNickname && !/^[^\n]*$/i.test(watchNickname)
|
|
64
54
|
|
|
65
55
|
const styles = StyleSheet.create({
|
|
66
56
|
icons: {
|
|
@@ -73,9 +63,13 @@ export const PrinterEdition = (props: any) => {
|
|
|
73
63
|
paddingRight: 10
|
|
74
64
|
},
|
|
75
65
|
inputStyle: {
|
|
76
|
-
height: 40,
|
|
77
66
|
borderWidth: 1,
|
|
78
67
|
borderRadius: 8,
|
|
68
|
+
color: theme.colors.arrowColor,
|
|
69
|
+
borderColor: theme.colors.inputSignup,
|
|
70
|
+
backgroundColor: theme.colors.transparent,
|
|
71
|
+
minHeight: 50,
|
|
72
|
+
maxHeight: 50
|
|
79
73
|
},
|
|
80
74
|
savePrinterBtnText: {
|
|
81
75
|
color: theme.colors.white,
|
|
@@ -98,6 +92,36 @@ export const PrinterEdition = (props: any) => {
|
|
|
98
92
|
})
|
|
99
93
|
}
|
|
100
94
|
|
|
95
|
+
const portDiscovery = async () => {
|
|
96
|
+
try {
|
|
97
|
+
setDiscoverPort({ ...discoverPort, loading: true })
|
|
98
|
+
let printers = await StarPRNT.portDiscovery('Bluetooth');
|
|
99
|
+
|
|
100
|
+
if (printers?.length) {
|
|
101
|
+
setValue('bt', printers[0]?.portName)
|
|
102
|
+
setCurrentPrinter({
|
|
103
|
+
...currentPrinter,
|
|
104
|
+
['bt']: printers[0]?.portName
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
setDiscoverPort({
|
|
109
|
+
...discoverPort,
|
|
110
|
+
loading: false,
|
|
111
|
+
msg: !printers?.length
|
|
112
|
+
? t('NO_PRINTERS_FOUND', 'No printers found')
|
|
113
|
+
: null
|
|
114
|
+
})
|
|
115
|
+
}, 1000);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
setValue('bt', currentPrinter?.portName)
|
|
118
|
+
setCurrentPrinter({
|
|
119
|
+
...currentPrinter,
|
|
120
|
+
['bt']: currentPrinter?.portName
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
101
125
|
const onSubmit = () => {
|
|
102
126
|
handleChangePrinter({ edit: !!printer, isAdd: !printer })
|
|
103
127
|
onClose && onClose()
|
|
@@ -105,6 +129,7 @@ export const PrinterEdition = (props: any) => {
|
|
|
105
129
|
|
|
106
130
|
useEffect(() => {
|
|
107
131
|
currentPrinter?.ip && setValue('ip', currentPrinter?.ip)
|
|
132
|
+
currentPrinter?.bt && setValue('bt', currentPrinter?.bt)
|
|
108
133
|
currentPrinter?.nickname && setValue('nickname', currentPrinter?.nickname)
|
|
109
134
|
}, [currentPrinter?.type])
|
|
110
135
|
|
|
@@ -281,51 +306,93 @@ export const PrinterEdition = (props: any) => {
|
|
|
281
306
|
{t('CONNECTION_VIA_LAN', 'Via LAN')}
|
|
282
307
|
</OText>
|
|
283
308
|
</WrapperIcon>
|
|
284
|
-
{
|
|
285
|
-
|
|
286
|
-
<View style={{ flexDirection: 'row' }}>
|
|
287
|
-
<Controller
|
|
288
|
-
control={control}
|
|
289
|
-
name={'ip'}
|
|
290
|
-
rules={{
|
|
291
|
-
required: t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required'),
|
|
292
|
-
pattern: {
|
|
293
|
-
value: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i,
|
|
294
|
-
message: t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
|
|
295
|
-
}
|
|
296
|
-
}}
|
|
297
|
-
defaultValue={currentPrinter?.ip ?? ''}
|
|
298
|
-
render={() => (
|
|
299
|
-
<OInput
|
|
300
|
-
placeholder={t('IP_ADDRESS', 'Ip address')}
|
|
301
|
-
placeholderTextColor={theme.colors.arrowColor}
|
|
302
|
-
style={{
|
|
303
|
-
...styles.inputStyle,
|
|
304
|
-
borderColor: isErrorIp ? theme.colors.danger500 : theme.colors.tabBar
|
|
305
|
-
}}
|
|
306
|
-
value={currentPrinter?.ip ?? ''}
|
|
307
|
-
selectionColor={theme.colors.primary}
|
|
308
|
-
color={theme.colors.textGray}
|
|
309
|
-
onChange={(value: any) => {
|
|
310
|
-
setValue('ip', value)
|
|
311
|
-
setCurrentPrinter({
|
|
312
|
-
...currentPrinter,
|
|
313
|
-
ip: value
|
|
314
|
-
})
|
|
315
|
-
}}
|
|
316
|
-
/>
|
|
317
|
-
)}
|
|
318
|
-
/>
|
|
319
|
-
</View>
|
|
309
|
+
<View style={{ flexDirection: 'column', marginTop: 30 }}>
|
|
310
|
+
{currentPrinter?.type === 1 && (
|
|
320
311
|
<OText
|
|
321
312
|
size={14}
|
|
322
|
-
color={theme.colors.
|
|
323
|
-
style={{
|
|
313
|
+
color={theme.colors.toastInfo}
|
|
314
|
+
style={{ marginBottom: 10 }}
|
|
324
315
|
>
|
|
325
|
-
{
|
|
316
|
+
{t('SEARCH_AVAILABLE_PRINTER_MESSAGE', 'Use the search icon to find an available printer')}
|
|
326
317
|
</OText>
|
|
327
|
-
|
|
328
|
-
|
|
318
|
+
)}
|
|
319
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
320
|
+
<Controller
|
|
321
|
+
control={control}
|
|
322
|
+
name={currentPrinter?.type === 2 ? 'ip' : 'bt'}
|
|
323
|
+
rules={{
|
|
324
|
+
required: currentPrinter?.type === 2
|
|
325
|
+
? t('VALIDATION_ERROR_IP_ADDRESS_REQUIRED', 'Ip address is required')
|
|
326
|
+
: t('VALIDATION_ERROR_BLUETOOTH_PORN_REQUIRED', 'Bluetooth port name is required'),
|
|
327
|
+
pattern: {
|
|
328
|
+
value: currentPrinter?.type === 2
|
|
329
|
+
? /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i
|
|
330
|
+
: /^[a-zA-Z0-9]+$/i,
|
|
331
|
+
message: currentPrinter?.type === 2
|
|
332
|
+
? t('INVALID_ERROR_IP_ADDRESS', 'Invalid ip address')
|
|
333
|
+
: t('INVALID_ERROR_BLUETOOTH_PORT_NAME', 'Invalid bluetooth port name')
|
|
334
|
+
}
|
|
335
|
+
}}
|
|
336
|
+
defaultValue={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
|
|
337
|
+
render={() => (
|
|
338
|
+
<OInput
|
|
339
|
+
placeholder={currentPrinter?.type === 2
|
|
340
|
+
? t('IP_ADDRESS', 'Ip address')
|
|
341
|
+
: t('BLUETOOTH_PORT', 'Bluetooth port')
|
|
342
|
+
}
|
|
343
|
+
placeholderTextColor={theme.colors.arrowColor}
|
|
344
|
+
style={{
|
|
345
|
+
...styles.inputStyle,
|
|
346
|
+
borderColor: isErrorInput ? theme.colors.danger500 : theme.colors.tabBar
|
|
347
|
+
}}
|
|
348
|
+
value={currentPrinter?.type === 2 ? currentPrinter?.ip ?? '' : currentPrinter?.bt ?? ''}
|
|
349
|
+
selectionColor={theme.colors.primary}
|
|
350
|
+
color={theme.colors.textGray}
|
|
351
|
+
onChange={(value: any) => {
|
|
352
|
+
setValue(currentPrinter?.type === 2 ? 'ip' : 'bt', value)
|
|
353
|
+
setCurrentPrinter({
|
|
354
|
+
...currentPrinter,
|
|
355
|
+
[currentPrinter?.type === 2 ? 'ip' : 'bt']: value
|
|
356
|
+
})
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
|
+
)}
|
|
360
|
+
/>
|
|
361
|
+
{currentPrinter?.type === 1 && (
|
|
362
|
+
<>
|
|
363
|
+
{!discoverPort.loading ? (
|
|
364
|
+
<FAIcons
|
|
365
|
+
name='search'
|
|
366
|
+
size={22}
|
|
367
|
+
color={theme.colors.primary}
|
|
368
|
+
style={{ marginLeft: 10 }}
|
|
369
|
+
onPress={() => portDiscovery()}
|
|
370
|
+
/>
|
|
371
|
+
) : (
|
|
372
|
+
<ActivityIndicator
|
|
373
|
+
size="small"
|
|
374
|
+
style={{ marginLeft: 10 }}
|
|
375
|
+
color={theme.colors.primary}
|
|
376
|
+
/>
|
|
377
|
+
)}
|
|
378
|
+
</>
|
|
379
|
+
)}
|
|
380
|
+
</View>
|
|
381
|
+
</View>
|
|
382
|
+
<OText
|
|
383
|
+
size={14}
|
|
384
|
+
color={theme.colors.tabBar}
|
|
385
|
+
style={{ paddingTop: 5, paddingLeft: 10 }}
|
|
386
|
+
>
|
|
387
|
+
{discoverPort.msg ? (
|
|
388
|
+
<MessageAlert
|
|
389
|
+
message={discoverPort.msg}
|
|
390
|
+
resetMsg={() => setDiscoverPort({ ...discoverPort, msg: null })}
|
|
391
|
+
/>
|
|
392
|
+
) : (
|
|
393
|
+
`${t('EXAMPLE_SHORT', 'Ex:')} ${currentPrinter?.type === 2 ? '8.8.8.8' : currentPrinter?.portName1}`
|
|
394
|
+
)}
|
|
395
|
+
</OText>
|
|
329
396
|
</WrapperIcons>
|
|
330
397
|
)}
|
|
331
398
|
</ContainerEdition>
|
|
@@ -341,6 +408,7 @@ export const PrinterEdition = (props: any) => {
|
|
|
341
408
|
isDisabled={
|
|
342
409
|
isErrorNickname ||
|
|
343
410
|
!currentPrinter?.model ||
|
|
411
|
+
currentPrinter?.type === 1 && !currentPrinter?.bt ||
|
|
344
412
|
currentPrinter?.type === 2 && !currentPrinter?.ip
|
|
345
413
|
}
|
|
346
414
|
onClick={() => onSubmit()}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const PRINTERS = [
|
|
2
|
+
{ model: 'mPOP', emulation: 'StarPRNT', printMode: 'append' },
|
|
3
|
+
{ model: 'FVP10', emulation: 'StarLine', printMode: 'append' },
|
|
4
|
+
{ model: 'TSP100', emulation: 'StarGraphic', printMode: 'appendBitmapText' },
|
|
5
|
+
{ model: 'TSP100IV', emulation: 'StarLine', printMode: 'append' },
|
|
6
|
+
{ model: 'TSP65011', emulation: 'StarLine', printMode: 'append' },
|
|
7
|
+
{ model: 'TSP7001', emulation: 'StarLine', printMode: 'append' },
|
|
8
|
+
{ model: 'TSP80011', emulation: 'StarLine', printMode: 'append' },
|
|
9
|
+
{ model: 'SP700', emulation: 'StarDotImpact', printMode: 'append' },
|
|
10
|
+
{ model: 'SM-S210i', emulation: 'EscPosMobile', printMode: 'append' },
|
|
11
|
+
{ model: 'SM-S220i', emulation: 'EscPosMobile', printMode: 'append' },
|
|
12
|
+
{ model: 'SM-S230i', emulation: 'EscosMobile', printMode: 'append' },
|
|
13
|
+
{ model: 'SM-T300i/T300', emulation: 'EscPosMobile', printMode: 'append' },
|
|
14
|
+
{ model: 'SM-T400i', emulation: 'EscosMobile', printMode: 'append' },
|
|
15
|
+
{ model: 'SM-L200', emulation: 'StarPRNT', printMode: 'append' },
|
|
16
|
+
{ model: 'SM-L300', emulation: 'StarPRNT', printMode: 'append' },
|
|
17
|
+
{ model: 'BSC10', emulation: 'EscPos', bt: 'BT:BSC10', printMode: 'append' },
|
|
18
|
+
{ model: 'SM-S210i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
19
|
+
{ model: 'SM-S220i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
20
|
+
{ model: 'SM-S230i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
21
|
+
{ model: 'SM-T300i/T300 StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
22
|
+
{ model: 'SM-T400i StarPRNT', emulation: 'StarPRNT', printMode: 'append' },
|
|
23
|
+
]
|
|
@@ -102,7 +102,7 @@ export const PrinterSettings = (props: any) => {
|
|
|
102
102
|
type: type ?? _currentPrinter?.type ?? 1,
|
|
103
103
|
ip: ip ?? _currentPrinter?.ip ?? '',
|
|
104
104
|
portName: (type ?? _currentPrinter?.type) === 1 || !ip
|
|
105
|
-
? item.portName1 ?? _currentPrinter?.portName1
|
|
105
|
+
? item?.bt ?? item.portName1 ?? _currentPrinter?.portName1
|
|
106
106
|
: `TCP:${ip}`
|
|
107
107
|
}
|
|
108
108
|
edit ? (_printers[idx] = _item) : _printers.push(_item)
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from './styles';
|
|
23
23
|
import { OText, OAlert } from '../shared';
|
|
24
24
|
import { ProductItemAccordionParams } from '../../types';
|
|
25
|
+
import { getCurrenySymbol } from '../../utils';
|
|
25
26
|
|
|
26
27
|
export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
27
28
|
const {
|
|
@@ -71,26 +72,24 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
71
72
|
const parseOptions = typeof productInfo().options === 'string' ? JSON.parse(productInfo().options) : productInfo().options
|
|
72
73
|
|
|
73
74
|
const getProductPrice = (product: any) => {
|
|
74
|
-
let subOptionPrice = 0
|
|
75
|
-
if (product?.options
|
|
76
|
-
|
|
77
|
-
for (const
|
|
78
|
-
|
|
75
|
+
let subOptionPrice = 0
|
|
76
|
+
if (Array.isArray(product?.options)) {
|
|
77
|
+
if (product.options?.length > 0) {
|
|
78
|
+
for (const option of product.options) {
|
|
79
|
+
for (const suboption of option.suboptions) {
|
|
80
|
+
subOptionPrice += suboption.quantity * ((['left', 'right'].includes(suboption.position)) ? (suboption.half_price ?? suboption.price) : suboption.price)
|
|
81
|
+
}
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
const price = product.quantity * (product.price + subOptionPrice)
|
|
84
|
-
return parseFloat(price.toFixed(2))
|
|
85
|
-
}
|
|
86
|
+
const price = product.quantity * (product.price + subOptionPrice)
|
|
87
|
+
return parseFloat(price.toFixed(2))
|
|
88
|
+
}
|
|
86
89
|
|
|
87
90
|
const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return `${quantity} x ${name} ${pos} +${price}`
|
|
91
|
-
} else {
|
|
92
|
-
return 'No';
|
|
93
|
-
}
|
|
91
|
+
const pos = position ? `(${position})` : ''
|
|
92
|
+
return `${quantity} x ${name} ${pos} +${price}`
|
|
94
93
|
};
|
|
95
94
|
|
|
96
95
|
/*useEffect(() => {
|
|
@@ -160,7 +159,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
160
159
|
}}>
|
|
161
160
|
<View style={{ flexDirection: 'row' }}>
|
|
162
161
|
<OText size={12} color={theme.colors.textGray}>
|
|
163
|
-
{parsePrice(getProductPrice(product), { currency })}
|
|
162
|
+
{parsePrice(getProductPrice(product), { currency: getCurrenySymbol(currency) })}
|
|
164
163
|
</OText>
|
|
165
164
|
|
|
166
165
|
{(
|
|
@@ -281,7 +280,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
281
280
|
suboption.position,
|
|
282
281
|
)
|
|
283
282
|
: '',
|
|
284
|
-
price: parsePrice(suboption.price, { currency }),
|
|
283
|
+
price: (['left', 'right'].includes(suboption.position)) ? parsePrice(suboption.half_price ?? suboption.price, { currency: getCurrenySymbol(currency) }) : parsePrice(suboption.price, { currency: getCurrenySymbol(currency) }),
|
|
285
284
|
})}
|
|
286
285
|
</OText>
|
|
287
286
|
</ProductSubOption>
|