ordering-ui-react-native 0.17.71 → 0.17.72

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.71",
3
+ "version": "0.17.72",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -66,6 +66,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
66
66
  getNextProducts,
67
67
  handleUpdateProducts,
68
68
  professionalSelected,
69
+ handleUpdateProfessionals,
69
70
  handleChangeProfessionalSelected,
70
71
  onBusinessClick
71
72
  } = props
@@ -570,6 +571,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
570
571
  professionalList={business?.professionals}
571
572
  professionalSelected={professionalSelected}
572
573
  handleChangeProfessional={handleChangeProfessionalSelected}
574
+ handleUpdateProfessionals={handleUpdateProfessionals}
573
575
  onSave={() => setOpenService(false)}
574
576
  onClose={() => setOpenService(false)}
575
577
  />
@@ -452,7 +452,7 @@ const CheckoutUI = (props: any) => {
452
452
  <OText
453
453
  size={14}
454
454
  >
455
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
455
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
456
456
  </OText>
457
457
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
458
458
  </DeliveryOptionItem>
@@ -84,16 +84,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
84
84
  review: orderCompleted.review && currentOrder.review,
85
85
  user_review: orderCompleted.user_review && currentOrder.user_review,
86
86
  products: [orderCompleted.products, currentOrder.products].flat()
87
- }))
87
+ })).filter((order: any) => {
88
+ const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
89
+ if (!isDuplicate) {
90
+ uniqueOrders.push(order?.cart_group_id)
91
+ return true
92
+ }
93
+ return false
94
+ })
88
95
  : order)
89
- .filter((order: any) => {
90
- const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
91
- if (!isDuplicate) {
92
- uniqueOrders.push(order?.cart_group_id)
93
- return true
94
- }
95
- return false
96
- })
97
96
  setOrders(orders)
98
97
  }, [JSON.stringify(_orders)])
99
98
 
@@ -111,9 +111,15 @@ const ServiceFormUI = (props: ServiceFormParams) => {
111
111
 
112
112
  const isBusyTime = (professional: any) => {
113
113
  if (professional?.busy_times?.length === 0 || !dateSelected) return false
114
- const valid = professional?.busy_times.some((item: any) => {
115
- return moment(item?.start).valueOf() <= moment(dateSelected).valueOf() &&
116
- moment(dateSelected).valueOf() <= moment(item?.end).valueOf()
114
+ const duration = product?.duration ?? 0
115
+ const busyTimes = isCartProduct
116
+ ? professional?.busy_times.filter((item: any) => !(item.start === productCart?.calendar_event?.start && item.end === productCart?.calendar_event?.end))
117
+ : [...professional?.busy_times]
118
+ const valid = busyTimes.some((item: any) => {
119
+ return (moment.utc(item?.start).local().valueOf() <= moment(dateSelected).valueOf() &&
120
+ moment(dateSelected).valueOf() <= moment.utc(item?.end).local().valueOf()) ||
121
+ (moment.utc(item?.start).local().valueOf() <= moment(dateSelected).add(duration, 'minutes').valueOf() &&
122
+ moment(dateSelected).add(duration, 'minutes').valueOf() <= moment.utc(item?.end).local().valueOf())
117
123
  })
118
124
  return valid
119
125
  }
@@ -523,7 +529,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
523
529
  ? t('SOLD_OUT', 'Sold out')
524
530
  : t('BOOK', 'Book'))}
525
531
  style={styles.buttonStyle}
526
- isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected}
532
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected || isBusyTime(currentProfessional)}
527
533
  textStyle={{ fontSize: 14, color: theme.colors.white }}
528
534
  />
529
535
  )}
@@ -249,6 +249,7 @@ export interface BusinessProductsListingParams {
249
249
  handleUpdateProducts?: any;
250
250
  professionalSelected?: any;
251
251
  handleChangeProfessionalSelected?: any;
252
+ handleUpdateProfessionals?: any;
252
253
  onBusinessClick?: any;
253
254
  }
254
255
  export interface BusinessBasicInformationParams {