kui-crm_actions 0.0.137 → 0.0.138

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 CHANGED
@@ -254,14 +254,14 @@ var inspectionsRequestBody = {
254
254
  regular: __assign(__assign({}, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
255
255
  };
256
256
  },
257
- getPostBodyTransferInspection: function (inspection, roomsImages) {
257
+ getPostBodyTransferInspection: function (inspection, roomsImages, contractFile) {
258
258
  return {
259
259
  date: (inspection.date || luxon.DateTime.now()).toISODate(),
260
260
  inspection_type: "transfer",
261
261
  based_on: null,
262
262
  dropbox_link: inspection.dropboxLink,
263
263
  photo_groups: roomsImages,
264
- transfer: __assign(__assign({ transfer_type: inspection.transferType }, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
264
+ transfer: __assign(__assign({ contract_document: contractFile || undefined, transfer_type: inspection.transferType }, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
265
265
  };
266
266
  },
267
267
  getInspectionFilling: function (fillingList) {
@@ -285,7 +285,7 @@ var inspectionsRequestBody = {
285
285
  }); }),
286
286
  };
287
287
  },
288
- getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles) {
288
+ getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles, contractFile) {
289
289
  var _this = this;
290
290
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
291
291
  return {
@@ -294,7 +294,7 @@ var inspectionsRequestBody = {
294
294
  based_on: null,
295
295
  dropbox_link: inspection.dropboxLink,
296
296
  photo_groups: roomsImages,
297
- 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
297
+ 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
298
298
  ? kuiUtils.getPhoneNumberFromPhoneParams(inspection.barrierPhone)
299
299
  : null, concierge_phone: inspection.conciergePhone
300
300
  ? kuiUtils.getPhoneNumberFromPhoneParams(inspection.conciergePhone)
@@ -435,15 +435,20 @@ var inspectionsRequests = {
435
435
  },
436
436
  createTransferInspection: function (data, apartmentId, loader) {
437
437
  return __awaiter(this, void 0, void 0, function () {
438
- var roomsImages, body;
438
+ var roomsImages, file, body;
439
439
  return __generator(this, function (_a) {
440
- if (apartmentId) {
441
- loader.startLoading("inspection creation");
442
- roomsImages = this.getRoomParams(data.roomsImages);
443
- body = inspectionsRequestBody.getPostBodyTransferInspection(data, roomsImages);
444
- return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
440
+ switch (_a.label) {
441
+ case 0:
442
+ if (!apartmentId) return [3 /*break*/, 2];
443
+ loader.startLoading("inspection creation");
444
+ roomsImages = this.getRoomParams(data.roomsImages);
445
+ return [4 /*yield*/, kuiCrm.uploadNewFile(loader, data.contractFile)];
446
+ case 1:
447
+ file = _a.sent();
448
+ body = inspectionsRequestBody.getPostBodyTransferInspection(data, roomsImages, file);
449
+ return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
450
+ case 2: return [2 /*return*/, null];
445
451
  }
446
- return [2 /*return*/, null];
447
452
  });
448
453
  });
449
454
  },
@@ -461,11 +466,12 @@ var inspectionsRequests = {
461
466
  return [4 /*yield*/, kuiUtils.callPromises([
462
467
  kuiCrm.uploadFiles(loader, fillingFiles),
463
468
  kuiCrm.uploadFiles(loader, metersFiles),
469
+ kuiCrm.uploadNewFile(loader, data.contractFile),
464
470
  ])];
465
471
  case 1:
466
472
  files = _b.sent();
467
473
  roomsImages = this.getRoomParams(data.roomsImages);
468
- body = inspectionsRequestBody.getPostBodyInventoryInspection(data, roomsImages, files[0], files[1]);
474
+ body = inspectionsRequestBody.getPostBodyInventoryInspection(data, roomsImages, files[0], files[1], files[2]);
469
475
  return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
470
476
  case 2: return [2 /*return*/, null];
471
477
  }