@bytebrand/fe-ui-core 4.2.153 → 4.2.154
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
package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx
CHANGED
|
@@ -73,95 +73,137 @@ const OrderStatusSection = ({
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
const defaultCarProps = {
|
|
77
|
+
car: {
|
|
78
|
+
_id: '',
|
|
79
|
+
mainData: {
|
|
80
|
+
make: '',
|
|
81
|
+
model: '',
|
|
82
|
+
subModel: ''
|
|
83
|
+
},
|
|
84
|
+
metaData: {
|
|
85
|
+
mainImageId: ''
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
buyingType: '',
|
|
89
|
+
selfPickup: false,
|
|
90
|
+
paybackPeriod: 0,
|
|
91
|
+
monthlyInstallment: 0,
|
|
92
|
+
status: '',
|
|
93
|
+
request: '',
|
|
94
|
+
registration: false,
|
|
95
|
+
currentSalesPrice: 0,
|
|
96
|
+
deposit: 0,
|
|
97
|
+
preparationCost: 0,
|
|
98
|
+
licensePlateCost: 0,
|
|
99
|
+
registrationCost: 0,
|
|
100
|
+
transportationCost: 0,
|
|
101
|
+
customerAddress: {
|
|
102
|
+
customerFirstname: '',
|
|
103
|
+
customerLastname: '',
|
|
104
|
+
customerStreet: '',
|
|
105
|
+
customerZip: ''
|
|
106
|
+
},
|
|
107
|
+
deliveryAddress: {
|
|
108
|
+
deliveryPartner: '',
|
|
109
|
+
deliveryStreet: '',
|
|
110
|
+
deliveryZip: '',
|
|
111
|
+
deliveryCity: ''
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
76
115
|
const renderRequestedCars = () => {
|
|
77
116
|
return (
|
|
78
117
|
<>
|
|
79
|
-
{!!orderedCars && orderedCars.map((
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
...
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
118
|
+
{!!orderedCars && orderedCars.map((orderedCarData: any, index: number) => {
|
|
119
|
+
if (orderedCarData && typeof orderedCarData.car === 'object') {
|
|
120
|
+
const orderedCar = { ...defaultCarProps, ...orderedCarData };
|
|
121
|
+
const { car: { _id } } = orderedCar;
|
|
122
|
+
const { car: { mainData: { make, model, subModel } } } = orderedCar;
|
|
123
|
+
const { car: { metaData: { mainImageId } } } = orderedCar;
|
|
124
|
+
const {
|
|
125
|
+
buyingType,
|
|
126
|
+
selfPickup,
|
|
127
|
+
paybackPeriod,
|
|
128
|
+
monthlyInstallment,
|
|
129
|
+
status,
|
|
130
|
+
request,
|
|
131
|
+
registration,
|
|
132
|
+
currentSalesPrice,
|
|
133
|
+
deposit,
|
|
134
|
+
preparationCost,
|
|
135
|
+
licensePlateCost,
|
|
136
|
+
registrationCost,
|
|
137
|
+
transportationCost,
|
|
138
|
+
customerAddress,
|
|
139
|
+
deliveryAddress
|
|
140
|
+
} = orderedCar;
|
|
141
|
+
|
|
142
|
+
const additionalOrderData = {
|
|
143
|
+
addressData: [
|
|
144
|
+
...customerAddress ? [{ label: t('MyOrderPage:billingAddress'), value: getTransformAddressToString(customerAddress) }] : [],
|
|
145
|
+
...deliveryAddress ? [{ label: t('MyOrderPage:vehicleDelivery'), value: getTransformAddressToString(deliveryAddress) }] : []
|
|
146
|
+
],
|
|
147
|
+
carPriceData: [
|
|
148
|
+
...currentSalesPrice ? [getDataPriceItem(currentSalesPrice, t('MyOrderPage:carPrice'))] : [],
|
|
149
|
+
...preparationCost ? [getDataPriceItem(preparationCost, t('MyOrderPage:preparationCost'))] : [],
|
|
150
|
+
...registrationCost ? [getDataPriceItem(registrationCost, t('MyOrderPage:vehicleRegistration'))] : [],
|
|
151
|
+
...licensePlateCost ? [getDataPriceItem(licensePlateCost, t('MyOrderPage:licensePlates'))] : [],
|
|
152
|
+
...transportationCost ? [getDataPriceItem(transportationCost, t('MyOrderPage:delivery'))] : [],
|
|
153
|
+
...buyingType !== 'buy' ? [
|
|
154
|
+
...monthlyInstallment ? [
|
|
155
|
+
{
|
|
156
|
+
label: t(`MyOrderPage:${buyingType}Rate`),
|
|
157
|
+
value: t('MyOrderPage:monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f', '', '€') })
|
|
158
|
+
}] : [],
|
|
159
|
+
...paybackPeriod ? [{ label: t('MyOrderPage:runningTime'), value: t('MyOrderPage:paybackPeriod', { paybackPeriod }) }] : [],
|
|
160
|
+
...deposit ? [getDataPriceItem(deposit, t('MyOrderPage:deposit'))] : []
|
|
161
|
+
] : []
|
|
162
|
+
],
|
|
163
|
+
overallRate: {
|
|
164
|
+
label: t('MyOrderPage:yourOverallRate'),
|
|
165
|
+
value: buyingType === 'buy' ? currentSalesPrice : monthlyInstallment
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const additionalOrderInfoProps = {
|
|
170
|
+
t,
|
|
171
|
+
additionalOrderData,
|
|
172
|
+
redirectToUrl,
|
|
173
|
+
buyingType
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const imageUrl = getSupportedImageFormat(_id, mainImageId, 'small');
|
|
177
|
+
|
|
178
|
+
const orderStatusCarProps = {
|
|
179
|
+
make,
|
|
180
|
+
model,
|
|
181
|
+
subModel,
|
|
182
|
+
buyingType,
|
|
183
|
+
imageUrl,
|
|
184
|
+
selfPickup,
|
|
185
|
+
paybackPeriod,
|
|
186
|
+
monthlyInstallment,
|
|
187
|
+
status,
|
|
188
|
+
t,
|
|
189
|
+
request,
|
|
190
|
+
registration,
|
|
191
|
+
currentSalesPrice,
|
|
192
|
+
onClick: () => onDetailsClick(_id)
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const title = <span>
|
|
196
|
+
{t('orderStatus.title')}:
|
|
197
|
+
<span className={styles.orderStatus}>{t(`orderStatus.${status}`)}</span>
|
|
198
|
+
</span>;
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<DashboardSection key={index} title={title}>
|
|
202
|
+
<OrderStatusCar { ...orderStatusCarProps } />
|
|
203
|
+
{withAdditionalInfo ? <AdditionalOrderInfo { ...additionalOrderInfoProps } /> : null}
|
|
204
|
+
</DashboardSection>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
165
207
|
})}
|
|
166
208
|
</>
|
|
167
209
|
);
|