kui-crm_actions 0.0.27 → 0.0.29

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,8 +258,14 @@ 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
- value?: string | number | null;
265
+ cold?: string | number | null;
266
+ hot?: string | number | null;
267
+ gas?: string | number | null;
268
+ heating?: string | number | null;
244
269
  T1?: string | number | null;
245
270
  T2?: string | number | null;
246
271
  T3?: string | number | null;
@@ -248,13 +273,13 @@ declare type InspectionMeterValueModel = {
248
273
  declare type PartialMeterModel = {
249
274
  id: number;
250
275
  passport_number: string;
251
- meter_type?: MeterTypes;
276
+ meter_type?: MeterTypes$1;
252
277
  resource_type: ResourceTypes;
253
278
  values: InspectionMeterValueModel;
254
279
  photos: ImageBodyRequest[];
255
280
  };
256
281
  declare type InspectionMeterCommonFields = {
257
- meter_type?: MeterTypes | null;
282
+ meter_type?: MeterTypes$1 | null;
258
283
  passport_number: string;
259
284
  resource_type: ResourceTypes;
260
285
  activation_date: string | null;
@@ -488,6 +513,32 @@ declare const inspectionsRequestBody: {
488
513
  tariff: number | undefined;
489
514
  }[];
490
515
  };
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;
520
+ cold?: undefined;
521
+ hot?: undefined;
522
+ } | {
523
+ cold: string | number | null | undefined;
524
+ T1?: undefined;
525
+ T2?: undefined;
526
+ T3?: undefined;
527
+ hot?: undefined;
528
+ } | {
529
+ hot: string | number | null | undefined;
530
+ T1?: undefined;
531
+ T2?: undefined;
532
+ T3?: undefined;
533
+ cold?: undefined;
534
+ } | {
535
+ [x: string]: string | number | null | undefined;
536
+ T1?: undefined;
537
+ T2?: undefined;
538
+ T3?: undefined;
539
+ cold?: undefined;
540
+ hot?: undefined;
541
+ };
491
542
  getMeterCommonFields(meter: InspectionMeterFields$1): {
492
543
  id: number | undefined;
493
544
  meter_type: kui_crm.MeterTypes | undefined;
@@ -572,8 +623,8 @@ declare const DetailApartmentInfoStepSchema: yup.ObjectSchema<{
572
623
  ceilingHeight: number;
573
624
  numberOfWindows: number;
574
625
  renovation: {
575
- year: number;
576
626
  type: string;
627
+ year: number;
577
628
  style: string;
578
629
  };
579
630
  }, yup.AnyObject, {
@@ -830,4 +881,4 @@ declare type InspectionFieldsSettings = {
830
881
  [key: string]: InputParams<any>;
831
882
  };
832
883
 
833
- 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
@@ -178,6 +178,7 @@ var inspectionsRequestBody = {
178
178
  };
179
179
  },
180
180
  getPartialInspectionMeters: function (meters, metersImages) {
181
+ var _this = this;
181
182
  return {
182
183
  meters: meters.map(function (meter, index) { return ({
183
184
  id: meter.id,
@@ -185,12 +186,7 @@ var inspectionsRequestBody = {
185
186
  meter_type: meter.type,
186
187
  passport_number: meter.number,
187
188
  photos: metersImages[index],
188
- values: clearNotValidFields({
189
- value: meter.value,
190
- T1: meter.T1,
191
- T2: meter.T2,
192
- T3: meter.T3,
193
- }),
189
+ values: clearNotValidFields(_this.getInspectionMeterValues(meter)),
194
190
  }); }),
195
191
  };
196
192
  },
@@ -228,14 +224,30 @@ var inspectionsRequestBody = {
228
224
  getInventoryInspectionMeters: function (meters, metersFiles, metersImages) {
229
225
  var _this = this;
230
226
  return {
231
- meters: (meters === null || meters === void 0 ? void 0 : meters.map(function (meter, index) { return (__assign(__assign({}, _this.getMeterCommonFields(meter)), { passport: metersFiles[index], values: clearNotValidFields({
232
- value: meter.initialValue,
233
- T1: meter.initialValueT1,
234
- T2: meter.initialValueT2,
235
- T3: meter.initialValueT3,
236
- }), 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 })); })) || [],
237
228
  };
238
229
  },
230
+ getInspectionMeterValues: function (meter, fieldName) {
231
+ var _a;
232
+ if (meter.resource === "electricity") {
233
+ var prefix = fieldName || "";
234
+ return {
235
+ T1: meter["".concat(prefix, "T1")],
236
+ T2: meter["".concat(prefix, "T2")],
237
+ T3: meter["".concat(prefix, "T3")],
238
+ };
239
+ }
240
+ var valueField = (fieldName || "value");
241
+ if (meter.resource === "water") {
242
+ if (meter.type === "cold") {
243
+ return { cold: meter[valueField] };
244
+ }
245
+ return { hot: meter[valueField] };
246
+ }
247
+ return _a = {},
248
+ _a[meter.resource] = meter[valueField],
249
+ _a;
250
+ },
239
251
  getMeterCommonFields: function (meter) {
240
252
  var _a, _b, _c;
241
253
  return {