thm-p3-configurator 0.0.198 → 0.0.199

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.
@@ -172,7 +172,6 @@ const InternalAppointmentForm = _ref => {
172
172
  } = _ref;
173
173
  const [order, dispatch] = (0, _OrderSessionContext.useOrderSession)();
174
174
  const [refreshKey, setRefreshKey] = (0, _react.useState)(Date.now());
175
- const [clearSuccess, setClearSuccess] = (0, _react.useState)(false);
176
175
  const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
177
176
  const [isCompanyInputFocused, setIsCompanyInputFocused] = (0, _react.useState)(false);
178
177
  const {
@@ -697,6 +696,213 @@ const InternalAppointmentForm = _ref => {
697
696
  label: "Telefoonnummer:",
698
697
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
699
698
  key: "phoneNumber-".concat(refreshKey)
699
+ })) : (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
700
+ placeholder: "",
701
+ value: customer.firstName,
702
+ name: "firstName",
703
+ onChange: value => dispatch({
704
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
705
+ payload: {
706
+ firstName: value
707
+ }
708
+ }),
709
+ key: "firstName-".concat(refreshKey),
710
+ isRequired: true,
711
+ form: "appointment",
712
+ label: "Voornaam:",
713
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['firstName']
714
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
715
+ placeholder: "",
716
+ value: customer.infix,
717
+ name: "infix",
718
+ onChange: value => dispatch({
719
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
720
+ payload: {
721
+ infix: value
722
+ }
723
+ }),
724
+ key: "infix-".concat(refreshKey),
725
+ isRequired: false,
726
+ form: "appointment",
727
+ label: "Tussenvoegsel:",
728
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['infix']
729
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
730
+ placeholder: "",
731
+ value: customer.lastName,
732
+ name: "lastName",
733
+ onChange: value => dispatch({
734
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
735
+ payload: {
736
+ lastName: value
737
+ }
738
+ }),
739
+ key: "lastName-".concat(refreshKey),
740
+ isRequired: true,
741
+ form: "appointment",
742
+ label: "Achternaam:",
743
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['lastName']
744
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
745
+ placeholder: "",
746
+ value: customer.email,
747
+ name: "email",
748
+ onChange: value => dispatch({
749
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
750
+ payload: {
751
+ email: value
752
+ }
753
+ }),
754
+ key: "email-".concat(refreshKey),
755
+ isRequired: true,
756
+ form: "appointment",
757
+ label: "E-mailadres:",
758
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
759
+ }), /*#__PURE__*/_react.default.createElement("div", {
760
+ className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
761
+ }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
762
+ placeholder: "Zoek leasemaatschappijen...",
763
+ value: customer.companyName,
764
+ name: "companyName",
765
+ onChange: value => {
766
+ // Update company name in state
767
+ dispatch({
768
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
769
+ payload: {
770
+ companyName: value
771
+ }
772
+ });
773
+
774
+ // Also update search term if value is different
775
+ if (value !== companySearchTerm) {
776
+ console.log('value', value);
777
+ setCompanySearchTerm(value);
778
+ // Force focused state when typing
779
+ setIsCompanyInputFocused(true);
780
+ }
781
+ },
782
+ onFocus: () => {
783
+ setIsCompanyInputFocused(true);
784
+ },
785
+ onBlur: () => {
786
+ // Delay hiding the dropdown to allow click events to complete
787
+ setTimeout(() => {
788
+ setIsCompanyInputFocused(false);
789
+ }, 300); // Increased delay for better chance of click completion
790
+ },
791
+ isRequired: false,
792
+ form: "quotation",
793
+ label: "Leasemaatschappij:",
794
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
795
+ }), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 && branchesByType && branchesByType.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
796
+ className: (0, _helpers__.withStyle)('dropdown-results position-absolute w-100 border rounded bg-white shadow'),
797
+ style: {
798
+ maxHeight: '200px',
799
+ overflowY: 'auto',
800
+ zIndex: 1050,
801
+ top: '100%',
802
+ left: 0,
803
+ right: 0
804
+ },
805
+ onMouseDown: e => {
806
+ e.preventDefault();
807
+ }
808
+ }, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
809
+ className: (0, _helpers__.withStyle)('p-2 text-center')
810
+ }, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
811
+ key: branch.entityId,
812
+ className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
813
+ style: {
814
+ cursor: 'pointer'
815
+ },
816
+ onMouseDown: e => {
817
+ e.preventDefault();
818
+ dispatch({
819
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
820
+ payload: {
821
+ companyName: branch.name
822
+ }
823
+ });
824
+ if (branch.postalCode) {
825
+ dispatch({
826
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
827
+ payload: {
828
+ zipCode: branch.postalCode
829
+ }
830
+ });
831
+ }
832
+ if (branch.street) {
833
+ dispatch({
834
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
835
+ payload: {
836
+ streetName: branch.street
837
+ }
838
+ });
839
+ }
840
+ if (branch.city) {
841
+ dispatch({
842
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
843
+ payload: {
844
+ city: branch.city
845
+ }
846
+ });
847
+ }
848
+ if (branch.street2) {
849
+ dispatch({
850
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
851
+ payload: {
852
+ houseNumber: branch.street2
853
+ }
854
+ });
855
+ }
856
+ if (branch.vatNumber) {
857
+ dispatch({
858
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
859
+ payload: {
860
+ vatNumber: branch.vatNumber
861
+ }
862
+ });
863
+ }
864
+ if (branch.kvkNumber) {
865
+ dispatch({
866
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
867
+ payload: {
868
+ kvkNumber: branch.kvkNumber
869
+ }
870
+ });
871
+ }
872
+ if (branch.huisnummerToevoeging) {
873
+ dispatch({
874
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
875
+ payload: {
876
+ houseNumberAddition: branch.huisnummerToevoeging
877
+ }
878
+ });
879
+ }
880
+ if (branch.country && branch.country.entityId) {
881
+ dispatch({
882
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
883
+ payload: {
884
+ countryId: branch.country.entityId
885
+ }
886
+ });
887
+ setRefreshKey(Date.now());
888
+ }
889
+ setCompanySearchTerm('');
890
+ setIsCompanyInputFocused(false);
891
+ }
892
+ }, branch.name)))), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
893
+ placeholder: "",
894
+ value: customer.phoneNumber,
895
+ name: "phoneNumber",
896
+ onChange: value => dispatch({
897
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
898
+ payload: {
899
+ phoneNumber: value
900
+ }
901
+ }),
902
+ isRequired: true,
903
+ label: "Telefoonnummer:",
904
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
905
+ key: "phoneNumber-".concat(refreshKey)
700
906
  })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
701
907
  placeholder: "",
702
908
  value: customer.firstName,
@@ -1015,6 +1221,98 @@ const InternalAppointmentForm = _ref => {
1015
1221
  }
1016
1222
  });
1017
1223
  }
1224
+ })) : (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1225
+ placeholder: "",
1226
+ value: customer.zipCode,
1227
+ name: "zipCode",
1228
+ onChange: value => dispatch({
1229
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
1230
+ payload: {
1231
+ zipCode: value
1232
+ }
1233
+ }),
1234
+ key: "zipCode-".concat(refreshKey),
1235
+ isRequired: true,
1236
+ label: "Postcode:",
1237
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['zipCode']
1238
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1239
+ placeholder: "",
1240
+ value: customer.houseNumber,
1241
+ name: "houseNumber",
1242
+ onChange: value => dispatch({
1243
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
1244
+ payload: {
1245
+ houseNumber: value
1246
+ }
1247
+ }),
1248
+ key: "houseNumber-".concat(refreshKey),
1249
+ isRequired: true,
1250
+ label: "Huisnummer:",
1251
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
1252
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1253
+ placeholder: "",
1254
+ value: customer.houseNumberAddition,
1255
+ name: "houseNumberAddition",
1256
+ onChange: value => dispatch({
1257
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
1258
+ payload: {
1259
+ houseNumberAddition: value
1260
+ }
1261
+ }),
1262
+ key: "houseNumberAddition-".concat(refreshKey),
1263
+ isRequired: false,
1264
+ label: "Huisnummer toevoeging:",
1265
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumberAddition']
1266
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1267
+ placeholder: "",
1268
+ value: customer.streetName,
1269
+ name: "streetName",
1270
+ onChange: value => dispatch({
1271
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
1272
+ payload: {
1273
+ streetName: value
1274
+ }
1275
+ }),
1276
+ key: "streetName-".concat(refreshKey),
1277
+ isRequired: true,
1278
+ label: "Straat:",
1279
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['streetName']
1280
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1281
+ placeholder: "",
1282
+ value: customer.city,
1283
+ name: "city",
1284
+ onChange: value => dispatch({
1285
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
1286
+ payload: {
1287
+ city: value
1288
+ }
1289
+ }),
1290
+ key: "city-".concat(refreshKey),
1291
+ isRequired: true,
1292
+ label: "Stad:",
1293
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
1294
+ }), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
1295
+ key: "country-lease-".concat((customer === null || customer === void 0 ? void 0 : customer.countryId) || 'default'),
1296
+ options: countryOptions,
1297
+ name: "country",
1298
+ label: "Land:",
1299
+ isRequired: false,
1300
+ isLoading: isLoadingCountries,
1301
+ noOptionsMessage: "Geen landen beschikbaar",
1302
+ placeholder: "Selecteer een land",
1303
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1304
+ initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1305
+ onChange: _ref6 => {
1306
+ let {
1307
+ value
1308
+ } = _ref6;
1309
+ return dispatch({
1310
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1311
+ payload: {
1312
+ countryId: value
1313
+ }
1314
+ });
1315
+ }
1018
1316
  })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
1019
1317
  placeholder: "",
1020
1318
  value: customer.phoneNumber,
@@ -1110,10 +1408,10 @@ const InternalAppointmentForm = _ref => {
1110
1408
  placeholder: "Selecteer een land",
1111
1409
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1112
1410
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1113
- onChange: _ref6 => {
1411
+ onChange: _ref7 => {
1114
1412
  let {
1115
1413
  value
1116
- } = _ref6;
1414
+ } = _ref7;
1117
1415
  return dispatch({
1118
1416
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1119
1417
  payload: {
@@ -717,7 +717,139 @@ const InternalQuotationForm = _ref => {
717
717
  form: "quotation",
718
718
  label: "E-mailadres:",
719
719
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
720
- }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
720
+ }), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement("div", {
721
+ className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
722
+ }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
723
+ placeholder: "Zoek leasemaatschappijen...",
724
+ value: customer.companyName,
725
+ name: "companyName",
726
+ onChange: value => {
727
+ // Update company name in state
728
+ dispatch({
729
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
730
+ payload: {
731
+ companyName: value
732
+ }
733
+ });
734
+
735
+ // Also update search term if value is different
736
+ if (value !== companySearchTerm) {
737
+ setCompanySearchTerm(value);
738
+ // Force focused state when typing
739
+ setIsCompanyInputFocused(true);
740
+ }
741
+ },
742
+ onFocus: () => {
743
+ setIsCompanyInputFocused(true);
744
+ },
745
+ onBlur: () => {
746
+ // Delay hiding the dropdown to allow click events to complete
747
+ setTimeout(() => {
748
+ setIsCompanyInputFocused(false);
749
+ }, 300); // Increased delay for better chance of click completion
750
+ },
751
+ isRequired: false,
752
+ form: "quotation",
753
+ label: "Leasemaatschappij:",
754
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
755
+ }), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 && branchesByType && branchesByType.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
756
+ className: (0, _helpers__.withStyle)('dropdown-results position-absolute w-100 border rounded bg-white shadow'),
757
+ style: {
758
+ maxHeight: '200px',
759
+ overflowY: 'auto',
760
+ zIndex: 1050,
761
+ top: '100%',
762
+ left: 0,
763
+ right: 0
764
+ },
765
+ onMouseDown: e => {
766
+ e.preventDefault();
767
+ }
768
+ }, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
769
+ className: (0, _helpers__.withStyle)('p-2 text-center')
770
+ }, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
771
+ key: branch.entityId,
772
+ className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
773
+ style: {
774
+ cursor: 'pointer'
775
+ },
776
+ onMouseDown: e => {
777
+ e.preventDefault();
778
+ dispatch({
779
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
780
+ payload: {
781
+ companyName: branch.name
782
+ }
783
+ });
784
+ if (branch.postalCode) {
785
+ dispatch({
786
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
787
+ payload: {
788
+ zipCode: branch.postalCode
789
+ }
790
+ });
791
+ }
792
+ if (branch.street) {
793
+ dispatch({
794
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
795
+ payload: {
796
+ streetName: branch.street
797
+ }
798
+ });
799
+ }
800
+ if (branch.city) {
801
+ dispatch({
802
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
803
+ payload: {
804
+ city: branch.city
805
+ }
806
+ });
807
+ }
808
+ if (branch.street2) {
809
+ dispatch({
810
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
811
+ payload: {
812
+ houseNumber: branch.street2
813
+ }
814
+ });
815
+ }
816
+ if (branch.vatNumber) {
817
+ dispatch({
818
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
819
+ payload: {
820
+ vatNumber: branch.vatNumber
821
+ }
822
+ });
823
+ }
824
+ if (branch.kvkNumber) {
825
+ dispatch({
826
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
827
+ payload: {
828
+ kvkNumber: branch.kvkNumber
829
+ }
830
+ });
831
+ }
832
+ if (branch.huisnummerToevoeging) {
833
+ dispatch({
834
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
835
+ payload: {
836
+ houseNumberAddition: branch.huisnummerToevoeging
837
+ }
838
+ });
839
+ }
840
+ if (branch.country && branch.country.entityId) {
841
+ dispatch({
842
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
843
+ payload: {
844
+ countryId: branch.country.entityId
845
+ }
846
+ });
847
+ setRefreshKey(Date.now());
848
+ }
849
+ setCompanySearchTerm('');
850
+ setIsCompanyInputFocused(false);
851
+ }
852
+ }, branch.name)))), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
721
853
  placeholder: "",
722
854
  value: customer.phoneNumber,
723
855
  name: "phoneNumber",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.198",
3
+ "version": "0.0.199",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",