kui-crm_actions 0.0.21 → 0.0.23

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, FileBodyRequest, ImageBodyRequest, 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$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';
3
3
  import * as yup from 'yup';
4
4
  import { Loader, MultistepForm } from 'kui-utils';
5
5
  import { DateTime } from 'luxon';
@@ -161,10 +161,11 @@ type InspectionRoomPhotoTypes =
161
161
  | "combined_bathroom"
162
162
  | "keys"
163
163
 
164
- type CommonInspectionFormFields = () => {
164
+ type CommonInspectionFormFields = {
165
165
  date: DateTime
166
166
  basedOn?: number
167
167
  type: InspectionTypes
168
+ dropboxLink?: string
168
169
  }
169
170
 
170
171
  type InspectionRoomImagesParams = {
@@ -177,6 +178,17 @@ type InspectionRoomsImagesFields = {
177
178
  roomsImages: InspectionRoomImagesParams[]
178
179
  }
179
180
 
181
+ type InspectionRoomsFields = {
182
+ roomsNumber: number | null
183
+ bathroomsNumber: number | null
184
+ restroomsNumber: number | null
185
+ combinedBathroomsNumber: number | null
186
+ }
187
+
188
+ type InspectionImageFieldsSettings = {
189
+ [key: string]: any
190
+ }
191
+
180
192
  type TransferInspectionTypes =
181
193
  | "maroom_tenant"
182
194
  | "tenant_maroom"
@@ -216,11 +228,13 @@ declare type CommonInspectionFields = {
216
228
  based_on: number | null;
217
229
  date: string;
218
230
  inspection_type: InspectionTypes;
231
+ dropbox_link?: string;
219
232
  };
220
233
  declare type PostApartmentInspectionRequest = {
221
234
  based_on?: number;
222
235
  date: string;
223
236
  inspection_type: InspectionTypes;
237
+ dropbox_link?: string;
224
238
  initial?: InitialInspectionFieldsBody;
225
239
  quarterly?: QuarterlyInspectionFieldsBody;
226
240
  transfer?: TransferInspectionFieldsBody;
@@ -237,6 +251,7 @@ declare type PartialMeterModel = {
237
251
  meter_type?: MeterTypes;
238
252
  resource_type: ResourceTypes;
239
253
  values: InspectionMeterValueModel;
254
+ photo: ImageBodyRequest[];
240
255
  };
241
256
  declare type InspectionMeterCommonFields = {
242
257
  meter_type?: MeterTypes | null;
@@ -246,6 +261,7 @@ declare type InspectionMeterCommonFields = {
246
261
  operating_account?: string | null;
247
262
  company?: number;
248
263
  passport: FileBodyRequest;
264
+ photo: ImageBodyRequest[];
249
265
  };
250
266
  declare type InventoryMeterModel = {
251
267
  values: InspectionMeterValueModel;
@@ -280,22 +296,22 @@ declare type InventoryInspectionFieldsBody = {
280
296
  } & Partial<ApartmentDetailInfoModelFields>;
281
297
  declare type InventoryInspectionPostBody = {
282
298
  inventory: InventoryInspectionFieldsBody;
283
- rooms_with_photos: InspectionRoomPhotoRequest[];
299
+ photo_groups: InspectionRoomPhotoRequest[];
284
300
  } & CommonInspectionFields;
285
301
  declare type InitialInspectionPostBody = {
286
302
  initial: InitialInspectionFieldsBody;
287
- rooms_with_photos: InspectionRoomPhotoRequest[];
303
+ photo_groups: InspectionRoomPhotoRequest[];
288
304
  } & CommonInspectionFields;
289
305
  declare type QuarterlyInspectionPostBody = {
290
306
  quarterly: QuarterlyInspectionFieldsBody;
291
- rooms_with_photos: InspectionRoomPhotoRequest[];
307
+ photo_groups: InspectionRoomPhotoRequest[];
292
308
  } & CommonInspectionFields;
293
309
  declare type TransferInspectionPostBody = {
294
310
  transfer: TransferInspectionFieldsBody;
295
- rooms_with_photos: InspectionRoomPhotoRequest[];
311
+ photo_groups: InspectionRoomPhotoRequest[];
296
312
  } & CommonInspectionFields;
297
313
  declare type InspectionRoomPhotoRequest = {
298
- room_purpose: InspectionRoomPhotoTypes;
314
+ purpose: InspectionRoomPhotoTypes;
299
315
  comment?: string;
300
316
  photos: ImageBodyRequest[];
301
317
  };
@@ -444,7 +460,7 @@ declare const inspectionsRequestBody: {
444
460
  resource_type: kui_crm.ResourceTypes;
445
461
  meter_type: kui_crm.MeterTypes | undefined;
446
462
  passport_number: string;
447
- photos: ImageBodyRequest[];
463
+ photo: ImageBodyRequest[];
448
464
  values: {
449
465
  [key: string]: any;
450
466
  };
@@ -457,7 +473,7 @@ declare const inspectionsRequestBody: {
457
473
  values: {
458
474
  [key: string]: any;
459
475
  };
460
- photos: ImageBodyRequest[];
476
+ photo: ImageBodyRequest[];
461
477
  id: number | undefined;
462
478
  meter_type: kui_crm.MeterTypes | undefined;
463
479
  passport_number: string;
@@ -802,10 +818,12 @@ type MeterInfoStepProps = {
802
818
 
803
819
  declare const renderMetersSteps: (MeterStep: (props: MeterInfoStepProps) => ReactElement, MeterPhotoStep: (props: MeterInfoStepProps) => ReactElement, maxMeters?: MetersCountParams | null | undefined) => JSX.Element[][];
804
820
 
821
+ declare const getRoomsImagesSteps: (type: InspectionTypes, settings: InspectionImageFieldsSettings, roomsParams?: InspectionRoomsFields | null | undefined) => any[];
822
+
805
823
  declare const useMetersValues: (formStore: MultistepForm<any>, metersStore: ApartmentMetersStoreInterface) => void;
806
824
 
807
825
  declare type InspectionFieldsSettings = {
808
826
  [key: string]: InputParams<any>;
809
827
  };
810
828
 
811
- 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, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
829
+ 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 };
package/index.js CHANGED
@@ -118,7 +118,8 @@ var inspectionsRequestBody = {
118
118
  based_on: null,
119
119
  date: DateTime.now().toISODate(),
120
120
  inspection_type: "initial",
121
- rooms_with_photos: roomsImages,
121
+ dropbox_link: inspection.dropboxLink,
122
+ photo_groups: roomsImages,
122
123
  initial: this.getInitialInspectionFields(inspection),
123
124
  };
124
125
  },
@@ -161,7 +162,8 @@ var inspectionsRequestBody = {
161
162
  date: DateTime.now().toISODate(),
162
163
  inspection_type: "quarterly",
163
164
  based_on: null,
164
- rooms_with_photos: roomsImages,
165
+ dropbox_link: inspection.dropboxLink,
166
+ photo_groups: roomsImages,
165
167
  quarterly: this.getPartialInspectionMeters(inspection.meters, metersImages),
166
168
  };
167
169
  },
@@ -170,7 +172,8 @@ var inspectionsRequestBody = {
170
172
  date: DateTime.now().toISODate(),
171
173
  inspection_type: "transfer",
172
174
  based_on: null,
173
- rooms_with_photos: roomsImages,
175
+ dropbox_link: inspection.dropboxLink,
176
+ photo_groups: roomsImages,
174
177
  transfer: __assign({ transfer_type: inspection.transferType }, this.getPartialInspectionMeters(inspection.meters, metersImages)),
175
178
  };
176
179
  },
@@ -181,7 +184,7 @@ var inspectionsRequestBody = {
181
184
  resource_type: meter.resource,
182
185
  meter_type: meter.type,
183
186
  passport_number: meter.number,
184
- photos: metersImages[index],
187
+ photo: metersImages[index],
185
188
  values: clearNotValidFields({
186
189
  value: meter.value,
187
190
  T1: meter.T1,
@@ -197,7 +200,8 @@ var inspectionsRequestBody = {
197
200
  date: DateTime.now().toISODate(),
198
201
  inspection_type: "inventory",
199
202
  based_on: null,
200
- rooms_with_photos: roomsImages,
203
+ dropbox_link: inspection.dropboxLink,
204
+ photo_groups: roomsImages,
201
205
  inventory: __assign({ not_allowed_children: !inspection.withChildren, not_allowed_pets: !inspection.withPets, additional_terms: inspection.additionalTerms, country_of_residence: ((_a = inspection.countryOfResidence) === null || _a === void 0 ? void 0 : _a.id) || null, administrative_company: ((_b = inspection.company) === null || _b === void 0 ? void 0 : _b.id) || null, tax_type: inspection.taxesType, financial_personal_account: inspection.communalServicesAccount, max_electricity_counters: (_c = inspection.maxMeters) === null || _c === void 0 ? void 0 : _c.electricity, max_gas_counters: (_d = inspection.maxMeters) === null || _d === void 0 ? void 0 : _d.gas, max_heating_counters: (_e = inspection.maxMeters) === null || _e === void 0 ? void 0 : _e.heating, max_water_counters: (_f = inspection.maxMeters) === null || _f === void 0 ? void 0 : _f.water, has_barrier: inspection.hasBarrier, has_concierge: inspection.hasConcierge, has_security: inspection.hasSecurity, has_video_surveillance: inspection.hasVideoControl, barrier_phone: inspection.barrierPhone
202
206
  ? getPhoneNumberFromPhoneParams(inspection.barrierPhone)
203
207
  : null, concierge_phone: inspection.conciergePhone
@@ -229,7 +233,7 @@ var inspectionsRequestBody = {
229
233
  T1: meter.initialValueT1,
230
234
  T2: meter.initialValueT2,
231
235
  T3: meter.initialValueT3,
232
- }), photos: metersImages[index] })); })) || [],
236
+ }), photo: metersImages[index] })); })) || [],
233
237
  };
234
238
  },
235
239
  getMeterCommonFields: function (meter) {
@@ -283,7 +287,7 @@ var inspectionsRequests = {
283
287
  case 1:
284
288
  images = _a.sent();
285
289
  return [2 /*return*/, roomsImages.map(function (room, index) { return ({
286
- room_purpose: room.type,
290
+ purpose: room.type,
287
291
  comment: room.comment,
288
292
  photos: images[index] || [],
289
293
  }); })];
@@ -647,6 +651,21 @@ var renderMetersSteps = function (MeterStep, MeterPhotoStep, maxMeters) {
647
651
  ]; });
648
652
  };
649
653
 
654
+ var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
655
+ __assign({ type: "kitchen" }, settings.kitchen)
656
+ ], new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.roomsNumber) || 0))
657
+ .fill(0)
658
+ .map(function (_, index) { return (__assign({ type: "room" }, settings.room((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.roomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bathroomsNumber) || 0))
659
+ .fill(0)
660
+ .map(function (_, index) { return (__assign({ type: "bathroom" }, settings.bathroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bathroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.restroomsNumber) || 0))
661
+ .fill(0)
662
+ .map(function (_, index) { return (__assign({ type: "toilet" }, settings.toilet((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.restroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.combinedBathroomsNumber) || 0))
663
+ .fill(0)
664
+ .map(function (_, index) { return (__assign({ type: "combined_bathroom" }, settings.combinedBathroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.combinedBathroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), [
665
+ __assign({ type: "others" }, settings.others),
666
+ __assign({ type: "keys" }, settings.keys)
667
+ ], false), addToArrayByCondition(type === "initial", __assign({ type: "entrance" }, settings.entrance)), true); };
668
+
650
669
  var useMetersValues = function (formStore, metersStore) {
651
670
  useEffect(function () {
652
671
  var _a, _b;
@@ -661,5 +680,5 @@ var useMetersValues = function (formStore, metersStore) {
661
680
  }, [metersStore.meters, metersStore.loader.isLoading]);
662
681
  };
663
682
 
664
- export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, 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 };
683
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, MetersInfoFieldsSchema, MetersInfoStepSchema, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
665
684
  //# sourceMappingURL=index.js.map