@bytebrand/fe-ui-core 4.2.241 → 4.2.243
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/source/components/Checkout/CheckoutStepper/CheckoutStepper.styl +2 -190
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.styl +2 -2
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.tsx +3 -3
- package/source/components/InfoBlocks/FirstInfoBlock/FirstInfoBlockItem/FirstInfoBlockItem.styl +4 -6
- package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.styl +5 -1
- package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.tsx +1 -1
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +43 -27
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx +62 -27
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.styl +9 -1
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +36 -32
- package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +1 -1
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.styl +45 -0
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +112 -42
- package/source/components/VehicleDetailedSlider/partials/Stats.tsx +2 -2
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +4 -2
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +35 -1
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +8 -2
- package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.styl +11 -2
- package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +2 -1
- package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +0 -2
- package/source/components/_common/Button/Button.tsx +4 -2
- package/source/components/_common/IconSVG/IconSVGConfig.tsx +2 -0
- package/source/components/_common/IconSVG/SVG/slider/YoutubeButton.tsx +26 -0
- package/source/components/_common/MaterialAutocomplete/MaterialAutocomplete.styled.tsx +8 -8
- package/source/components/_common/MaterialSelect/MaterialSelect.styled.tsx +4 -4
- package/source/components/_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper.tsx +12 -4
- package/source/components/_common/withStats/withStats.styl +3 -0
- package/source/components/_common/withStats/withStats.tsx +18 -15
- package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.styl +3 -1
- package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.tsx +7 -7
- package/source/framework/types/types.ts +2 -0
- package/source/framework/utils/CommonUtils.ts +1 -0
- package/source/framework/utils/DateUtils.ts +8 -0
package/package.json
CHANGED
|
@@ -30,193 +30,5 @@
|
|
|
30
30
|
[class*='MuiPickersToolbar-toolbar']
|
|
31
31
|
background-color: #005CCB !important;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// .root
|
|
37
|
-
// & [class*='MuiStepLabel-label'][class*='MuiStepLabel-alternativeLabel']
|
|
38
|
-
// fontSize: 10
|
|
39
|
-
// maxWidth: 56
|
|
40
|
-
|
|
41
|
-
// & [class*='MuiStepLabel-label'][class*='MuiStepLabel-active']
|
|
42
|
-
// fontWeight: bold
|
|
43
|
-
|
|
44
|
-
// & [class*='MuiSvgIcon-root']
|
|
45
|
-
// width: 24
|
|
46
|
-
// height: 24
|
|
47
|
-
|
|
48
|
-
// & [class*='MuiStepConnector-line']
|
|
49
|
-
// borderWidth: 2px
|
|
50
|
-
|
|
51
|
-
// & [class*='MuiStepConnector-vertical']
|
|
52
|
-
// marginLeft: 50,
|
|
53
|
-
// padding: 12px 0 16px
|
|
54
|
-
|
|
55
|
-
// .active
|
|
56
|
-
// @media (min-width: 992px):
|
|
57
|
-
// backgroundColor: rgba(0, 92, 203, 0.08)
|
|
58
|
-
|
|
59
|
-
// & [class*='MuiStepIcon-text']
|
|
60
|
-
// fill: white !important
|
|
61
|
-
|
|
62
|
-
// & [class*='MuiStepIcon-active']
|
|
63
|
-
// color: #005CCB
|
|
64
|
-
// fontWeight: bold
|
|
65
|
-
// & [class*='MuiStepConnector-line']
|
|
66
|
-
// borderColor: #005CCB
|
|
67
|
-
// borderTopWidth: 2px
|
|
68
|
-
|
|
69
|
-
// .isCompleted
|
|
70
|
-
// & [class*='MuiStep-vertical'] + [class*='MuiStepConnector-vertical']
|
|
71
|
-
// & [class*='MuiStepConnector-line']
|
|
72
|
-
// borderColor: #005CCB
|
|
73
|
-
|
|
74
|
-
// .stepper
|
|
75
|
-
// & [class*='MuiStepper-root']
|
|
76
|
-
// padding: 0
|
|
77
|
-
// // overflow: 'scroll'
|
|
78
|
-
|
|
79
|
-
// .labelWrap
|
|
80
|
-
// & [class*='MuiStepLabel-label']
|
|
81
|
-
// marginTop: 7
|
|
82
|
-
// lineHeight: 11px
|
|
83
|
-
|
|
84
|
-
// .verticalWrap
|
|
85
|
-
// padding: 14px 0 14px 26px
|
|
86
|
-
// borderRadius: 0px 38px 38px 0px
|
|
87
|
-
// boxSizing: border-box
|
|
88
|
-
|
|
89
|
-
// & [class*='MuiStepLabel-iconContainer']
|
|
90
|
-
// paddingRight: 17
|
|
91
|
-
|
|
92
|
-
// & [class*='MuiSvgIcon-root']
|
|
93
|
-
// width: 48
|
|
94
|
-
// height: 48
|
|
95
|
-
|
|
96
|
-
// & [class*='MuiStepLabel-label']
|
|
97
|
-
// color: rgba(0, 0, 0, 0.83)
|
|
98
|
-
// fontWeight: bold
|
|
99
|
-
// fontSize: 22
|
|
100
|
-
|
|
101
|
-
// .default
|
|
102
|
-
// & [class*='MuiStepIcon-text']
|
|
103
|
-
// fill: grey
|
|
104
|
-
|
|
105
|
-
// & [class*='MuiStepIcon-root']
|
|
106
|
-
// color: transparent
|
|
107
|
-
// border: 1px solid grey
|
|
108
|
-
// boxSizing: border-box
|
|
109
|
-
// borderRadius: 50%
|
|
110
|
-
|
|
111
|
-
// & [class*='MuiStepLabel-label']
|
|
112
|
-
// color: rgba(0, 0, 0, 0.38)
|
|
113
|
-
// fontWeight: 400
|
|
114
|
-
|
|
115
|
-
// .completeStep
|
|
116
|
-
// color: #005CCB
|
|
117
|
-
// & [class*='MuiStepIcon-root']
|
|
118
|
-
// borderColor: #005CCB
|
|
119
|
-
// borderWidth: 2px
|
|
120
|
-
|
|
121
|
-
// & [class*='MuiStepIcon-text']
|
|
122
|
-
// fill: #005CCB
|
|
123
|
-
// fontWeight: bold
|
|
124
|
-
|
|
125
|
-
// & [class*='MuiStepLabel-label'][class*='MuiStepLabel-alternativeLabel']
|
|
126
|
-
// color: #005CCB
|
|
127
|
-
|
|
128
|
-
// & [class*='MuiStepLabel-label']
|
|
129
|
-
// color: #005CCB
|
|
130
|
-
|
|
131
|
-
// & [class*='MuiStepConnector-lineVertical']
|
|
132
|
-
// borderColor: #005CCB
|
|
133
|
-
|
|
134
|
-
// .completeLine
|
|
135
|
-
// & [class*='MuiStepConnector-line']
|
|
136
|
-
// borderColor: #005CCB
|
|
137
|
-
// borderTopWidth: 2px
|
|
138
|
-
|
|
139
|
-
// & [class*='MuiStepConnector-line'][class*='MuiStepConnector-lineVertical']
|
|
140
|
-
// borderColor: #005CCB
|
|
141
|
-
|
|
142
|
-
// .activeLine
|
|
143
|
-
// & [class*='MuiStepConnector-line']
|
|
144
|
-
// borderColor: #005CCB
|
|
145
|
-
// borderTopWidth: 2px
|
|
146
|
-
|
|
147
|
-
// .minutes
|
|
148
|
-
// fontSize: 14
|
|
149
|
-
// color: rgba(0, 0, 0, 0.63)
|
|
150
|
-
// display: block
|
|
151
|
-
// textAlign: left
|
|
152
|
-
// fontWeight: 400
|
|
153
|
-
|
|
154
|
-
// .buttonItem
|
|
155
|
-
// margin: 0
|
|
156
|
-
// padding: 0
|
|
157
|
-
|
|
158
|
-
// // .checkoutFooter:
|
|
159
|
-
// // display: 'block'
|
|
160
|
-
// // width: '100%'
|
|
161
|
-
// // textAlign: 'center'
|
|
162
|
-
// // background: '#f2f2f2'
|
|
163
|
-
// // color: '#757575'
|
|
164
|
-
// // fontSize: '7px'
|
|
165
|
-
|
|
166
|
-
// // .checkoutFooterItem:
|
|
167
|
-
// // margin: '0 4px'
|
|
168
|
-
|
|
169
|
-
// // .buttonWeiter
|
|
170
|
-
// // width: '328px'
|
|
171
|
-
// // margin: '16px auto'
|
|
172
|
-
// // display: 'block'
|
|
173
|
-
// // height: '44px'
|
|
174
|
-
// // textTransform: 'none'
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// .stepperWrapper
|
|
195
|
-
// width: 100%
|
|
196
|
-
// overflow: hidden
|
|
197
|
-
|
|
198
|
-
// +media-tablet-landscape-up()
|
|
199
|
-
// .stepperWrapper
|
|
200
|
-
// box-sizing: border-box
|
|
201
|
-
// background-color: #fff
|
|
202
|
-
// width: 376px
|
|
203
|
-
// box-shadow: 2px 0px 5px rgba(0, 0, 0, 0.15);
|
|
204
|
-
// position fixed
|
|
205
|
-
// z-index: 1;
|
|
206
|
-
// padding: 35px 8px 35px
|
|
207
|
-
// height: 100%
|
|
208
|
-
|
|
209
|
-
// .menuArrow
|
|
210
|
-
// position: absolute;
|
|
211
|
-
// right: 0;
|
|
212
|
-
// top: 50%;
|
|
213
|
-
// max-width: 17px;
|
|
214
|
-
// transform: rotate(-90deg) translateY(-50%);
|
|
215
|
-
// transform-origin: 0 center;
|
|
216
|
-
// path
|
|
217
|
-
// fill: rgba(0, 0, 0, 0.38);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// [class*='MuiPickersToolbar-toolbar']
|
|
222
|
-
// background-color: #005CCB !important;
|
|
33
|
+
[class*='MuiStepIcon-root'][class*='Mui-active']
|
|
34
|
+
color: #005CCB !important;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.editableFieldWrapper
|
|
4
4
|
font-family: $font-style-arial
|
|
5
|
-
margin-top:
|
|
5
|
+
margin-top: 10px
|
|
6
6
|
|
|
7
7
|
.header
|
|
8
8
|
display: flex
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
.field
|
|
13
13
|
display: flex
|
|
14
14
|
justify-content: space-between
|
|
15
|
-
margin-top:
|
|
15
|
+
margin-top: 10px
|
|
16
16
|
color: $black60
|
|
17
17
|
font-size: 14px
|
|
18
18
|
|
|
@@ -15,18 +15,18 @@ interface IOrderOverviewItem {
|
|
|
15
15
|
rate?: string;
|
|
16
16
|
};
|
|
17
17
|
activeStep: number;
|
|
18
|
+
dontShowEdit?:boolean;
|
|
18
19
|
handleStep: (index: number) => () => void;
|
|
19
20
|
titleClassName?: string;
|
|
20
21
|
fieldClassName?: string;
|
|
21
22
|
fieldWrapperClassName?: string;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
const OrderOverviewItem: FC<IOrderOverviewItem> = ({ fields, handleStep, activeStep, titleClassName, fieldClassName, fieldWrapperClassName }) => {
|
|
25
|
+
const OrderOverviewItem: FC<IOrderOverviewItem> = ({ dontShowEdit, fields, handleStep, activeStep, titleClassName, fieldClassName, fieldWrapperClassName }) => {
|
|
25
26
|
const wrapperClasses = classnames(
|
|
26
27
|
styles.editableFieldWrapper,
|
|
27
28
|
{ [fieldWrapperClassName]: fieldWrapperClassName }
|
|
28
29
|
);
|
|
29
|
-
|
|
30
30
|
return (
|
|
31
31
|
<div className={wrapperClasses}>
|
|
32
32
|
<div>
|
|
@@ -34,7 +34,7 @@ const OrderOverviewItem: FC<IOrderOverviewItem> = ({ fields, handleStep, activeS
|
|
|
34
34
|
<span className={titleClassName}>{fields.title} {fields.additionalTitle && <span className={styles.additionalTitle}>{fields.additionalTitle}</span>}</span>
|
|
35
35
|
<span className={styles.fieldLineWrapper} data-testid='editIcon' onClick={() => handleStep(activeStep)()}>
|
|
36
36
|
{fields.oneLineRate && <span className={classnames(styles.fieldLine, fieldClassName)}>{fields.oneLineRate}</span>}
|
|
37
|
-
{!fieldWrapperClassName && <span className={styles.editIcon}><IconSVG name='editIcon'/></span >}
|
|
37
|
+
{!dontShowEdit &&!fieldWrapperClassName && <span className={styles.editIcon}><IconSVG name='editIcon'/></span >}
|
|
38
38
|
</span>
|
|
39
39
|
</div>
|
|
40
40
|
{fields.content && fields.content.map((fields, index) => (
|
package/source/components/InfoBlocks/FirstInfoBlock/FirstInfoBlockItem/FirstInfoBlockItem.styl
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
align-items: center;
|
|
23
23
|
width: 100%;
|
|
24
24
|
grid-template-columns: 1fr 82px;
|
|
25
|
-
grid-column-gap:
|
|
25
|
+
grid-column-gap: 9px;
|
|
26
26
|
padding: 17px 0
|
|
27
27
|
|
|
28
28
|
& + &
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
align-items: center;
|
|
34
34
|
|
|
35
35
|
.icon
|
|
36
|
-
margin-right:
|
|
36
|
+
margin-right: 0
|
|
37
37
|
width: 64px
|
|
38
38
|
height: 64px
|
|
39
39
|
display block;
|
|
@@ -42,18 +42,16 @@
|
|
|
42
42
|
+media-phone-only()
|
|
43
43
|
width: 82px
|
|
44
44
|
height: 82px
|
|
45
|
-
margin-right: 0
|
|
46
45
|
grid-column: 2;
|
|
47
46
|
grid-row: 1 / span 3;
|
|
48
47
|
|
|
49
48
|
.title
|
|
50
|
-
font-size:
|
|
49
|
+
font-size: 16px;
|
|
51
50
|
margin-bottom: 5px
|
|
52
51
|
color: $grey-3a;
|
|
53
52
|
+media-phone-only()
|
|
54
|
-
font-size: 16px;
|
|
55
53
|
grid-row: 1 / span 1;
|
|
56
|
-
text-align:
|
|
54
|
+
text-align: start;
|
|
57
55
|
color: $grey-32;
|
|
58
56
|
|
|
59
57
|
.textContent
|
package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.tsx
CHANGED
|
@@ -55,7 +55,7 @@ const AdditionalOrderInfo = ({ t, additionalOrderData, redirectToUrl, buyingType
|
|
|
55
55
|
return (
|
|
56
56
|
<div key={label} className={styles.flexContainer}>
|
|
57
57
|
<div className={styles.labelText}>{label}</div>
|
|
58
|
-
<div className={styles.labelText}>{value}</div>
|
|
58
|
+
<div className={classNames(styles.labelText, styles.priceValue)}>{value}</div>
|
|
59
59
|
</div>
|
|
60
60
|
);
|
|
61
61
|
}
|
|
@@ -3,6 +3,7 @@ import styles from './OrderStatusSection.styl';
|
|
|
3
3
|
import OrderStatusCard from './OrderStatusCard';
|
|
4
4
|
// import Image from '../../../_common/Image/Image';
|
|
5
5
|
import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
|
|
6
|
+
import AdditionalOrderInfo from './AdditionalOrderInfo';
|
|
6
7
|
|
|
7
8
|
// tslint:disable-next-line:interface-name
|
|
8
9
|
interface ITFunction {
|
|
@@ -25,6 +26,11 @@ interface IOrderStatusCar {
|
|
|
25
26
|
registration: boolean;
|
|
26
27
|
currentSalesPrice: number;
|
|
27
28
|
onClick: () => void;
|
|
29
|
+
isFinishedOrder?: boolean;
|
|
30
|
+
additionalOrderInfoProps?: any;
|
|
31
|
+
wonStatus?: string;
|
|
32
|
+
transformedDeliveryDate?: string | null;
|
|
33
|
+
delivery?: boolean;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
const OrderStatusCar = ({
|
|
@@ -41,7 +47,11 @@ const OrderStatusCar = ({
|
|
|
41
47
|
request,
|
|
42
48
|
registration,
|
|
43
49
|
currentSalesPrice,
|
|
44
|
-
onClick
|
|
50
|
+
onClick,
|
|
51
|
+
additionalOrderInfoProps,
|
|
52
|
+
wonStatus,
|
|
53
|
+
transformedDeliveryDate,
|
|
54
|
+
delivery
|
|
45
55
|
}: IOrderStatusCar) => {
|
|
46
56
|
const ref = useRef(null);
|
|
47
57
|
const [activeStep, setActiveStep] = useState(0); // 0 - when we have no active steps
|
|
@@ -50,7 +60,7 @@ const OrderStatusCar = ({
|
|
|
50
60
|
{ icon: 'orderReceivedDashboard', selector: 'selector_status_order_received' },
|
|
51
61
|
{ icon: 'preparaionDashboard', selector: 'selector_status_preparation' },
|
|
52
62
|
{ icon: 'registrationDashboard', selector: 'selector_status_registration' },
|
|
53
|
-
selfPickup ? { icon: 'pickupDashboard', selector: 'selector_status_pick_up' }
|
|
63
|
+
selfPickup || !delivery ? { icon: 'pickupDashboard', selector: 'selector_status_pick_up' }
|
|
54
64
|
: { icon: 'deliveryDashboard', selector: 'selector_status_delivery' },
|
|
55
65
|
{ icon: 'handingOverDashboard', selector: 'selector_status_handing_over' }
|
|
56
66
|
];
|
|
@@ -94,37 +104,43 @@ const OrderStatusCar = ({
|
|
|
94
104
|
<img data-testid='car-image' src={imageUrl}/>
|
|
95
105
|
</div>
|
|
96
106
|
<div className={styles.requestId}>{request}</div>
|
|
97
|
-
<div className={styles.carPayment}
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
<div className={styles.carPayment}>
|
|
108
|
+
{wonStatus === 'won' && !!transformedDeliveryDate ? transformedDeliveryDate
|
|
109
|
+
: <>
|
|
110
|
+
{t(`buyingType.${buyingType}`)},
|
|
111
|
+
{buyingType !== 'buy' && `${t('paybackPeriod', { paybackPeriod })},`}
|
|
112
|
+
{buyingType === 'buy' ?
|
|
113
|
+
t('currentSalesPrice', { currentSalesPrice: getFormattedPrice(currentSalesPrice) })
|
|
114
|
+
: t('monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f') })
|
|
115
|
+
}
|
|
116
|
+
</>
|
|
103
117
|
}
|
|
104
118
|
</div>
|
|
105
119
|
</div>
|
|
106
120
|
</div>
|
|
107
|
-
<
|
|
108
|
-
{
|
|
109
|
-
|
|
121
|
+
{wonStatus === 'won' ? <AdditionalOrderInfo { ...additionalOrderInfoProps } />
|
|
122
|
+
: <div className={styles.cardsSection} ref={ref}>
|
|
123
|
+
{cardItems.map((card, index) => {
|
|
124
|
+
const { icon, selector } = card;
|
|
110
125
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
const statusDescription = !registration && index === 2 ?
|
|
127
|
+
t('orderStatus.independentRegistration') :
|
|
128
|
+
t(`orderStatus.${selector}_desc`);
|
|
114
129
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
return (
|
|
131
|
+
<OrderStatusCard
|
|
132
|
+
title={t(`orderStatus.${selector}`)}
|
|
133
|
+
description={statusDescription}
|
|
134
|
+
icon={icon}
|
|
135
|
+
key={index}
|
|
136
|
+
isActive={index + 1 === activeStep}
|
|
137
|
+
isDisabled={index + 1 > activeStep}
|
|
138
|
+
isDone={index + 1 < activeStep}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
})}
|
|
142
|
+
</div>
|
|
143
|
+
}
|
|
128
144
|
</div>
|
|
129
145
|
</div>
|
|
130
146
|
);
|
package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import styles from './OrderStatusSection.styl';
|
|
|
7
7
|
import { Skeleton } from '@mui/material';
|
|
8
8
|
|
|
9
9
|
import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
|
|
10
|
+
import { fromUTCToDateString } from '../../../../framework/utils/DateUtils';
|
|
10
11
|
|
|
11
12
|
interface ITFunction {
|
|
12
13
|
<T = string>(key: string, options?: object): T;
|
|
@@ -20,6 +21,7 @@ interface IOrderStatusSection {
|
|
|
20
21
|
isFetching: boolean;
|
|
21
22
|
withAdditionalInfo?: boolean; // for using on /account/my-order.
|
|
22
23
|
orderedCars: any[]; // TODO: create interface for orderedCars, when the object is formatted by the backend
|
|
24
|
+
wonCars?: any[];
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const OrderStatusSection = ({
|
|
@@ -27,6 +29,7 @@ const OrderStatusSection = ({
|
|
|
27
29
|
t,
|
|
28
30
|
redirectToUrl,
|
|
29
31
|
orderedCars,
|
|
32
|
+
wonCars,
|
|
30
33
|
isFetching,
|
|
31
34
|
withAdditionalInfo = false
|
|
32
35
|
}: IOrderStatusSection) => {
|
|
@@ -41,23 +44,21 @@ const OrderStatusSection = ({
|
|
|
41
44
|
if (!!addressObj) {
|
|
42
45
|
Object.keys(addressObj).forEach((key) => {
|
|
43
46
|
switch (key) {
|
|
44
|
-
case '
|
|
45
|
-
case '
|
|
47
|
+
case 'firstname':
|
|
48
|
+
case 'lastname':
|
|
46
49
|
addressString = `${addressString} ${addressObj[key]}`;
|
|
47
50
|
break;
|
|
48
|
-
case '
|
|
49
|
-
case '
|
|
50
|
-
case '
|
|
51
|
-
case '
|
|
52
|
-
case 'deliveryZip':
|
|
51
|
+
case 'partner':
|
|
52
|
+
case 'street':
|
|
53
|
+
case 'zip':
|
|
54
|
+
case 'number':
|
|
53
55
|
if (!!addressString) {
|
|
54
56
|
addressString = `${addressString}, ${addressObj[key]}`;
|
|
55
57
|
} else {
|
|
56
58
|
addressString = `${addressString} ${addressObj[key]}`;
|
|
57
59
|
}
|
|
58
60
|
break;
|
|
59
|
-
case '
|
|
60
|
-
case 'deliveryCity':
|
|
61
|
+
case 'city':
|
|
61
62
|
addressString = `${addressString} ${addressObj[key]}`;
|
|
62
63
|
break;
|
|
63
64
|
default: addressString = `${addressString} ${addressObj[key]}`;
|
|
@@ -112,10 +113,21 @@ const OrderStatusSection = ({
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
const
|
|
116
|
+
const carPriceWithWarrantyTitle = (warranty: { warrantyPackage: string, warrantyCost: number, warrantyPeriod: number }) => {
|
|
117
|
+
if (!warranty || !warranty.warrantyCost) {
|
|
118
|
+
return t('MyOrderPage:carPrice');
|
|
119
|
+
}
|
|
120
|
+
const warrantyPackage = t(`MyOrderPage:${warranty.warrantyPackage}`);
|
|
121
|
+
const warrantyPeriod = t(`MyOrderPage:${warranty.warrantyPeriod}year`, { warrantyPeriod: warranty.warrantyPeriod });
|
|
122
|
+
const carPriceIncWarrantyTitle =
|
|
123
|
+
`${t('MyOrderPage:carPrice')} ${t('MyOrderPage:incWarranty', { warrantyPackage, warrantyPeriod })}`;
|
|
124
|
+
return carPriceIncWarrantyTitle;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const renderRequestedCars = (cars: any[] = []) => {
|
|
116
128
|
return (
|
|
117
129
|
<>
|
|
118
|
-
{!!
|
|
130
|
+
{!!cars && cars.map((orderedCarData: any, index: number) => {
|
|
119
131
|
if (orderedCarData && typeof orderedCarData.car === 'object') {
|
|
120
132
|
const orderedCar = { ...defaultCarProps, ...orderedCarData };
|
|
121
133
|
const { car: { _id } } = orderedCar;
|
|
@@ -130,6 +142,7 @@ const OrderStatusSection = ({
|
|
|
130
142
|
request,
|
|
131
143
|
registration,
|
|
132
144
|
currentSalesPrice,
|
|
145
|
+
totalPrice,
|
|
133
146
|
deposit,
|
|
134
147
|
preparationCost,
|
|
135
148
|
licensePlateCost,
|
|
@@ -138,20 +151,31 @@ const OrderStatusSection = ({
|
|
|
138
151
|
customerAddress,
|
|
139
152
|
deliveryAddress,
|
|
140
153
|
firstRate,
|
|
141
|
-
paymentProtectionInsuranceCost
|
|
154
|
+
paymentProtectionInsuranceCost,
|
|
155
|
+
wonStatus,
|
|
156
|
+
warranty,
|
|
157
|
+
deliveryDate,
|
|
158
|
+
isLicensePlateFee,
|
|
159
|
+
delivery,
|
|
160
|
+
extrasSumCost
|
|
142
161
|
} = orderedCar;
|
|
162
|
+
|
|
163
|
+
const transformedDeliveryDate = !!deliveryDate ? `${t('MyOrderPage:deliveredOn')} ${fromUTCToDateString(deliveryDate)}` : null;
|
|
164
|
+
|
|
165
|
+
const currentSalesPriceWithWarranty = !!warranty && !!warranty.warrantyCost ? currentSalesPrice + warranty.warrantyCost : currentSalesPrice;
|
|
143
166
|
|
|
144
167
|
const additionalOrderData = {
|
|
145
168
|
addressData: [
|
|
146
169
|
...customerAddress ? [{ label: t('MyOrderPage:billingAddress'), value: getTransformAddressToString(customerAddress) }] : [],
|
|
147
|
-
...deliveryAddress ? [{ label: t('MyOrderPage:vehicleDelivery'), value: getTransformAddressToString(deliveryAddress) }] : []
|
|
170
|
+
...deliveryAddress ? [{ label: t('MyOrderPage:vehicleDelivery'), value: selfPickup ? t('MyOrderPage:selfPickup') : getTransformAddressToString(deliveryAddress) }] : []
|
|
148
171
|
],
|
|
149
172
|
carPriceData: [
|
|
150
|
-
...currentSalesPrice ? [getDataPriceItem(
|
|
173
|
+
...currentSalesPrice ? [getDataPriceItem(currentSalesPriceWithWarranty, carPriceWithWarrantyTitle(warranty))] : [],
|
|
151
174
|
...preparationCost ? [getDataPriceItem(preparationCost, t('MyOrderPage:preparationCost'))] : [],
|
|
152
|
-
...
|
|
153
|
-
...
|
|
154
|
-
...
|
|
175
|
+
...extrasSumCost ? [getDataPriceItem(extrasSumCost, t('MyOrderPage:extrasSumCost'))] : [],
|
|
176
|
+
...registrationCost && registration ? [getDataPriceItem(registrationCost, t('MyOrderPage:vehicleRegistration'))] : [],
|
|
177
|
+
...licensePlateCost && isLicensePlateFee ? [getDataPriceItem(licensePlateCost, t('MyOrderPage:licensePlates'))] : [],
|
|
178
|
+
...!!transportationCost && delivery ? [getDataPriceItem(transportationCost, t('MyOrderPage:delivery'))] : [],
|
|
155
179
|
...paymentProtectionInsuranceCost ? [getDataPriceItem(paymentProtectionInsuranceCost, t('MyOrderPage:paymentProtectionInsuranceCost'))]: [],
|
|
156
180
|
...firstRate ? [getDataPriceItem(firstRate, t('MyOrderPage:firstRate'))] : [],
|
|
157
181
|
...buyingType !== 'buy' ? [
|
|
@@ -165,8 +189,8 @@ const OrderStatusSection = ({
|
|
|
165
189
|
] : []
|
|
166
190
|
],
|
|
167
191
|
overallRate: {
|
|
168
|
-
label: t('MyOrderPage:yourOverallRate'),
|
|
169
|
-
value: buyingType === 'buy' ?
|
|
192
|
+
label: (buyingType === 'buy' || wonStatus === 'won') ? t('MyOrderPage:yourOverallPrice') : t('MyOrderPage:yourOverallRate'),
|
|
193
|
+
value: buyingType === 'buy' || wonStatus === 'won' ? totalPrice : monthlyInstallment
|
|
170
194
|
}
|
|
171
195
|
};
|
|
172
196
|
|
|
@@ -193,18 +217,26 @@ const OrderStatusSection = ({
|
|
|
193
217
|
request,
|
|
194
218
|
registration,
|
|
195
219
|
currentSalesPrice,
|
|
196
|
-
onClick: () => onDetailsClick(_id)
|
|
220
|
+
onClick: () => onDetailsClick(_id),
|
|
221
|
+
additionalOrderInfoProps,
|
|
222
|
+
wonStatus,
|
|
223
|
+
transformedDeliveryDate,
|
|
224
|
+
delivery
|
|
197
225
|
};
|
|
198
226
|
|
|
199
|
-
const title = <span>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
227
|
+
const title = wonStatus === 'pending' ? <span>
|
|
228
|
+
{t('orderStatus.title')}:
|
|
229
|
+
<span className={styles.orderStatus}>{t(`orderStatus.${status}`)}</span>
|
|
230
|
+
</span>
|
|
231
|
+
: <span>{t('orderStatus.myOrder')}</span>;
|
|
203
232
|
|
|
204
233
|
return (
|
|
205
234
|
<DashboardSection key={index} title={title}>
|
|
206
|
-
<OrderStatusCar
|
|
207
|
-
{withAdditionalInfo
|
|
235
|
+
<OrderStatusCar { ...orderStatusCarProps } />
|
|
236
|
+
{withAdditionalInfo && wonStatus === 'pending' ?
|
|
237
|
+
<AdditionalOrderInfo { ...additionalOrderInfoProps } />
|
|
238
|
+
: null
|
|
239
|
+
}
|
|
208
240
|
</DashboardSection>
|
|
209
241
|
);
|
|
210
242
|
}
|
|
@@ -219,7 +251,10 @@ const OrderStatusSection = ({
|
|
|
219
251
|
<div className={styles.skeletonBlock}>
|
|
220
252
|
<Skeleton animation='wave' variant='rectangular' width='100%' />
|
|
221
253
|
</div>
|
|
222
|
-
:
|
|
254
|
+
: <>
|
|
255
|
+
{renderRequestedCars(orderedCars)}
|
|
256
|
+
{renderRequestedCars(wonCars)}
|
|
257
|
+
</>
|
|
223
258
|
}
|
|
224
259
|
</>
|
|
225
260
|
);
|