kui-crm_actions 0.0.28 → 0.0.30

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 { RoomType, CountryModel, RegionModel, CityModel, CountyModel, DistrictModel, LatLonParams, RoomTypes, RenovationType, RenovationStyle, ParkingTypes, InputParams, ResourceTypes as ResourceTypes$1, MeterTypes as MeterTypes$1, InputFileWithVisibilityFields, MeterFeaturesFormFields, ContractLinkModel, ImageBodyRequest, FileBodyRequest, CityParams, RenovationParams, RoomParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes as TaxesTypes$1, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, FillingInfoFormFields as FillingInfoFormFields$1 } from 'kui-crm';
2
+ import { RoomType, CountryModel, RegionModel, CityModel, CountyModel, DistrictModel, LatLonParams, RoomTypes, RenovationType, RenovationStyle, ParkingTypes, InputParams, ResourceTypes as ResourceTypes$1, MeterTypes as MeterTypes$2, InputFileWithVisibilityFields, MeterFeaturesFormFields, ContractLinkModel, ImageBodyRequest, FileBodyRequest, CityParams, RenovationParams, RoomParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes as TaxesTypes$1, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, FillingInfoFormFields as FillingInfoFormFields$1 } from 'kui-crm';
3
3
  import * as yup from 'yup';
4
4
  import { Loader, MultistepForm } from 'kui-utils';
5
5
  import { DateTime } from 'luxon';
@@ -11,11 +11,11 @@ declare type RoomModel = {
11
11
  area: number | null;
12
12
  room_type?: RoomType | null;
13
13
  };
14
- declare type WaterMeterTypes = "cold" | "hot";
15
- declare type ElectricityMeterTypes = "T1" | "T2" | "T3";
14
+ declare type WaterMeterTypes$1 = "cold" | "hot";
15
+ declare type ElectricityMeterTypes$1 = "T1" | "T2" | "T3";
16
16
  declare type ResourceTypes = "water" | "electricity" | "gas" | "heating";
17
17
  declare type TaxesTypes = "resident" | "nonresident" | "individual-entrepreneur" | "company" | "self-employed";
18
- declare type MeterTypes = ElectricityMeterTypes | WaterMeterTypes | null;
18
+ declare type MeterTypes$1 = ElectricityMeterTypes$1 | WaterMeterTypes$1 | null;
19
19
  declare type ApartmentMainInfoModelFields = {
20
20
  country: CountryModel;
21
21
  region: RegionModel;
@@ -76,7 +76,7 @@ declare type ApartmentDetailInfoModelFields = {
76
76
  payer_code: string;
77
77
  };
78
78
 
79
- declare const getPartialMeterInfoFields: (resource: ResourceTypes, type?: MeterTypes | undefined, name?: string | undefined, settings?: any) => InputParams<any>[];
79
+ declare const getPartialMeterInfoFields: (resource: ResourceTypes, type?: MeterTypes$1 | undefined, name?: string | undefined, settings?: any) => InputParams<any>[];
80
80
 
81
81
  declare const getPartialMeterInfoSchema: (valuesFields: InputParams<any>[]) => yup.ObjectSchema<{
82
82
  [x: string]: any;
@@ -107,13 +107,13 @@ type UploadFileParams = {
107
107
  type PartialMeterInfoStepProps = {
108
108
  resource: ResourceTypes$1
109
109
  index: number
110
- type?: MeterTypes$1
110
+ type?: MeterTypes$2
111
111
  }
112
112
 
113
113
  type PartialMeterInfoFields = {
114
114
  id: number
115
115
  resource: ResourceTypes$1
116
- type?: MeterTypes$1
116
+ type?: MeterTypes$2
117
117
  number: string
118
118
  value?: string | number | null
119
119
  T1?: string | number | null
@@ -189,6 +189,10 @@ type InspectionImageFieldsSettings = {
189
189
  [key: string]: any
190
190
  }
191
191
 
192
+ declare type WaterMeterTypes = "cold" | "hot";
193
+ declare type ElectricityMeterTypes = "T1" | "T2" | "T3";
194
+ declare type MeterTypes = ElectricityMeterTypes | WaterMeterTypes | null;
195
+
192
196
  type TransferInspectionTypes =
193
197
  | "maroom_tenant"
194
198
  | "tenant_maroom"
@@ -204,6 +208,21 @@ type TransferInspectionFormFields = {
204
208
  InspectionPartialMetersStepFields &
205
209
  InspectionRoomsImagesFields
206
210
 
211
+ type MeterValue = string | number | null
212
+
213
+ type MeterValuesFields = {
214
+ resource: ResourceTypes
215
+ type?: MeterTypes
216
+ value?: MeterValue
217
+ T1?: MeterValue
218
+ T2?: MeterValue
219
+ T3?: MeterValue
220
+ initialValue?: MeterValue
221
+ initialValueT1?: MeterValue
222
+ initialValueT2?: MeterValue
223
+ initialValueT3?: MeterValue
224
+ }
225
+
207
226
  declare type InspectionAppraisalLiteModel = {
208
227
  id: number;
209
228
  date: string;
@@ -239,6 +258,9 @@ declare type PostApartmentInspectionRequest = {
239
258
  quarterly?: QuarterlyInspectionFieldsBody;
240
259
  transfer?: TransferInspectionFieldsBody;
241
260
  };
261
+ declare type MeterValueModel = {
262
+ last_value: string | number | null;
263
+ };
242
264
  declare type InspectionMeterValueModel = {
243
265
  cold?: string | number | null;
244
266
  hot?: string | number | null;
@@ -251,13 +273,13 @@ declare type InspectionMeterValueModel = {
251
273
  declare type PartialMeterModel = {
252
274
  id: number;
253
275
  passport_number: string;
254
- meter_type?: MeterTypes;
276
+ meter_type?: MeterTypes$1;
255
277
  resource_type: ResourceTypes;
256
278
  values: InspectionMeterValueModel;
257
279
  photos: ImageBodyRequest[];
258
280
  };
259
281
  declare type InspectionMeterCommonFields = {
260
- meter_type?: MeterTypes | null;
282
+ meter_type?: MeterTypes$1 | null;
261
283
  passport_number: string;
262
284
  resource_type: ResourceTypes;
263
285
  activation_date: string | null;
@@ -471,32 +493,6 @@ declare const inspectionsRequestBody: {
471
493
  };
472
494
  }[];
473
495
  };
474
- getPartialMeterValues(meter: PartialMeterInfoFields): {
475
- T1: string | number | null | undefined;
476
- T2: string | number | null | undefined;
477
- T3: string | number | null | undefined;
478
- cold?: undefined;
479
- hot?: undefined;
480
- } | {
481
- cold: string | number | null | undefined;
482
- T1?: undefined;
483
- T2?: undefined;
484
- T3?: undefined;
485
- hot?: undefined;
486
- } | {
487
- hot: string | number | null | undefined;
488
- T1?: undefined;
489
- T2?: undefined;
490
- T3?: undefined;
491
- cold?: undefined;
492
- } | {
493
- [x: string]: string | number | null | undefined;
494
- T1?: undefined;
495
- T2?: undefined;
496
- T3?: undefined;
497
- cold?: undefined;
498
- hot?: undefined;
499
- };
500
496
  getPostBodyInventoryInspection(inspection: InventoryInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[], fillingFiles: FileBodyRequest[], metersFiles: FileBodyRequest[], metersImages: ImageBodyRequest[][], fillingImages: ImageBodyRequest[][]): InventoryInspectionPostBody;
501
497
  getInventoryInspectionMeters(meters: InspectionMeterFields$1[], metersFiles: FileBodyRequest[], metersImages: ImageBodyRequest[][]): {
502
498
  meters: {
@@ -517,26 +513,26 @@ declare const inspectionsRequestBody: {
517
513
  tariff: number | undefined;
518
514
  }[];
519
515
  };
520
- getInventoryMeterValues(meter: InspectionMeterFields$1): {
521
- T1: number | undefined;
522
- T2: number | undefined;
523
- T3: number | undefined;
516
+ getInspectionMeterValues(meter: MeterValuesFields, fieldName?: keyof MeterValuesFields | undefined): {
517
+ T1: string | number | null | undefined;
518
+ T2: string | number | null | undefined;
519
+ T3: string | number | null | undefined;
524
520
  cold?: undefined;
525
521
  hot?: undefined;
526
522
  } | {
527
- cold: number | undefined;
523
+ cold: string | number | null | undefined;
528
524
  T1?: undefined;
529
525
  T2?: undefined;
530
526
  T3?: undefined;
531
527
  hot?: undefined;
532
528
  } | {
533
- hot: number | undefined;
529
+ hot: string | number | null | undefined;
534
530
  T1?: undefined;
535
531
  T2?: undefined;
536
532
  T3?: undefined;
537
533
  cold?: undefined;
538
534
  } | {
539
- [x: string]: number | undefined;
535
+ [x: string]: string | number | null | undefined;
540
536
  T1?: undefined;
541
537
  T2?: undefined;
542
538
  T3?: undefined;
@@ -627,8 +623,8 @@ declare const DetailApartmentInfoStepSchema: yup.ObjectSchema<{
627
623
  ceilingHeight: number;
628
624
  numberOfWindows: number;
629
625
  renovation: {
630
- year: number;
631
626
  type: string;
627
+ year: number;
632
628
  style: string;
633
629
  };
634
630
  }, yup.AnyObject, {
@@ -885,4 +881,4 @@ declare type InspectionFieldsSettings = {
885
881
  [key: string]: InputParams<any>;
886
882
  };
887
883
 
888
- export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentDetailInfoModelFields, ApartmentInspectionModel, ApartmentMainInfoModelFields, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, ElectricityMeterTypes, FillingInfoFieldsSchema, FillingInfoFormFields, 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, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
884
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentDetailInfoModelFields, ApartmentInspectionModel, ApartmentMainInfoModelFields, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, ElectricityMeterTypes$1 as ElectricityMeterTypes, FillingInfoFieldsSchema, FillingInfoFormFields, 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$1 as MeterTypes, MeterValueModel, MeterValuesFields, 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$1 as WaterMeterTypes, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
package/index.js CHANGED
@@ -186,29 +186,10 @@ var inspectionsRequestBody = {
186
186
  meter_type: meter.type,
187
187
  passport_number: meter.number,
188
188
  photos: metersImages[index],
189
- values: clearNotValidFields(_this.getPartialMeterValues(meter)),
189
+ values: clearNotValidFields(_this.getInspectionMeterValues(meter)),
190
190
  }); }),
191
191
  };
192
192
  },
193
- getPartialMeterValues: function (meter) {
194
- var _a;
195
- if (meter.resource === "electricity") {
196
- return {
197
- T1: meter.T1,
198
- T2: meter.T2,
199
- T3: meter.T3,
200
- };
201
- }
202
- if (meter.resource === "water") {
203
- if (meter.type === "cold") {
204
- return { cold: meter.value };
205
- }
206
- return { hot: meter.value };
207
- }
208
- return _a = {},
209
- _a[meter.resource] = meter.value,
210
- _a;
211
- },
212
193
  getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles, metersImages, fillingImages) {
213
194
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
214
195
  return {
@@ -243,26 +224,28 @@ var inspectionsRequestBody = {
243
224
  getInventoryInspectionMeters: function (meters, metersFiles, metersImages) {
244
225
  var _this = this;
245
226
  return {
246
- meters: (meters === null || meters === void 0 ? void 0 : meters.map(function (meter, index) { return (__assign(__assign({}, _this.getMeterCommonFields(meter)), { passport: metersFiles[index], values: clearNotValidFields(_this.getInventoryMeterValues(meter)), photos: metersImages[index], no_tariff: meter.noTariff, auto_sending: meter.withAutoSending })); })) || [],
227
+ meters: (meters === null || meters === void 0 ? void 0 : meters.map(function (meter, index) { return (__assign(__assign({}, _this.getMeterCommonFields(meter)), { passport: metersFiles[index], values: clearNotValidFields(_this.getInspectionMeterValues(meter, "initialValue")), photos: metersImages[index], no_tariff: meter.noTariff, auto_sending: meter.withAutoSending })); })) || [],
247
228
  };
248
229
  },
249
- getInventoryMeterValues: function (meter) {
230
+ getInspectionMeterValues: function (meter, fieldName) {
250
231
  var _a;
251
232
  if (meter.resource === "electricity") {
233
+ var prefix = fieldName || "";
252
234
  return {
253
- T1: meter.initialValueT1,
254
- T2: meter.initialValueT2,
255
- T3: meter.initialValueT3,
235
+ T1: meter["".concat(prefix, "T1")],
236
+ T2: meter["".concat(prefix, "T2")],
237
+ T3: meter["".concat(prefix, "T3")],
256
238
  };
257
239
  }
240
+ var valueField = (fieldName || "value");
258
241
  if (meter.resource === "water") {
259
242
  if (meter.type === "cold") {
260
- return { cold: meter.initialValue };
243
+ return { cold: meter[valueField] };
261
244
  }
262
- return { hot: meter.initialValue };
245
+ return { hot: meter[valueField] };
263
246
  }
264
247
  return _a = {},
265
- _a[meter.resource] = meter.initialValue,
248
+ _a[meter.resource] = meter[valueField],
266
249
  _a;
267
250
  },
268
251
  getMeterCommonFields: function (meter) {