kui-crm_actions 0.0.38 → 0.0.40
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 +17 -23
- package/cjs/index.js.map +1 -1
- package/index.d.ts +14 -9
- package/index.js +18 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { addToArrayByCondition, clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises } from 'kui-utils';
|
2
2
|
import * as yup from 'yup';
|
3
|
-
import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues,
|
3
|
+
import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, ParkingTypesValues, fieldWithConditionSchema, defaultRequiredMessage, CompanyAutocomplete, TaxTypeValues, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete } from 'kui-crm';
|
4
4
|
import to from 'await-to-js';
|
5
5
|
import { DateTime } from 'luxon';
|
6
6
|
import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm } from 'kui-complex';
|
@@ -139,20 +139,16 @@ var inspectionsRequestBody = {
|
|
139
139
|
has_gate: inspection.hasGate,
|
140
140
|
gate_code: inspection.gateCode,
|
141
141
|
area: inspection.area,
|
142
|
-
living_area: inspection.livingArea,
|
143
|
-
kitchen_area: inspection.kitchenArea,
|
144
142
|
rooms_number: inspection.roomsNumber,
|
145
143
|
bedrooms_number: inspection.bedroomsNumber,
|
146
144
|
bathrooms_number: inspection.bathroomsNumber,
|
147
145
|
restrooms_number: inspection.restroomsNumber,
|
148
146
|
combined_bathrooms_number: inspection.combinedBathroomsNumber,
|
149
|
-
ceiling_height: inspection.ceilingHeight,
|
150
147
|
number_of_windows: inspection.numberOfWindows,
|
151
148
|
renovation_year: (_a = inspection.renovation) === null || _a === void 0 ? void 0 : _a.year,
|
152
149
|
renovation_type: (_b = inspection.renovation) === null || _b === void 0 ? void 0 : _b.type,
|
153
150
|
renovation_style: (_c = inspection.renovation) === null || _c === void 0 ? void 0 : _c.style,
|
154
151
|
rooms: inspection.rooms.map(function (room, index) { return ({
|
155
|
-
area: room.area,
|
156
152
|
room_type: room.type,
|
157
153
|
order_number: index + 1,
|
158
154
|
}); }),
|
@@ -446,25 +442,21 @@ var inputProps = {
|
|
446
442
|
var getDetailApartmentInfoFields = function (roomsCount, bedroomsCount, settings) {
|
447
443
|
var _a, _b;
|
448
444
|
return __spreadArray(__spreadArray([
|
449
|
-
__assign(__assign({ label: "Total area", name: "area", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.area)
|
450
|
-
__assign(__assign({ label: "Living area", name: "livingArea", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.livingArea),
|
451
|
-
__assign(__assign({ label: "Kitchen area", name: "kitchenArea", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.kitchenArea)
|
445
|
+
__assign(__assign({ label: "Total area", name: "area", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.area)
|
452
446
|
], (roomsCount
|
453
447
|
? new Array(Number(roomsCount))
|
454
448
|
.fill(0)
|
455
449
|
.map(function (_, key) {
|
456
|
-
var _a
|
450
|
+
var _a;
|
457
451
|
var label = bedroomsCount && key < bedroomsCount
|
458
452
|
? "Bedroom ".concat(key + 1)
|
459
453
|
: "Room ".concat(key + 1);
|
460
454
|
return [
|
461
|
-
__assign(
|
462
|
-
__assign({ name: "rooms.".concat(key, ".type"), label: "".concat(label, " type"), variant: "select", options: RoomTypeValues }, ((settings === null || settings === void 0 ? void 0 : settings.rooms) ? (_b = settings.rooms(key)) === null || _b === void 0 ? void 0 : _b.type : {})),
|
455
|
+
__assign({ name: "rooms.".concat(key, ".type"), label: "".concat(label, " type"), variant: "select", options: RoomTypeValues }, ((settings === null || settings === void 0 ? void 0 : settings.rooms) ? (_a = settings.rooms(key)) === null || _a === void 0 ? void 0 : _a.type : {})),
|
463
456
|
];
|
464
457
|
})
|
465
458
|
.flat()
|
466
459
|
: []), true), [
|
467
|
-
__assign(__assign({ name: "ceilingHeight", label: "Ceiling height", type: "number" }, inputProps), settings === null || settings === void 0 ? void 0 : settings.ceilingHeight),
|
468
460
|
__assign({ name: "numberOfWindows", label: "Windows", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.numberOfWindows),
|
469
461
|
__assign({ name: "renovation.year", label: "Year of last renovation", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.renovation.year),
|
470
462
|
__assign({ name: "renovation.type", label: "Type of renovation", variant: "select", options: RenovationTypeValues }, (_a = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _a === void 0 ? void 0 : _a.type),
|
@@ -544,6 +536,8 @@ var getSecurityApartmentInfoFields = function (settings) { return [
|
|
544
536
|
__assign({ name: "intercomCode", label: "Intercom code", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasIntercom" }, settings === null || settings === void 0 ? void 0 : settings.intercomCode),
|
545
537
|
__assign({ name: "hasGate", label: "Gate", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasGate),
|
546
538
|
__assign({ name: "gateCode", label: "Gate code", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasGate" }, settings === null || settings === void 0 ? void 0 : settings.gateCode),
|
539
|
+
__assign({ name: "parkingType", label: "Parking", variant: "select", options: ParkingTypesValues }, settings === null || settings === void 0 ? void 0 : settings.parkingType),
|
540
|
+
__assign({ name: "parkingNumber", label: "Parking number", variant: "custom", CustomInput: DependentInput, dependentInputName: "parkingType" }, settings === null || settings === void 0 ? void 0 : settings.parkingNumber),
|
547
541
|
]; };
|
548
542
|
|
549
543
|
var SecurityApartmentInfoFieldsSchema = {
|
@@ -553,6 +547,14 @@ var SecurityApartmentInfoFieldsSchema = {
|
|
553
547
|
intercomCode: fieldWithConditionSchema("hasIntercom"),
|
554
548
|
hasGate: yup.string().required("This field is required"),
|
555
549
|
gateCode: fieldWithConditionSchema("hasGate"),
|
550
|
+
parkingType: yup.string().nullable(),
|
551
|
+
parkingNumber: yup
|
552
|
+
.string()
|
553
|
+
.when("parkingType", {
|
554
|
+
is: function (value) { return !!value; },
|
555
|
+
then: function (rule) { return rule.required(defaultRequiredMessage); },
|
556
|
+
})
|
557
|
+
.nullable(),
|
556
558
|
};
|
557
559
|
var SecurityApartmentInfoStepSchema = yup.object(SecurityApartmentInfoFieldsSchema);
|
558
560
|
|
@@ -589,8 +591,6 @@ var getHouseServicesInfoStep = function (settings) { return [
|
|
589
591
|
__assign({ name: "securityPhone", label: "Security", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasSecurity", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.securityPhone),
|
590
592
|
__assign({ name: "hasVideoControl", label: "Video surveillance", variant: "select", options: BooleanValues }, settings === null || settings === void 0 ? void 0 : settings.hasVideoControl),
|
591
593
|
__assign({ name: "videoControlPhone", label: "Video surveillance", variant: "custom", CustomInput: DependentInput, dependentInputName: "hasVideoControl", Input: InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.videoControlPhone),
|
592
|
-
__assign({ name: "parkingType", label: "Parking", variant: "select", options: ParkingTypesValues }, settings === null || settings === void 0 ? void 0 : settings.parkingType),
|
593
|
-
__assign({ name: "parkingNumber", label: "Parking number", variant: "custom", CustomInput: DependentInput, dependentInputName: "parkingType" }, settings === null || settings === void 0 ? void 0 : settings.parkingNumber),
|
594
594
|
__assign({ name: "passengerElevatorsCount", label: "Passenger elevators", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.passengerElevatorsCount),
|
595
595
|
__assign({ name: "serviceElevatorsCount", label: "Service elevators", type: "number" }, settings === null || settings === void 0 ? void 0 : settings.serviceElevatorsCount),
|
596
596
|
]; };
|
@@ -604,14 +604,6 @@ var HouseServicesInfoFieldsSchema = {
|
|
604
604
|
securityPhone: phoneWithConditionSchema("hasSecurity"),
|
605
605
|
hasVideoControl: yup.string().required(defaultRequiredMessage),
|
606
606
|
videoControlPhone: phoneWithConditionSchema("hasVideoControl"),
|
607
|
-
parkingType: yup.string().nullable(),
|
608
|
-
parkingNumber: yup
|
609
|
-
.string()
|
610
|
-
.when("parkingType", {
|
611
|
-
is: function (value) { return !!value; },
|
612
|
-
then: function (rule) { return rule.required(defaultRequiredMessage); },
|
613
|
-
})
|
614
|
-
.nullable(),
|
615
607
|
passengerElevatorsCount: positiveNumberSchema,
|
616
608
|
serviceElevatorsCount: positiveNumberSchema,
|
617
609
|
};
|
@@ -685,7 +677,7 @@ var renderMetersSteps = function (MeterStep, MeterPhotoStep, maxMeters) {
|
|
685
677
|
]; });
|
686
678
|
};
|
687
679
|
|
688
|
-
var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
680
|
+
var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
689
681
|
__assign({ type: "kitchen" }, settings.kitchen)
|
690
682
|
], new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bedroomsNumber) || 0))
|
691
683
|
.fill(0)
|
@@ -703,7 +695,9 @@ var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spre
|
|
703
695
|
.map(function (_, index) { return (__assign({ type: "combined_bathroom" }, settings.combinedBathroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.combinedBathroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), [
|
704
696
|
__assign({ type: "others" }, settings.others),
|
705
697
|
__assign({ type: "keys" }, settings.keys)
|
706
|
-
], false), addToArrayByCondition(type === "
|
698
|
+
], false), addToArrayByCondition(type === "inventory", __assign({ type: "entrance" }, settings.entrance)), true), addToArrayByCondition(type === "initial", __assign({ type: "parking" }, settings.parkung)), true), [
|
699
|
+
__assign({ type: "additional" }, settings.additional),
|
700
|
+
], false); };
|
707
701
|
|
708
702
|
var useMetersValues = function (formStore, metersStore) {
|
709
703
|
useEffect(function () {
|