ordering-ui-react-native 0.16.82 → 0.16.83
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/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/Checkout/index.tsx +17 -10
- package/themes/original/src/components/OrdersOption/index.tsx +3 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +4 -0
- package/themes/original/src/components/ProductForm/index.tsx +4 -4
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
28
28
|
getProductMax,
|
|
29
29
|
onDeleteProduct,
|
|
30
30
|
onEditProduct,
|
|
31
|
+
currency
|
|
31
32
|
} = props;
|
|
32
33
|
|
|
33
34
|
const [, t] = useLanguage();
|
|
@@ -147,7 +148,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
147
148
|
}}>
|
|
148
149
|
<View style={{ flexDirection: 'row' }}>
|
|
149
150
|
<OText size={12} color={theme.colors.textGray}>
|
|
150
|
-
{parsePrice(getProductPrice(product))}
|
|
151
|
+
{parsePrice(getProductPrice(product), { currency })}
|
|
151
152
|
</OText>
|
|
152
153
|
|
|
153
154
|
{(
|
|
@@ -268,7 +269,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
268
269
|
suboption.position,
|
|
269
270
|
)
|
|
270
271
|
: '',
|
|
271
|
-
price: parsePrice(suboption.price),
|
|
272
|
+
price: parsePrice(suboption.price, { currency }),
|
|
272
273
|
})}
|
|
273
274
|
</OText>
|
|
274
275
|
</ProductSubOption>
|
|
@@ -393,6 +393,7 @@ export interface ProductItemAccordionParams {
|
|
|
393
393
|
offsetDisabled?: any;
|
|
394
394
|
isFromCheckout?: any;
|
|
395
395
|
isClickableEvent?: any;
|
|
396
|
+
currency?: any;
|
|
396
397
|
}
|
|
397
398
|
export interface ReviewOrderParams {
|
|
398
399
|
order?: { orderId: number; businessId: number; logo: string };
|
|
@@ -818,16 +818,23 @@ export const Checkout = (props: any) => {
|
|
|
818
818
|
|
|
819
819
|
const getOrder = async (cartId: any) => {
|
|
820
820
|
try {
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
821
|
+
let result: any = {}
|
|
822
|
+
const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
|
|
823
|
+
if (cart) {
|
|
824
|
+
result = { ...cart }
|
|
825
|
+
} else {
|
|
826
|
+
setCartState({ ...cartState, loading: true })
|
|
827
|
+
const url = `${ordering.root}/carts/${cartId}`
|
|
828
|
+
const response = await fetch(url, {
|
|
829
|
+
method: 'GET',
|
|
830
|
+
headers: {
|
|
831
|
+
'Content-Type': 'application/json',
|
|
832
|
+
Authorization: `Bearer ${token}`
|
|
833
|
+
}
|
|
834
|
+
})
|
|
835
|
+
const content = await response.json();
|
|
836
|
+
result = content.result
|
|
837
|
+
}
|
|
831
838
|
|
|
832
839
|
let publicKey = null
|
|
833
840
|
try {
|
|
@@ -141,7 +141,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
141
141
|
|
|
142
142
|
useFocusEffect(
|
|
143
143
|
React.useCallback(() => {
|
|
144
|
-
|
|
144
|
+
if (!businessesSearchList) {
|
|
145
|
+
loadOrders(false, false, false, true)
|
|
146
|
+
}
|
|
145
147
|
}, [navigation])
|
|
146
148
|
)
|
|
147
149
|
|
|
@@ -102,6 +102,10 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
|
|
|
102
102
|
showToast(ToastType.Error, t('VALIDATION_ERROR_INTEGER', 'The _attribute_ must be an integer.').replace('_attribute_', placeholderText))
|
|
103
103
|
return
|
|
104
104
|
}
|
|
105
|
+
if (Number(spotNumber) < 0) {
|
|
106
|
+
showToast(ToastType.Error, t('VALIDATION_MUST_BIGGER_ZERO', '_attribute_ must be bigger than zero').replace('_attribute_', placeholderText))
|
|
107
|
+
return
|
|
108
|
+
}
|
|
105
109
|
const isVehicle = Object.values(vehicle).every(e => e)
|
|
106
110
|
const bodyToSend: any = {}
|
|
107
111
|
spotNumber && (bodyToSend.spot_number = spotNumber)
|
|
@@ -981,15 +981,15 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
981
981
|
<OText size={16} lineHeight={24} weight={'600'}>
|
|
982
982
|
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
983
983
|
</OText>
|
|
984
|
-
{product?.minimum_per_order && productCart?.quantity
|
|
985
|
-
{product?.maximum_per_order && productCart?.quantity
|
|
984
|
+
{product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
|
|
985
|
+
{product?.maximum_per_order && productCart?.quantity >= product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
|
|
986
986
|
</View>
|
|
987
987
|
{productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
988
988
|
<>
|
|
989
989
|
<View style={styles.quantityControl}>
|
|
990
990
|
<TouchableOpacity
|
|
991
991
|
onPress={decrement}
|
|
992
|
-
disabled={productCart.quantity === 1 || isSoldOut}>
|
|
992
|
+
disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order)}>
|
|
993
993
|
<OIcon
|
|
994
994
|
src={theme.images.general.minus}
|
|
995
995
|
width={16}
|
|
@@ -1095,7 +1095,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1095
1095
|
export const ProductForm = (props: any) => {
|
|
1096
1096
|
const productOptionsProps = {
|
|
1097
1097
|
...props,
|
|
1098
|
-
productCart: { quantity: props?.product?.maximum_per_order || 1 },
|
|
1098
|
+
productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
|
|
1099
1099
|
UIComponent: ProductOptionsUI,
|
|
1100
1100
|
};
|
|
1101
1101
|
|