ordering-ui-react-native 0.12.76 → 0.12.77

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.12.76",
3
+ "version": "0.12.77",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -333,144 +333,147 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
333
333
  onClickButton={() => navigation.navigate('Orders')}
334
334
  />
335
335
  )}
336
- <View style={{ flex: 1 }}>
337
- <OrderHeaderComponent
338
- order={order}
339
- handleOpenMapView={handleOpenMapView}
340
- handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
341
- getOrderStatus={getOrderStatus}
342
- handleArrowBack={handleArrowBack}
343
- logisticOrderStatus={logisticOrderStatus}
344
- />
345
- {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
346
- <>
347
- <OrderDetailsContainer
348
- keyboardShouldPersistTaps="handled"
349
- showsVerticalScrollIndicator={false}
350
- >
351
- {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
352
- <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
353
- )) : (
354
- <OrderDetailsInformation order={order} />
355
- )}
356
- </OrderDetailsContainer>
357
- {showFloatButtonsPickUp[order?.status] && (
358
- <FloatingButton
359
- disabled={props.order?.loading}
360
- btnText={t('PICKUP_FAILED', 'Pickup failed')}
361
- isSecondaryBtn={false}
362
- secondButtonClick={() =>
363
- handleChangeOrderStatus && handleChangeOrderStatus(9)
364
- }
365
- firstButtonClick={() =>
366
- handleViewActionOrder && handleViewActionOrder('pickupFailed')
367
- }
368
- secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
369
- secondButton={true}
370
- firstColorCustom={theme.colors.red}
371
- secondColorCustom={theme.colors.green}
372
- widthButton={'45%'}
373
- />
374
- )}
375
- {(order?.status === 9 || order?.status === 19) && (
336
+ {!((!order || Object.keys(order).length === 0) &&
337
+ (props.order?.error?.length < 1 || !props.order?.error)) && (
338
+ <View style={{ flex: 1 }}>
339
+ <OrderHeaderComponent
340
+ order={order}
341
+ handleOpenMapView={handleOpenMapView}
342
+ handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
343
+ getOrderStatus={getOrderStatus}
344
+ handleArrowBack={handleArrowBack}
345
+ logisticOrderStatus={logisticOrderStatus}
346
+ />
347
+ {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
376
348
  <>
377
- <FloatingButton
378
- disabled={props.order?.loading}
379
- btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
380
- isSecondaryBtn={false}
381
- secondButtonClick={() =>
382
- handleChangeOrderStatus && handleChangeOrderStatus(11)
349
+ <OrderDetailsContainer
350
+ keyboardShouldPersistTaps="handled"
351
+ showsVerticalScrollIndicator={false}
352
+ >
353
+ {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
354
+ <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
355
+ )) : (
356
+ <OrderDetailsInformation order={order} />
357
+ )}
358
+ </OrderDetailsContainer>
359
+ {showFloatButtonsPickUp[order?.status] && (
360
+ <FloatingButton
361
+ disabled={props.order?.loading}
362
+ btnText={t('PICKUP_FAILED', 'Pickup failed')}
363
+ isSecondaryBtn={false}
364
+ secondButtonClick={() =>
365
+ handleChangeOrderStatus && handleChangeOrderStatus(9)
366
+ }
367
+ firstButtonClick={() =>
368
+ handleViewActionOrder && handleViewActionOrder('pickupFailed')
369
+ }
370
+ secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
371
+ secondButton={true}
372
+ firstColorCustom={theme.colors.red}
373
+ secondColorCustom={theme.colors.green}
374
+ widthButton={'45%'}
375
+ />
376
+ )}
377
+ {(order?.status === 9 || order?.status === 19) && (
378
+ <>
379
+ <FloatingButton
380
+ disabled={props.order?.loading}
381
+ btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
382
+ isSecondaryBtn={false}
383
+ secondButtonClick={() =>
384
+ handleChangeOrderStatus && handleChangeOrderStatus(11)
385
+ }
386
+ firstButtonClick={() =>
387
+ handleViewActionOrder && handleViewActionOrder('deliveryFailed')
388
+ }
389
+ secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
390
+ secondButton={true}
391
+ firstColorCustom={theme.colors.red}
392
+ secondColorCustom={theme.colors.green}
393
+ widthButton={'45%'}
394
+ />
395
+ </>
396
+ )}
397
+ {showFloatButtonsAcceptOrReject[order?.status] && (
398
+ <FloatingButton
399
+ btnText={t('REJECT', 'Reject')}
400
+ isSecondaryBtn={false}
401
+ secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
402
+ firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
403
+ secondBtnText={t('ACCEPT', 'Accept')}
404
+ secondButton={true}
405
+ firstColorCustom={theme.colors.red}
406
+ secondColorCustom={theme.colors.green}
407
+ widthButton={'45%'}
408
+ />
409
+ )}
410
+ </>
411
+ )}
412
+ {openModalForMapView && (
413
+ <OModal
414
+ open={openModalForMapView}
415
+ onClose={() => handleOpenMapView()}
416
+ entireModal
417
+ customClose>
418
+ <DriverMap
419
+ navigation={navigation}
420
+ order={order}
421
+ orderStatus={getOrderStatus(order?.status, t)?.value || ''}
422
+ location={locationMarker}
423
+ readOnly
424
+ updateDriverPosition={updateDriverPosition}
425
+ driverUpdateLocation={driverUpdateLocation}
426
+ setDriverUpdateLocation={setDriverUpdateLocation}
427
+ handleViewActionOrder={handleViewActionOrder}
428
+ isBusinessMarker={isBusinessMarker}
429
+ isToFollow={isToFollow}
430
+ showAcceptOrReject={
431
+ showFloatButtonsAcceptOrReject[order?.status]
383
432
  }
384
- firstButtonClick={() =>
385
- handleViewActionOrder && handleViewActionOrder('deliveryFailed')
433
+ handleOpenMapView={handleOpenMapView}
434
+ />
435
+ </OModal>
436
+ )}
437
+ {openModalForBusiness && (
438
+ <OModal
439
+ open={openModalForBusiness}
440
+ order={order}
441
+ title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
442
+ entireModal
443
+ onClose={() => handleCloseModal()}>
444
+ <Chat
445
+ type={
446
+ openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
386
447
  }
387
- secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
388
- secondButton={true}
389
- firstColorCustom={theme.colors.red}
390
- secondColorCustom={theme.colors.green}
391
- widthButton={'45%'}
448
+ orderId={order?.id}
449
+ messages={messages}
450
+ order={order}
451
+ setMessages={setMessages}
392
452
  />
393
- </>
453
+ </OModal>
394
454
  )}
395
- {showFloatButtonsAcceptOrReject[order?.status] && (
396
- <FloatingButton
397
- btnText={t('REJECT', 'Reject')}
398
- isSecondaryBtn={false}
399
- secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
400
- firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
401
- secondBtnText={t('ACCEPT', 'Accept')}
402
- secondButton={true}
403
- firstColorCustom={theme.colors.red}
404
- secondColorCustom={theme.colors.green}
405
- widthButton={'45%'}
406
- />
455
+ {openModalForAccept && (
456
+ <OModal
457
+ open={openModalForAccept}
458
+ onClose={() => setOpenModalForAccept(false)}
459
+ entireModal
460
+ customClose>
461
+ <AcceptOrRejectOrder
462
+ handleUpdateOrder={handleChangeOrderStatus}
463
+ closeModal={setOpenModalForAccept}
464
+ customerCellphone={order?.customer?.cellphone}
465
+ loading={props.order?.loading}
466
+ action={actionOrder}
467
+ orderId={order?.id}
468
+ notShowCustomerPhone
469
+ actions={actions}
470
+ orderTitle={orderTitle}
471
+ appTitle={appTitle}
472
+ />
473
+ </OModal>
407
474
  )}
408
- </>
409
- )}
410
- {openModalForMapView && (
411
- <OModal
412
- open={openModalForMapView}
413
- onClose={() => handleOpenMapView()}
414
- entireModal
415
- customClose>
416
- <DriverMap
417
- navigation={navigation}
418
- order={order}
419
- orderStatus={getOrderStatus(order?.status, t)?.value || ''}
420
- location={locationMarker}
421
- readOnly
422
- updateDriverPosition={updateDriverPosition}
423
- driverUpdateLocation={driverUpdateLocation}
424
- setDriverUpdateLocation={setDriverUpdateLocation}
425
- handleViewActionOrder={handleViewActionOrder}
426
- isBusinessMarker={isBusinessMarker}
427
- isToFollow={isToFollow}
428
- showAcceptOrReject={
429
- showFloatButtonsAcceptOrReject[order?.status]
430
- }
431
- handleOpenMapView={handleOpenMapView}
432
- />
433
- </OModal>
434
- )}
435
- {openModalForBusiness && (
436
- <OModal
437
- open={openModalForBusiness}
438
- order={order}
439
- title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
440
- entireModal
441
- onClose={() => handleCloseModal()}>
442
- <Chat
443
- type={
444
- openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
445
- }
446
- orderId={order?.id}
447
- messages={messages}
448
- order={order}
449
- setMessages={setMessages}
450
- />
451
- </OModal>
452
- )}
453
- {openModalForAccept && (
454
- <OModal
455
- open={openModalForAccept}
456
- onClose={() => setOpenModalForAccept(false)}
457
- entireModal
458
- customClose>
459
- <AcceptOrRejectOrder
460
- handleUpdateOrder={handleChangeOrderStatus}
461
- closeModal={setOpenModalForAccept}
462
- customerCellphone={order?.customer?.cellphone}
463
- loading={props.order?.loading}
464
- action={actionOrder}
465
- orderId={order?.id}
466
- notShowCustomerPhone
467
- actions={actions}
468
- orderTitle={orderTitle}
469
- appTitle={appTitle}
470
- />
471
- </OModal>
475
+ </View>
472
476
  )}
473
- </View>
474
477
  {alertState?.open && (
475
478
  <Alert
476
479
  open={alertState.open}
@@ -175,7 +175,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
175
175
  )}
176
176
  </>
177
177
  </OText>
178
- {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
178
+ {!order?.isLogistic && order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
179
179
  <OText size={13}>
180
180
  {`${order?.paymethod?.name} - ${order.delivery_type === 1
181
181
  ? t('DELIVERY', 'Delivery')