kui-crm_actions 0.0.108 → 0.0.111

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as kui_crm from 'kui-crm';
2
- import { InputParams, ResourceTypes, MeterTypes, FileStore, InputFileWithVisibilityFields, MeterFeaturesFormFields, InspectionTypes, InspectionRoomPhotoTypes, ParkingTypes as ParkingTypes$1, CityParams, RoomTypes, RenovationParams, RoomParams, HouseTypes as HouseTypes$1, WallMaterials as WallMaterials$1, OverlapTypes as OverlapTypes$1, GasTypes as GasTypes$1, ImageStore, ApartmentDescriptionParams, ApartmentMetroStationsParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, ImageBodyRequest, FillingInfoFormFields as FillingInfoFormFields$1, ContractLinkModel, FileBodyRequest, RoomType, ApartmentMainInfoModelFields, PostInspectionFillingListModel, ApartmentDetailInfoModelFields as ApartmentDetailInfoModelFields$1, ApartmentModel, ApartmentPartialDescriptionParams, MainObjectInfoInterface, ApartmentMainInfoParams, SecurityObjectInfoInterface, ApartmentSecurityInfoParams, DetailObjectInfoInterface, ApartmentDetailInfoParams, ApartmentTelecommunicationInfoParams, ApartmentHouseInfoParams, MaxMetersInfoParams, LatLonParams, InspectionRoomPhotoModel, InspectionFillingModel, ApartmentMetroParams, TransferInspectionMeterModel, InventoryInspectionMeterModel, InspectionPartialMetersInfoParams, ApartmentPaymentInfoParams, FullInspectionCommonFields, InspectionPaymentInfoParams, InspectionMeterCommonInfo, InspectionMeterInfoParams, InventoryInspectionFields, InspectionMetersInfoParams, InspectionFeedbackParams, FillingTypes, FillingListItemModel, GeolocationParams } from 'kui-crm';
2
+ import { InputParams, ResourceTypes, MeterTypes, FileStore, InputFileWithVisibilityFields, MeterFeaturesFormFields, InspectionTypes, InspectionRoomPhotoTypes, ParkingTypes as ParkingTypes$1, CityParams, RoomTypes, RenovationParams, RoomParams, HouseTypes as HouseTypes$1, WallMaterials as WallMaterials$1, OverlapTypes as OverlapTypes$1, GasTypes as GasTypes$1, ImageStore, ApartmentDescriptionParams, ApartmentMetroStationsParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, ImageBodyRequest, FillingInfoFormFields as FillingInfoFormFields$1, ContractLinkModel, FileBodyRequest, RoomType, ApartmentMainInfoModelFields, PostInspectionFillingListModel, ApartmentDetailInfoModelFields as ApartmentDetailInfoModelFields$1, ApartmentModel, ApartmentPartialDescriptionParams, MainObjectInfoInterface, ApartmentMainInfoParams, SecurityObjectInfoInterface, ApartmentSecurityInfoParams, DetailObjectInfoInterface, ApartmentDetailInfoParams, ApartmentTelecommunicationInfoParams, ApartmentHouseInfoParams, MaxMetersInfoParams, LatLonParams, InspectionRoomPhotoModel, InspectionFillingModel, ApartmentMetroParams, TransferInspectionMeterModel, InventoryInspectionMeterModel, InspectionPartialMetersInfoParams, ApartmentPaymentInfoParams, FullInspectionCommonFields, InspectionPaymentInfoParams, InspectionMeterCommonInfo, InspectionMeterInfoParams, InventoryInspectionFields, InspectionMetersInfoParams, BasicMeterFeaturesFormFields, BasicMeterFieldsSettings, InputByTypeProps, InspectionFeedbackParams, FillingTypes, FillingListItemModel, GeolocationParams } from 'kui-crm';
3
3
  import { DateTime } from 'luxon';
4
4
  import { Loader, MultistepForm, PhoneParams as PhoneParams$1 } from 'kui-utils';
5
5
  import * as yup from 'yup';
@@ -620,7 +620,6 @@ declare const BasicApartmentInfoFieldsSchema: {
620
620
  }, yup.AnyObject, {
621
621
  name: undefined;
622
622
  }, "">;
623
- zipCode: yup.StringSchema<string, yup.AnyObject, undefined, "">;
624
623
  };
625
624
  declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
626
625
  apartment: {
@@ -630,7 +629,6 @@ declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
630
629
  city: {
631
630
  name: string;
632
631
  };
633
- zipCode: string;
634
632
  }, yup.AnyObject, {
635
633
  apartment: {
636
634
  address: undefined;
@@ -639,7 +637,6 @@ declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
639
637
  city: {
640
638
  name: undefined;
641
639
  };
642
- zipCode: undefined;
643
640
  }, "">;
644
641
 
645
642
  declare const getHouseInfoStep: (settings?: InspectionFieldsSettings | undefined) => InputParams<HouseInfoStepFields>[];
@@ -781,17 +778,28 @@ declare const AdditionalInfoFieldsSchema: {
781
778
  }, yup.AnyObject, {
782
779
  name: undefined;
783
780
  }, "">;
781
+ company: yup.ObjectSchema<{
782
+ name: string;
783
+ }, yup.AnyObject, {
784
+ name: undefined;
785
+ }, "">;
784
786
  };
785
787
  declare const AdditionalInfoStepSchema: yup.ObjectSchema<{
786
788
  taxesType: string;
787
789
  countryOfResidence: {
788
790
  name: string;
789
791
  };
792
+ company: {
793
+ name: string;
794
+ };
790
795
  }, yup.AnyObject, {
791
796
  taxesType: undefined;
792
797
  countryOfResidence: {
793
798
  name: undefined;
794
799
  };
800
+ company: {
801
+ name: undefined;
802
+ };
795
803
  }, "">;
796
804
 
797
805
  declare const getHouseServicesInfoStep: (settings?: InspectionFieldsSettings | undefined) => InputParams<HouseServicesInfoStepFields>[];
@@ -892,7 +900,6 @@ declare const MetersInfoStepSchema: yup.ObjectSchema<{
892
900
  declare const getTelecommunicationsInfoStepFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<TelecommunicationsInfoStepFields>[];
893
901
 
894
902
  declare const TelecommunicationsInfoFieldsSchema: {
895
- tvType: yup.StringSchema<string, yup.AnyObject, undefined, "">;
896
903
  homePhone: yup.ObjectSchema<{
897
904
  phoneNumber: string | null | undefined;
898
905
  } | null, yup.AnyObject, {
@@ -900,12 +907,10 @@ declare const TelecommunicationsInfoFieldsSchema: {
900
907
  }, "">;
901
908
  };
902
909
  declare const TelecommunicationsInfoStepSchema: yup.ObjectSchema<{
903
- tvType: string;
904
910
  homePhone: {
905
911
  phoneNumber?: string | null | undefined;
906
912
  } | null;
907
913
  }, yup.AnyObject, {
908
- tvType: undefined;
909
914
  homePhone: {
910
915
  phoneNumber: undefined;
911
916
  };
@@ -929,6 +934,17 @@ declare const FillingInfoFieldsSchema: yup.ObjectSchema<{
929
934
  serialNumber: undefined;
930
935
  }, "">;
931
936
 
937
+ type InventoryMeterInfoFieldsProps = {
938
+ resource?: ResourceTypes
939
+ handleSubmit: (data: BasicMeterFeaturesFormFields) => void
940
+ handlePrevClick: () => void
941
+ defaultValues?: Partial<BasicMeterFeaturesFormFields>
942
+ }
943
+
944
+ declare const getInventoryMeterFields: (settings: BasicMeterFieldsSettings, inputsSettings?: any) => InputByTypeProps<BasicMeterFeaturesFormFields>[];
945
+
946
+ declare function InventoryMeterInfoFields(props: InventoryMeterInfoFieldsProps): JSX.Element;
947
+
932
948
  type MeterInfoStepProps = {
933
949
  index: number
934
950
  resource: ResourceTypes
@@ -1039,4 +1055,4 @@ type ApartmentPointProps = {
1039
1055
 
1040
1056
  declare const ObjectForMapPoint: (props: ApartmentPointProps) => JSX.Element;
1041
1057
 
1042
- export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingCheckParams, FillingInfoFieldsSchema, FillingInfoFormFields, FillingInfoStepFields, FillingListInfoStepFields, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepFields, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InitialInspectionRoomParams, InspectionAppraisalLiteModel, _default as InspectionFeedback, InspectionFieldsSettings, InspectionFillingCard, InspectionFillingCardProps, InspectionFillingItemFields, InspectionFillingListFields, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomPhotoRequest, InspectionRoomsImagesFields, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterModel, MeterInfoStepProps, MeterValueModel, MeterValuesFields, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, MetroStationParams, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapParams, ObjectForMapPoint, PartialMeterInfoFields, PartialMeterInfoStepProps, PartialMeterModel, PostApartmentInspectionRequest, RegularInspectionFormFields, RegularInspectionPostBody, RegularlyInspectionFieldsBody, RoomImagesParams, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, TenantParams, TransferInspectionFieldsBody, TransferInspectionFormFields, TransferInspectionPostBody, TransferInspectionTypes, WaterMeterFieldsSchema, apartmentFields, getAdditionalInfoStepFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseInfoStep, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useFillingList, useMetersValues };
1058
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingCheckParams, FillingInfoFieldsSchema, FillingInfoFormFields, FillingInfoStepFields, FillingListInfoStepFields, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepFields, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InitialInspectionRoomParams, InspectionAppraisalLiteModel, _default as InspectionFeedback, InspectionFieldsSettings, InspectionFillingCard, InspectionFillingCardProps, InspectionFillingItemFields, InspectionFillingListFields, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomPhotoRequest, InspectionRoomsImagesFields, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterInfoFields, InventoryMeterModel, MeterInfoStepProps, MeterValueModel, MeterValuesFields, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, MetroStationParams, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapParams, ObjectForMapPoint, PartialMeterInfoFields, PartialMeterInfoStepProps, PartialMeterModel, PostApartmentInspectionRequest, RegularInspectionFormFields, RegularInspectionPostBody, RegularlyInspectionFieldsBody, RoomImagesParams, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, TenantParams, TransferInspectionFieldsBody, TransferInspectionFormFields, TransferInspectionPostBody, TransferInspectionTypes, WaterMeterFieldsSchema, apartmentFields, getAdditionalInfoStepFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseInfoStep, getHouseServicesInfoStep, getInventoryMeterFields, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useFillingList, useMetersValues };
package/index.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import * as yup from 'yup';
2
- import { NumberField, requests, uploadFiles, ImageStore, FileStore, matchesAPIFillingTypes, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, HouseTypesValues, WallMaterialsValues, SlabsTypesValues, GasTypesValues, BooleanValues, positiveNumberSchema, defaultRequiredMessage, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, ParkingTypesValues, fieldWithConditionSchema, getApartmentPaymentFields, phoneWithConditionSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete, Tooltip, ApartmentsAgent, PreviewContent, Link, UserBadge, useMapCards, MapOverlay } from 'kui-crm';
2
+ import { NumberField, requests, uploadFiles, ImageStore, FileStore, matchesAPIFillingTypes, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, HouseTypesValues, WallMaterialsValues, SlabsTypesValues, GasTypesValues, BooleanValues, positiveNumberSchema, defaultRequiredMessage, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, ParkingTypesValues, fieldWithConditionSchema, getApartmentPaymentFields, phoneWithConditionSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete, getMeterValuesFieldsSchema, basicFieldsOfNewResourceMeter, FormWrapper, MeterTypeRadioGroup, InputByType, Tooltip, ApartmentsAgent, PreviewContent, Link, UserBadge, useMapCards, MapOverlay } from 'kui-crm';
3
3
  import _ from 'lodash';
4
4
  import { clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises, getPhoneParamsFromString, addToArrayByCondition, Loader } from 'kui-utils';
5
5
  import to from 'await-to-js';
6
6
  import { DateTime } from 'luxon';
7
- import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm } from 'kui-complex';
7
+ import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm, InputFile } from 'kui-complex';
8
8
  import { jsx, jsxs } from 'react/jsx-runtime';
9
- import { theme, Caption, Grid, Button } from 'kui-basic';
9
+ import { useState, useMemo, useEffect } from 'react';
10
+ import { useForm } from 'react-hook-form';
11
+ import { Grid, theme, Caption, Button } from 'kui-basic';
12
+ import { yupResolver } from '@hookform/resolvers/yup';
10
13
  import { observer } from 'mobx-react';
11
14
  import styled from '@emotion/styled';
12
15
  import { CheckIcon, CancelIcon, CommentIcon, UpdateIcon, WarningIcon, PhoneIcon, CloseIcon } from 'kui-icon';
13
- import { useEffect } from 'react';
14
16
  import { makeAutoObservable } from 'mobx';
15
17
 
16
18
  /******************************************************************************
@@ -656,9 +658,9 @@ var apartmentFields = {
656
658
  var getBasicApartmentInfoFields = function (handlePlaceSelect, settings) { return [
657
659
  __assign({ name: "country", label: "Country", variant: "custom", CustomInput: CountryAutocomplete, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.country),
658
660
  __assign({ name: "region", label: "Region", variant: "custom", CustomInput: RegionAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.region),
659
- __assign({ name: "city", label: "City", variant: "custom", CustomInput: CityAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.city),
660
- __assign({ name: "apartment", variant: "custom", CustomInput: InputWithAddressAutocomplete, handlePlaceSelect: handlePlaceSelect, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.apartment),
661
- __assign({ label: "Apartment", name: "apartmentNumber", "data-testid": "apartment_number" }, settings === null || settings === void 0 ? void 0 : settings.apartmentNumber),
661
+ __assign({ name: "city", label: "City", variant: "custom", CustomInput: CityAutocomplete, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.city),
662
+ __assign({ name: "apartment", variant: "custom", CustomInput: InputWithAddressAutocomplete, handlePlaceSelect: handlePlaceSelect, size: 12, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.apartment),
663
+ __assign({ label: "Apartment", name: "apartmentNumber", "data-testid": "apartment_number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.apartmentNumber),
662
664
  __assign({ label: "Zip code", name: "zipCode" }, settings === null || settings === void 0 ? void 0 : settings.zipCode),
663
665
  ]; };
664
666
 
@@ -670,20 +672,19 @@ var BasicApartmentInfoFieldsSchema = {
670
672
  city: yup.object({
671
673
  name: yup.string().required("This field is required"),
672
674
  }),
673
- zipCode: yup.string().required("This field is required"),
674
675
  };
675
676
  var BasicApartmentInfoStepSchema = yup.object(BasicApartmentInfoFieldsSchema);
676
677
 
677
678
  var getHouseInfoStep = function (settings) { return [
678
- __assign({ name: "typeOfHouse", label: "Type houses", variant: "select", options: HouseTypesValues }, settings === null || settings === void 0 ? void 0 : settings.typeOfHouse),
679
+ __assign({ name: "typeOfHouse", label: "Type houses", variant: "select", options: HouseTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.typeOfHouse),
679
680
  __assign({ name: "houseNumber", label: "House series" }, settings === null || settings === void 0 ? void 0 : settings.houseNumber),
680
- __assign({ name: "wallMaterial", label: "Wall material", variant: "select", options: WallMaterialsValues }, settings === null || settings === void 0 ? void 0 : settings.wallMaterial),
681
- __assign({ name: "overlapType", label: "Overlap type", variant: "select", options: SlabsTypesValues }, settings === null || settings === void 0 ? void 0 : settings.overlapType),
682
- __assign({ name: "gasLeads", label: "Gas", variant: "select", options: GasTypesValues }, settings === null || settings === void 0 ? void 0 : settings.gasLeads),
683
- __assign({ name: "withHotWater", label: "Hot water", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.withHotWater),
684
- __assign({ name: "passengerElevatorsCount", label: "Passenger elevators", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.passengerElevatorsCount),
685
- __assign({ name: "serviceElevatorsCount", label: "Service elevators", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.serviceElevatorsCount),
686
- __assign({ name: "buildingYear", label: "Builded" }, settings === null || settings === void 0 ? void 0 : settings.buildingYear),
681
+ __assign({ name: "wallMaterial", label: "Wall material", variant: "select", options: WallMaterialsValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.wallMaterial),
682
+ __assign({ name: "overlapType", label: "Overlap type", variant: "select", options: SlabsTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.overlapType),
683
+ __assign({ name: "gasLeads", label: "Gas", variant: "select", options: GasTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.gasLeads),
684
+ __assign({ name: "withHotWater", label: "Hot water", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.withHotWater),
685
+ __assign({ name: "passengerElevatorsCount", label: "Passenger elevators", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.passengerElevatorsCount),
686
+ __assign({ name: "serviceElevatorsCount", label: "Service elevators", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.serviceElevatorsCount),
687
+ __assign({ name: "buildingYear", label: "Builded", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.buildingYear),
687
688
  ]; };
688
689
 
689
690
  var HouseInfoFieldsSchema = {
@@ -704,7 +705,7 @@ var inputProps = {
704
705
  var getDetailApartmentInfoFields = function (roomsCount, bedroomsCount, settings) {
705
706
  var _a, _b;
706
707
  return __spreadArray(__spreadArray([
707
- __assign(__assign({ label: "Total area", name: "area", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.area)
708
+ __assign(__assign({ label: "Total area", name: "area", type: "number", isRequired: true }, inputProps), settings === null || settings === void 0 ? void 0 : settings.area)
708
709
  ], (roomsCount
709
710
  ? new Array(Number(roomsCount))
710
711
  .fill(0)
@@ -715,18 +716,18 @@ var getDetailApartmentInfoFields = function (roomsCount, bedroomsCount, settings
715
716
  : "Room ".concat(key + 1);
716
717
  var settingsKey = bedroomsCount && key < bedroomsCount ? "bedrooms" : "rooms";
717
718
  return [
718
- __assign({ name: "rooms.".concat(key, ".type"), label: "".concat(label, " type"), variant: "select", options: RoomTypeValues }, ((settings === null || settings === void 0 ? void 0 : settings[settingsKey])
719
+ __assign({ name: "rooms.".concat(key, ".type"), label: "".concat(label, " type"), variant: "select", options: RoomTypeValues, isRequired: true }, ((settings === null || settings === void 0 ? void 0 : settings[settingsKey])
719
720
  ? (_a = settings[settingsKey](key)) === null || _a === void 0 ? void 0 : _a.type
720
721
  : {})),
721
722
  ];
722
723
  })
723
724
  .flat()
724
725
  : []), true), [
725
- __assign(__assign({ name: "ceilingHeight", label: "Ceiling height", type: "number", cornerLabel: "m." }, inputProps), settings === null || settings === void 0 ? void 0 : settings.ceilingHeight),
726
- __assign({ name: "numberOfWindows", label: "Windows", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.numberOfWindows),
727
- __assign({ name: "renovation.year", label: "Year of last renovation", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.renovation.year),
728
- __assign({ name: "renovation.type", label: "Type of renovation", variant: "select", options: RenovationTypeValues }, (_a = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _a === void 0 ? void 0 : _a.type),
729
- __assign({ name: "renovation.style", label: "Renovation style", variant: "select", options: RenovationStyleValues }, (_b = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _b === void 0 ? void 0 : _b.style),
726
+ __assign(__assign({ name: "ceilingHeight", label: "Ceiling height", type: "number", cornerLabel: "m.", isRequired: true }, inputProps), settings === null || settings === void 0 ? void 0 : settings.ceilingHeight),
727
+ __assign({ name: "numberOfWindows", label: "Windows", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.numberOfWindows),
728
+ __assign({ name: "renovation.year", label: "Year of last renovation", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.renovation.year),
729
+ __assign({ name: "renovation.type", label: "Type of renovation", variant: "select", options: RenovationTypeValues, isRequired: true }, (_a = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _a === void 0 ? void 0 : _a.type),
730
+ __assign({ name: "renovation.style", label: "Renovation style", variant: "select", options: RenovationStyleValues, isRequired: true }, (_b = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _b === void 0 ? void 0 : _b.style),
730
731
  ], false);
731
732
  };
732
733
 
@@ -746,13 +747,13 @@ var DetailApartmentInfoFieldsSchema = {
746
747
  var DetailApartmentInfoStepSchema = yup.object(DetailApartmentInfoFieldsSchema);
747
748
 
748
749
  var getRoomsApartmentInfoFields = function (settings) { return [
749
- __assign({ label: "Floor", name: "floor", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.floor),
750
- __assign({ label: "Floors", name: "floorCount", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.floorCount),
751
- __assign({ label: "Rooms", name: "roomsNumber", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.roomsNumber),
752
- __assign({ label: "Bedrooms", name: "bedroomsNumber", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.bedroomsNumber),
753
- __assign({ label: "Bathrooms", name: "bathroomsNumber", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.bathroomsNumber),
754
- __assign({ label: "Restrooms", name: "restroomsNumber", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.restroomsNumber),
755
- __assign({ label: "Combined bathroom", name: "combinedBathroomsNumber", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.combinedBathroomsNumber),
750
+ __assign({ label: "Floor", name: "floor", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.floor),
751
+ __assign({ label: "Floors", name: "floorCount", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.floorCount),
752
+ __assign({ label: "Rooms", name: "roomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.roomsNumber),
753
+ __assign({ label: "Bedrooms", name: "bedroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.bedroomsNumber),
754
+ __assign({ label: "Bathrooms", name: "bathroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.bathroomsNumber),
755
+ __assign({ label: "Restrooms", name: "restroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.restroomsNumber),
756
+ __assign({ label: "Combined bathroom", name: "combinedBathroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.combinedBathroomsNumber),
756
757
  ]; };
757
758
 
758
759
  var RoomsApartmentInfoFieldsSchema = {
@@ -793,11 +794,11 @@ var RoomsApartmentInfoFieldsSchema = {
793
794
  var RoomsApartmentInfoStepSchema = yup.object(RoomsApartmentInfoFieldsSchema);
794
795
 
795
796
  var getSecurityApartmentInfoFields = function (settings) { return [
796
- __assign({ label: "Object type", name: "typeOfObject", variant: "select", options: RoomTypesValues }, settings === null || settings === void 0 ? void 0 : settings.typeOfObject),
797
- __assign({ label: "Entrance", name: "entrance" }, settings === null || settings === void 0 ? void 0 : settings.entrance),
798
- __assign({ name: "hasIntercom", label: "Intercom", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasIntercom),
797
+ __assign({ label: "Object type", name: "typeOfObject", variant: "select", options: RoomTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.typeOfObject),
798
+ __assign({ label: "Entrance", name: "entrance", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.entrance),
799
+ __assign({ name: "hasIntercom", label: "Intercom", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasIntercom),
799
800
  __assign({ name: "intercomCode", label: "Intercom code", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasIntercom" }, settings === null || settings === void 0 ? void 0 : settings.intercomCode),
800
- __assign({ name: "hasGate", label: "Gate", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasGate),
801
+ __assign({ name: "hasGate", label: "Gate", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasGate),
801
802
  __assign({ name: "gateCode", label: "Gate code", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasGate" }, settings === null || settings === void 0 ? void 0 : settings.gateCode),
802
803
  __assign({ name: "parkingType", label: "Parking", variant: "select", options: ParkingTypesValues }, settings === null || settings === void 0 ? void 0 : settings.parkingType),
803
804
  __assign({ name: "parkingNumber", label: "Parking number", variant: "custom", CustomInput: DependentInput, dependentInputName: "parkingType" }, settings === null || settings === void 0 ? void 0 : settings.parkingNumber),
@@ -827,17 +828,20 @@ var AdditionalInfoFieldsSchema = {
827
828
  countryOfResidence: yup.object({
828
829
  name: yup.string().required(defaultRequiredMessage),
829
830
  }),
831
+ company: yup.object({
832
+ name: yup.string().required(defaultRequiredMessage),
833
+ }),
830
834
  };
831
835
  var AdditionalInfoStepSchema = yup.object(AdditionalInfoFieldsSchema);
832
836
 
833
837
  var getHouseServicesInfoStep = function (settings) { return [
834
- __assign({ name: "hasBarrier", label: "Barrier", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasBarrier),
838
+ __assign({ name: "hasBarrier", label: "Barrier", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasBarrier),
835
839
  __assign({ name: "barrierPhone", label: "Barrier code", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasBarrier", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.barrierPhone),
836
- __assign({ name: "hasConcierge", label: "Concierge", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasConcierge),
840
+ __assign({ name: "hasConcierge", label: "Concierge", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasConcierge),
837
841
  __assign({ name: "conciergePhone", label: "Concierge", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasConcierge", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.conciergePhone),
838
- __assign({ name: "hasSecurity", label: "Security", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasSecurity),
842
+ __assign({ name: "hasSecurity", label: "Security", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasSecurity),
839
843
  __assign({ name: "securityPhone", label: "Security", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasSecurity", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.securityPhone),
840
- __assign({ name: "hasVideoControl", label: "Video surveillance", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasVideoControl),
844
+ __assign({ name: "hasVideoControl", label: "Video surveillance", variant: "select", options: BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasVideoControl),
841
845
  __assign({ name: "videoControlPhone", label: "Video surveillance", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasVideoControl", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.videoControlPhone),
842
846
  ]; };
843
847
 
@@ -857,10 +861,10 @@ var metersOptions = getNumbersValues(7);
857
861
  var getMetersInfoStepFields = function (settings) {
858
862
  var _a, _b, _c, _d;
859
863
  return [
860
- __assign({ name: "maxMeters.water", label: "Water", variant: "select", options: metersOptions }, (_a = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _a === void 0 ? void 0 : _a.water),
861
- __assign({ name: "maxMeters.electricity", label: "Electricity", variant: "select", options: metersOptions }, (_b = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _b === void 0 ? void 0 : _b.electricity),
862
- __assign({ name: "maxMeters.gas", label: "Gas", variant: "select", options: metersOptions }, (_c = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _c === void 0 ? void 0 : _c.gas),
863
- __assign({ name: "maxMeters.heating", label: "Heating", variant: "select", options: metersOptions }, (_d = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _d === void 0 ? void 0 : _d.heating),
864
+ __assign({ name: "maxMeters.water", label: "Water", variant: "select", options: metersOptions, isRequired: true }, (_a = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _a === void 0 ? void 0 : _a.water),
865
+ __assign({ name: "maxMeters.electricity", label: "Electricity", variant: "select", options: metersOptions, isRequired: true }, (_b = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _b === void 0 ? void 0 : _b.electricity),
866
+ __assign({ name: "maxMeters.gas", label: "Gas", variant: "select", options: metersOptions, isRequired: true }, (_c = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _c === void 0 ? void 0 : _c.gas),
867
+ __assign({ name: "maxMeters.heating", label: "Heating", variant: "select", options: metersOptions, isRequired: true }, (_d = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _d === void 0 ? void 0 : _d.heating),
864
868
  ];
865
869
  };
866
870
 
@@ -888,15 +892,14 @@ var getTelecommunicationsInfoStepFields = function (settings) {
888
892
  };
889
893
 
890
894
  var TelecommunicationsInfoFieldsSchema = {
891
- tvType: yup.string().required(defaultRequiredMessage),
892
895
  homePhone: phoneNonRequiredSchema("homePhone"),
893
896
  };
894
897
  var TelecommunicationsInfoStepSchema = yup
895
898
  .object()
896
899
  .shape(TelecommunicationsInfoFieldsSchema, [["homePhone", "homePhone"]]);
897
900
 
898
- var getFillingInfoFields = function (withType, type, setType, settings) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], addToArrayByCondition(withType, __assign({ label: "Filling type", name: "type", variant: "select", options: FillingTypeValues, handleChange: setType }, settings === null || settings === void 0 ? void 0 : settings.type)), true), [
899
- __assign({ label: "Name (tag)", name: "tag", type: type, variant: "custom", CustomInput: FillingTagsAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.tag)
901
+ var getFillingInfoFields = function (withType, type, setType, settings) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], addToArrayByCondition(withType, __assign({ label: "Filling type", name: "type", variant: "select", options: FillingTypeValues, handleChange: setType, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.type)), true), [
902
+ __assign({ label: "Name (tag)", name: "tag", type: type, variant: "custom", CustomInput: FillingTagsAutocomplete, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.tag)
900
903
  ], false), addToArrayByCondition(type !== "finish", __assign({ label: "Serial code", name: "serialNumber", size: 6 }, settings === null || settings === void 0 ? void 0 : settings.serialNumber)), true), addToArrayByCondition(type !== "finish", __assign({ label: "Amount", name: "numberOfSubjects", type: "number", size: 6 }, settings === null || settings === void 0 ? void 0 : settings.numberOfSubjects)), true), [
901
904
  __assign({ label: "Description", name: "name", isTextArea: true }, settings === null || settings === void 0 ? void 0 : settings.name)
902
905
  ], false), addToArrayByCondition(type !== "finish", __assign({ label: "Instruction", name: "instruction", variant: "custom", CustomInput: InputFileWithVisibility }, settings === null || settings === void 0 ? void 0 : settings.instruction)), true); };
@@ -913,6 +916,46 @@ var FillingInfoFieldsSchema = yup.object().shape({
913
916
  }),
914
917
  });
915
918
 
919
+ var meterFeaturesFieldsSchema = {
920
+ number: yup.string().required("This field is required"),
921
+ };
922
+ var getMeterFeaturesFieldsSchema = function (valuesFields) {
923
+ var valuesSchema = getMeterValuesFieldsSchema(valuesFields);
924
+ return yup.object().shape(__assign(__assign({}, meterFeaturesFieldsSchema), Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))));
925
+ };
926
+
927
+ var getInventoryMeterFields = function (settings, inputsSettings) { return __spreadArray(__spreadArray([], basicFieldsOfNewResourceMeter(settings, inputsSettings), true), [
928
+ __assign({ label: "Activation date", name: "startDate", variant: "date", max: DateTime.now() }, inputsSettings === null || inputsSettings === void 0 ? void 0 : inputsSettings.startDate),
929
+ __assign({ label: "Passport", name: "passportFile", variant: "custom", CustomInput: InputFile }, inputsSettings === null || inputsSettings === void 0 ? void 0 : inputsSettings.passportFile),
930
+ ], false); };
931
+
932
+ function InventoryMeterInfoFields(props) {
933
+ var resource = props.resource, handleSubmit = props.handleSubmit, handlePrevClick = props.handlePrevClick, defaultValues = props.defaultValues;
934
+ var withMeterType = resource === "water" || resource === "electricity";
935
+ var defaultType = resource === "water" ? "cold" : "T1";
936
+ var defaultMeterType = withMeterType ? defaultType : null;
937
+ var _a = useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.type) || defaultMeterType), meterType = _a[0], setMeterType = _a[1];
938
+ var meterFields = getInventoryMeterFields({
939
+ resource: resource,
940
+ meterType: meterType,
941
+ });
942
+ var valueFieldsName = meterFields
943
+ .filter(function (field) { return field.type === "number"; })
944
+ .map(function (field) { return field.name; });
945
+ var meterFeaturesFieldsSchema = getMeterFeaturesFieldsSchema(valueFieldsName);
946
+ var form = useMemo(function () {
947
+ return useForm({
948
+ resolver: yupResolver(meterFeaturesFieldsSchema),
949
+ defaultValues: __assign({}, defaultValues),
950
+ values: defaultValues,
951
+ });
952
+ }, [meterFeaturesFieldsSchema]);
953
+ return (jsx(FormWrapper, __assign({ form: form, onSubmit: handleSubmit, label: "Next", variant: "next", withPrevStep: true, handlePrevClick: handlePrevClick }, { children: jsxs(Grid, __assign({ container: true, spacing: 2 }, { children: [withMeterType && (jsx(MeterTypeRadioGroup, { form: form, resource: resource, handleChange: setMeterType })), meterFields.map(function (_a) {
954
+ var size = _a.size, field = __rest(_a, ["size"]);
955
+ return (jsx(Grid, __assign({ item: true, xs: size || 6 }, { children: jsx(InputByType, __assign({ form: form }, field)) }), field.name));
956
+ })] })) })));
957
+ }
958
+
916
959
  var renderMetersSteps = function (MeterStep, MeterPhotoStep, maxMeters) {
917
960
  var meters = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.water) || 0)).fill("water"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.electricity) || 0)).fill("electricity"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.gas) || 0)).fill("gas"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.heating) || 0)).fill("heating"), true);
918
961
  return meters.map(function (resource, index) { return [
@@ -1112,5 +1155,5 @@ var ObjectForMapOverlay = function (props) {
1112
1155
  var StyledWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
1113
1156
  var templateObject_1;
1114
1157
 
1115
- export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, index as InspectionFeedback, InspectionFillingCard, MetersInfoFieldsSchema, MetersInfoStepSchema, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapPoint, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, WaterMeterFieldsSchema, apartmentFields, getAdditionalInfoStepFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseInfoStep, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useFillingList, useMetersValues };
1158
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, index as InspectionFeedback, InspectionFillingCard, InventoryMeterInfoFields, MetersInfoFieldsSchema, MetersInfoStepSchema, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapPoint, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, WaterMeterFieldsSchema, apartmentFields, getAdditionalInfoStepFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseInfoStep, getHouseServicesInfoStep, getInventoryMeterFields, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useFillingList, useMetersValues };
1116
1159
  //# sourceMappingURL=index.js.map