ordering-ui-react-native 0.17.93-release → 0.17.94-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 +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +20 -25
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +8 -21
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
package/package.json
CHANGED
|
@@ -98,27 +98,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
98
98
|
const [slaSettingTime, setSlaSettingTime] = useState(6000)
|
|
99
99
|
const [currentDeliveryType, setCurrentDeliveryType] = useState('Delivery')
|
|
100
100
|
const [search, setSearch] = useState(defaultSearchList)
|
|
101
|
-
const [selectedTabStatus, setSelectedTabStatus] = useState<any>([])
|
|
102
|
-
const [openedSelect, setOpenedSelect] = useState('')
|
|
103
|
-
|
|
104
|
-
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
105
|
-
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
106
|
-
|
|
107
|
-
const preorderTypeList = [
|
|
108
|
-
{ key: null, name: t('SLA', 'SLA\'s') },
|
|
109
|
-
{ key: 'in_time', name: t('OK', 'Ok') },
|
|
110
|
-
{ key: 'at_risk', name: t('AT_RISK', 'At Risk') },
|
|
111
|
-
{ key: 'delayed', name: t('DELAYED', 'Delayed') }
|
|
112
|
-
]
|
|
113
|
-
|
|
114
|
-
const defaultOrderTypes = [
|
|
115
|
-
{ key: 1, name: t('DELIVERY', 'Delivery') },
|
|
116
|
-
{ key: 2, name: t('PICKUP', 'Pickup') },
|
|
117
|
-
{ key: 3, name: t('EAT_IN', 'Eat in') },
|
|
118
|
-
{ key: 4, name: t('CURBSIDE', 'Curbside') },
|
|
119
|
-
{ key: 5, name: t('DRIVE_THRU', 'Drive thru') }
|
|
120
|
-
]
|
|
121
|
-
|
|
122
101
|
const deliveryStatus = [
|
|
123
102
|
{
|
|
124
103
|
key: t('OK', 'Ok'),
|
|
@@ -142,6 +121,26 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
142
121
|
backColor: '#E63757'
|
|
143
122
|
}
|
|
144
123
|
]
|
|
124
|
+
const [selectedTabStatus, setSelectedTabStatus] = useState<any>(deliveryStatus)
|
|
125
|
+
const [openedSelect, setOpenedSelect] = useState('')
|
|
126
|
+
|
|
127
|
+
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
128
|
+
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
129
|
+
|
|
130
|
+
const preorderTypeList = [
|
|
131
|
+
{ key: null, name: t('SLA', 'SLA\'s') },
|
|
132
|
+
{ key: 'in_time', name: t('OK', 'Ok') },
|
|
133
|
+
{ key: 'at_risk', name: t('AT_RISK', 'At Risk') },
|
|
134
|
+
{ key: 'delayed', name: t('DELAYED', 'Delayed') }
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
const defaultOrderTypes = [
|
|
138
|
+
{ key: 1, name: t('DELIVERY', 'Delivery') },
|
|
139
|
+
{ key: 2, name: t('PICKUP', 'Pickup') },
|
|
140
|
+
{ key: 3, name: t('EAT_IN', 'Eat in') },
|
|
141
|
+
{ key: 4, name: t('CURBSIDE', 'Curbside') },
|
|
142
|
+
{ key: 5, name: t('DRIVE_THRU', 'Drive thru') }
|
|
143
|
+
]
|
|
145
144
|
|
|
146
145
|
const styles = StyleSheet.create({
|
|
147
146
|
header: {
|
|
@@ -383,10 +382,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
383
382
|
setTags({ values: [] })
|
|
384
383
|
}, [currentTabSelected])
|
|
385
384
|
|
|
386
|
-
useEffect(() => {
|
|
387
|
-
setSelectedTabStatus(deliveryStatus)
|
|
388
|
-
}, [])
|
|
389
|
-
|
|
390
385
|
return (
|
|
391
386
|
<>
|
|
392
387
|
<View style={styles.header}>
|
|
@@ -100,12 +100,13 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
const getDelayMinutes = (order: any) => {
|
|
103
|
-
const
|
|
103
|
+
const offset = 300
|
|
104
|
+
const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
|
|
104
105
|
const _delivery = order?.delivery_datetime_utc
|
|
105
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
106
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm:ss' })
|
|
106
107
|
: parseDate(cdtToutc)
|
|
107
108
|
const _eta = order?.eta_time
|
|
108
|
-
const diffTimeAsSeconds = moment(_delivery
|
|
109
|
+
const diffTimeAsSeconds = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'seconds')
|
|
109
110
|
return Math.ceil(diffTimeAsSeconds / 60)
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -127,12 +128,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
127
128
|
return finalTaget
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
const getStatusClassName = (minutes: number) => {
|
|
131
|
-
if (isNaN(Number(minutes))) return 'in_time'
|
|
132
|
-
const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
|
|
133
|
-
return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
|
|
134
|
-
}
|
|
135
|
-
|
|
136
131
|
useEffect(() => {
|
|
137
132
|
const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
|
|
138
133
|
setAllowColumns({
|
|
@@ -152,15 +147,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
152
147
|
<Card key={order.id}>
|
|
153
148
|
{!!allowColumns?.slaBar && (
|
|
154
149
|
<Timestatus
|
|
155
|
-
|
|
156
|
-
backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time'
|
|
157
|
-
? '#00D27A'
|
|
158
|
-
: getStatusClassName(getDelayMinutes(order)) === 'at_risk'
|
|
159
|
-
? '#FFC700'
|
|
160
|
-
: getStatusClassName(getDelayMinutes(order)) === 'delayed'
|
|
161
|
-
? '#E63757'
|
|
162
|
-
: ''
|
|
163
|
-
}}
|
|
150
|
+
timeState={order?.time_status}
|
|
164
151
|
/>
|
|
165
152
|
)}
|
|
166
153
|
<Logo style={styles.logo}>
|
|
@@ -214,11 +201,11 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
214
201
|
<OText
|
|
215
202
|
style={styles.date}
|
|
216
203
|
color={
|
|
217
|
-
|
|
204
|
+
order?.time_status === 'in_time'
|
|
218
205
|
? '#00D27A'
|
|
219
|
-
:
|
|
206
|
+
: order?.time_status === 'at_risk'
|
|
220
207
|
? '#FFC700'
|
|
221
|
-
:
|
|
208
|
+
: order?.time_status === 'delayed'
|
|
222
209
|
? '#E63757'
|
|
223
210
|
: ''}
|
|
224
211
|
>
|
|
@@ -8,7 +8,7 @@ import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
|
|
|
8
8
|
|
|
9
9
|
function OrderListPropsAreEqual(prevProps: any, nextProps: any) {
|
|
10
10
|
return JSON.stringify(prevProps.order) === JSON.stringify(nextProps.order) &&
|
|
11
|
-
JSON.stringify(prevProps._order) === JSON.stringify(nextProps._order) &&
|
|
11
|
+
JSON.stringify(prevProps._order) === JSON.stringify(nextProps._order) &&
|
|
12
12
|
JSON.stringify(prevProps.currentOrdenSelected) === JSON.stringify(nextProps.currentOrdenSelected) &&
|
|
13
13
|
prevProps.currentTabSelected === nextProps.currentTabSelected
|
|
14
14
|
}
|
|
@@ -41,6 +41,16 @@ export const Timestatus = styled.View`
|
|
|
41
41
|
height: 55px;
|
|
42
42
|
border-radius: 20px;
|
|
43
43
|
top: 5px;
|
|
44
|
+
|
|
45
|
+
${({ timeState }: any) => timeState === 'in_time' && css`
|
|
46
|
+
background-color: #00D27A;
|
|
47
|
+
`}
|
|
48
|
+
${({ timeState }: any) => timeState === 'at_risk' && css`
|
|
49
|
+
background-color: #FFC700;
|
|
50
|
+
`}
|
|
51
|
+
${({ timeState }: any) => timeState === 'delayed' && css`
|
|
52
|
+
background-color: #E63757;
|
|
53
|
+
`}
|
|
44
54
|
`
|
|
45
55
|
|
|
46
56
|
export const AccordionSection = styled.View`
|