kui-crm_actions 0.0.68 → 0.0.70
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/cjs/index.js +238 -29
- package/cjs/index.js.map +1 -1
- package/index.d.ts +57 -23
- package/index.js +241 -31
- package/index.js.map +1 -1
- package/package.json +1 -1
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, CityParams, RoomTypes, RenovationParams, RoomParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, ImageBodyRequest, FillingInfoFormFields as FillingInfoFormFields$1, ContractLinkModel, FileBodyRequest, RoomType, ApartmentMainInfoModelFields, ApartmentDetailInfoModelFields,
|
2
|
+
import { InputParams, ResourceTypes, MeterTypes, FileStore, InputFileWithVisibilityFields, MeterFeaturesFormFields, InspectionTypes, InspectionRoomPhotoTypes, ParkingTypes, CityParams, RoomTypes, RenovationParams, RoomParams, ImageStore, ApartmentDescriptionParams, ApartmentMetroStationsParams, PhoneParams, WifiParams, InternetProviderParams, TVTypes, CompanyAutocompleteFields, CountryAutocompleteFields, TaxesTypes, MetersCountParams, FillingTagsAutocompleteFields, ApartmentFillingVariants, ImageBodyRequest, FillingInfoFormFields as FillingInfoFormFields$1, ContractLinkModel, FileBodyRequest, RoomType, ApartmentMainInfoModelFields, ApartmentDetailInfoModelFields, 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, 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';
|
@@ -165,6 +165,16 @@ type MeterValuesFields = {
|
|
165
165
|
initialValueT3?: MeterValue
|
166
166
|
}
|
167
167
|
|
168
|
+
type RoomImagesParams = {
|
169
|
+
type: InspectionRoomPhotoTypes
|
170
|
+
comment?: string
|
171
|
+
images: ImageStore[]
|
172
|
+
roomNumber?: number
|
173
|
+
}
|
174
|
+
|
175
|
+
type ApartmentDescriptionWithMetro = ApartmentDescriptionParams &
|
176
|
+
ApartmentMetroStationsParams
|
177
|
+
|
168
178
|
type HouseServicesInfoStepFields = {
|
169
179
|
hasBarrier: boolean | null
|
170
180
|
barrierPhone: PhoneParams | null
|
@@ -452,6 +462,51 @@ declare const inspectionsRequestBody: {
|
|
452
462
|
getFilesParams(files: FileStore[]): ImageBodyRequest[];
|
453
463
|
};
|
454
464
|
|
465
|
+
declare const apartmentFields: {
|
466
|
+
getApartmentDescriptionInfo(apartment: ApartmentModel): ApartmentPartialDescriptionParams;
|
467
|
+
getApartmentMainInfo(apartment: MainObjectInfoInterface): ApartmentMainInfoParams;
|
468
|
+
getApartmentSecurityInfo(apartment: SecurityObjectInfoInterface): ApartmentSecurityInfoParams;
|
469
|
+
getApartmentDetailInfo(apartment: DetailObjectInfoInterface): ApartmentDetailInfoParams;
|
470
|
+
getApartmentTelecommunicationInfo(apartment: ApartmentModel): ApartmentTelecommunicationInfoParams;
|
471
|
+
getApartmentHouseInfo(apartment: ApartmentModel): ApartmentHouseInfoParams;
|
472
|
+
getMaxMetersParams(apartment: ApartmentModel): MaxMetersInfoParams;
|
473
|
+
getGeolocationParams(geolocation?: LatLonParams | undefined): {
|
474
|
+
lat: number;
|
475
|
+
lng: number;
|
476
|
+
} | null;
|
477
|
+
getObjectRoomsImages(images: InspectionRoomPhotoModel[]): RoomImagesParams[];
|
478
|
+
getInspectionFillingParams(filling: InspectionFillingModel): {
|
479
|
+
id: number;
|
480
|
+
name: string;
|
481
|
+
tag: {
|
482
|
+
id: number;
|
483
|
+
name: string;
|
484
|
+
};
|
485
|
+
images: ImageStore[];
|
486
|
+
serialNumber: string | undefined;
|
487
|
+
numberOfSubjects: number;
|
488
|
+
instruction: FileStore | null;
|
489
|
+
type: ApartmentFillingVariants;
|
490
|
+
};
|
491
|
+
getApartmentDescriptionWithMetro(apartment: ApartmentModel): ApartmentDescriptionWithMetro;
|
492
|
+
getMetroStationsParams(metroStations?: ApartmentMetroParams[] | undefined): {
|
493
|
+
id: number;
|
494
|
+
name: string;
|
495
|
+
walkDistance: number | undefined;
|
496
|
+
carDistance: number;
|
497
|
+
carTime: number | undefined;
|
498
|
+
walkTime: number;
|
499
|
+
}[];
|
500
|
+
getMeterValues(meter: TransferInspectionMeterModel | InventoryInspectionMeterModel, resource: ResourceTypes, fieldName?: string | undefined): {
|
501
|
+
[x: string]: number;
|
502
|
+
};
|
503
|
+
getTransferMetersInfo(meters: TransferInspectionMeterModel[]): InspectionPartialMetersInfoParams;
|
504
|
+
getApartmentPaymentInfo(apartment: ApartmentModel): ApartmentPaymentInfoParams;
|
505
|
+
getInspectionPaymentInfo(inspection: FullInspectionCommonFields): InspectionPaymentInfoParams;
|
506
|
+
getMeterInfo(meter: InspectionMeterCommonInfo, resource: ResourceTypes): InspectionMeterInfoParams;
|
507
|
+
getInventoryMetersInfo(inspection: InventoryInspectionFields): InspectionMetersInfoParams;
|
508
|
+
};
|
509
|
+
|
455
510
|
declare const getBasicApartmentInfoFields: (handlePlaceSelect?: ((coords: google.maps.LatLngLiteral) => void) | undefined, settings?: InspectionFieldsSettings | undefined) => InputParams<BasicApartmentInfoStepFields>[];
|
456
511
|
|
457
512
|
declare const BasicApartmentInfoFieldsSchema: {
|
@@ -761,27 +816,6 @@ declare const renderMetersSteps: (MeterStep: (props: MeterInfoStepProps) => Reac
|
|
761
816
|
|
762
817
|
declare const getRoomsImagesSteps: (type: InspectionTypes, settings: InspectionImageFieldsSettings, roomsParams?: InspectionRoomsFields | null | undefined) => any[];
|
763
818
|
|
764
|
-
type InspectionLabelInterface = {
|
765
|
-
rejected: string
|
766
|
-
notSigned: string
|
767
|
-
signed: string
|
768
|
-
}
|
769
|
-
|
770
|
-
type InspectionFeedbackCommentProps = {
|
771
|
-
feedback: InspectionFeedbackParams
|
772
|
-
labels: InspectionLabelInterface
|
773
|
-
}
|
774
|
-
|
775
|
-
type InspectionFeedbackIndicatorProps = {
|
776
|
-
feedback: InspectionFeedbackParams
|
777
|
-
className?: string
|
778
|
-
labels: InspectionLabelInterface
|
779
|
-
}
|
780
|
-
|
781
|
-
declare const InspectionFeedbackIndicator: (props: InspectionFeedbackIndicatorProps) => JSX.Element;
|
782
|
-
|
783
|
-
declare const InspectionFeedbackComment: (props: InspectionFeedbackCommentProps) => JSX.Element;
|
784
|
-
|
785
819
|
declare const useMetersValues: (formStore: MultistepForm<any>, metersStore: ApartmentMetersStoreInterface) => void;
|
786
820
|
|
787
821
|
declare type InspectionFieldsSettings = {
|
@@ -835,4 +869,4 @@ type ApartmentOverlayProps = {
|
|
835
869
|
|
836
870
|
declare const ApartmentInspectionOverlay: (props: ApartmentOverlayProps) => JSX.Element;
|
837
871
|
|
838
|
-
export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionOverlay, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, FillingInfoFormFields, FillingInfoStepFields, FillingListInfoStepFields, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InitialInspectionRoomParams, InspectionAppraisalLiteModel,
|
872
|
+
export { AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionOverlay, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, FillingInfoFormFields, FillingInfoStepFields, FillingListInfoStepFields, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InitialInspectionRoomParams, InspectionAppraisalLiteModel, InspectionFieldsSettings, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomPhotoRequest, InspectionRoomsImagesFields, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterModel, MeterInfoStepProps, MeterValueModel, MeterValuesFields, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, MetroStationParams, 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, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
|
package/index.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as yup from 'yup';
|
2
|
-
import { NumberField, requests, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, ParkingTypesValues, fieldWithConditionSchema, defaultRequiredMessage, getApartmentPaymentFields, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete,
|
2
|
+
import { NumberField, requests, uploadFiles, ImageStore, FileStore, matchesAPIFillingTypes, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, ParkingTypesValues, fieldWithConditionSchema, defaultRequiredMessage, getApartmentPaymentFields, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete, PreviewContent, Link, UserBadge, useMapCards, MapOverlay } from 'kui-crm';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises, addToArrayByCondition } from 'kui-utils';
|
4
|
+
import { clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises, getPhoneParamsFromString, addToArrayByCondition } from 'kui-utils';
|
5
5
|
import to from 'await-to-js';
|
6
6
|
import { DateTime } from 'luxon';
|
7
7
|
import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm } from 'kui-complex';
|
8
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
9
|
-
import styled from '@emotion/styled';
|
10
|
-
import { QuestionIcon, CheckWithCircleIcon, CrossWithCircleIcon, PhoneIcon, CloseIcon } from 'kui-icon';
|
11
|
-
import { Caption, theme, Button, Grid } from 'kui-basic';
|
12
9
|
import { useEffect } from 'react';
|
10
|
+
import styled from '@emotion/styled';
|
11
|
+
import { Button, Grid, Caption, theme } from 'kui-basic';
|
12
|
+
import { PhoneIcon, CloseIcon } from 'kui-icon';
|
13
13
|
|
14
14
|
/******************************************************************************
|
15
15
|
Copyright (c) Microsoft Corporation.
|
@@ -394,6 +394,241 @@ var inspectionsRequests = {
|
|
394
394
|
},
|
395
395
|
};
|
396
396
|
|
397
|
+
var averageWalkMetersPerHour = 5000;
|
398
|
+
var minutesPerHour = 60;
|
399
|
+
var apartmentFields = {
|
400
|
+
getApartmentDescriptionInfo: function (apartment) {
|
401
|
+
return __assign(__assign(__assign(__assign(__assign(__assign({}, this.getApartmentMainInfo(apartment)), this.getApartmentSecurityInfo(apartment)), this.getApartmentDetailInfo(apartment)), this.getApartmentTelecommunicationInfo(apartment)), this.getApartmentHouseInfo(apartment)), this.getMaxMetersParams(apartment));
|
402
|
+
},
|
403
|
+
getApartmentMainInfo: function (apartment) {
|
404
|
+
return __assign(__assign({}, apartment), { apartmentNumber: apartment.apartment_number, zipCode: apartment.post_index || "", floorCount: apartment.floor_count, entrance: apartment.num_entrance, geolocation: this.getGeolocationParams(apartment.geolocation), distanceToCenter: apartment.distance_to_center_kilometers || null, typeOfObject: apartment.room_type });
|
405
|
+
},
|
406
|
+
getApartmentSecurityInfo: function (apartment) {
|
407
|
+
var _a, _b, _c, _d, _e, _f;
|
408
|
+
return {
|
409
|
+
hasIntercom: (_a = apartment.has_intercom) !== null && _a !== void 0 ? _a : null,
|
410
|
+
hasGate: (_b = apartment.has_gate) !== null && _b !== void 0 ? _b : null,
|
411
|
+
hasBarrier: (_c = apartment.has_barrier) !== null && _c !== void 0 ? _c : null,
|
412
|
+
hasSecurity: (_d = apartment.has_security) !== null && _d !== void 0 ? _d : null,
|
413
|
+
hasConcierge: (_e = apartment.has_concierge) !== null && _e !== void 0 ? _e : null,
|
414
|
+
hasVideoControl: (_f = apartment.has_video_surveillance) !== null && _f !== void 0 ? _f : null,
|
415
|
+
intercomCode: apartment.intercom_code || "",
|
416
|
+
gateCode: apartment.gate_code || "",
|
417
|
+
barrierPhone: apartment.barrier_phone
|
418
|
+
? getPhoneParamsFromString(apartment.barrier_phone)
|
419
|
+
: null,
|
420
|
+
conciergePhone: apartment.concierge_phone
|
421
|
+
? getPhoneParamsFromString(apartment.concierge_phone)
|
422
|
+
: null,
|
423
|
+
securityPhone: apartment.security_phone
|
424
|
+
? getPhoneParamsFromString(apartment.security_phone)
|
425
|
+
: null,
|
426
|
+
videoControlPhone: apartment.video_surveillance_phone
|
427
|
+
? getPhoneParamsFromString(apartment.video_surveillance_phone)
|
428
|
+
: null,
|
429
|
+
};
|
430
|
+
},
|
431
|
+
getApartmentDetailInfo: function (apartment) {
|
432
|
+
var _a;
|
433
|
+
return {
|
434
|
+
area: apartment.area,
|
435
|
+
livingArea: apartment.living_area,
|
436
|
+
kitchenArea: apartment.kitchen_area,
|
437
|
+
roomsNumber: apartment.rooms_number,
|
438
|
+
bedroomsNumber: apartment.bedrooms_number,
|
439
|
+
bathroomsNumber: apartment.bathrooms_number,
|
440
|
+
restroomsNumber: apartment.restrooms_number,
|
441
|
+
combinedBathroomsNumber: apartment.combined_bathrooms_number,
|
442
|
+
ceilingHeight: apartment.ceiling_height,
|
443
|
+
numberOfWindows: apartment.number_of_windows,
|
444
|
+
renovation: {
|
445
|
+
year: apartment.renovation_year || null,
|
446
|
+
type: apartment.renovation_type || null,
|
447
|
+
style: apartment.renovation_style || null,
|
448
|
+
},
|
449
|
+
rooms: ((_a = apartment.rooms) === null || _a === void 0 ? void 0 : _a.map(function (room) { return ({
|
450
|
+
id: room.id,
|
451
|
+
area: room.area || null,
|
452
|
+
type: room.room_type || null,
|
453
|
+
}); })) || [],
|
454
|
+
};
|
455
|
+
},
|
456
|
+
getApartmentTelecommunicationInfo: function (apartment) {
|
457
|
+
return {
|
458
|
+
homePhone: apartment.home_phone
|
459
|
+
? getPhoneParamsFromString(apartment.home_phone)
|
460
|
+
: null,
|
461
|
+
wifi: {
|
462
|
+
name: apartment.wifi_name,
|
463
|
+
password: apartment.wifi_password,
|
464
|
+
},
|
465
|
+
internetProvider: {
|
466
|
+
link: apartment.internet_provider_link,
|
467
|
+
login: apartment.internet_provider_login,
|
468
|
+
password: apartment.internet_provider_password,
|
469
|
+
},
|
470
|
+
tvType: apartment.tv_type,
|
471
|
+
};
|
472
|
+
},
|
473
|
+
getApartmentHouseInfo: function (apartment) {
|
474
|
+
return {
|
475
|
+
typeOfHouse: apartment.type_houses,
|
476
|
+
buildingYear: apartment.building_year,
|
477
|
+
houseNumber: apartment.serial_number,
|
478
|
+
wallMaterial: apartment.wall_type,
|
479
|
+
overlapType: apartment.overlap_type,
|
480
|
+
parkingType: apartment.parking_type,
|
481
|
+
parkingNumber: apartment.parking_number,
|
482
|
+
passengerElevatorsCount: apartment.passenger_elevators_number
|
483
|
+
? Number(apartment.passenger_elevators_number)
|
484
|
+
: null,
|
485
|
+
serviceElevatorsCount: apartment.service_elevators_number
|
486
|
+
? Number(apartment.service_elevators_number)
|
487
|
+
: null,
|
488
|
+
gasLeads: apartment.type_gas,
|
489
|
+
withHotWater: apartment.hot_water,
|
490
|
+
};
|
491
|
+
},
|
492
|
+
getMaxMetersParams: function (apartment) {
|
493
|
+
return {
|
494
|
+
maxMeters: {
|
495
|
+
water: apartment.max_water_counters,
|
496
|
+
electricity: apartment.max_electricity_counters,
|
497
|
+
gas: apartment.max_gas_counters,
|
498
|
+
heating: apartment.max_heating_counters,
|
499
|
+
},
|
500
|
+
};
|
501
|
+
},
|
502
|
+
getGeolocationParams: function (geolocation) {
|
503
|
+
return geolocation
|
504
|
+
? {
|
505
|
+
lat: Number(geolocation.lat),
|
506
|
+
lng: Number(geolocation.lon),
|
507
|
+
}
|
508
|
+
: null;
|
509
|
+
},
|
510
|
+
getObjectRoomsImages: function (images) {
|
511
|
+
return images.map(function (imageBlock) { return ({
|
512
|
+
id: imageBlock.id,
|
513
|
+
type: imageBlock.purpose,
|
514
|
+
comment: imageBlock.comment,
|
515
|
+
images: imageBlock.photos.map(function (image) {
|
516
|
+
return ImageStore.initFromImageModel(image);
|
517
|
+
}),
|
518
|
+
roomNumber: typeof imageBlock.room_order_number === "number"
|
519
|
+
? imageBlock.room_order_number + 1
|
520
|
+
: 0,
|
521
|
+
}); });
|
522
|
+
},
|
523
|
+
getInspectionFillingParams: function (filling) {
|
524
|
+
var _a;
|
525
|
+
return {
|
526
|
+
id: filling.id,
|
527
|
+
name: filling.description || "",
|
528
|
+
tag: {
|
529
|
+
id: filling.feature.id,
|
530
|
+
name: filling.feature.name,
|
531
|
+
},
|
532
|
+
images: (_a = filling.photos) === null || _a === void 0 ? void 0 : _a.map(function (image) {
|
533
|
+
return ImageStore.initFromImageModel(image);
|
534
|
+
}),
|
535
|
+
serialNumber: filling.serial_code,
|
536
|
+
numberOfSubjects: Number(filling.amount),
|
537
|
+
instruction: filling.instruction
|
538
|
+
? FileStore.initFromDocumentModel(filling.instruction)
|
539
|
+
: null,
|
540
|
+
type: matchesAPIFillingTypes[filling.feature.feature_type],
|
541
|
+
};
|
542
|
+
},
|
543
|
+
getApartmentDescriptionWithMetro: function (apartment) {
|
544
|
+
return __assign(__assign({}, this.getApartmentDescriptionInfo(apartment)), { metroStations: this.getMetroStationsParams(apartment === null || apartment === void 0 ? void 0 : apartment.metro_stations) });
|
545
|
+
},
|
546
|
+
getMetroStationsParams: function (metroStations) {
|
547
|
+
return ((metroStations === null || metroStations === void 0 ? void 0 : metroStations.map(function (metroStation) { return ({
|
548
|
+
id: metroStation.metro_station_id,
|
549
|
+
name: metroStation.name,
|
550
|
+
walkDistance: metroStation.distance_walk_meters,
|
551
|
+
carDistance: Number(metroStation.distance_car_kilometers),
|
552
|
+
carTime: metroStation.time_car_minutes,
|
553
|
+
walkTime: Math.round(metroStation.distance_walk_meters /
|
554
|
+
(averageWalkMetersPerHour / minutesPerHour)),
|
555
|
+
}); })) || []);
|
556
|
+
},
|
557
|
+
getMeterValues: function (meter, resource, fieldName) {
|
558
|
+
var _a, _b, _c, _d, _e, _f;
|
559
|
+
if (resource === "electricity") {
|
560
|
+
var prefix = fieldName || "";
|
561
|
+
return __assign(__assign((_a = {}, _a["".concat(prefix, "T1")] = Number(meter.values.T1), _a), (meter.meter_type !== "T1" && (_b = {},
|
562
|
+
_b["".concat(prefix, "T2")] = Number(meter.values.T2),
|
563
|
+
_b))), (meter.meter_type === "T3" && (_c = {},
|
564
|
+
_c["".concat(prefix, "T3")] = Number(meter.values.T3),
|
565
|
+
_c)));
|
566
|
+
}
|
567
|
+
var valueField = fieldName || "value";
|
568
|
+
if (resource === "water") {
|
569
|
+
if (meter.meter_type === "cold") {
|
570
|
+
return _d = {}, _d["".concat(valueField)] = Number(meter.values.cold), _d;
|
571
|
+
}
|
572
|
+
return _e = {}, _e["".concat(valueField)] = Number(meter.values.hot), _e;
|
573
|
+
}
|
574
|
+
return _f = {},
|
575
|
+
_f["".concat(valueField)] = Number(meter.values[resource]),
|
576
|
+
_f;
|
577
|
+
},
|
578
|
+
getTransferMetersInfo: function (meters) {
|
579
|
+
var _this = this;
|
580
|
+
return {
|
581
|
+
meters: meters.map(function (meter) {
|
582
|
+
var _a;
|
583
|
+
return (__assign({ id: meter.id, type: meter.meter_type, number: meter.passport_number, resource: meter.resource_type, images: ((_a = meter.photos) === null || _a === void 0 ? void 0 : _a.map(function (photo) { return ImageStore.initFromImageModel(photo); })) ||
|
584
|
+
[] }, _this.getMeterValues(meter, meter.resource_type)));
|
585
|
+
}),
|
586
|
+
};
|
587
|
+
},
|
588
|
+
getApartmentPaymentInfo: function (apartment) {
|
589
|
+
return {
|
590
|
+
payerCode: apartment.payer_code,
|
591
|
+
communalServicesAccount: apartment.financial_personal_account,
|
592
|
+
managementCompany: apartment.administrative_company
|
593
|
+
? __assign(__assign({}, apartment.administrative_company), { operatingAccount: apartment.payer_code }) : null,
|
594
|
+
};
|
595
|
+
},
|
596
|
+
getInspectionPaymentInfo: function (inspection) {
|
597
|
+
return __assign(__assign({}, this.getApartmentPaymentInfo(inspection)), { countryOfResidence: inspection.country_of_residence, taxesType: inspection.taxes_type });
|
598
|
+
},
|
599
|
+
getMeterInfo: function (meter, resource) {
|
600
|
+
var _a;
|
601
|
+
return {
|
602
|
+
id: meter.id,
|
603
|
+
type: meter.meter_type,
|
604
|
+
number: meter.passport_number,
|
605
|
+
startDate: meter.activation_date
|
606
|
+
? DateTime.fromISO(meter.activation_date)
|
607
|
+
: null,
|
608
|
+
company: meter.company,
|
609
|
+
operationalAccountNumber: meter.operating_account,
|
610
|
+
resource: resource,
|
611
|
+
tariff: meter.tariff
|
612
|
+
? {
|
613
|
+
id: meter.tariff.id,
|
614
|
+
name: meter.tariff.code_name,
|
615
|
+
}
|
616
|
+
: null,
|
617
|
+
passportFile: meter.passport
|
618
|
+
? FileStore.initFromFileModel(meter.passport)
|
619
|
+
: null,
|
620
|
+
images: ((_a = meter.photos) === null || _a === void 0 ? void 0 : _a.map(function (photo) { return ImageStore.initFromImageModel(photo); })) ||
|
621
|
+
[],
|
622
|
+
};
|
623
|
+
},
|
624
|
+
getInventoryMetersInfo: function (inspection) {
|
625
|
+
var _this = this;
|
626
|
+
return {
|
627
|
+
meters: inspection.meters.map(function (meter) { return (__assign(__assign({}, _this.getMeterInfo(meter, meter.resource_type)), _this.getMeterValues(meter, meter.resource_type, "initialValue"))); }),
|
628
|
+
};
|
629
|
+
},
|
630
|
+
};
|
631
|
+
|
397
632
|
var getBasicApartmentInfoFields = function (handlePlaceSelect, settings) { return [
|
398
633
|
__assign({ name: "country", label: "Country", variant: "custom", CustomInput: CountryAutocomplete, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.country),
|
399
634
|
__assign({ name: "region", label: "Region", variant: "custom", CustomInput: RegionAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.region),
|
@@ -669,31 +904,6 @@ var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spre
|
|
669
904
|
__assign({ type: "additional" }, settings.additional),
|
670
905
|
], false); };
|
671
906
|
|
672
|
-
var InspectionFeedbackComment = function (props) {
|
673
|
-
var feedback = props.feedback, labels = props.labels;
|
674
|
-
if (feedback.status === "rejected") {
|
675
|
-
return (jsxs("div", { children: [jsx(Caption, __assign({ size: "xs" }, { children: labels.rejected })), jsxs(StyledComment, __assign({ size: "xs" }, { children: [jsx(StyledAccent, { children: "Comment:" }), " ", feedback.comment || "-"] }))] }));
|
676
|
-
}
|
677
|
-
return jsx(Caption, __assign({ size: "xs" }, { children: labels[feedback.status] }));
|
678
|
-
};
|
679
|
-
var StyledComment = styled(Caption)(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n margin-top: 8px;\n"], ["\n margin-top: 8px;\n"])));
|
680
|
-
var StyledAccent = styled.span(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), theme.palette.grey.fiftyP);
|
681
|
-
var templateObject_1$5, templateObject_2$4;
|
682
|
-
|
683
|
-
var InspectionFeedbackIndicator = function (props) {
|
684
|
-
var feedback = props.feedback, className = props.className, labels = props.labels;
|
685
|
-
return (jsx("div", __assign({ className: className }, { children: jsx(Tooltip, __assign({ content: jsx(InspectionFeedbackComment, { feedback: feedback, labels: labels }) }, { children: indicatorIcon[feedback.status] })) })));
|
686
|
-
};
|
687
|
-
var StyledQuestionIcon = styled(QuestionIcon)(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n path {\n fill: ", ";\n }\n"], ["\n path {\n fill: ", ";\n }\n"])), theme.palette.grey.fiftyP);
|
688
|
-
var StyledCheckIcon = styled(CheckWithCircleIcon)(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n path {\n fill: ", ";\n }\n"], ["\n path {\n fill: ", ";\n }\n"])), theme.palette.green.fiftyP);
|
689
|
-
var StyledErrorIcon = styled(CrossWithCircleIcon)(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n width: 14px;\n height: 14px;\n path {\n fill: ", ";\n }\n"], ["\n width: 14px;\n height: 14px;\n path {\n fill: ", ";\n }\n"])), theme.palette.red.fiftyP);
|
690
|
-
var indicatorIcon = {
|
691
|
-
notSigned: jsx(StyledQuestionIcon, {}),
|
692
|
-
signed: jsx(StyledCheckIcon, {}),
|
693
|
-
rejected: jsx(StyledErrorIcon, {}),
|
694
|
-
};
|
695
|
-
var templateObject_1$4, templateObject_2$3, templateObject_3$1;
|
696
|
-
|
697
907
|
var useMetersValues = function (formStore, metersStore) {
|
698
908
|
useEffect(function () {
|
699
909
|
var _a, _b;
|
@@ -755,5 +965,5 @@ var ApartmentInspectionOverlay = function (props) {
|
|
755
965
|
var StyledWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
|
756
966
|
var templateObject_1;
|
757
967
|
|
758
|
-
export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, ApartmentInspectionOverlay, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema,
|
968
|
+
export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, ApartmentInspectionOverlay, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, MetersInfoFieldsSchema, MetersInfoStepSchema, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, WaterMeterFieldsSchema, apartmentFields, getAdditionalInfoStepFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getWaterMeterFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
|
759
969
|
//# sourceMappingURL=index.js.map
|