kui-crm_actions 0.0.137 → 0.0.139
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 +31 -12
- package/cjs/index.js.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +32 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
@@ -72,6 +72,7 @@ type CommonInspectionFormFields = {
|
|
72
72
|
basedOn?: number
|
73
73
|
type: InspectionTypes
|
74
74
|
dropboxLink?: string
|
75
|
+
contractFile?: InputFileWithVisibilityFields | null
|
75
76
|
}
|
76
77
|
|
77
78
|
type InspectionRoomImagesParams = {
|
@@ -456,6 +457,7 @@ declare type RegularlyInspectionFieldsBody = {
|
|
456
457
|
declare type TransferInspectionFieldsBody = {
|
457
458
|
transfer_type: TransferInspectionTypes;
|
458
459
|
meters: PartialMeterModel[];
|
460
|
+
contract_document?: FileBodyRequest | null;
|
459
461
|
} & PostInspectionFillingListModel;
|
460
462
|
declare type InventoryInspectionFieldsBody = {
|
461
463
|
country_of_residence: number | null;
|
@@ -466,6 +468,7 @@ declare type InventoryInspectionFieldsBody = {
|
|
466
468
|
allowed_children: boolean;
|
467
469
|
allowed_pets: boolean;
|
468
470
|
additional_terms: string;
|
471
|
+
contract_document?: FileBodyRequest | null;
|
469
472
|
} & Partial<ApartmentDetailInfoModelFields$1>;
|
470
473
|
declare type InventoryInspectionPostBody = {
|
471
474
|
inventory: InventoryInspectionFieldsBody;
|
@@ -497,7 +500,7 @@ declare const inspectionsRequestBody: {
|
|
497
500
|
getPostBodyInitialInspection(inspection: InitialInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): InitialInspectionPostBody;
|
498
501
|
getInitialInspectionFields(inspection: InitialInspectionInfoFields): InitialInspectionFieldsBody;
|
499
502
|
getPostBodyRegularInspection(inspection: RegularInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): RegularInspectionPostBody;
|
500
|
-
getPostBodyTransferInspection(inspection: TransferInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[]): TransferInspectionPostBody;
|
503
|
+
getPostBodyTransferInspection(inspection: TransferInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[], contractFile?: FileBodyRequest | null | undefined): TransferInspectionPostBody;
|
501
504
|
getInspectionFilling(fillingList: InspectionFillingItemFields[]): {
|
502
505
|
filling: {
|
503
506
|
apartment_feature_id: number;
|
@@ -516,7 +519,7 @@ declare const inspectionsRequestBody: {
|
|
516
519
|
};
|
517
520
|
}[];
|
518
521
|
};
|
519
|
-
getPostBodyInventoryInspection(inspection: InventoryInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[], fillingFiles: FileBodyRequest[], metersFiles: FileBodyRequest[]): InventoryInspectionPostBody;
|
522
|
+
getPostBodyInventoryInspection(inspection: InventoryInspectionFormFields, roomsImages: InspectionRoomPhotoRequest[], fillingFiles: FileBodyRequest[], metersFiles: FileBodyRequest[], contractFile?: FileBodyRequest | null | undefined): InventoryInspectionPostBody;
|
520
523
|
getInventoryInspectionMeters(meters: InspectionMeterFields[], metersFiles: FileBodyRequest[], metersImages?: ImageBodyRequest[][] | undefined): {
|
521
524
|
meters: {
|
522
525
|
passport: FileBodyRequest;
|
@@ -633,6 +636,13 @@ declare const BasicApartmentInfoFieldsSchema: {
|
|
633
636
|
}, yup.AnyObject, {
|
634
637
|
name: undefined;
|
635
638
|
}, "">;
|
639
|
+
metroStations: yup.ArraySchema<{
|
640
|
+
id?: number | undefined;
|
641
|
+
name: string;
|
642
|
+
walkDistance: number;
|
643
|
+
carDistance: number;
|
644
|
+
carTime: number;
|
645
|
+
}[] | undefined, yup.AnyObject, "", "">;
|
636
646
|
};
|
637
647
|
declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
|
638
648
|
apartment: {
|
@@ -642,6 +652,13 @@ declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
|
|
642
652
|
city: {
|
643
653
|
name: string;
|
644
654
|
};
|
655
|
+
metroStations: {
|
656
|
+
id?: number | undefined;
|
657
|
+
name: string;
|
658
|
+
walkDistance: number;
|
659
|
+
carDistance: number;
|
660
|
+
carTime: number;
|
661
|
+
}[] | undefined;
|
645
662
|
}, yup.AnyObject, {
|
646
663
|
apartment: {
|
647
664
|
address: undefined;
|
@@ -650,6 +667,7 @@ declare const BasicApartmentInfoStepSchema: yup.ObjectSchema<{
|
|
650
667
|
city: {
|
651
668
|
name: undefined;
|
652
669
|
};
|
670
|
+
metroStations: "";
|
653
671
|
}, "">;
|
654
672
|
|
655
673
|
declare const getHouseInfoStep: (settings?: InspectionFieldsSettings | undefined) => InputParams<HouseInfoStepFields>[];
|
package/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as yup from 'yup';
|
2
|
-
import { NumberField, requests, uploadFiles, ImageStore, FileStore, matchesAPIFillingTypes, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, HouseTypesValues, WallMaterialsValues, SlabsTypesValues, GasTypesValues, BooleanValues, positiveNumberSchema,
|
2
|
+
import { NumberField, requests, uploadNewFile, uploadFiles, ImageStore, FileStore, matchesAPIFillingTypes, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, defaultRequiredMessage, HouseTypesValues, WallMaterialsValues, SlabsTypesValues, GasTypesValues, BooleanValues, positiveNumberSchema, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, ParkingTypesValues, fieldWithConditionSchema, BigCheckbox, getApartmentPaymentFields, phoneWithConditionSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete, getMeterValuesFieldsSchema, basicFieldsOfNewResourceMeter, meterUnitLabel, FormWrapper, MeterTypeRadioGroup, InputByType, Tooltip, ApartmentsAgent, PreviewContent, Link, UserBadge, useMapCards, MapOverlay } from 'kui-crm';
|
3
3
|
import _ from 'lodash';
|
4
4
|
import { clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises, getPhoneParamsFromString, addToArrayByCondition, Loader, clearIndexStores, addToIndexDBWithQueue, initIndexDB, readFromIndexDB, addIndexDBStore } from 'kui-utils';
|
5
5
|
import to from 'await-to-js';
|
@@ -225,14 +225,14 @@ var inspectionsRequestBody = {
|
|
225
225
|
regular: __assign(__assign({}, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
|
226
226
|
};
|
227
227
|
},
|
228
|
-
getPostBodyTransferInspection: function (inspection, roomsImages) {
|
228
|
+
getPostBodyTransferInspection: function (inspection, roomsImages, contractFile) {
|
229
229
|
return {
|
230
230
|
date: (inspection.date || DateTime.now()).toISODate(),
|
231
231
|
inspection_type: "transfer",
|
232
232
|
based_on: null,
|
233
233
|
dropbox_link: inspection.dropboxLink,
|
234
234
|
photo_groups: roomsImages,
|
235
|
-
transfer: __assign(__assign({ transfer_type: inspection.transferType }, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
|
235
|
+
transfer: __assign(__assign({ contract_document: contractFile || undefined, transfer_type: inspection.transferType }, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
|
236
236
|
};
|
237
237
|
},
|
238
238
|
getInspectionFilling: function (fillingList) {
|
@@ -256,7 +256,7 @@ var inspectionsRequestBody = {
|
|
256
256
|
}); }),
|
257
257
|
};
|
258
258
|
},
|
259
|
-
getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles) {
|
259
|
+
getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles, contractFile) {
|
260
260
|
var _this = this;
|
261
261
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
262
262
|
return {
|
@@ -265,7 +265,7 @@ var inspectionsRequestBody = {
|
|
265
265
|
based_on: null,
|
266
266
|
dropbox_link: inspection.dropboxLink,
|
267
267
|
photo_groups: roomsImages,
|
268
|
-
inventory: __assign({ allowed_children: inspection.withChildren, 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
|
268
|
+
inventory: __assign({ contract_document: contractFile || undefined, allowed_children: inspection.withChildren, 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
|
269
269
|
? getPhoneNumberFromPhoneParams(inspection.barrierPhone)
|
270
270
|
: null, concierge_phone: inspection.conciergePhone
|
271
271
|
? getPhoneNumberFromPhoneParams(inspection.conciergePhone)
|
@@ -406,15 +406,20 @@ var inspectionsRequests = {
|
|
406
406
|
},
|
407
407
|
createTransferInspection: function (data, apartmentId, loader) {
|
408
408
|
return __awaiter(this, void 0, void 0, function () {
|
409
|
-
var roomsImages, body;
|
409
|
+
var roomsImages, file, body;
|
410
410
|
return __generator(this, function (_a) {
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
411
|
+
switch (_a.label) {
|
412
|
+
case 0:
|
413
|
+
if (!apartmentId) return [3 /*break*/, 2];
|
414
|
+
loader.startLoading("inspection creation");
|
415
|
+
roomsImages = this.getRoomParams(data.roomsImages);
|
416
|
+
return [4 /*yield*/, uploadNewFile(loader, data.contractFile)];
|
417
|
+
case 1:
|
418
|
+
file = _a.sent();
|
419
|
+
body = inspectionsRequestBody.getPostBodyTransferInspection(data, roomsImages, file);
|
420
|
+
return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
|
421
|
+
case 2: return [2 /*return*/, null];
|
416
422
|
}
|
417
|
-
return [2 /*return*/, null];
|
418
423
|
});
|
419
424
|
});
|
420
425
|
},
|
@@ -432,11 +437,12 @@ var inspectionsRequests = {
|
|
432
437
|
return [4 /*yield*/, callPromises([
|
433
438
|
uploadFiles(loader, fillingFiles),
|
434
439
|
uploadFiles(loader, metersFiles),
|
440
|
+
uploadNewFile(loader, data.contractFile),
|
435
441
|
])];
|
436
442
|
case 1:
|
437
443
|
files = _b.sent();
|
438
444
|
roomsImages = this.getRoomParams(data.roomsImages);
|
439
|
-
body = inspectionsRequestBody.getPostBodyInventoryInspection(data, roomsImages, files[0], files[1]);
|
445
|
+
body = inspectionsRequestBody.getPostBodyInventoryInspection(data, roomsImages, files[0], files[1], files[2]);
|
440
446
|
return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
|
441
447
|
case 2: return [2 /*return*/, null];
|
442
448
|
}
|
@@ -700,6 +706,19 @@ var BasicApartmentInfoFieldsSchema = {
|
|
700
706
|
city: yup.object({
|
701
707
|
name: yup.string().required("This field is required"),
|
702
708
|
}),
|
709
|
+
metroStations: yup.array().of(yup.object({
|
710
|
+
id: yup.number(),
|
711
|
+
name: yup
|
712
|
+
.string()
|
713
|
+
.required(defaultRequiredMessage)
|
714
|
+
.test("check-id", "Please select an metro station from the dropdown", function (value) {
|
715
|
+
var id = this.parent.location.id;
|
716
|
+
return !!id;
|
717
|
+
}),
|
718
|
+
walkDistance: yup.number().required(defaultRequiredMessage),
|
719
|
+
carDistance: yup.number().required(defaultRequiredMessage),
|
720
|
+
carTime: yup.number().required(defaultRequiredMessage),
|
721
|
+
})),
|
703
722
|
};
|
704
723
|
var BasicApartmentInfoStepSchema = yup.object(BasicApartmentInfoFieldsSchema);
|
705
724
|
|