kui-crm_actions 0.0.67 → 0.0.69
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 +194 -0
- package/cjs/index.js.map +1 -1
- package/index.d.ts +53 -2
- package/index.js +196 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
@@ -423,6 +423,199 @@ var inspectionsRequests = {
|
|
423
423
|
},
|
424
424
|
};
|
425
425
|
|
426
|
+
var averageWalkMetersPerHour = 5000;
|
427
|
+
var minutesPerHour = 60;
|
428
|
+
var apartmentFields = {
|
429
|
+
getApartmentDescriptionInfo: function (apartment) {
|
430
|
+
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));
|
431
|
+
},
|
432
|
+
getApartmentMainInfo: function (apartment) {
|
433
|
+
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 });
|
434
|
+
},
|
435
|
+
getApartmentSecurityInfo: function (apartment) {
|
436
|
+
var _a, _b, _c, _d, _e, _f;
|
437
|
+
return {
|
438
|
+
hasIntercom: (_a = apartment.has_intercom) !== null && _a !== void 0 ? _a : null,
|
439
|
+
hasGate: (_b = apartment.has_gate) !== null && _b !== void 0 ? _b : null,
|
440
|
+
hasBarrier: (_c = apartment.has_barrier) !== null && _c !== void 0 ? _c : null,
|
441
|
+
hasSecurity: (_d = apartment.has_security) !== null && _d !== void 0 ? _d : null,
|
442
|
+
hasConcierge: (_e = apartment.has_concierge) !== null && _e !== void 0 ? _e : null,
|
443
|
+
hasVideoControl: (_f = apartment.has_video_surveillance) !== null && _f !== void 0 ? _f : null,
|
444
|
+
intercomCode: apartment.intercom_code || "",
|
445
|
+
gateCode: apartment.gate_code || "",
|
446
|
+
barrierPhone: apartment.barrier_phone
|
447
|
+
? kuiUtils.getPhoneParamsFromString(apartment.barrier_phone)
|
448
|
+
: null,
|
449
|
+
conciergePhone: apartment.concierge_phone
|
450
|
+
? kuiUtils.getPhoneParamsFromString(apartment.concierge_phone)
|
451
|
+
: null,
|
452
|
+
securityPhone: apartment.security_phone
|
453
|
+
? kuiUtils.getPhoneParamsFromString(apartment.security_phone)
|
454
|
+
: null,
|
455
|
+
videoControlPhone: apartment.video_surveillance_phone
|
456
|
+
? kuiUtils.getPhoneParamsFromString(apartment.video_surveillance_phone)
|
457
|
+
: null,
|
458
|
+
};
|
459
|
+
},
|
460
|
+
getApartmentDetailInfo: function (apartment) {
|
461
|
+
var _a;
|
462
|
+
return {
|
463
|
+
area: apartment.area,
|
464
|
+
livingArea: apartment.living_area,
|
465
|
+
kitchenArea: apartment.kitchen_area,
|
466
|
+
roomsNumber: apartment.rooms_number,
|
467
|
+
bedroomsNumber: apartment.bedrooms_number,
|
468
|
+
bathroomsNumber: apartment.bathrooms_number,
|
469
|
+
restroomsNumber: apartment.restrooms_number,
|
470
|
+
combinedBathroomsNumber: apartment.combined_bathrooms_number,
|
471
|
+
ceilingHeight: apartment.ceiling_height,
|
472
|
+
numberOfWindows: apartment.number_of_windows,
|
473
|
+
renovation: {
|
474
|
+
year: apartment.renovation_year || null,
|
475
|
+
type: apartment.renovation_type || null,
|
476
|
+
style: apartment.renovation_style || null,
|
477
|
+
},
|
478
|
+
rooms: ((_a = apartment.rooms) === null || _a === void 0 ? void 0 : _a.map(function (room) { return ({
|
479
|
+
id: room.id,
|
480
|
+
area: room.area || null,
|
481
|
+
type: room.room_type || null,
|
482
|
+
}); })) || [],
|
483
|
+
};
|
484
|
+
},
|
485
|
+
getApartmentTelecommunicationInfo: function (apartment) {
|
486
|
+
return {
|
487
|
+
homePhone: apartment.home_phone
|
488
|
+
? kuiUtils.getPhoneParamsFromString(apartment.home_phone)
|
489
|
+
: null,
|
490
|
+
wifi: {
|
491
|
+
name: apartment.wifi_name,
|
492
|
+
password: apartment.wifi_password,
|
493
|
+
},
|
494
|
+
internetProvider: {
|
495
|
+
link: apartment.internet_provider_link,
|
496
|
+
login: apartment.internet_provider_login,
|
497
|
+
password: apartment.internet_provider_password,
|
498
|
+
},
|
499
|
+
tvType: apartment.tv_type,
|
500
|
+
};
|
501
|
+
},
|
502
|
+
getApartmentHouseInfo: function (apartment) {
|
503
|
+
return {
|
504
|
+
typeOfHouse: apartment.type_houses,
|
505
|
+
buildingYear: apartment.building_year,
|
506
|
+
houseNumber: apartment.serial_number,
|
507
|
+
wallMaterial: apartment.wall_type,
|
508
|
+
overlapType: apartment.overlap_type,
|
509
|
+
parkingType: apartment.parking_type,
|
510
|
+
parkingNumber: apartment.parking_number,
|
511
|
+
passengerElevatorsCount: apartment.passenger_elevators_number
|
512
|
+
? Number(apartment.passenger_elevators_number)
|
513
|
+
: null,
|
514
|
+
serviceElevatorsCount: apartment.service_elevators_number
|
515
|
+
? Number(apartment.service_elevators_number)
|
516
|
+
: null,
|
517
|
+
gasLeads: apartment.type_gas,
|
518
|
+
withHotWater: apartment.hot_water,
|
519
|
+
};
|
520
|
+
},
|
521
|
+
getMaxMetersParams: function (apartment) {
|
522
|
+
return {
|
523
|
+
maxMeters: {
|
524
|
+
water: apartment.max_water_counters,
|
525
|
+
electricity: apartment.max_electricity_counters,
|
526
|
+
gas: apartment.max_gas_counters,
|
527
|
+
heating: apartment.max_heating_counters,
|
528
|
+
},
|
529
|
+
};
|
530
|
+
},
|
531
|
+
getGeolocationParams: function (geolocation) {
|
532
|
+
return geolocation
|
533
|
+
? {
|
534
|
+
lat: Number(geolocation.lat),
|
535
|
+
lng: Number(geolocation.lon),
|
536
|
+
}
|
537
|
+
: null;
|
538
|
+
},
|
539
|
+
getObjectRoomsImages: function (images) {
|
540
|
+
return images.map(function (imageBlock) { return ({
|
541
|
+
id: imageBlock.id,
|
542
|
+
type: imageBlock.purpose,
|
543
|
+
comment: imageBlock.comment,
|
544
|
+
images: imageBlock.photos.map(function (image) {
|
545
|
+
return kuiCrm.ImageStore.initFromImageModel(image);
|
546
|
+
}),
|
547
|
+
roomNumber: typeof imageBlock.room_order_number === "number"
|
548
|
+
? imageBlock.room_order_number + 1
|
549
|
+
: 0,
|
550
|
+
}); });
|
551
|
+
},
|
552
|
+
getInspectionFillingParams: function (filling) {
|
553
|
+
var _a;
|
554
|
+
return {
|
555
|
+
id: filling.id,
|
556
|
+
name: filling.description || "",
|
557
|
+
tag: {
|
558
|
+
id: filling.feature.id,
|
559
|
+
name: filling.feature.name,
|
560
|
+
},
|
561
|
+
images: (_a = filling.photos) === null || _a === void 0 ? void 0 : _a.map(function (image) {
|
562
|
+
return kuiCrm.ImageStore.initFromImageModel(image);
|
563
|
+
}),
|
564
|
+
serialNumber: filling.serial_code,
|
565
|
+
numberOfSubjects: Number(filling.amount),
|
566
|
+
instruction: filling.instruction
|
567
|
+
? kuiCrm.FileStore.initFromDocumentModel(filling.instruction)
|
568
|
+
: null,
|
569
|
+
type: kuiCrm.matchesAPIFillingTypes[filling.feature.feature_type],
|
570
|
+
};
|
571
|
+
},
|
572
|
+
getApartmentDescriptionWithMetro: function (apartment) {
|
573
|
+
return __assign(__assign({}, this.getApartmentDescriptionInfo(apartment)), { metroStations: this.getMetroStationsParams(apartment === null || apartment === void 0 ? void 0 : apartment.metro_stations) });
|
574
|
+
},
|
575
|
+
getMetroStationsParams: function (metroStations) {
|
576
|
+
return ((metroStations === null || metroStations === void 0 ? void 0 : metroStations.map(function (metroStation) { return ({
|
577
|
+
id: metroStation.metro_station_id,
|
578
|
+
name: metroStation.name,
|
579
|
+
walkDistance: metroStation.distance_walk_meters,
|
580
|
+
carDistance: Number(metroStation.distance_car_kilometers),
|
581
|
+
carTime: metroStation.time_car_minutes,
|
582
|
+
walkTime: Math.round(metroStation.distance_walk_meters /
|
583
|
+
(averageWalkMetersPerHour / minutesPerHour)),
|
584
|
+
}); })) || []);
|
585
|
+
},
|
586
|
+
getMeterValues: function (meter, resource, fieldName) {
|
587
|
+
var _a, _b, _c, _d, _e, _f;
|
588
|
+
if (resource === "electricity") {
|
589
|
+
var prefix = fieldName || "";
|
590
|
+
return __assign(__assign((_a = {}, _a["".concat(prefix, "T1")] = Number(meter.values.T1), _a), (meter.meter_type !== "T1" && (_b = {},
|
591
|
+
_b["".concat(prefix, "T2")] = Number(meter.values.T2),
|
592
|
+
_b))), (meter.meter_type === "T3" && (_c = {},
|
593
|
+
_c["".concat(prefix, "T3")] = Number(meter.values.T3),
|
594
|
+
_c)));
|
595
|
+
}
|
596
|
+
var valueField = fieldName || "value";
|
597
|
+
if (resource === "water") {
|
598
|
+
if (meter.meter_type === "cold") {
|
599
|
+
return _d = {}, _d["".concat(valueField)] = Number(meter.values.cold), _d;
|
600
|
+
}
|
601
|
+
return _e = {}, _e["".concat(valueField)] = Number(meter.values.hot), _e;
|
602
|
+
}
|
603
|
+
return _f = {},
|
604
|
+
_f["".concat(valueField)] = Number(meter.values[resource]),
|
605
|
+
_f;
|
606
|
+
},
|
607
|
+
getTransferMetersInfo: function (meters) {
|
608
|
+
var _this = this;
|
609
|
+
return {
|
610
|
+
meters: meters.map(function (meter) {
|
611
|
+
var _a;
|
612
|
+
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 kuiCrm.ImageStore.initFromImageModel(photo); })) ||
|
613
|
+
[] }, _this.getMeterValues(meter, meter.resource_type)));
|
614
|
+
}),
|
615
|
+
};
|
616
|
+
},
|
617
|
+
};
|
618
|
+
|
426
619
|
var getBasicApartmentInfoFields = function (handlePlaceSelect, settings) { return [
|
427
620
|
__assign({ name: "country", label: "Country", variant: "custom", CustomInput: kuiCrm.CountryAutocomplete, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.country),
|
428
621
|
__assign({ name: "region", label: "Region", variant: "custom", CustomInput: kuiCrm.RegionAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.region),
|
@@ -778,6 +971,7 @@ exports.SecurityApartmentInfoStepSchema = SecurityApartmentInfoStepSchema;
|
|
778
971
|
exports.TelecommunicationsInfoFieldsSchema = TelecommunicationsInfoFieldsSchema;
|
779
972
|
exports.TelecommunicationsInfoStepSchema = TelecommunicationsInfoStepSchema;
|
780
973
|
exports.WaterMeterFieldsSchema = WaterMeterFieldsSchema;
|
974
|
+
exports.apartmentFields = apartmentFields;
|
781
975
|
exports.getAdditionalInfoStepFields = getAdditionalInfoStepFields;
|
782
976
|
exports.getBasicApartmentInfoFields = getBasicApartmentInfoFields;
|
783
977
|
exports.getDetailApartmentInfoFields = getDetailApartmentInfoFields;
|