thm-p3-configurator 0.0.359 → 0.0.360
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/dist/src/shared/__api__/mutations.js +17 -0
- package/dist/src/shared/__api__/queries.js +7 -4
- package/dist/src/shared/__containers__/AppointmentForm.js +2 -0
- package/dist/src/shared/__containers__/ExitIntentModal.js +2 -0
- package/dist/src/shared/__containers__/QuotationForm.js +2 -0
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +71 -93
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +80 -105
- package/dist/src/shared/__helpers__/dossier.js +11 -10
- package/package.json +1 -1
|
@@ -97,6 +97,7 @@ const useCreateQuotationMutation = () => {
|
|
|
97
97
|
let {
|
|
98
98
|
licensePlate,
|
|
99
99
|
model,
|
|
100
|
+
constructionYear,
|
|
100
101
|
answers,
|
|
101
102
|
cart,
|
|
102
103
|
selectBoardComputerUpdate,
|
|
@@ -110,6 +111,7 @@ const useCreateQuotationMutation = () => {
|
|
|
110
111
|
return _publicProxyApi.publicProxyApi.postQuotation({
|
|
111
112
|
isExitIntent,
|
|
112
113
|
model,
|
|
114
|
+
constructionYear,
|
|
113
115
|
vehicle,
|
|
114
116
|
licensePlate,
|
|
115
117
|
formula,
|
|
@@ -139,6 +141,7 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
139
141
|
let {
|
|
140
142
|
licensePlate,
|
|
141
143
|
model,
|
|
144
|
+
constructionYear,
|
|
142
145
|
answers,
|
|
143
146
|
cart,
|
|
144
147
|
selectBoardComputerUpdate,
|
|
@@ -150,6 +153,7 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
150
153
|
} = _ref2;
|
|
151
154
|
return _publicProxyApi.publicProxyApi.postAppointmentRequest({
|
|
152
155
|
model,
|
|
156
|
+
constructionYear,
|
|
153
157
|
licensePlate,
|
|
154
158
|
formula,
|
|
155
159
|
answers: answers,
|
|
@@ -283,6 +287,7 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
283
287
|
chassisNumber,
|
|
284
288
|
licensePlate,
|
|
285
289
|
model,
|
|
290
|
+
constructionYear,
|
|
286
291
|
answers,
|
|
287
292
|
cart,
|
|
288
293
|
selectBoardComputerUpdate,
|
|
@@ -311,6 +316,7 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
311
316
|
const createQuotation = () => _authenticatedProxyApi.authenticatedProxyApi.postQuotation({
|
|
312
317
|
isExitIntent,
|
|
313
318
|
model,
|
|
319
|
+
constructionYear,
|
|
314
320
|
vehicle,
|
|
315
321
|
chassisNumber,
|
|
316
322
|
licensePlate,
|
|
@@ -338,6 +344,7 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
338
344
|
return _authenticatedProxyApi.authenticatedProxyApi.postQuotation({
|
|
339
345
|
isExitIntent,
|
|
340
346
|
model,
|
|
347
|
+
constructionYear,
|
|
341
348
|
vehicle,
|
|
342
349
|
chassisNumber,
|
|
343
350
|
licensePlate,
|
|
@@ -401,6 +408,7 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
401
408
|
appointment,
|
|
402
409
|
licensePlate,
|
|
403
410
|
model,
|
|
411
|
+
constructionYear,
|
|
404
412
|
answers,
|
|
405
413
|
cart,
|
|
406
414
|
chassisNumber,
|
|
@@ -430,6 +438,7 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
430
438
|
const response = await _authenticatedProxyApi.authenticatedProxyApi.postAppointment({
|
|
431
439
|
appointment,
|
|
432
440
|
model,
|
|
441
|
+
constructionYear,
|
|
433
442
|
vehicle,
|
|
434
443
|
licensePlate,
|
|
435
444
|
channel,
|
|
@@ -491,6 +500,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
491
500
|
appointment,
|
|
492
501
|
licensePlate,
|
|
493
502
|
model,
|
|
503
|
+
constructionYear,
|
|
494
504
|
answers,
|
|
495
505
|
cart,
|
|
496
506
|
chassisNumber,
|
|
@@ -519,6 +529,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
519
529
|
const response = await _authenticatedProxyApi.authenticatedProxyApi.postAppointmentRequest({
|
|
520
530
|
appointment,
|
|
521
531
|
model,
|
|
532
|
+
constructionYear,
|
|
522
533
|
vehicle,
|
|
523
534
|
licensePlate,
|
|
524
535
|
channel,
|
|
@@ -579,6 +590,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
579
590
|
licensePlate,
|
|
580
591
|
chassisNumber,
|
|
581
592
|
model,
|
|
593
|
+
constructionYear,
|
|
582
594
|
answers,
|
|
583
595
|
cart,
|
|
584
596
|
selectBoardComputerUpdate,
|
|
@@ -617,6 +629,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
617
629
|
payload: {
|
|
618
630
|
appointment,
|
|
619
631
|
model,
|
|
632
|
+
constructionYear,
|
|
620
633
|
vehicle,
|
|
621
634
|
licensePlate,
|
|
622
635
|
chassisNumber,
|
|
@@ -668,6 +681,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
668
681
|
chassisNumber,
|
|
669
682
|
licensePlate,
|
|
670
683
|
model,
|
|
684
|
+
constructionYear,
|
|
671
685
|
answers,
|
|
672
686
|
cart,
|
|
673
687
|
selectBoardComputerUpdate,
|
|
@@ -705,6 +719,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
705
719
|
id,
|
|
706
720
|
payload: {
|
|
707
721
|
model,
|
|
722
|
+
constructionYear,
|
|
708
723
|
vehicle,
|
|
709
724
|
chassisNumber,
|
|
710
725
|
licensePlate,
|
|
@@ -756,6 +771,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
756
771
|
licensePlate,
|
|
757
772
|
chassisNumber,
|
|
758
773
|
model,
|
|
774
|
+
constructionYear,
|
|
759
775
|
answers,
|
|
760
776
|
cart,
|
|
761
777
|
selectBoardComputerUpdate,
|
|
@@ -796,6 +812,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
796
812
|
payload: {
|
|
797
813
|
appointment,
|
|
798
814
|
model,
|
|
815
|
+
constructionYear,
|
|
799
816
|
vehicle,
|
|
800
817
|
licensePlate,
|
|
801
818
|
chassisNumber,
|
|
@@ -691,15 +691,18 @@ const useBranchesByType = _ref4 => {
|
|
|
691
691
|
organisationType,
|
|
692
692
|
searchTerm,
|
|
693
693
|
isTmg = false,
|
|
694
|
-
isTowCenterBranch = false
|
|
694
|
+
isTowCenterBranch = false,
|
|
695
|
+
allowEmptySearch = false,
|
|
696
|
+
enabled = true
|
|
695
697
|
} = _ref4;
|
|
696
|
-
const
|
|
698
|
+
const normalizedSearchTerm = searchTerm !== null && searchTerm !== void 0 ? searchTerm : '';
|
|
699
|
+
const branchesByTypeQuery = (0, _reactQuery.useQuery)(['branchesByType', formula, ownershipType, organisationType, normalizedSearchTerm, isTmg, isTowCenterBranch, allowEmptySearch], {
|
|
697
700
|
queryFn: async () => {
|
|
698
701
|
const response = await _authenticatedProxyApi.authenticatedProxyApi.getBranchesByType({
|
|
699
702
|
formula,
|
|
700
703
|
ownershipType,
|
|
701
704
|
organisationType,
|
|
702
|
-
searchTerm,
|
|
705
|
+
searchTerm: normalizedSearchTerm,
|
|
703
706
|
isTmg,
|
|
704
707
|
isTowCenterBranch
|
|
705
708
|
});
|
|
@@ -708,7 +711,7 @@ const useBranchesByType = _ref4 => {
|
|
|
708
711
|
}
|
|
709
712
|
return response.data;
|
|
710
713
|
},
|
|
711
|
-
enabled: !!
|
|
714
|
+
enabled: enabled && (allowEmptySearch || !!normalizedSearchTerm && normalizedSearchTerm.length >= 3)
|
|
712
715
|
});
|
|
713
716
|
return {
|
|
714
717
|
isLoadingBranchesByType: branchesByTypeQuery.isLoading,
|
|
@@ -135,6 +135,7 @@ const AppointmentForm = () => {
|
|
|
135
135
|
vehicle,
|
|
136
136
|
licensePlate,
|
|
137
137
|
model,
|
|
138
|
+
buildYear,
|
|
138
139
|
durationAnswer,
|
|
139
140
|
selectedBoardComputer,
|
|
140
141
|
selectedCableset,
|
|
@@ -177,6 +178,7 @@ const AppointmentForm = () => {
|
|
|
177
178
|
const appointmentRequestPayload = (0, _helpers__.removeNullishProps)({
|
|
178
179
|
licensePlate: licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.replace(/-/g, ''),
|
|
179
180
|
model,
|
|
181
|
+
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
180
182
|
answers: (0, _helpers__.removeNullishProps)({
|
|
181
183
|
duration: durationAnswer,
|
|
182
184
|
execution1: executionAnswer1,
|
|
@@ -125,6 +125,7 @@ const ExitIntentModal = () => {
|
|
|
125
125
|
customer,
|
|
126
126
|
licensePlate,
|
|
127
127
|
model,
|
|
128
|
+
buildYear,
|
|
128
129
|
durationAnswer,
|
|
129
130
|
selectedBoardComputer,
|
|
130
131
|
selectedCableset,
|
|
@@ -177,6 +178,7 @@ const ExitIntentModal = () => {
|
|
|
177
178
|
isExitIntent: true,
|
|
178
179
|
licensePlate,
|
|
179
180
|
model,
|
|
181
|
+
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
180
182
|
answers: (0, _helpers__.removeNullishProps)({
|
|
181
183
|
duration: durationAnswer,
|
|
182
184
|
execution1: executionAnswer1,
|
|
@@ -128,6 +128,7 @@ const QuotationForm = () => {
|
|
|
128
128
|
vehicle,
|
|
129
129
|
licensePlate,
|
|
130
130
|
model,
|
|
131
|
+
buildYear,
|
|
131
132
|
durationAnswer,
|
|
132
133
|
selectedBoardComputer,
|
|
133
134
|
selectedCableset,
|
|
@@ -168,6 +169,7 @@ const QuotationForm = () => {
|
|
|
168
169
|
isExitIntent: false,
|
|
169
170
|
licensePlate,
|
|
170
171
|
model,
|
|
172
|
+
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
171
173
|
answers: (0, _helpers__.removeNullishProps)({
|
|
172
174
|
duration: durationAnswer,
|
|
173
175
|
execution1: executionAnswer1,
|
|
@@ -184,6 +184,7 @@ const getEmptyCustomerState = () => ({
|
|
|
184
184
|
streetName: '',
|
|
185
185
|
city: '',
|
|
186
186
|
companyName: '',
|
|
187
|
+
companyNamePlaceholder: '',
|
|
187
188
|
kvkNumber: '',
|
|
188
189
|
vatNumber: '',
|
|
189
190
|
countryId: '',
|
|
@@ -197,6 +198,20 @@ const getEmptyCustomerState = () => ({
|
|
|
197
198
|
zakeiljkContactFactuuradres: '',
|
|
198
199
|
zakelijkContactEMailadres: ''
|
|
199
200
|
});
|
|
201
|
+
const buildLeaseCompanyOption = function buildLeaseCompanyOption() {
|
|
202
|
+
let customer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
203
|
+
const label = (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijBedrijfsnaam) || (customer === null || customer === void 0 ? void 0 : customer.companyName) || '';
|
|
204
|
+
if (!label) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
label,
|
|
209
|
+
value: {
|
|
210
|
+
entityId: (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId) || '',
|
|
211
|
+
name: label
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
};
|
|
200
215
|
const InternalAppointmentForm = _ref => {
|
|
201
216
|
var _branchTypes$byId$aut, _authSession$branch, _authSession$branch2, _contextCustomer$note2;
|
|
202
217
|
let {
|
|
@@ -219,6 +234,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
219
234
|
licensePlate,
|
|
220
235
|
licensePlateBrandModel,
|
|
221
236
|
model,
|
|
237
|
+
buildYear,
|
|
222
238
|
vehicle,
|
|
223
239
|
chassisNumber,
|
|
224
240
|
channel,
|
|
@@ -482,7 +498,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
482
498
|
const handleSubmit = async function handleSubmit() {
|
|
483
499
|
let appointmentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants__.DOSSIER_TYPES.PlannedAppointment;
|
|
484
500
|
try {
|
|
485
|
-
var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2, _ref4;
|
|
501
|
+
var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2, _ref4, _vehicle$leaseNumber, _vehicle$leaseNumberU, _customer$companyName2, _customer$kvkNumber3, _customer$vatNumber3;
|
|
486
502
|
setErrors({});
|
|
487
503
|
if (!model) {
|
|
488
504
|
// Note: this does not throw on error.
|
|
@@ -566,6 +582,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
566
582
|
channel,
|
|
567
583
|
licensePlate: (_ref4 = licensePlate || _licensePlate) === null || _ref4 === void 0 ? void 0 : _ref4.replace(/-/g, ''),
|
|
568
584
|
model,
|
|
585
|
+
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
569
586
|
chassisNumber,
|
|
570
587
|
priceCalculationDate,
|
|
571
588
|
answers: (0, _helpers__.removeNullishProps)({
|
|
@@ -603,24 +620,30 @@ const InternalAppointmentForm = _ref => {
|
|
|
603
620
|
}),
|
|
604
621
|
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
605
622
|
}));
|
|
623
|
+
payload.vehicle = _objectSpread(_objectSpread({}, payload.vehicle), {}, {
|
|
624
|
+
leaseNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_vehicle$leaseNumber = vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber) !== null && _vehicle$leaseNumber !== void 0 ? _vehicle$leaseNumber : '' : '',
|
|
625
|
+
leaseNumberUnknown: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_vehicle$leaseNumberU = vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumberUnknown) !== null && _vehicle$leaseNumberU !== void 0 ? _vehicle$leaseNumberU : false : false
|
|
626
|
+
});
|
|
627
|
+
payload.customer = _objectSpread(_objectSpread({}, payload.customer || {}), {}, {
|
|
628
|
+
companyName: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$companyName2 = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName2 !== void 0 ? _customer$companyName2 : '' : '',
|
|
629
|
+
kvkNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$kvkNumber3 = customer === null || customer === void 0 ? void 0 : customer.kvkNumber) !== null && _customer$kvkNumber3 !== void 0 ? _customer$kvkNumber3 : '' : '',
|
|
630
|
+
vatNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$vatNumber3 = customer === null || customer === void 0 ? void 0 : customer.vatNumber) !== null && _customer$vatNumber3 !== void 0 ? _customer$vatNumber3 : '' : ''
|
|
631
|
+
});
|
|
606
632
|
if (existingDossierId && appointmentType === _constants__.DOSSIER_TYPES.PlannedAppointment && typeof invoicePaymentByLeaseCompany === 'boolean') {
|
|
607
|
-
payload.invoicePaymentByLeaseCompany = invoicePaymentByLeaseCompany;
|
|
633
|
+
payload.invoicePaymentByLeaseCompany = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? invoicePaymentByLeaseCompany : false;
|
|
608
634
|
}
|
|
609
635
|
|
|
610
636
|
// Add contact fields after removeNullishProps so they don't get stripped
|
|
611
637
|
// Middleware reads these from req.body top level, not from req.body.customer
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
payload.zakeiljkContactFactuuradres = (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || '';
|
|
622
|
-
payload.zakelijkContactEMailadres = (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || '';
|
|
623
|
-
}
|
|
638
|
+
payload.leasemaatschappijEntityId = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId) || '' : '';
|
|
639
|
+
payload.leasemaatschappijBedrijfsnaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijBedrijfsnaam) || '' : '';
|
|
640
|
+
payload.leasemaatschappijContactpersoonNaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactpersoonNaam) || '' : '';
|
|
641
|
+
payload.leasemaatschappijContactTelefoonnummer = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactTelefoonnummer) || '' : '';
|
|
642
|
+
payload.leasemaatschappijContactEMailadres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactEMailadres) || '' : '';
|
|
643
|
+
payload.zakelijkContactPersoonNaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactPersoonNaam) || '' : '';
|
|
644
|
+
payload.zakelijkContactTelefoonnummer = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactTelefoonnummer) || '' : '';
|
|
645
|
+
payload.zakeiljkContactFactuuradres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || '' : '';
|
|
646
|
+
payload.zakelijkContactEMailadres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || '' : '';
|
|
624
647
|
await onSubmit(payload);
|
|
625
648
|
} catch (ex) {
|
|
626
649
|
console.error("handleSubmit(): ".concat(ex));
|
|
@@ -636,10 +659,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
636
659
|
} = (0, _queries.useBranchesByType)({
|
|
637
660
|
isTmg,
|
|
638
661
|
isTowCenterBranch,
|
|
639
|
-
searchTerm:
|
|
662
|
+
searchTerm: '',
|
|
640
663
|
formula,
|
|
641
664
|
ownershipType: activeOwnershipType,
|
|
642
|
-
organisationType: branchType
|
|
665
|
+
organisationType: branchType,
|
|
666
|
+
allowEmptySearch: isLeaseOwnership,
|
|
667
|
+
enabled: isLeaseOwnership
|
|
643
668
|
});
|
|
644
669
|
const {
|
|
645
670
|
businessBranches,
|
|
@@ -649,6 +674,19 @@ const InternalAppointmentForm = _ref => {
|
|
|
649
674
|
formula: authSession === null || authSession === void 0 || (_authSession$branch2 = authSession.branch) === null || _authSession$branch2 === void 0 ? void 0 : _authSession$branch2.formule,
|
|
650
675
|
enabled: isBusinessOwnership
|
|
651
676
|
});
|
|
677
|
+
const leaseCompanyOptions = (0, _react.useMemo)(() => (branchesByType || []).map(branch => ({
|
|
678
|
+
label: branch === null || branch === void 0 ? void 0 : branch.name,
|
|
679
|
+
value: branch
|
|
680
|
+
})), [branchesByType]);
|
|
681
|
+
const selectedLeaseCompanyOption = (0, _react.useMemo)(() => {
|
|
682
|
+
if (!(customer !== null && customer !== void 0 && customer.leasemaatschappijEntityId) && !(customer !== null && customer !== void 0 && customer.companyName)) {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
return leaseCompanyOptions.find(option => {
|
|
686
|
+
var _option$value;
|
|
687
|
+
return (option === null || option === void 0 || (_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.entityId) === (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId);
|
|
688
|
+
}) || buildLeaseCompanyOption(customer);
|
|
689
|
+
}, [customer, leaseCompanyOptions]);
|
|
652
690
|
|
|
653
691
|
/**
|
|
654
692
|
* @description Autofills the customer form with the current branch data where applicable
|
|
@@ -791,91 +829,31 @@ const InternalAppointmentForm = _ref => {
|
|
|
791
829
|
label: "Type:",
|
|
792
830
|
initialValue: activeOwnershipType,
|
|
793
831
|
onChange: val => {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
const leaving = prev[activeOwnershipType];
|
|
797
|
-
const cleared = _objectSpread({}, leaving);
|
|
798
|
-
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
|
|
799
|
-
cleared.leasemaatschappijEntityId = '';
|
|
800
|
-
cleared.leasemaatschappijBedrijfsnaam = '';
|
|
801
|
-
cleared.leasemaatschappijContactpersoonNaam = '';
|
|
802
|
-
cleared.leasemaatschappijContactTelefoonnummer = '';
|
|
803
|
-
cleared.leasemaatschappijContactEMailadres = '';
|
|
804
|
-
}
|
|
805
|
-
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk) {
|
|
806
|
-
cleared.zakelijkContactPersoonNaam = '';
|
|
807
|
-
cleared.zakelijkContactTelefoonnummer = '';
|
|
808
|
-
cleared.zakeiljkContactFactuuradres = '';
|
|
809
|
-
cleared.zakelijkContactEMailadres = '';
|
|
810
|
-
}
|
|
811
|
-
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
812
|
-
[activeOwnershipType]: cleared
|
|
813
|
-
});
|
|
814
|
-
});
|
|
832
|
+
setCompanySearchTerm('');
|
|
833
|
+
setIsCompanyInputFocused(false);
|
|
815
834
|
setActiveOwnershipType(val);
|
|
816
835
|
},
|
|
817
836
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
818
837
|
isRequired: true,
|
|
819
838
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
820
|
-
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
821
|
-
|
|
822
|
-
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
823
|
-
placeholder: "Zoek leasemaatschappijen...",
|
|
824
|
-
value: customer.companyName,
|
|
839
|
+
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
840
|
+
options: leaseCompanyOptions,
|
|
825
841
|
name: "companyName",
|
|
826
|
-
onChange: value => {
|
|
827
|
-
updateCustomerField('companyName', value);
|
|
828
|
-
|
|
829
|
-
// Also update search term if value is different
|
|
830
|
-
if (value !== companySearchTerm) {
|
|
831
|
-
setCompanySearchTerm(value);
|
|
832
|
-
setIsCompanyInputFocused(true);
|
|
833
|
-
}
|
|
834
|
-
},
|
|
835
|
-
onFocus: () => {
|
|
836
|
-
setIsCompanyInputFocused(true);
|
|
837
|
-
},
|
|
838
|
-
onBlur: () => {
|
|
839
|
-
setTimeout(() => {
|
|
840
|
-
setIsCompanyInputFocused(false);
|
|
841
|
-
}, 300); // Increased delay for better chance of click completion
|
|
842
|
-
},
|
|
843
|
-
isRequired: false,
|
|
844
|
-
form: "quotation",
|
|
845
842
|
label: "Leasemaatschappij:",
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
e.preventDefault();
|
|
859
|
-
}
|
|
860
|
-
}, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
|
|
861
|
-
className: (0, _helpers__.withStyle)('p-2 text-center')
|
|
862
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
|
|
863
|
-
key: branch.entityId,
|
|
864
|
-
className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
|
|
865
|
-
style: {
|
|
866
|
-
cursor: 'pointer'
|
|
867
|
-
},
|
|
868
|
-
onMouseDown: e => {
|
|
869
|
-
e.preventDefault();
|
|
870
|
-
|
|
871
|
-
// Only set company name for lease companies, no other autofills
|
|
872
|
-
updateCustomerField('companyName', branch.name);
|
|
873
|
-
updateCustomerField('leasemaatschappijEntityId', branch.entityId || '');
|
|
874
|
-
updateCustomerField('leasemaatschappijBedrijfsnaam', branch.name || '');
|
|
875
|
-
setCompanySearchTerm('');
|
|
876
|
-
setIsCompanyInputFocused(false);
|
|
843
|
+
isRequired: false,
|
|
844
|
+
isLoading: isLoadingBranchesByType,
|
|
845
|
+
noOptionsMessage: "Geen leasemaatschappijen beschikbaar",
|
|
846
|
+
placeholder: "Kies een leasemaatschappij",
|
|
847
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName'],
|
|
848
|
+
initialValue: selectedLeaseCompanyOption,
|
|
849
|
+
isClearable: true,
|
|
850
|
+
onChange: option => {
|
|
851
|
+
const branch = option === null || option === void 0 ? void 0 : option.value;
|
|
852
|
+
updateCustomerField('companyName', (branch === null || branch === void 0 ? void 0 : branch.name) || '');
|
|
853
|
+
updateCustomerField('leasemaatschappijEntityId', (branch === null || branch === void 0 ? void 0 : branch.entityId) || '');
|
|
854
|
+
updateCustomerField('leasemaatschappijBedrijfsnaam', (branch === null || branch === void 0 ? void 0 : branch.name) || '');
|
|
877
855
|
}
|
|
878
|
-
}
|
|
856
|
+
}), existingDossierId && existingDossierType === _constants__.DOSSIER_TYPES.PlannedAppointment && (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
879
857
|
name: "invoicePaymentByLeaseCompany",
|
|
880
858
|
label: "Factuur betaling door Leasemaatschappij",
|
|
881
859
|
initialValue: invoicePaymentByLeaseCompany === true,
|
|
@@ -141,6 +141,7 @@ const getEmptyCustomerState = () => ({
|
|
|
141
141
|
streetName: '',
|
|
142
142
|
city: '',
|
|
143
143
|
companyName: '',
|
|
144
|
+
companyNamePlaceholder: '',
|
|
144
145
|
kvkNumber: '',
|
|
145
146
|
vatNumber: '',
|
|
146
147
|
countryId: '',
|
|
@@ -154,6 +155,20 @@ const getEmptyCustomerState = () => ({
|
|
|
154
155
|
zakeiljkContactFactuuradres: '',
|
|
155
156
|
zakelijkContactEMailadres: ''
|
|
156
157
|
});
|
|
158
|
+
const buildLeaseCompanyOption = function buildLeaseCompanyOption() {
|
|
159
|
+
let customer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
160
|
+
const label = (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijBedrijfsnaam) || (customer === null || customer === void 0 ? void 0 : customer.companyName) || '';
|
|
161
|
+
if (!label) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
label,
|
|
166
|
+
value: {
|
|
167
|
+
entityId: (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId) || '',
|
|
168
|
+
name: label
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
};
|
|
157
172
|
const internalQuotationFormSchema = (0, _yup.object)({
|
|
158
173
|
ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
159
174
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
@@ -205,6 +220,7 @@ const InternalQuotationForm = _ref => {
|
|
|
205
220
|
priceCalculationDate,
|
|
206
221
|
durationAnswer,
|
|
207
222
|
existingDossierId,
|
|
223
|
+
buildYear,
|
|
208
224
|
selectedBoardComputer,
|
|
209
225
|
selectedCableset,
|
|
210
226
|
selectedCombiset,
|
|
@@ -385,10 +401,12 @@ const InternalQuotationForm = _ref => {
|
|
|
385
401
|
} = (0, _queries.useBranchesByType)({
|
|
386
402
|
isTmg,
|
|
387
403
|
isTowCenterBranch,
|
|
388
|
-
searchTerm:
|
|
404
|
+
searchTerm: '',
|
|
389
405
|
formula,
|
|
390
406
|
ownershipType: activeOwnershipType,
|
|
391
|
-
organisationType: branchType
|
|
407
|
+
organisationType: branchType,
|
|
408
|
+
allowEmptySearch: isLeaseOwnership,
|
|
409
|
+
enabled: isLeaseOwnership
|
|
392
410
|
});
|
|
393
411
|
const {
|
|
394
412
|
businessBranches,
|
|
@@ -398,6 +416,19 @@ const InternalQuotationForm = _ref => {
|
|
|
398
416
|
formula: authSession === null || authSession === void 0 || (_authSession$branch2 = authSession.branch) === null || _authSession$branch2 === void 0 ? void 0 : _authSession$branch2.formule,
|
|
399
417
|
enabled: isBusinessOwnership
|
|
400
418
|
});
|
|
419
|
+
const leaseCompanyOptions = (0, _react.useMemo)(() => (branchesByType || []).map(branch => ({
|
|
420
|
+
label: branch === null || branch === void 0 ? void 0 : branch.name,
|
|
421
|
+
value: branch
|
|
422
|
+
})), [branchesByType]);
|
|
423
|
+
const selectedLeaseCompanyOption = (0, _react.useMemo)(() => {
|
|
424
|
+
if (!(customer !== null && customer !== void 0 && customer.leasemaatschappijEntityId) && !(customer !== null && customer !== void 0 && customer.companyName)) {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
return leaseCompanyOptions.find(option => {
|
|
428
|
+
var _option$value;
|
|
429
|
+
return (option === null || option === void 0 || (_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.entityId) === (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId);
|
|
430
|
+
}) || buildLeaseCompanyOption(customer);
|
|
431
|
+
}, [customer, leaseCompanyOptions]);
|
|
401
432
|
const countryOptions = (0, _react.useMemo)(() => {
|
|
402
433
|
var _countries$results;
|
|
403
434
|
if (!(countries !== null && countries !== void 0 && (_countries$results = countries.results) !== null && _countries$results !== void 0 && _countries$results.length)) return [];
|
|
@@ -466,7 +497,7 @@ const InternalQuotationForm = _ref => {
|
|
|
466
497
|
*/
|
|
467
498
|
const handleSubmit = async () => {
|
|
468
499
|
try {
|
|
469
|
-
var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _ref4;
|
|
500
|
+
var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _ref4, _vehicle$leaseNumber, _vehicle$leaseNumberU, _customer$companyName2, _customer$kvkNumber, _customer$vatNumber;
|
|
470
501
|
setErrors(null);
|
|
471
502
|
if (!model) {
|
|
472
503
|
// Note: this does not throw on error.
|
|
@@ -527,6 +558,7 @@ const InternalQuotationForm = _ref => {
|
|
|
527
558
|
channel,
|
|
528
559
|
licensePlate: (_ref4 = licensePlate || _licensePlate) === null || _ref4 === void 0 ? void 0 : _ref4.replace(/-/g, ''),
|
|
529
560
|
model,
|
|
561
|
+
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
530
562
|
answers: (0, _helpers__.removeNullishProps)({
|
|
531
563
|
duration: durationAnswer,
|
|
532
564
|
execution1: executionAnswer1,
|
|
@@ -563,20 +595,26 @@ const InternalQuotationForm = _ref => {
|
|
|
563
595
|
}),
|
|
564
596
|
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
565
597
|
}));
|
|
598
|
+
payload.vehicle = _objectSpread(_objectSpread({}, payload.vehicle), {}, {
|
|
599
|
+
leaseNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_vehicle$leaseNumber = vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber) !== null && _vehicle$leaseNumber !== void 0 ? _vehicle$leaseNumber : '' : '',
|
|
600
|
+
leaseNumberUnknown: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_vehicle$leaseNumberU = vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumberUnknown) !== null && _vehicle$leaseNumberU !== void 0 ? _vehicle$leaseNumberU : false : false
|
|
601
|
+
});
|
|
602
|
+
payload.customer = _objectSpread(_objectSpread({}, payload.customer || {}), {}, {
|
|
603
|
+
companyName: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$companyName2 = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName2 !== void 0 ? _customer$companyName2 : '' : '',
|
|
604
|
+
kvkNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$kvkNumber = customer === null || customer === void 0 ? void 0 : customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 ? _customer$kvkNumber : '' : '',
|
|
605
|
+
vatNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$vatNumber = customer === null || customer === void 0 ? void 0 : customer.vatNumber) !== null && _customer$vatNumber !== void 0 ? _customer$vatNumber : '' : ''
|
|
606
|
+
});
|
|
566
607
|
|
|
567
608
|
// Add contact fields after removeNullishProps so they don't get stripped
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
payload.zakeiljkContactFactuuradres = (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || '';
|
|
578
|
-
payload.zakelijkContactEMailadres = (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || '';
|
|
579
|
-
}
|
|
609
|
+
payload.leasemaatschappijEntityId = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijEntityId) || '' : '';
|
|
610
|
+
payload.leasemaatschappijBedrijfsnaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijBedrijfsnaam) || '' : '';
|
|
611
|
+
payload.leasemaatschappijContactpersoonNaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactpersoonNaam) || '' : '';
|
|
612
|
+
payload.leasemaatschappijContactTelefoonnummer = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactTelefoonnummer) || '' : '';
|
|
613
|
+
payload.leasemaatschappijContactEMailadres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (customer === null || customer === void 0 ? void 0 : customer.leasemaatschappijContactEMailadres) || '' : '';
|
|
614
|
+
payload.zakelijkContactPersoonNaam = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactPersoonNaam) || '' : '';
|
|
615
|
+
payload.zakelijkContactTelefoonnummer = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactTelefoonnummer) || '' : '';
|
|
616
|
+
payload.zakeiljkContactFactuuradres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || '' : '';
|
|
617
|
+
payload.zakelijkContactEMailadres = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || '' : '';
|
|
580
618
|
await onSubmit(payload);
|
|
581
619
|
} catch (ex) {
|
|
582
620
|
console.error("handleSubmit(): ".concat(ex));
|
|
@@ -661,27 +699,8 @@ const InternalQuotationForm = _ref => {
|
|
|
661
699
|
label: "Type:",
|
|
662
700
|
initialValue: activeOwnershipType,
|
|
663
701
|
onChange: val => {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
const leaving = prev[activeOwnershipType];
|
|
667
|
-
const cleared = _objectSpread({}, leaving);
|
|
668
|
-
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
|
|
669
|
-
cleared.leasemaatschappijEntityId = '';
|
|
670
|
-
cleared.leasemaatschappijBedrijfsnaam = '';
|
|
671
|
-
cleared.leasemaatschappijContactpersoonNaam = '';
|
|
672
|
-
cleared.leasemaatschappijContactTelefoonnummer = '';
|
|
673
|
-
cleared.leasemaatschappijContactEMailadres = '';
|
|
674
|
-
}
|
|
675
|
-
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk) {
|
|
676
|
-
cleared.zakelijkContactPersoonNaam = '';
|
|
677
|
-
cleared.zakelijkContactTelefoonnummer = '';
|
|
678
|
-
cleared.zakeiljkContactFactuuradres = '';
|
|
679
|
-
cleared.zakelijkContactEMailadres = '';
|
|
680
|
-
}
|
|
681
|
-
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
682
|
-
[activeOwnershipType]: cleared
|
|
683
|
-
});
|
|
684
|
-
});
|
|
702
|
+
setCompanySearchTerm('');
|
|
703
|
+
setIsCompanyInputFocused(false);
|
|
685
704
|
setActiveOwnershipType(val);
|
|
686
705
|
},
|
|
687
706
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
@@ -821,68 +840,33 @@ const InternalQuotationForm = _ref => {
|
|
|
821
840
|
form: "quotation",
|
|
822
841
|
label: "E-mailadres:",
|
|
823
842
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
|
|
824
|
-
}),
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
onChange: value => {
|
|
831
|
-
// Update company name in state
|
|
832
|
-
updateCustomerField('companyName', value);
|
|
833
|
-
|
|
834
|
-
// Also update search term if value is different
|
|
835
|
-
if (value !== companySearchTerm) {
|
|
836
|
-
setCompanySearchTerm(value);
|
|
837
|
-
// Force focused state when typing
|
|
838
|
-
setIsCompanyInputFocused(true);
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
onFocus: () => {
|
|
842
|
-
setIsCompanyInputFocused(true);
|
|
843
|
-
},
|
|
844
|
-
onBlur: () => {
|
|
845
|
-
// Delay hiding the dropdown to allow click events to complete
|
|
846
|
-
setTimeout(() => {
|
|
847
|
-
setIsCompanyInputFocused(false);
|
|
848
|
-
}, 300); // Increased delay for better chance of click completion
|
|
849
|
-
},
|
|
850
|
-
isRequired: false,
|
|
843
|
+
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
844
|
+
placeholder: "",
|
|
845
|
+
value: customer.phoneNumber,
|
|
846
|
+
name: "phoneNumber",
|
|
847
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
848
|
+
isRequired: true,
|
|
851
849
|
form: "quotation",
|
|
850
|
+
label: "Telefoonnummer:",
|
|
851
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber']
|
|
852
|
+
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
853
|
+
options: leaseCompanyOptions,
|
|
854
|
+
name: "companyName",
|
|
852
855
|
label: "Leasemaatschappij:",
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
e.preventDefault();
|
|
866
|
-
}
|
|
867
|
-
}, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
|
|
868
|
-
className: (0, _helpers__.withStyle)('p-2 text-center')
|
|
869
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
|
|
870
|
-
key: branch.entityId,
|
|
871
|
-
className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
|
|
872
|
-
style: {
|
|
873
|
-
cursor: 'pointer'
|
|
874
|
-
},
|
|
875
|
-
onMouseDown: e => {
|
|
876
|
-
e.preventDefault();
|
|
877
|
-
|
|
878
|
-
// Only set company name for lease companies, no other autofills
|
|
879
|
-
updateCustomerField('companyName', branch.name);
|
|
880
|
-
updateCustomerField('leasemaatschappijEntityId', branch.entityId || '');
|
|
881
|
-
updateCustomerField('leasemaatschappijBedrijfsnaam', branch.name || '');
|
|
882
|
-
setCompanySearchTerm('');
|
|
883
|
-
setIsCompanyInputFocused(false);
|
|
856
|
+
isRequired: false,
|
|
857
|
+
isLoading: isLoadingBranchesByType,
|
|
858
|
+
noOptionsMessage: "Geen leasemaatschappijen beschikbaar",
|
|
859
|
+
placeholder: "Kies een leasemaatschappij",
|
|
860
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName'],
|
|
861
|
+
initialValue: selectedLeaseCompanyOption,
|
|
862
|
+
isClearable: true,
|
|
863
|
+
onChange: option => {
|
|
864
|
+
const branch = option === null || option === void 0 ? void 0 : option.value;
|
|
865
|
+
updateCustomerField('companyName', (branch === null || branch === void 0 ? void 0 : branch.name) || '');
|
|
866
|
+
updateCustomerField('leasemaatschappijEntityId', (branch === null || branch === void 0 ? void 0 : branch.entityId) || '');
|
|
867
|
+
updateCustomerField('leasemaatschappijBedrijfsnaam', (branch === null || branch === void 0 ? void 0 : branch.name) || '');
|
|
884
868
|
}
|
|
885
|
-
}
|
|
869
|
+
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
886
870
|
className: (0, _helpers__.withStyle)('modal-title mb-2 mt-3')
|
|
887
871
|
}, "Contactgegevens leasemaatschappij:"), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
888
872
|
placeholder: "",
|
|
@@ -935,16 +919,7 @@ const InternalQuotationForm = _ref => {
|
|
|
935
919
|
onChange: value => updateCustomerField('zakelijkContactEMailadres', value),
|
|
936
920
|
isRequired: false,
|
|
937
921
|
label: "Contact e-mailadres:"
|
|
938
|
-
})), /*#__PURE__*/_react.default.createElement(
|
|
939
|
-
placeholder: "",
|
|
940
|
-
value: customer.phoneNumber,
|
|
941
|
-
name: "phoneNumber",
|
|
942
|
-
onChange: value => updateCustomerField('phoneNumber', value),
|
|
943
|
-
isRequired: true,
|
|
944
|
-
form: "quotation",
|
|
945
|
-
label: "Telefoonnummer:",
|
|
946
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber']
|
|
947
|
-
}))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
922
|
+
})))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
948
923
|
className: (0, _helpers__.withStyle)('col-12 mb-4')
|
|
949
924
|
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
950
925
|
className: (0, _helpers__.withStyle)('row')
|
|
@@ -98,8 +98,9 @@ const getDossierValue = function getDossierValue() {
|
|
|
98
98
|
* @description Covnerts an existing hyper dossier object into a local order session
|
|
99
99
|
*/
|
|
100
100
|
const parseDossierToOrderSession = exports.parseDossierToOrderSession = function parseDossierToOrderSession() {
|
|
101
|
-
var _dossier$typeEigendom, _dossier$bedrijf, _dossier$bedrijf2, _dossier$bedrijf3, _dossier$lines, _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$kanaalWebsit, _dossier$kanaal2, _dossier$statusDossie, _dossier$statusDossie2, _dossier$vestiging, _dossier$chassisnumme, _dossier$typeEigendom2, _getDossierValue, _getDossierValue2, _getDossierValue3, _getDossierValue4, _getDossierValue5, _dossier$anwbId, _dossier$leasemaatsch, _dossier$leasemaatsch2, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer,
|
|
101
|
+
var _ref2, _ref3, _ref4, _dossier$construction, _dossier$typeEigendom, _dossier$bedrijf, _dossier$bedrijf2, _dossier$bedrijf3, _dossier$lines, _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$kanaalWebsit, _dossier$kanaal2, _dossier$statusDossie, _dossier$statusDossie2, _dossier$merk, _dossier$vestiging, _dossier$chassisnumme, _dossier$typeEigendom2, _getDossierValue, _getDossierValue2, _getDossierValue3, _getDossierValue4, _getDossierValue5, _dossier$anwbId, _dossier$leasemaatsch, _dossier$leasemaatsch2, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer, _ref5, _ref6, _dossier$leasemaatsch3, _dossier$leasemaatsch4, _dossier$bedrijf4, _ref7, _ref8, _ref9, _dossier$leasemaatsch5, _dossier$leasemaatsch6, _dossier$leasemaatsch7, _dossier$leasemaatsch8, _dossier$leasemaatsch9, _dossier$leasemaatsch10, _dossier$zakelijkCont, _dossier$zakelijkCont2, _ref10, _dossier$zakeiljkCont, _dossier$zakelijkCont3, _dossier$hasGoedkeuri, _meerprijsLine$consum, _meerprijsLine$extraN;
|
|
102
102
|
let dossier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
103
|
+
const resolvedBuildYear = (_ref2 = (_ref3 = (_ref4 = (_dossier$construction = dossier === null || dossier === void 0 ? void 0 : dossier.constructionYear) !== null && _dossier$construction !== void 0 ? _dossier$construction : dossier === null || dossier === void 0 ? void 0 : dossier.bouwjaar) !== null && _ref4 !== void 0 ? _ref4 : dossier === null || dossier === void 0 ? void 0 : dossier.bouwjaar2) !== null && _ref3 !== void 0 ? _ref3 : dossier === null || dossier === void 0 ? void 0 : dossier.modeljaar) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
103
104
|
const isLeaseOwnership = (dossier === null || dossier === void 0 || (_dossier$typeEigendom = dossier.typeEigendomAuto) === null || _dossier$typeEigendom === void 0 ? void 0 : _dossier$typeEigendom.title) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij;
|
|
104
105
|
const leaseBedrijfName = isLeaseOwnership ? (dossier === null || dossier === void 0 || (_dossier$bedrijf = dossier.bedrijf) === null || _dossier$bedrijf === void 0 ? void 0 : _dossier$bedrijf.name) || (dossier === null || dossier === void 0 || (_dossier$bedrijf2 = dossier.bedrijf) === null || _dossier$bedrijf2 === void 0 ? void 0 : _dossier$bedrijf2.title) || (dossier === null || dossier === void 0 || (_dossier$bedrijf3 = dossier.bedrijf) === null || _dossier$bedrijf3 === void 0 ? void 0 : _dossier$bedrijf3.naamVestiging) || undefined : undefined;
|
|
105
106
|
|
|
@@ -137,8 +138,8 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
137
138
|
allowLocationChange: (_dossier$statusDossie = dossier === null || dossier === void 0 || (_dossier$statusDossie2 = dossier.statusDossier) === null || _dossier$statusDossie2 === void 0 ? void 0 : _dossier$statusDossie2.vestigingWijzigenToegestaan) !== null && _dossier$statusDossie !== void 0 ? _dossier$statusDossie : false,
|
|
138
139
|
// Static:
|
|
139
140
|
franchiseName: null,
|
|
140
|
-
buildYear:
|
|
141
|
-
brand: null,
|
|
141
|
+
buildYear: resolvedBuildYear,
|
|
142
|
+
brand: (_dossier$merk = dossier === null || dossier === void 0 ? void 0 : dossier.merk) !== null && _dossier$merk !== void 0 ? _dossier$merk : null,
|
|
142
143
|
isTouched: false,
|
|
143
144
|
isBoardComputerDeselected: ((_dossier$lines2, _dossier$lines3, _dossier$lines4) => {
|
|
144
145
|
const hasInactiveVoertuigcodering = dossier === null || dossier === void 0 || (_dossier$lines2 = dossier.lines) === null || _dossier$lines2 === void 0 ? void 0 : _dossier$lines2.some(line => {
|
|
@@ -188,14 +189,14 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
188
189
|
companyNamePlaceholder: (_dossier$placeholderB = dossier === null || dossier === void 0 ? void 0 : dossier.placeholderBedrijfsnaam) !== null && _dossier$placeholderB !== void 0 ? _dossier$placeholderB : undefined,
|
|
189
190
|
kvkNumber: (_dossier$kvkNummer = dossier === null || dossier === void 0 ? void 0 : dossier.kvkNummer) !== null && _dossier$kvkNummer !== void 0 ? _dossier$kvkNummer : undefined,
|
|
190
191
|
vatNumber: (_dossier$btwNummer = dossier === null || dossier === void 0 ? void 0 : dossier.btwNummer) !== null && _dossier$btwNummer !== void 0 ? _dossier$btwNummer : undefined,
|
|
191
|
-
leasemaatschappijEntityId: (
|
|
192
|
-
leasemaatschappijBedrijfsnaam: (
|
|
192
|
+
leasemaatschappijEntityId: (_ref5 = (_ref6 = (_dossier$leasemaatsch3 = dossier === null || dossier === void 0 ? void 0 : dossier.leasemaatschappijEntityId) !== null && _dossier$leasemaatsch3 !== void 0 ? _dossier$leasemaatsch3 : dossier === null || dossier === void 0 || (_dossier$leasemaatsch4 = dossier.leasemaatschappij) === null || _dossier$leasemaatsch4 === void 0 ? void 0 : _dossier$leasemaatsch4.entityId) !== null && _ref6 !== void 0 ? _ref6 : isLeaseOwnership ? dossier === null || dossier === void 0 || (_dossier$bedrijf4 = dossier.bedrijf) === null || _dossier$bedrijf4 === void 0 ? void 0 : _dossier$bedrijf4.entityId : undefined) !== null && _ref5 !== void 0 ? _ref5 : undefined,
|
|
193
|
+
leasemaatschappijBedrijfsnaam: (_ref7 = (_ref8 = (_ref9 = (_dossier$leasemaatsch5 = dossier === null || dossier === void 0 ? void 0 : dossier.leasemaatschappijBedrijfsnaam) !== null && _dossier$leasemaatsch5 !== void 0 ? _dossier$leasemaatsch5 : dossier === null || dossier === void 0 || (_dossier$leasemaatsch6 = dossier.leasemaatschappij) === null || _dossier$leasemaatsch6 === void 0 ? void 0 : _dossier$leasemaatsch6.name) !== null && _ref9 !== void 0 ? _ref9 : dossier === null || dossier === void 0 || (_dossier$leasemaatsch7 = dossier.leasemaatschappij) === null || _dossier$leasemaatsch7 === void 0 ? void 0 : _dossier$leasemaatsch7.title) !== null && _ref8 !== void 0 ? _ref8 : leaseBedrijfName) !== null && _ref7 !== void 0 ? _ref7 : undefined,
|
|
193
194
|
leasemaatschappijContactpersoonNaam: (_dossier$leasemaatsch8 = dossier === null || dossier === void 0 ? void 0 : dossier.leasemaatschappijContactpersoonNaam) !== null && _dossier$leasemaatsch8 !== void 0 ? _dossier$leasemaatsch8 : undefined,
|
|
194
195
|
leasemaatschappijContactTelefoonnummer: (_dossier$leasemaatsch9 = dossier === null || dossier === void 0 ? void 0 : dossier.leasemaatschappijContactTelefoonnummer) !== null && _dossier$leasemaatsch9 !== void 0 ? _dossier$leasemaatsch9 : undefined,
|
|
195
196
|
leasemaatschappijContactEMailadres: (_dossier$leasemaatsch10 = dossier === null || dossier === void 0 ? void 0 : dossier.leasemaatschappijContactEMailadres) !== null && _dossier$leasemaatsch10 !== void 0 ? _dossier$leasemaatsch10 : undefined,
|
|
196
197
|
zakelijkContactPersoonNaam: (_dossier$zakelijkCont = dossier === null || dossier === void 0 ? void 0 : dossier.zakelijkContactPersoonNaam) !== null && _dossier$zakelijkCont !== void 0 ? _dossier$zakelijkCont : undefined,
|
|
197
198
|
zakelijkContactTelefoonnummer: (_dossier$zakelijkCont2 = dossier === null || dossier === void 0 ? void 0 : dossier.zakelijkContactTelefoonnummer) !== null && _dossier$zakelijkCont2 !== void 0 ? _dossier$zakelijkCont2 : undefined,
|
|
198
|
-
zakeiljkContactFactuuradres: (
|
|
199
|
+
zakeiljkContactFactuuradres: (_ref10 = (_dossier$zakeiljkCont = dossier === null || dossier === void 0 ? void 0 : dossier.zakeiljkContactFactuuradres) !== null && _dossier$zakeiljkCont !== void 0 ? _dossier$zakeiljkCont : dossier === null || dossier === void 0 ? void 0 : dossier.zakelijkContactFactuuradres) !== null && _ref10 !== void 0 ? _ref10 : undefined,
|
|
199
200
|
zakelijkContactEMailadres: (_dossier$zakelijkCont3 = dossier === null || dossier === void 0 ? void 0 : dossier.zakelijkContactEMailadres) !== null && _dossier$zakelijkCont3 !== void 0 ? _dossier$zakelijkCont3 : undefined
|
|
200
201
|
},
|
|
201
202
|
hasGoedkeuringsnummerActivity: (_dossier$hasGoedkeuri = dossier === null || dossier === void 0 ? void 0 : dossier.hasGoedkeuringsnummerActivity) !== null && _dossier$hasGoedkeuri !== void 0 ? _dossier$hasGoedkeuri : false,
|
|
@@ -211,7 +212,7 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
211
212
|
* Does so by iterating over the lines in the `dossier.lines` array, and checking the order API `articles` keys ['towbars', 'cablesets', 'combisets', 'extras', 'discountCode' ] to find a matching `articleNumber`
|
|
212
213
|
* This function is used to edit a session, by checking which towbar,cableset, combiset, extras and discounted products were originally chosen.
|
|
213
214
|
*/
|
|
214
|
-
const extractSessionProductsByOrder =
|
|
215
|
+
const extractSessionProductsByOrder = _ref11 => {
|
|
215
216
|
let {
|
|
216
217
|
lines = [],
|
|
217
218
|
orderProducts = {
|
|
@@ -222,7 +223,7 @@ const extractSessionProductsByOrder = _ref8 => {
|
|
|
222
223
|
discountCode: []
|
|
223
224
|
},
|
|
224
225
|
boardComputerUpdate = {}
|
|
225
|
-
} =
|
|
226
|
+
} = _ref11;
|
|
226
227
|
return lines.filter(line => line.activeArticle).reduce((acc, lineItem) => {
|
|
227
228
|
const allArticleNumbers = [...acc.allArticleNumbers, lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber];
|
|
228
229
|
|
|
@@ -243,8 +244,8 @@ const extractSessionProductsByOrder = _ref8 => {
|
|
|
243
244
|
touchedConsumerDiscounts
|
|
244
245
|
});
|
|
245
246
|
}
|
|
246
|
-
const orderProductEntries = Object.entries(orderProducts).find(
|
|
247
|
-
let [productCategory, products] =
|
|
247
|
+
const orderProductEntries = Object.entries(orderProducts).find(_ref12 => {
|
|
248
|
+
let [productCategory, products] = _ref12;
|
|
248
249
|
return products.some(product => product.articleNumber === (lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber));
|
|
249
250
|
});
|
|
250
251
|
switch (orderProductEntries === null || orderProductEntries === void 0 ? void 0 : orderProductEntries[0]) {
|