kui-crm_actions 0.0.4 → 0.0.6

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,18 +1,84 @@
1
- import { InputParams, ResourceTypes as ResourceTypes$1, MeterTypes as MeterTypes$1, InputFileWithVisibilityFields, MeterFeaturesFormFields, ImageBodyRequest, CityParams, RoomTypes, RenovationParams, RoomParams, PhoneParams, ParkingTypes, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes, MetersCountParams, FillingInfoFormFields } from 'kui-crm';
1
+ import * as kui_crm from 'kui-crm';
2
+ import { RoomType, CountryModel, RegionModel, CityModel, CountyModel, DistrictModel, LatLonParams, RoomTypes, RenovationType, RenovationStyle, ParkingTypes, InputParams, ResourceTypes as ResourceTypes$1, MeterTypes as MeterTypes$1, InputFileWithVisibilityFields, MeterFeaturesFormFields, ContractLinkModel, FileBodyRequest, ImageBodyRequest, CityParams, RenovationParams, RoomParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes as TaxesTypes$1, MetersCountParams, FillingInfoFormFields, ApartmentFillingVariants } from 'kui-crm';
2
3
  import * as yup from 'yup';
3
- import { Loader } from 'kui-utils';
4
+ import { Loader, MultistepForm } from 'kui-utils';
4
5
  import { DateTime } from 'luxon';
5
6
  import UploadFileParams, { UploadFileParams as UploadFileParams$1 } from 'kui-complex/dist/FileItem';
6
7
  import { InputWithAddressFields } from 'kui-complex/dist/InputWithAddressAutocomplete';
8
+ import React from 'react';
7
9
 
10
+ declare type RoomModel = {
11
+ area: number | null;
12
+ room_type?: RoomType | null;
13
+ };
8
14
  declare type WaterMeterTypes = "cold" | "hot";
9
15
  declare type ElectricityMeterTypes = "T1" | "T2" | "T3";
10
16
  declare type ResourceTypes = "water" | "electricity" | "gas" | "heating";
11
- declare type MeterTypes = ElectricityMeterTypes | WaterMeterTypes | null;
17
+ declare type TaxesTypes = "resident" | "nonresident" | "individual-entrepreneur" | "company" | "self-employed";
18
+ declare type MeterTypes = ElectricityMeterTypes | WaterMeterTypes | null;
19
+ declare type ApartmentMainInfoModelFields = {
20
+ country: CountryModel;
21
+ region: RegionModel;
22
+ city: CityModel;
23
+ county: CountyModel;
24
+ district: DistrictModel;
25
+ geolocation: LatLonParams;
26
+ address: string;
27
+ apartment_number: string | number;
28
+ post_index?: string;
29
+ floor: number | null;
30
+ floor_count: number;
31
+ room_type: RoomTypes | null;
32
+ num_entrance: string;
33
+ has_intercom: boolean | null;
34
+ intercom_code: string;
35
+ has_gate: boolean | null;
36
+ gate_code: string;
37
+ area: string | number | null;
38
+ living_area: string | number | null;
39
+ kitchen_area: string | number | null;
40
+ rooms_number: number | null;
41
+ bedrooms_number: number | null;
42
+ bathrooms_number: number | null;
43
+ restrooms_number: number | null;
44
+ combined_bathrooms_number: number | null;
45
+ ceiling_height: string | number | null;
46
+ number_of_windows: number | null;
47
+ renovation_year?: number | null;
48
+ renovation_type?: RenovationType | null;
49
+ renovation_style?: RenovationStyle | null;
50
+ rooms: RoomModel[];
51
+ };
52
+ declare type ApartmentDetailInfoModelFields = {
53
+ financial_personal_account: string;
54
+ max_electricity_counters: number | null;
55
+ max_gas_counters: number | null;
56
+ max_heating_counters: number | null;
57
+ max_water_counters: number | null;
58
+ has_barrier: boolean | null;
59
+ has_concierge: boolean | null;
60
+ has_security: boolean | null;
61
+ has_video_surveillance: boolean | null;
62
+ barrier_phone: string | null;
63
+ concierge_phone: string | null;
64
+ security_phone: string | null;
65
+ video_surveillance_phone: string | null;
66
+ home_phone: string | null;
67
+ wifi_name: string;
68
+ wifi_password: string;
69
+ internet_provider_link: string;
70
+ internet_provider_login: string;
71
+ internet_provider_password: string;
72
+ parking_type: ParkingTypes | null;
73
+ parking_number: string;
74
+ passenger_elevators_number: string | number | null;
75
+ service_elevators_number: string | number | null;
76
+ payer_code: string;
77
+ };
12
78
 
13
79
  declare const getPartialMeterInfoFields: (resource: ResourceTypes, type?: MeterTypes | undefined) => InputParams<any>[];
14
80
 
15
- declare const getPartialMeterInfoSchema: (valuesFields: string[]) => yup.ObjectSchema<{
81
+ declare const getPartialMeterInfoSchema: (valuesFields: InputParams<any>[]) => yup.ObjectSchema<{
16
82
  [x: string]: any;
17
83
  }, yup.AnyObject, {
18
84
  [x: string]: any;
@@ -49,6 +115,12 @@ type InspectionPartialMetersStepFields = {
49
115
  meters: PartialMeterInfoFields[]
50
116
  }
51
117
 
118
+ type ApartmentMetersStoreInterface = {
119
+ loader: Loader
120
+ fetchMeters: () => Promise<void>
121
+ meters: PartialMeterInfoFields[]
122
+ }
123
+
52
124
  type InspectionTypes =
53
125
  | "initial"
54
126
  | "inventory"
@@ -95,6 +167,108 @@ type TransferInspectionFormFields = {
95
167
  InspectionPartialMetersStepFields &
96
168
  InspectionRoomsImagesFields
97
169
 
170
+ declare type InspectionAppraisalLiteModel = {
171
+ id: number;
172
+ date: string;
173
+ max_price: string;
174
+ min_price: string;
175
+ };
176
+ declare type InspectionImpairmentLiteModel = {
177
+ id: number;
178
+ damage: string;
179
+ wear_and_tear: string;
180
+ };
181
+ declare type ApartmentInspectionModel = {
182
+ id: number;
183
+ date: string;
184
+ inspection_type: InspectionTypes;
185
+ rental_contract?: ContractLinkModel;
186
+ appraisal: InspectionAppraisalLiteModel | null;
187
+ impairment: InspectionImpairmentLiteModel | null;
188
+ comment: string;
189
+ };
190
+ declare type CommonInspectionFields = {
191
+ based_on: number | null;
192
+ date: string;
193
+ inspection_type: InspectionTypes;
194
+ };
195
+ declare type PostApartmentInspectionRequest = {
196
+ based_on?: number;
197
+ date: string;
198
+ inspection_type: InspectionTypes;
199
+ initial?: InitialInspectionFieldsBody;
200
+ quarterly?: QuarterlyInspectionFieldsBody;
201
+ transfer?: TransferInspectionFieldsBody;
202
+ };
203
+ declare type InspectionMeterValueModel = {
204
+ value?: string | number | null;
205
+ T1?: string | number | null;
206
+ T2?: string | number | null;
207
+ T3?: string | number | null;
208
+ };
209
+ declare type PartialMeterModel = {
210
+ id: number;
211
+ passport_number: string;
212
+ meter_type?: MeterTypes;
213
+ resource_type: ResourceTypes;
214
+ values: InspectionMeterValueModel;
215
+ };
216
+ declare type InspectionMeterCommonFields = {
217
+ meter_type?: MeterTypes | null;
218
+ passport_number: string;
219
+ resource_type: ResourceTypes;
220
+ activation_date: string;
221
+ operating_account?: string | null;
222
+ company?: number;
223
+ passport: FileBodyRequest;
224
+ };
225
+ declare type InventoryMeterModel = {
226
+ values: InspectionMeterValueModel;
227
+ } & InspectionMeterCommonFields;
228
+ declare type InspectionFillingParams = {
229
+ feature: number;
230
+ description?: string;
231
+ serial_code?: string;
232
+ amount?: number | string | null;
233
+ photos: ImageBodyRequest[];
234
+ instruction?: FileBodyRequest | null;
235
+ };
236
+ declare type InitialInspectionFieldsBody = {
237
+ city: number;
238
+ } & Omit<Partial<ApartmentMainInfoModelFields>, "city">;
239
+ declare type QuarterlyInspectionFieldsBody = {
240
+ meters: PartialMeterModel[];
241
+ };
242
+ declare type TransferInspectionFieldsBody = {
243
+ transfer_type: TransferInspectionTypes;
244
+ meters: PartialMeterModel[];
245
+ };
246
+ declare type InventoryInspectionFieldsBody = {
247
+ country_of_residence: number | null;
248
+ administrative_company: number | null;
249
+ tax_type: TaxesTypes | null;
250
+ meters: InventoryMeterModel[];
251
+ filling: InspectionFillingParams[];
252
+ not_allowed_children: boolean;
253
+ not_allowed_pets: boolean;
254
+ additional_terms: string;
255
+ } & Partial<ApartmentDetailInfoModelFields>;
256
+ declare type InventoryInspectionPostBody = {
257
+ inventory: InventoryInspectionFieldsBody;
258
+ rooms_with_photos: InspectionRoomPhotoRequest[];
259
+ } & CommonInspectionFields;
260
+ declare type InitialInspectionPostBody = {
261
+ initial: InitialInspectionFieldsBody;
262
+ rooms_with_photos: InspectionRoomPhotoRequest[];
263
+ } & CommonInspectionFields;
264
+ declare type QuarterlyInspectionPostBody = {
265
+ quarterly: QuarterlyInspectionFieldsBody;
266
+ rooms_with_photos: InspectionRoomPhotoRequest[];
267
+ } & CommonInspectionFields;
268
+ declare type TransferInspectionPostBody = {
269
+ transfer: TransferInspectionFieldsBody;
270
+ rooms_with_photos: InspectionRoomPhotoRequest[];
271
+ } & CommonInspectionFields;
98
272
  declare type InspectionRoomPhotoRequest = {
99
273
  room_purpose: InspectionRoomPhotoTypes;
100
274
  comment?: string;
@@ -173,7 +347,7 @@ type ApartmentPaymentsFormFields = {
173
347
  communalServicesAccount: string
174
348
  company: CompanyAutocompleteFields | null
175
349
  countryOfResidence: CountryAutocompleteFields | null
176
- taxesType: TaxesTypes | null
350
+ taxesType: TaxesTypes$1 | null
177
351
  }
178
352
 
179
353
  type AdditionalInfoStepFields = {
@@ -222,12 +396,70 @@ declare const inspectionsRequests: {
222
396
  createInventoryInspection(data: InventoryInspectionFormFields, apartmentId: number, loader: Loader): Promise<number | null | undefined>;
223
397
  };
224
398
 
225
- declare type InspectionFieldsSettings = {
226
- [key: string]: InputParams<any>;
399
+ declare const inspectionsRequestBody: {
400
+ getPostBodyInitialInspection(inspection: InitialInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): InitialInspectionPostBody;
401
+ getInitialInspectionFields(inspection: InitialInspectionInfoFields): InitialInspectionFieldsBody;
402
+ getPostBodyQuarterlyInspection(inspection: QuarterlyInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): QuarterlyInspectionPostBody;
403
+ getPostBodyTransferInspection(inspection: TransferInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): TransferInspectionPostBody;
404
+ getPartialInspectionMeters(meters: PartialMeterInfoFields[]): {
405
+ meters: {
406
+ id: number;
407
+ resource_type: kui_crm.ResourceTypes;
408
+ meter_type: kui_crm.MeterTypes | undefined;
409
+ passport_number: string;
410
+ values: {
411
+ [key: string]: any;
412
+ };
413
+ }[];
414
+ };
415
+ getPostBodyInventoryInspection(inspection: InventoryInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[], fillingFiles: FileBodyRequest[], metersFiles: FileBodyRequest[], fillingImages: ImageBodyRequest[][]): InventoryInspectionPostBody;
416
+ getInventoryInspectionMeters(meters: InspectionMeterFields$1[], metersFiles: FileBodyRequest[]): {
417
+ meters: {
418
+ passport: FileBodyRequest;
419
+ values: {
420
+ [key: string]: any;
421
+ };
422
+ id: number | undefined;
423
+ meter_type: kui_crm.MeterTypes | undefined;
424
+ passport_number: string;
425
+ resource_type: kui_crm.ResourceTypes;
426
+ activation_date: string;
427
+ operating_account: string | null | undefined;
428
+ company: number | undefined;
429
+ tariff: number | undefined;
430
+ }[];
431
+ };
432
+ getMeterCommonFields(meter: InspectionMeterFields$1): {
433
+ id: number | undefined;
434
+ meter_type: kui_crm.MeterTypes | undefined;
435
+ passport_number: string;
436
+ resource_type: kui_crm.ResourceTypes;
437
+ activation_date: string;
438
+ operating_account: string | null | undefined;
439
+ company: number | undefined;
440
+ tariff: number | undefined;
441
+ };
442
+ getMeterValues(initialValue?: string | number | null | undefined, lastValue?: string | number | null | undefined): {
443
+ [key: string]: any;
444
+ };
227
445
  };
228
446
 
229
447
  declare const getBasicApartmentInfoFields: (handlePlaceSelect: (coords: google.maps.LatLngLiteral) => void, settings?: InspectionFieldsSettings | undefined) => InputParams<BasicApartmentInfoStepFields>[];
230
448
 
449
+ declare const BasicApartmentInfoFieldsSchema: {
450
+ apartment: yup.ObjectSchema<{
451
+ address: string;
452
+ }, yup.AnyObject, {
453
+ address: undefined;
454
+ }, "">;
455
+ apartmentNumber: yup.StringSchema<string, yup.AnyObject, undefined, "">;
456
+ city: yup.ObjectSchema<{
457
+ name: string;
458
+ }, yup.AnyObject, {
459
+ name: undefined;
460
+ }, "">;
461
+ zipCode: yup.StringSchema<string, yup.AnyObject, undefined, "">;
462
+ };
231
463
  declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
232
464
  apartment: {
233
465
  address: string;
@@ -250,6 +482,26 @@ declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
250
482
 
251
483
  declare const getDetailApartmentInfoFields: (roomsCount?: number | null | undefined, settings?: InspectionFieldsSettings | undefined) => InputParams<DetailApartmentInfoStepFields>[];
252
484
 
485
+ declare const DetailApartmentInfoFieldsSchema: {
486
+ area: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
487
+ livingArea: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
488
+ kitchenArea: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
489
+ rooms: yup.ArraySchema<{
490
+ type: string;
491
+ area: number;
492
+ }[] | undefined, yup.AnyObject, "", "">;
493
+ ceilingHeight: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
494
+ numberOfWindows: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
495
+ renovation: yup.ObjectSchema<{
496
+ year: number;
497
+ type: string;
498
+ style: string;
499
+ }, yup.AnyObject, {
500
+ year: undefined;
501
+ type: undefined;
502
+ style: undefined;
503
+ }, "">;
504
+ };
253
505
  declare const DetailApartmentInfoStepSchema: yup.ObjectSchema<{
254
506
  area: number;
255
507
  livingArea: number;
@@ -281,6 +533,15 @@ declare const DetailApartmentInfoStepSchema: yup.ObjectSchema<{
281
533
 
282
534
  declare const getRoomsApartmentInfoFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<RoomsApartmentInfoStepFields>[];
283
535
 
536
+ declare const RoomsApartmentInfoFieldsSchema: {
537
+ floor: yup.NumberSchema<number | undefined, yup.AnyObject, undefined, "">;
538
+ floorCount: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
539
+ roomsNumber: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
540
+ bedroomsNumber: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
541
+ bathroomsNumber: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
542
+ restroomsNumber: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
543
+ combinedBathroomsNumber: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
544
+ };
284
545
  declare const RoomsApartmentInfoStepSchema: yup.ObjectSchema<{
285
546
  floor: number | undefined;
286
547
  floorCount: number;
@@ -301,6 +562,14 @@ declare const RoomsApartmentInfoStepSchema: yup.ObjectSchema<{
301
562
 
302
563
  declare const getSecurityApartmentInfoFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<SecurityApartmentInfoStepFields>[];
303
564
 
565
+ declare const SecurityApartmentInfoFieldsSchema: {
566
+ typeOfRoom: yup.StringSchema<string, yup.AnyObject, undefined, "">;
567
+ entrance: yup.StringSchema<string, yup.AnyObject, undefined, "">;
568
+ hasIntercom: yup.StringSchema<string, yup.AnyObject, undefined, "">;
569
+ intercomCode: yup.StringSchema<string, yup.AnyObject, undefined, "">;
570
+ hasGate: yup.StringSchema<string, yup.AnyObject, undefined, "">;
571
+ gateCode: yup.StringSchema<string, yup.AnyObject, undefined, "">;
572
+ };
304
573
  declare const SecurityApartmentInfoStepSchema: yup.ObjectSchema<{
305
574
  typeOfRoom: string;
306
575
  entrance: string;
@@ -320,6 +589,9 @@ declare const SecurityApartmentInfoStepSchema: yup.ObjectSchema<{
320
589
  declare const getApartmentPaymentFields: (settings?: InspectionFieldsSettings | undefined) => any[];
321
590
  declare const getAdditionalInfoStepFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<AdditionalInfoStepFields>[];
322
591
 
592
+ declare const AdditionalInfoFieldsSchema: {
593
+ taxesType: yup.StringSchema<string, yup.AnyObject, undefined, "">;
594
+ };
323
595
  declare const AdditionalInfoStepSchema: yup.ObjectSchema<{
324
596
  taxesType: string;
325
597
  }, yup.AnyObject, {
@@ -328,6 +600,36 @@ declare const AdditionalInfoStepSchema: yup.ObjectSchema<{
328
600
 
329
601
  declare const getHouseServicesInfoStep: (settings?: InspectionFieldsSettings | undefined) => InputParams<HouseServicesInfoStepFields>[];
330
602
 
603
+ declare const HouseServicesInfoFieldsSchema: {
604
+ hasBarrier: yup.StringSchema<string, yup.AnyObject, undefined, "">;
605
+ barrierPhone: yup.ObjectSchema<{
606
+ phoneNumber: string | null | undefined;
607
+ } | null, yup.AnyObject, {
608
+ phoneNumber: undefined;
609
+ }, "">;
610
+ hasConcierge: yup.StringSchema<string, yup.AnyObject, undefined, "">;
611
+ conciergePhone: yup.ObjectSchema<{
612
+ phoneNumber: string | null | undefined;
613
+ } | null, yup.AnyObject, {
614
+ phoneNumber: undefined;
615
+ }, "">;
616
+ hasSecurity: yup.StringSchema<string, yup.AnyObject, undefined, "">;
617
+ securityPhone: yup.ObjectSchema<{
618
+ phoneNumber: string | null | undefined;
619
+ } | null, yup.AnyObject, {
620
+ phoneNumber: undefined;
621
+ }, "">;
622
+ hasVideoControl: yup.StringSchema<string, yup.AnyObject, undefined, "">;
623
+ videoControlPhone: yup.ObjectSchema<{
624
+ phoneNumber: string | null | undefined;
625
+ } | null, yup.AnyObject, {
626
+ phoneNumber: undefined;
627
+ }, "">;
628
+ parkingType: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
629
+ parkingNumber: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
630
+ passengerElevatorsCount: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
631
+ serviceElevatorsCount: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
632
+ };
331
633
  declare const HouseServicesInfoStepSchema: yup.ObjectSchema<{
332
634
  hasBarrier: string;
333
635
  barrierPhone: {
@@ -374,6 +676,19 @@ declare const HouseServicesInfoStepSchema: yup.ObjectSchema<{
374
676
 
375
677
  declare const getMetersInfoStepFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<MetersInfoStepFields>[];
376
678
 
679
+ declare const MetersInfoFieldsSchema: {
680
+ maxMeters: yup.ObjectSchema<{
681
+ water: number;
682
+ electricity: number;
683
+ gas: number;
684
+ heating: number;
685
+ }, yup.AnyObject, {
686
+ water: undefined;
687
+ electricity: undefined;
688
+ gas: undefined;
689
+ heating: undefined;
690
+ }, "">;
691
+ };
377
692
  declare const MetersInfoStepSchema: yup.ObjectSchema<{
378
693
  maxMeters: {
379
694
  water: number;
@@ -392,6 +707,14 @@ declare const MetersInfoStepSchema: yup.ObjectSchema<{
392
707
 
393
708
  declare const getTelecommunicationsInfoStepFields: (settings?: InspectionFieldsSettings | undefined) => InputParams<TelecommunicationsInfoStepFields>[];
394
709
 
710
+ declare const TelecommunicationsInfoFieldsSchema: {
711
+ tvType: yup.StringSchema<string, yup.AnyObject, undefined, "">;
712
+ homePhone: yup.ObjectSchema<{
713
+ phoneNumber: string | null | undefined;
714
+ } | null, yup.AnyObject, {
715
+ phoneNumber: undefined;
716
+ }, "">;
717
+ };
395
718
  declare const TelecommunicationsInfoStepSchema: yup.ObjectSchema<{
396
719
  tvType: string;
397
720
  homePhone: {
@@ -404,4 +727,19 @@ declare const TelecommunicationsInfoStepSchema: yup.ObjectSchema<{
404
727
  };
405
728
  }, "">;
406
729
 
407
- export { AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentPaymentsFormFields, BasicApartmentInfoStepSchema as BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingInfoStepFields, FillingListInfoStepFields, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFormFields, InitialInspectionInfoFields, InspectionMeterFields$1 as InspectionMeterFields, InspectionMetersStepFields$1 as InspectionMetersStepFields, InspectionPartialMetersStepFields, InventoryInspectionFormFields, MetersInfoStepFields, MetersInfoStepSchema, PartialMeterInfoFields, PartialMeterInfoStepProps, RoomsApartmentInfoStepSchema as RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequests };
730
+ declare const getFillingInfoFields: (withType: boolean, type: ApartmentFillingVariants, setType: (fillingType: ApartmentFillingVariants) => void, settings?: InspectionFieldsSettings | undefined) => InputParams<FillingInfoFormFields>[];
731
+
732
+ type MeterInfoStepProps = {
733
+ index: number
734
+ resource: ResourceTypes$1
735
+ }
736
+
737
+ declare const renderMetersSteps: (MeterStep: React.ComponentClass<MeterInfoStepProps>, maxMeters?: MetersCountParams | null | undefined) => JSX.Element[];
738
+
739
+ declare const useMetersValues: (formStore: MultistepForm<any>, metersStore: ApartmentMetersStoreInterface) => void;
740
+
741
+ declare type InspectionFieldsSettings = {
742
+ [key: string]: InputParams<any>;
743
+ };
744
+
745
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentDetailInfoModelFields, ApartmentInspectionModel, ApartmentMainInfoModelFields, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, ElectricityMeterTypes, FillingInfoStepFields, FillingListInfoStepFields, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InspectionAppraisalLiteModel, InspectionFieldsSettings, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields$1 as InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields$1 as InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomPhotoRequest, InspectionRoomPhotoTypes, InspectionRoomsImagesFields, InspectionTypes, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterModel, MeterInfoStepProps, MeterTypes, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, PartialMeterInfoFields, PartialMeterInfoStepProps, PartialMeterModel, PostApartmentInspectionRequest, QuarterlyInspectionFieldsBody, QuarterlyInspectionFormFields, QuarterlyInspectionPostBody, ResourceTypes, RoomModel, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TaxesTypes, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, TransferInspectionFieldsBody, TransferInspectionFormFields, TransferInspectionPostBody, TransferInspectionTypes, WaterMeterTypes, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
package/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import { addToArrayByCondition, clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises } from 'kui-utils';
2
2
  import * as yup from 'yup';
3
- import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, CompanyAutocomplete, TaxTypeValues, defaultRequiredMessage, ParkingTypesValues, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema } from 'kui-crm';
3
+ import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, CompanyAutocomplete, TaxTypeValues, defaultRequiredMessage, ParkingTypesValues, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete } from 'kui-crm';
4
4
  import to from 'await-to-js';
5
5
  import { DateTime } from 'luxon';
6
6
  import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm } from 'kui-complex';
7
+ import { jsx } from 'react/jsx-runtime';
8
+ import { useEffect } from 'react';
7
9
 
8
10
  /******************************************************************************
9
11
  Copyright (c) Microsoft Corporation.
@@ -101,7 +103,10 @@ var getPartialMeterInfoFields = function (resource, type) {
101
103
  };
102
104
 
103
105
  var getPartialMeterInfoSchema = function (valuesFields) {
104
- var valuesSchema = valuesFields.map(function (field) {
106
+ var filteredFields = valuesFields
107
+ .filter(function (field) { return field.type === "number"; })
108
+ .map(function (field) { return field.name; });
109
+ var valuesSchema = filteredFields.map(function (field) {
105
110
  var _a;
106
111
  return (_a = {},
107
112
  _a[field] = yup
@@ -607,5 +612,30 @@ var TelecommunicationsInfoStepSchema = yup
607
612
  .object()
608
613
  .shape(TelecommunicationsInfoFieldsSchema, [["homePhone", "homePhone"]]);
609
614
 
610
- export { AdditionalInfoStepSchema, BasicApartmentInfoStepSchema as BasicApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, HouseServicesInfoStepSchema, MetersInfoStepSchema, RoomsApartmentInfoStepSchema as RoomsApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequests };
615
+ 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), [
616
+ __assign({ label: "Name (tag)", name: "tag", type: type, variant: "custom", CustomInput: FillingTagsAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.tag)
617
+ ], 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), [
618
+ __assign({ label: "Description", name: "name", isTextArea: true }, settings === null || settings === void 0 ? void 0 : settings.name)
619
+ ], false), addToArrayByCondition(type !== "finish", __assign({ label: "Instruction", name: "instruction", variant: "custom", CustomInput: InputFileWithVisibility }, settings === null || settings === void 0 ? void 0 : settings.instruction)), true); };
620
+
621
+ var renderMetersSteps = function (MeterStep, maxMeters) {
622
+ 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);
623
+ return meters.map(function (resource, index) { return (jsx(MeterStep, { index: index, resource: resource }, index)); });
624
+ };
625
+
626
+ var useMetersValues = function (formStore, metersStore) {
627
+ useEffect(function () {
628
+ var _a, _b;
629
+ if (!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b.length)) {
630
+ metersStore.fetchMeters();
631
+ }
632
+ }, []);
633
+ useEffect(function () {
634
+ if (!metersStore.loader.isLoading) {
635
+ formStore.updateFormFields({ meters: metersStore.meters });
636
+ }
637
+ }, [metersStore.meters, metersStore.loader.isLoading]);
638
+ };
639
+
640
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, MetersInfoFieldsSchema, MetersInfoStepSchema, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
611
641
  //# sourceMappingURL=index.js.map