kui-crm_actions 0.0.155 → 0.0.157
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/index.js +1 -1511
- package/package.json +2 -4
- package/cjs/index.js +0 -1592
- package/cjs/index.js.map +0 -1
- package/index.js.map +0 -1
package/cjs/index.js
DELETED
@@ -1,1592 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
-
|
5
|
-
var yup = require('yup');
|
6
|
-
var kuiCrm = require('kui-crm');
|
7
|
-
var _ = require('lodash');
|
8
|
-
var kuiUtils = require('kui-utils');
|
9
|
-
var to = require('await-to-js');
|
10
|
-
var luxon = require('luxon');
|
11
|
-
var kuiComplex = require('kui-complex');
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
13
|
-
var react = require('react');
|
14
|
-
var reactHookForm = require('react-hook-form');
|
15
|
-
var kuiBasic = require('kui-basic');
|
16
|
-
var yup$1 = require('@hookform/resolvers/yup');
|
17
|
-
var styled = require('@emotion/styled');
|
18
|
-
var kuiIcon = require('kui-icon');
|
19
|
-
var mobxReact = require('mobx-react');
|
20
|
-
var mobx = require('mobx');
|
21
|
-
|
22
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
23
|
-
|
24
|
-
function _interopNamespace(e) {
|
25
|
-
if (e && e.__esModule) return e;
|
26
|
-
var n = Object.create(null);
|
27
|
-
if (e) {
|
28
|
-
Object.keys(e).forEach(function (k) {
|
29
|
-
if (k !== 'default') {
|
30
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
31
|
-
Object.defineProperty(n, k, d.get ? d : {
|
32
|
-
enumerable: true,
|
33
|
-
get: function () { return e[k]; }
|
34
|
-
});
|
35
|
-
}
|
36
|
-
});
|
37
|
-
}
|
38
|
-
n["default"] = e;
|
39
|
-
return Object.freeze(n);
|
40
|
-
}
|
41
|
-
|
42
|
-
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
43
|
-
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
44
|
-
var to__default = /*#__PURE__*/_interopDefaultLegacy(to);
|
45
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
46
|
-
|
47
|
-
/******************************************************************************
|
48
|
-
Copyright (c) Microsoft Corporation.
|
49
|
-
|
50
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
51
|
-
purpose with or without fee is hereby granted.
|
52
|
-
|
53
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
54
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
55
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
56
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
57
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
58
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
59
|
-
PERFORMANCE OF THIS SOFTWARE.
|
60
|
-
***************************************************************************** */
|
61
|
-
|
62
|
-
var __assign = function() {
|
63
|
-
__assign = Object.assign || function __assign(t) {
|
64
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
65
|
-
s = arguments[i];
|
66
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
67
|
-
}
|
68
|
-
return t;
|
69
|
-
};
|
70
|
-
return __assign.apply(this, arguments);
|
71
|
-
};
|
72
|
-
|
73
|
-
function __rest(s, e) {
|
74
|
-
var t = {};
|
75
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
76
|
-
t[p] = s[p];
|
77
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
78
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
79
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
80
|
-
t[p[i]] = s[p[i]];
|
81
|
-
}
|
82
|
-
return t;
|
83
|
-
}
|
84
|
-
|
85
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
86
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
87
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
88
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
89
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
90
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
91
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
92
|
-
});
|
93
|
-
}
|
94
|
-
|
95
|
-
function __generator(thisArg, body) {
|
96
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
97
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
98
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
99
|
-
function step(op) {
|
100
|
-
if (f) throw new TypeError("Generator is already executing.");
|
101
|
-
while (_) try {
|
102
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
103
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
104
|
-
switch (op[0]) {
|
105
|
-
case 0: case 1: t = op; break;
|
106
|
-
case 4: _.label++; return { value: op[1], done: false };
|
107
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
108
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
109
|
-
default:
|
110
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
111
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
112
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
113
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
114
|
-
if (t[2]) _.ops.pop();
|
115
|
-
_.trys.pop(); continue;
|
116
|
-
}
|
117
|
-
op = body.call(thisArg, _);
|
118
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
119
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
function __spreadArray(to, from, pack) {
|
124
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
125
|
-
if (ar || !(i in from)) {
|
126
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
127
|
-
ar[i] = from[i];
|
128
|
-
}
|
129
|
-
}
|
130
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
131
|
-
}
|
132
|
-
|
133
|
-
function __makeTemplateObject(cooked, raw) {
|
134
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
135
|
-
return cooked;
|
136
|
-
}
|
137
|
-
|
138
|
-
var getPartialMeterInfoSchema = function (valuesFields) {
|
139
|
-
var filteredFields = valuesFields
|
140
|
-
.filter(function (field) { return field.maxIntegerPart; })
|
141
|
-
.map(function (field) { return field.name; });
|
142
|
-
var valuesSchema = filteredFields.map(function (field) {
|
143
|
-
var _a;
|
144
|
-
return (_a = {},
|
145
|
-
_a[field] = yup__namespace
|
146
|
-
.number()
|
147
|
-
.min(0)
|
148
|
-
.required("This field is required")
|
149
|
-
.transform(function (value) { return (Number.isNaN(value) ? undefined : value); }),
|
150
|
-
_a);
|
151
|
-
});
|
152
|
-
return yup__namespace.object().shape(__assign({ number: yup__namespace.string().trim().required("This field is required") }, Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))));
|
153
|
-
};
|
154
|
-
var WaterMeterFieldsSchema = yup__namespace.object().shape({
|
155
|
-
number: yup__namespace.string().trim().required("This field is required"),
|
156
|
-
value: yup__namespace
|
157
|
-
.number()
|
158
|
-
.min(0)
|
159
|
-
.required("This field is required")
|
160
|
-
.transform(function (value) { return (Number.isNaN(value) ? undefined : value); }),
|
161
|
-
});
|
162
|
-
|
163
|
-
var getWaterMeterFields = function (meters, meter, withCheckValue, name, settings) {
|
164
|
-
var _a, _b;
|
165
|
-
var prefixName = name ? "".concat(name, ".") : "";
|
166
|
-
var meterOptions = meters.length
|
167
|
-
? meters.map(function (meterParams) { return ({
|
168
|
-
value: meterParams.number,
|
169
|
-
label: "".concat(___default["default"].capitalize(meterParams.type || ""), " | #").concat(meterParams.number),
|
170
|
-
}); })
|
171
|
-
: [
|
172
|
-
{
|
173
|
-
value: meter === null || meter === void 0 ? void 0 : meter.number,
|
174
|
-
label: "".concat(___default["default"].capitalize((meter === null || meter === void 0 ? void 0 : meter.type) || ""), " | #").concat(meter === null || meter === void 0 ? void 0 : meter.number),
|
175
|
-
},
|
176
|
-
];
|
177
|
-
return [
|
178
|
-
__assign({ label: "Meter", name: "".concat(prefixName, "number"), variant: "select", options: meterOptions, size: 12, isRequired: true, disabled: meterOptions.length === 1 }, settings === null || settings === void 0 ? void 0 : settings.meter),
|
179
|
-
__assign({ label: "Value", name: "".concat(prefixName, "value"), variant: "custom", CustomInput: kuiCrm.NumberField, maxIntegerPart: 7, maxDecimalPart: 3, maxValue: ((_a = meter === null || meter === void 0 ? void 0 : meter.maxValue) === null || _a === void 0 ? void 0 : _a.value) && withCheckValue
|
180
|
-
? Number(meter.maxValue.value)
|
181
|
-
: null, warningMessage: "There are deviations in meter readings. It should be no more than", placeholder: (_b = meter === null || meter === void 0 ? void 0 : meter.values) === null || _b === void 0 ? void 0 : _b.value, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.value),
|
182
|
-
];
|
183
|
-
};
|
184
|
-
|
185
|
-
var inspectionsRequestBody = {
|
186
|
-
getPostBodyInitialInspection: function (inspection, roomsImages) {
|
187
|
-
return {
|
188
|
-
based_on: null,
|
189
|
-
date: (inspection.date || luxon.DateTime.now()).toISODate(),
|
190
|
-
inspection_type: "initial",
|
191
|
-
dropbox_link: inspection.dropboxLink,
|
192
|
-
photo_groups: roomsImages,
|
193
|
-
initial: this.getInitialInspectionFields(inspection),
|
194
|
-
};
|
195
|
-
},
|
196
|
-
getInitialInspectionFields: function (inspection) {
|
197
|
-
var _a, _b, _c;
|
198
|
-
return {
|
199
|
-
city: inspection.city.id,
|
200
|
-
address: inspection.apartment.address,
|
201
|
-
apartment_number: inspection.apartmentNumber || "",
|
202
|
-
post_index: inspection.zipCode,
|
203
|
-
floor: inspection.floor,
|
204
|
-
floor_count: inspection.floorCount,
|
205
|
-
room_type: inspection.typeOfObject,
|
206
|
-
num_entrance: inspection.entrance,
|
207
|
-
has_intercom: inspection.hasIntercom,
|
208
|
-
intercom_code: inspection.intercomCode,
|
209
|
-
has_gate: inspection.hasGate,
|
210
|
-
gate_code: inspection.gateCode,
|
211
|
-
area: inspection.area,
|
212
|
-
rooms_number: inspection.roomsNumber,
|
213
|
-
bedrooms_number: inspection.bedroomsNumber,
|
214
|
-
bathrooms_number: inspection.bathroomsNumber,
|
215
|
-
restrooms_number: inspection.restroomsNumber,
|
216
|
-
combined_bathrooms_number: inspection.combinedBathroomsNumber,
|
217
|
-
number_of_windows: inspection.numberOfWindows,
|
218
|
-
renovation_year: (_a = inspection.renovation) === null || _a === void 0 ? void 0 : _a.year,
|
219
|
-
renovation_type: (_b = inspection.renovation) === null || _b === void 0 ? void 0 : _b.type,
|
220
|
-
renovation_style: (_c = inspection.renovation) === null || _c === void 0 ? void 0 : _c.style,
|
221
|
-
wall_type: inspection.wallMaterial,
|
222
|
-
overlap_type: inspection.overlapType,
|
223
|
-
passenger_elevators_number: inspection.passengerElevatorsCount,
|
224
|
-
service_elevators_number: inspection.serviceElevatorsCount,
|
225
|
-
ceiling_height: inspection.ceilingHeight,
|
226
|
-
building_year: inspection.buildingYear,
|
227
|
-
serial_number: inspection.houseNumber,
|
228
|
-
type_gas: inspection.gasLeads,
|
229
|
-
hot_water: inspection.withHotWater,
|
230
|
-
type_houses: inspection.typeOfHouse,
|
231
|
-
parking_type: inspection.parkingType,
|
232
|
-
parking_number: inspection.parkingNumber,
|
233
|
-
rooms: inspection.rooms.map(function (room, index) { return ({
|
234
|
-
id: room.id,
|
235
|
-
room_type: room.type,
|
236
|
-
order_number: index,
|
237
|
-
}); }),
|
238
|
-
metro: inspection.metroStations.map(function (station) { return ({
|
239
|
-
name: station.name || "",
|
240
|
-
metro_station_id: station.id,
|
241
|
-
distance_walk_meters: station.walkDistance,
|
242
|
-
distance_car_kilometers: station.carDistance,
|
243
|
-
time_car_minutes: station.carTime,
|
244
|
-
}); }),
|
245
|
-
used_resources: {
|
246
|
-
electricity: inspection.availableResources.electricity,
|
247
|
-
water: inspection.availableResources.water,
|
248
|
-
gas: inspection.availableResources.gas,
|
249
|
-
heating: inspection.availableResources.heating,
|
250
|
-
},
|
251
|
-
};
|
252
|
-
},
|
253
|
-
getPostBodyRegularInspection: function (inspection, roomsImages) {
|
254
|
-
return {
|
255
|
-
date: (inspection.date || luxon.DateTime.now()).toISODate(),
|
256
|
-
inspection_type: "regular",
|
257
|
-
based_on: null,
|
258
|
-
dropbox_link: inspection.dropboxLink,
|
259
|
-
photo_groups: roomsImages,
|
260
|
-
regular: __assign(__assign({}, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
|
261
|
-
};
|
262
|
-
},
|
263
|
-
getPostBodyTransferInspection: function (inspection, roomsImages, contractFile) {
|
264
|
-
return {
|
265
|
-
date: (inspection.date || luxon.DateTime.now()).toISODate(),
|
266
|
-
inspection_type: "transfer",
|
267
|
-
based_on: null,
|
268
|
-
dropbox_link: inspection.dropboxLink,
|
269
|
-
photo_groups: roomsImages,
|
270
|
-
transfer: __assign(__assign({ contract_document: contractFile || undefined, transfer_type: inspection.transferType }, this.getInspectionFilling(inspection.fillingList)), this.getPartialInspectionMeters(inspection.meters)),
|
271
|
-
};
|
272
|
-
},
|
273
|
-
getInspectionFilling: function (fillingList) {
|
274
|
-
return {
|
275
|
-
filling: fillingList === null || fillingList === void 0 ? void 0 : fillingList.map(function (filling) { return ({
|
276
|
-
apartment_feature_id: filling.id,
|
277
|
-
is_absent: !filling.check,
|
278
|
-
}); }),
|
279
|
-
};
|
280
|
-
},
|
281
|
-
getPartialInspectionMeters: function (meters) {
|
282
|
-
var _this = this;
|
283
|
-
return {
|
284
|
-
meters: (meters === null || meters === void 0 ? void 0 : meters.map(function (meter, index) { return ({
|
285
|
-
id: meter.id,
|
286
|
-
resource_type: meter.resource,
|
287
|
-
meter_type: meter.type,
|
288
|
-
passport_number: meter.number,
|
289
|
-
photos: _this.getFilesParams(meter.images),
|
290
|
-
values: kuiUtils.clearNotValidFields(_this.getInspectionMeterValues(meter)),
|
291
|
-
}); })) || [],
|
292
|
-
};
|
293
|
-
},
|
294
|
-
getPostBodyInventoryInspection: function (inspection, roomsImages, fillingFiles, metersFiles, contractFile) {
|
295
|
-
var _this = this;
|
296
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
297
|
-
return {
|
298
|
-
date: (inspection.date || luxon.DateTime.now()).toISODate(),
|
299
|
-
inspection_type: "inventory",
|
300
|
-
based_on: null,
|
301
|
-
dropbox_link: inspection.dropboxLink,
|
302
|
-
photo_groups: roomsImages,
|
303
|
-
inventory: __assign({ contract_document: contractFile || undefined, allowed_children: inspection.withChildren, allowed_pets: inspection.withPets, allowed_smoking: inspection.withSmoking, 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
|
304
|
-
? kuiUtils.getPhoneNumberFromPhoneParams(inspection.barrierPhone)
|
305
|
-
: null, concierge_phone: inspection.conciergePhone
|
306
|
-
? kuiUtils.getPhoneNumberFromPhoneParams(inspection.conciergePhone)
|
307
|
-
: null, security_phone: inspection.securityPhone
|
308
|
-
? kuiUtils.getPhoneNumberFromPhoneParams(inspection.securityPhone)
|
309
|
-
: null, video_surveillance_phone: inspection.videoControlPhone
|
310
|
-
? kuiUtils.getPhoneNumberFromPhoneParams(inspection.videoControlPhone)
|
311
|
-
: null, home_phone: inspection.homePhone
|
312
|
-
? kuiUtils.getPhoneNumberFromPhoneParams(inspection.homePhone)
|
313
|
-
: null, wifi_name: (_g = inspection.wifi) === null || _g === void 0 ? void 0 : _g.name, wifi_password: (_h = inspection.wifi) === null || _h === void 0 ? void 0 : _h.password, internet_provider_link: (_j = inspection.internetProvider) === null || _j === void 0 ? void 0 : _j.link, internet_provider_login: (_k = inspection.internetProvider) === null || _k === void 0 ? void 0 : _k.login, internet_provider_password: (_l = inspection.internetProvider) === null || _l === void 0 ? void 0 : _l.password, payer_code: inspection.payerCode, filling: inspection.fillingList.map(function (filling, index) {
|
314
|
-
var _a;
|
315
|
-
return ({
|
316
|
-
feature: ((_a = filling.tag) === null || _a === void 0 ? void 0 : _a.id) || 0,
|
317
|
-
description: filling.description,
|
318
|
-
model: filling.name,
|
319
|
-
serial_code: filling.serialNumber,
|
320
|
-
amount: filling.numberOfSubjects,
|
321
|
-
photos: _this.getFilesParams(filling.images),
|
322
|
-
instruction: fillingFiles[index],
|
323
|
-
});
|
324
|
-
}) }, this.getInventoryInspectionMeters(inspection.meters, metersFiles)),
|
325
|
-
};
|
326
|
-
},
|
327
|
-
getInventoryInspectionMeters: function (meters, metersFiles, metersImages) {
|
328
|
-
var _this = this;
|
329
|
-
return {
|
330
|
-
meters: (meters === null || meters === void 0 ? void 0 : meters.map(function (meter, index) { return (__assign(__assign({}, _this.getMeterCommonFields(meter)), { passport: metersFiles[index], values: kuiUtils.clearNotValidFields(_this.getInspectionMeterValues(meter, "initialValue")), photos: metersImages
|
331
|
-
? metersImages[index]
|
332
|
-
: _this.getFilesParams(meter.images), no_tariff: meter.noTariff, auto_sending: meter.withAutoSending })); })) || [],
|
333
|
-
};
|
334
|
-
},
|
335
|
-
getInspectionMeterValues: function (meter, fieldName) {
|
336
|
-
var _a;
|
337
|
-
if (meter.resource === "electricity") {
|
338
|
-
var prefix = fieldName || "";
|
339
|
-
var t1 = meter["".concat(prefix, "T1")];
|
340
|
-
var t2 = meter["".concat(prefix, "T2")];
|
341
|
-
var t3 = meter["".concat(prefix, "T3")];
|
342
|
-
return {
|
343
|
-
T1: t1 ? Number(t1) : t1,
|
344
|
-
T2: t2 ? Number(t2) : t2,
|
345
|
-
T3: t3 ? Number(t3) : t3,
|
346
|
-
};
|
347
|
-
}
|
348
|
-
var valueField = (fieldName || "value");
|
349
|
-
if (meter.resource === "water") {
|
350
|
-
if (meter.type === "cold") {
|
351
|
-
var cold = meter[valueField];
|
352
|
-
return { cold: cold ? Number(cold) : cold };
|
353
|
-
}
|
354
|
-
var hot = meter[valueField];
|
355
|
-
return { hot: hot ? Number(hot) : hot };
|
356
|
-
}
|
357
|
-
var value = meter[valueField];
|
358
|
-
return _a = {},
|
359
|
-
_a[meter.resource] = value ? Number(value) : value,
|
360
|
-
_a;
|
361
|
-
},
|
362
|
-
getMeterCommonFields: function (meter) {
|
363
|
-
var _a;
|
364
|
-
return {
|
365
|
-
id: meter.id,
|
366
|
-
meter_type: meter.type,
|
367
|
-
passport_number: meter.number,
|
368
|
-
resource_type: meter.resource,
|
369
|
-
activation_date: ((_a = meter.startDate) === null || _a === void 0 ? void 0 : _a.toISODate()) || null,
|
370
|
-
};
|
371
|
-
},
|
372
|
-
getMeterValues: function (initialValue, lastValue) {
|
373
|
-
return kuiUtils.clearNotValidFields({
|
374
|
-
initial_value: initialValue,
|
375
|
-
last_value: lastValue,
|
376
|
-
});
|
377
|
-
},
|
378
|
-
getFilesParams: function (files) {
|
379
|
-
return ((files === null || files === void 0 ? void 0 : files.map(function (file) { return file.uploadedData; }).filter(function (data) { return data; })) || []);
|
380
|
-
},
|
381
|
-
};
|
382
|
-
|
383
|
-
var inspectionsRequests = {
|
384
|
-
createInspectionHandler: function (apartmentId, loader, callback) {
|
385
|
-
return __awaiter(this, void 0, void 0, function () {
|
386
|
-
var body, e_1, Sentry;
|
387
|
-
return __generator(this, function (_a) {
|
388
|
-
switch (_a.label) {
|
389
|
-
case 0:
|
390
|
-
if (!apartmentId) return [3 /*break*/, 5];
|
391
|
-
loader.startLoading("inspection creation");
|
392
|
-
body = void 0;
|
393
|
-
_a.label = 1;
|
394
|
-
case 1:
|
395
|
-
_a.trys.push([1, 3, , 4]);
|
396
|
-
return [4 /*yield*/, callback()];
|
397
|
-
case 2:
|
398
|
-
body = _a.sent();
|
399
|
-
return [3 /*break*/, 4];
|
400
|
-
case 3:
|
401
|
-
e_1 = _a.sent();
|
402
|
-
Sentry = kuiCrm.KUISettings.getSettings().Sentry;
|
403
|
-
Sentry.captureException(e_1);
|
404
|
-
loader.setError("inspection creation body", e_1);
|
405
|
-
return [3 /*break*/, 4];
|
406
|
-
case 4:
|
407
|
-
if (body)
|
408
|
-
return [2 /*return*/, this.createInspection(apartmentId, body, loader)];
|
409
|
-
return [2 /*return*/, null];
|
410
|
-
case 5: return [2 /*return*/, null];
|
411
|
-
}
|
412
|
-
});
|
413
|
-
});
|
414
|
-
},
|
415
|
-
getInspectionTypes: function (apartmentId) {
|
416
|
-
return __awaiter(this, void 0, void 0, function () {
|
417
|
-
var _a, err, res;
|
418
|
-
return __generator(this, function (_b) {
|
419
|
-
switch (_b.label) {
|
420
|
-
case 0: return [4 /*yield*/, to__default["default"](kuiCrm.requests.get("/apartments/".concat(apartmentId, "/inspection-types")))];
|
421
|
-
case 1:
|
422
|
-
_a = _b.sent(), err = _a[0], res = _a[1];
|
423
|
-
if (err)
|
424
|
-
return [2 /*return*/, [err, undefined]];
|
425
|
-
return [2 /*return*/, [null, res === null || res === void 0 ? void 0 : res.inspection_types]];
|
426
|
-
}
|
427
|
-
});
|
428
|
-
});
|
429
|
-
},
|
430
|
-
getTransferTypes: function (apartmentId) {
|
431
|
-
return __awaiter(this, void 0, void 0, function () {
|
432
|
-
var _a, err, res;
|
433
|
-
return __generator(this, function (_b) {
|
434
|
-
switch (_b.label) {
|
435
|
-
case 0: return [4 /*yield*/, to__default["default"](kuiCrm.requests.get("/apartments/".concat(apartmentId, "/transfer-inspection-types")))];
|
436
|
-
case 1:
|
437
|
-
_a = _b.sent(), err = _a[0], res = _a[1];
|
438
|
-
if (err)
|
439
|
-
return [2 /*return*/, [err, undefined]];
|
440
|
-
return [2 /*return*/, [null, res === null || res === void 0 ? void 0 : res.transfer_inspection_types]];
|
441
|
-
}
|
442
|
-
});
|
443
|
-
});
|
444
|
-
},
|
445
|
-
createInspection: function (apartmentId, body, loader) {
|
446
|
-
var _a;
|
447
|
-
return __awaiter(this, void 0, void 0, function () {
|
448
|
-
var response;
|
449
|
-
return __generator(this, function (_b) {
|
450
|
-
switch (_b.label) {
|
451
|
-
case 0: return [4 /*yield*/, to__default["default"](kuiCrm.requests.post("/apartments/".concat(apartmentId, "/inspections"), body))];
|
452
|
-
case 1:
|
453
|
-
response = _b.sent();
|
454
|
-
kuiUtils.resHandler(response, loader);
|
455
|
-
return [2 /*return*/, (_a = response[1]) === null || _a === void 0 ? void 0 : _a.id];
|
456
|
-
}
|
457
|
-
});
|
458
|
-
});
|
459
|
-
},
|
460
|
-
createInitialInspection: function (data, apartmentId, loader) {
|
461
|
-
return __awaiter(this, void 0, void 0, function () {
|
462
|
-
var _this = this;
|
463
|
-
return __generator(this, function (_a) {
|
464
|
-
return [2 /*return*/, this.createInspectionHandler(apartmentId, loader, function () { return __awaiter(_this, void 0, void 0, function () {
|
465
|
-
var roomsImages;
|
466
|
-
return __generator(this, function (_a) {
|
467
|
-
roomsImages = this.getRoomParams(data.roomsImages);
|
468
|
-
return [2 /*return*/, inspectionsRequestBody.getPostBodyInitialInspection(data, roomsImages)];
|
469
|
-
});
|
470
|
-
}); })];
|
471
|
-
});
|
472
|
-
});
|
473
|
-
},
|
474
|
-
createRegularInspection: function (data, apartmentId, loader) {
|
475
|
-
return __awaiter(this, void 0, void 0, function () {
|
476
|
-
var _this = this;
|
477
|
-
return __generator(this, function (_a) {
|
478
|
-
return [2 /*return*/, this.createInspectionHandler(apartmentId, loader, function () { return __awaiter(_this, void 0, void 0, function () {
|
479
|
-
var roomsImages;
|
480
|
-
return __generator(this, function (_a) {
|
481
|
-
roomsImages = this.getRoomParams(data.roomsImages);
|
482
|
-
return [2 /*return*/, inspectionsRequestBody.getPostBodyRegularInspection(data, roomsImages)];
|
483
|
-
});
|
484
|
-
}); })];
|
485
|
-
});
|
486
|
-
});
|
487
|
-
},
|
488
|
-
createTransferInspection: function (data, apartmentId, loader) {
|
489
|
-
return __awaiter(this, void 0, void 0, function () {
|
490
|
-
var _this = this;
|
491
|
-
return __generator(this, function (_a) {
|
492
|
-
return [2 /*return*/, this.createInspectionHandler(apartmentId, loader, function () { return __awaiter(_this, void 0, void 0, function () {
|
493
|
-
var roomsImages, file;
|
494
|
-
return __generator(this, function (_a) {
|
495
|
-
switch (_a.label) {
|
496
|
-
case 0:
|
497
|
-
roomsImages = this.getRoomParams(data.roomsImages);
|
498
|
-
return [4 /*yield*/, kuiCrm.uploadNewFile(loader, data.contractFile)];
|
499
|
-
case 1:
|
500
|
-
file = _a.sent();
|
501
|
-
return [2 /*return*/, inspectionsRequestBody.getPostBodyTransferInspection(data, roomsImages, file)];
|
502
|
-
}
|
503
|
-
});
|
504
|
-
}); })];
|
505
|
-
});
|
506
|
-
});
|
507
|
-
},
|
508
|
-
createInventoryInspection: function (data, apartmentId, loader) {
|
509
|
-
return __awaiter(this, void 0, void 0, function () {
|
510
|
-
var _this = this;
|
511
|
-
return __generator(this, function (_a) {
|
512
|
-
return [2 /*return*/, this.createInspectionHandler(apartmentId, loader, function () { return __awaiter(_this, void 0, void 0, function () {
|
513
|
-
var fillingFiles, metersFiles, files, roomsImages;
|
514
|
-
var _a;
|
515
|
-
return __generator(this, function (_b) {
|
516
|
-
switch (_b.label) {
|
517
|
-
case 0:
|
518
|
-
fillingFiles = data.fillingList.map(function (filling) { return filling.instruction; });
|
519
|
-
metersFiles = ((_a = data.meters) === null || _a === void 0 ? void 0 : _a.map(function (meter) { return meter.passportFile; })) || [];
|
520
|
-
return [4 /*yield*/, kuiUtils.callPromises([
|
521
|
-
kuiCrm.uploadFiles(loader, fillingFiles),
|
522
|
-
kuiCrm.uploadFiles(loader, metersFiles),
|
523
|
-
kuiCrm.uploadNewFile(loader, data.contractFile),
|
524
|
-
])];
|
525
|
-
case 1:
|
526
|
-
files = _b.sent();
|
527
|
-
roomsImages = this.getRoomParams(data.roomsImages);
|
528
|
-
return [2 /*return*/, inspectionsRequestBody.getPostBodyInventoryInspection(data, roomsImages, files[0], files[1], files[2])];
|
529
|
-
}
|
530
|
-
});
|
531
|
-
}); })];
|
532
|
-
});
|
533
|
-
});
|
534
|
-
},
|
535
|
-
getRoomParams: function (rooms) {
|
536
|
-
var roomIndex = -1;
|
537
|
-
return ((rooms === null || rooms === void 0 ? void 0 : rooms.map(function (room) {
|
538
|
-
var withOrderNumber = room.type === "room" || room.type === "bedroom";
|
539
|
-
if (withOrderNumber)
|
540
|
-
roomIndex += 1;
|
541
|
-
return {
|
542
|
-
purpose: room === null || room === void 0 ? void 0 : room.type,
|
543
|
-
comment: room === null || room === void 0 ? void 0 : room.comment,
|
544
|
-
photos: inspectionsRequestBody.getFilesParams(room.files),
|
545
|
-
room_order_number: withOrderNumber ? roomIndex : undefined,
|
546
|
-
};
|
547
|
-
})) || []);
|
548
|
-
},
|
549
|
-
};
|
550
|
-
|
551
|
-
var averageWalkMetersPerHour = 5000;
|
552
|
-
var minutesPerHour = 60;
|
553
|
-
var apartmentFields = {
|
554
|
-
getApartmentDescriptionInfo: function (apartment) {
|
555
|
-
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));
|
556
|
-
},
|
557
|
-
getApartmentMainInfo: function (apartment) {
|
558
|
-
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 });
|
559
|
-
},
|
560
|
-
getApartmentSecurityInfo: function (apartment) {
|
561
|
-
var _a, _b, _c, _d, _e, _f;
|
562
|
-
return {
|
563
|
-
hasIntercom: (_a = apartment.has_intercom) !== null && _a !== void 0 ? _a : null,
|
564
|
-
hasGate: (_b = apartment.has_gate) !== null && _b !== void 0 ? _b : null,
|
565
|
-
hasBarrier: (_c = apartment.has_barrier) !== null && _c !== void 0 ? _c : null,
|
566
|
-
hasSecurity: (_d = apartment.has_security) !== null && _d !== void 0 ? _d : null,
|
567
|
-
hasConcierge: (_e = apartment.has_concierge) !== null && _e !== void 0 ? _e : null,
|
568
|
-
hasVideoControl: (_f = apartment.has_video_surveillance) !== null && _f !== void 0 ? _f : null,
|
569
|
-
intercomCode: apartment.intercom_code || "",
|
570
|
-
gateCode: apartment.gate_code || "",
|
571
|
-
barrierPhone: apartment.barrier_phone
|
572
|
-
? kuiUtils.getPhoneParamsFromString(apartment.barrier_phone)
|
573
|
-
: null,
|
574
|
-
conciergePhone: apartment.concierge_phone
|
575
|
-
? kuiUtils.getPhoneParamsFromString(apartment.concierge_phone)
|
576
|
-
: null,
|
577
|
-
securityPhone: apartment.security_phone
|
578
|
-
? kuiUtils.getPhoneParamsFromString(apartment.security_phone)
|
579
|
-
: null,
|
580
|
-
videoControlPhone: apartment.video_surveillance_phone
|
581
|
-
? kuiUtils.getPhoneParamsFromString(apartment.video_surveillance_phone)
|
582
|
-
: null,
|
583
|
-
};
|
584
|
-
},
|
585
|
-
getApartmentDetailInfo: function (apartment) {
|
586
|
-
var _a;
|
587
|
-
return {
|
588
|
-
area: apartment.area,
|
589
|
-
livingArea: apartment.living_area,
|
590
|
-
kitchenArea: apartment.kitchen_area,
|
591
|
-
roomsNumber: apartment.rooms_number,
|
592
|
-
bedroomsNumber: apartment.bedrooms_number,
|
593
|
-
bathroomsNumber: apartment.bathrooms_number,
|
594
|
-
restroomsNumber: apartment.restrooms_number,
|
595
|
-
combinedBathroomsNumber: apartment.combined_bathrooms_number,
|
596
|
-
ceilingHeight: apartment.ceiling_height,
|
597
|
-
numberOfWindows: apartment.number_of_windows,
|
598
|
-
renovation: {
|
599
|
-
year: apartment.renovation_year || null,
|
600
|
-
type: apartment.renovation_type || null,
|
601
|
-
style: apartment.renovation_style || null,
|
602
|
-
},
|
603
|
-
rooms: ((_a = apartment.rooms) === null || _a === void 0 ? void 0 : _a.map(function (room) { return ({
|
604
|
-
id: room.id,
|
605
|
-
area: room.area || null,
|
606
|
-
type: room.room_type || null,
|
607
|
-
}); })) || [],
|
608
|
-
};
|
609
|
-
},
|
610
|
-
getApartmentTelecommunicationInfo: function (apartment) {
|
611
|
-
return {
|
612
|
-
homePhone: apartment.home_phone
|
613
|
-
? kuiUtils.getPhoneParamsFromString(apartment.home_phone)
|
614
|
-
: null,
|
615
|
-
wifi: {
|
616
|
-
name: apartment.wifi_name,
|
617
|
-
password: apartment.wifi_password,
|
618
|
-
},
|
619
|
-
internetProvider: {
|
620
|
-
link: apartment.internet_provider_link,
|
621
|
-
login: apartment.internet_provider_login,
|
622
|
-
password: apartment.internet_provider_password,
|
623
|
-
},
|
624
|
-
tvType: apartment.tv_type,
|
625
|
-
};
|
626
|
-
},
|
627
|
-
getApartmentHouseInfo: function (apartment) {
|
628
|
-
return {
|
629
|
-
typeOfHouse: apartment.type_houses,
|
630
|
-
buildingYear: apartment.building_year,
|
631
|
-
houseNumber: apartment.serial_number,
|
632
|
-
wallMaterial: apartment.wall_type,
|
633
|
-
overlapType: apartment.overlap_type,
|
634
|
-
parkingType: apartment.parking_type,
|
635
|
-
parkingNumber: apartment.parking_number,
|
636
|
-
passengerElevatorsCount: apartment.passenger_elevators_number
|
637
|
-
? Number(apartment.passenger_elevators_number)
|
638
|
-
: null,
|
639
|
-
serviceElevatorsCount: apartment.service_elevators_number
|
640
|
-
? Number(apartment.service_elevators_number)
|
641
|
-
: null,
|
642
|
-
gasLeads: apartment.type_gas,
|
643
|
-
withHotWater: apartment.hot_water,
|
644
|
-
};
|
645
|
-
},
|
646
|
-
getMaxMetersParams: function (apartment) {
|
647
|
-
return {
|
648
|
-
maxMeters: {
|
649
|
-
water: apartment.max_water_counters,
|
650
|
-
electricity: apartment.max_electricity_counters,
|
651
|
-
gas: apartment.max_gas_counters,
|
652
|
-
heating: apartment.max_heating_counters,
|
653
|
-
},
|
654
|
-
};
|
655
|
-
},
|
656
|
-
getGeolocationParams: function (geolocation) {
|
657
|
-
return geolocation
|
658
|
-
? {
|
659
|
-
lat: Number(geolocation.lat),
|
660
|
-
lng: Number(geolocation.lon),
|
661
|
-
}
|
662
|
-
: null;
|
663
|
-
},
|
664
|
-
getObjectRoomsImages: function (images) {
|
665
|
-
return images.map(function (imageBlock) { return ({
|
666
|
-
id: imageBlock.id,
|
667
|
-
type: imageBlock.purpose,
|
668
|
-
comment: imageBlock.comment,
|
669
|
-
images: imageBlock.photos.map(function (image) {
|
670
|
-
return kuiCrm.ImageStore.initFromImageModel(image);
|
671
|
-
}),
|
672
|
-
roomNumber: typeof imageBlock.room_order_number === "number"
|
673
|
-
? imageBlock.room_order_number + 1
|
674
|
-
: 0,
|
675
|
-
}); });
|
676
|
-
},
|
677
|
-
getInspectionFillingParams: function (filling, withChecking) {
|
678
|
-
var _a;
|
679
|
-
return __assign({ id: filling.id, name: filling.description || "", tag: {
|
680
|
-
id: filling.feature.id,
|
681
|
-
name: filling.feature.name,
|
682
|
-
}, images: (_a = filling.photos) === null || _a === void 0 ? void 0 : _a.map(function (image) {
|
683
|
-
return kuiCrm.ImageStore.initFromImageModel(image);
|
684
|
-
}), serialNumber: filling.serial_code, numberOfSubjects: Number(filling.amount), instruction: filling.instruction
|
685
|
-
? kuiCrm.FileStore.initFromDocumentModel(filling.instruction)
|
686
|
-
: null, type: kuiCrm.matchesAPIFillingTypes[filling.feature.feature_type] }, (withChecking && filling.feature.feature_type === "appliance"
|
687
|
-
? {
|
688
|
-
check: !filling.is_absent,
|
689
|
-
wasMissing: filling.previously_absent,
|
690
|
-
}
|
691
|
-
: {}));
|
692
|
-
},
|
693
|
-
getApartmentDescriptionWithMetro: function (apartment) {
|
694
|
-
return __assign(__assign({}, this.getApartmentDescriptionInfo(apartment)), { metroStations: this.getMetroStationsParams(apartment === null || apartment === void 0 ? void 0 : apartment.metro_stations) });
|
695
|
-
},
|
696
|
-
getMetroStationsParams: function (metroStations) {
|
697
|
-
return ((metroStations === null || metroStations === void 0 ? void 0 : metroStations.map(function (metroStation) { return ({
|
698
|
-
id: metroStation.metro_station_id,
|
699
|
-
name: metroStation.name,
|
700
|
-
walkDistance: metroStation.distance_walk_meters,
|
701
|
-
carDistance: Number(metroStation.distance_car_kilometers),
|
702
|
-
carTime: metroStation.time_car_minutes,
|
703
|
-
walkTime: Math.round(metroStation.distance_walk_meters /
|
704
|
-
(averageWalkMetersPerHour / minutesPerHour)),
|
705
|
-
}); })) || []);
|
706
|
-
},
|
707
|
-
getMeterValues: function (meter, resource, fieldName) {
|
708
|
-
var _a, _b, _c, _d, _e, _f;
|
709
|
-
if (resource === "electricity") {
|
710
|
-
var prefix = fieldName || "";
|
711
|
-
return __assign(__assign((_a = {}, _a["".concat(prefix, "T1")] = Number(meter.values.T1), _a), (meter.meter_type !== "T1" && (_b = {},
|
712
|
-
_b["".concat(prefix, "T2")] = Number(meter.values.T2),
|
713
|
-
_b))), (meter.meter_type === "T3" && (_c = {},
|
714
|
-
_c["".concat(prefix, "T3")] = Number(meter.values.T3),
|
715
|
-
_c)));
|
716
|
-
}
|
717
|
-
var valueField = fieldName || "value";
|
718
|
-
if (resource === "water") {
|
719
|
-
if (meter.meter_type === "cold") {
|
720
|
-
return _d = {}, _d["".concat(valueField)] = Number(meter.values.cold), _d;
|
721
|
-
}
|
722
|
-
return _e = {}, _e["".concat(valueField)] = Number(meter.values.hot), _e;
|
723
|
-
}
|
724
|
-
return _f = {},
|
725
|
-
_f["".concat(valueField)] = Number(meter.values[resource]),
|
726
|
-
_f;
|
727
|
-
},
|
728
|
-
getTransferMetersInfo: function (meters) {
|
729
|
-
var _this = this;
|
730
|
-
return {
|
731
|
-
meters: meters.map(function (meter) {
|
732
|
-
var _a;
|
733
|
-
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); })) ||
|
734
|
-
[], values: _this.getMeterValues(meter, meter.resource_type) }, _this.getMeterValues(meter, meter.resource_type)));
|
735
|
-
}),
|
736
|
-
};
|
737
|
-
},
|
738
|
-
getApartmentPaymentInfo: function (apartment) {
|
739
|
-
return {
|
740
|
-
payerCode: apartment.payer_code,
|
741
|
-
communalServicesAccount: apartment.financial_personal_account,
|
742
|
-
managementCompany: apartment.administrative_company
|
743
|
-
? __assign(__assign({}, apartment.administrative_company), { operatingAccount: apartment.payer_code }) : null,
|
744
|
-
};
|
745
|
-
},
|
746
|
-
getInspectionPaymentInfo: function (inspection) {
|
747
|
-
return __assign(__assign({}, this.getApartmentPaymentInfo(inspection)), { countryOfResidence: inspection.country_of_residence, taxesType: inspection.tax_type });
|
748
|
-
},
|
749
|
-
getMeterInfo: function (meter, resource) {
|
750
|
-
var _a;
|
751
|
-
return {
|
752
|
-
id: meter.id,
|
753
|
-
type: meter.meter_type,
|
754
|
-
number: meter.passport_number,
|
755
|
-
startDate: meter.activation_date
|
756
|
-
? luxon.DateTime.fromISO(meter.activation_date)
|
757
|
-
: null,
|
758
|
-
company: meter.company,
|
759
|
-
operationalAccountNumber: meter.operating_account,
|
760
|
-
resource: resource,
|
761
|
-
tariff: meter.tariff
|
762
|
-
? {
|
763
|
-
id: meter.tariff.id,
|
764
|
-
name: meter.tariff.code_name,
|
765
|
-
}
|
766
|
-
: null,
|
767
|
-
passportFile: meter.passport
|
768
|
-
? kuiCrm.FileStore.initFromFileModel(meter.passport)
|
769
|
-
: null,
|
770
|
-
images: ((_a = meter.photos) === null || _a === void 0 ? void 0 : _a.map(function (photo) { return kuiCrm.ImageStore.initFromImageModel(photo); })) ||
|
771
|
-
[],
|
772
|
-
};
|
773
|
-
},
|
774
|
-
getInventoryMetersInfo: function (inspection) {
|
775
|
-
var _this = this;
|
776
|
-
return {
|
777
|
-
meters: inspection.meters.map(function (meter) { return (__assign(__assign({}, _this.getMeterInfo(meter, meter.resource_type)), _this.getMeterValues(meter, meter.resource_type, "initialValue"))); }),
|
778
|
-
};
|
779
|
-
},
|
780
|
-
};
|
781
|
-
|
782
|
-
var getBasicApartmentInfoFields = function (handlePlaceSelect, settings) { return [
|
783
|
-
__assign({ name: "country", label: "Country", variant: "custom", CustomInput: kuiCrm.CountryAutocomplete, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.country),
|
784
|
-
__assign({ name: "region", label: "Region", variant: "custom", CustomInput: kuiCrm.RegionAutocomplete }, settings === null || settings === void 0 ? void 0 : settings.region),
|
785
|
-
__assign({ name: "city", label: "City", variant: "custom", CustomInput: kuiCrm.CityAutocomplete, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.city),
|
786
|
-
__assign({ name: "apartment", variant: "custom", CustomInput: kuiComplex.InputWithAddressAutocomplete, handlePlaceSelect: handlePlaceSelect, size: 12, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.apartment),
|
787
|
-
__assign({ label: "Apartment", name: "apartmentNumber", "data-testid": "apartment_number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.apartmentNumber),
|
788
|
-
__assign({ label: "Zip code", name: "zipCode" }, settings === null || settings === void 0 ? void 0 : settings.zipCode),
|
789
|
-
]; };
|
790
|
-
|
791
|
-
var BasicApartmentInfoFieldsSchema = {
|
792
|
-
apartment: yup__namespace.object({
|
793
|
-
address: yup__namespace.string().trim().required("This field is required"),
|
794
|
-
}),
|
795
|
-
apartmentNumber: yup__namespace.string().required("This field is required"),
|
796
|
-
city: yup__namespace.object({
|
797
|
-
name: yup__namespace.string().required("This field is required"),
|
798
|
-
}),
|
799
|
-
metroStations: yup__namespace.array().of(yup__namespace.object({
|
800
|
-
id: yup__namespace
|
801
|
-
.number()
|
802
|
-
.transform(function (value) { return (Number.isNaN(value) ? undefined : value); }),
|
803
|
-
name: yup__namespace
|
804
|
-
.string()
|
805
|
-
.required(kuiCrm.defaultRequiredMessage)
|
806
|
-
.test("check-id", "Please select an metro station from the dropdown", function (value) {
|
807
|
-
return !!this.parent.id;
|
808
|
-
}),
|
809
|
-
walkDistance: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
810
|
-
carDistance: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
811
|
-
carTime: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
812
|
-
})),
|
813
|
-
};
|
814
|
-
var BasicApartmentInfoStepSchema = yup__namespace.object(BasicApartmentInfoFieldsSchema);
|
815
|
-
|
816
|
-
var getHouseInfoStep = function (settings) { return [
|
817
|
-
__assign({ name: "typeOfHouse", label: "Type houses", variant: "select", options: kuiCrm.HouseTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.typeOfHouse),
|
818
|
-
__assign({ name: "houseNumber", label: "House series" }, settings === null || settings === void 0 ? void 0 : settings.houseNumber),
|
819
|
-
__assign({ name: "wallMaterial", label: "Wall material", variant: "select", options: kuiCrm.WallMaterialsValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.wallMaterial),
|
820
|
-
__assign({ name: "overlapType", label: "Overlap type", variant: "select", options: kuiCrm.SlabsTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.overlapType),
|
821
|
-
__assign({ name: "gasLeads", label: "Gas", variant: "select", options: kuiCrm.GasTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.gasLeads),
|
822
|
-
__assign({ name: "withHotWater", label: "Hot water", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.withHotWater),
|
823
|
-
__assign({ name: "passengerElevatorsCount", label: "Passenger elevators", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.passengerElevatorsCount),
|
824
|
-
__assign({ name: "serviceElevatorsCount", label: "Service elevators", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.serviceElevatorsCount),
|
825
|
-
__assign({ name: "buildingYear", label: "Builded", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.buildingYear),
|
826
|
-
]; };
|
827
|
-
|
828
|
-
var HouseInfoFieldsSchema = {
|
829
|
-
passengerElevatorsCount: kuiCrm.positiveNumberSchema,
|
830
|
-
serviceElevatorsCount: kuiCrm.positiveNumberSchema,
|
831
|
-
typeOfHouse: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
832
|
-
buildingYear: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
833
|
-
wallMaterial: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
834
|
-
overlapType: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
835
|
-
gasLeads: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
836
|
-
withHotWater: yup__namespace.boolean().required(kuiCrm.defaultRequiredMessage),
|
837
|
-
};
|
838
|
-
var HouseInfoStepSchema = yup__namespace.object(HouseInfoFieldsSchema);
|
839
|
-
|
840
|
-
var inputProps = {
|
841
|
-
step: 0.01,
|
842
|
-
};
|
843
|
-
var getDetailApartmentInfoFields = function (roomsCount, bedroomsCount, settings) {
|
844
|
-
var _a, _b;
|
845
|
-
return __spreadArray(__spreadArray([
|
846
|
-
__assign(__assign({ label: "Total area", name: "area", type: "number", isRequired: true }, inputProps), settings === null || settings === void 0 ? void 0 : settings.area)
|
847
|
-
], (roomsCount
|
848
|
-
? new Array(Number(roomsCount))
|
849
|
-
.fill(0)
|
850
|
-
.map(function (_, key) {
|
851
|
-
var _a;
|
852
|
-
var label = bedroomsCount && key < bedroomsCount
|
853
|
-
? "Bedroom ".concat(key + 1)
|
854
|
-
: "Room ".concat(key + 1);
|
855
|
-
var settingsKey = bedroomsCount && key < bedroomsCount ? "bedrooms" : "rooms";
|
856
|
-
return [
|
857
|
-
__assign({ name: "rooms.".concat(key, ".type"), label: "".concat(label, " type"), variant: "select", options: kuiCrm.RoomTypeValues, isRequired: true }, ((settings === null || settings === void 0 ? void 0 : settings[settingsKey])
|
858
|
-
? (_a = settings[settingsKey](key)) === null || _a === void 0 ? void 0 : _a.type
|
859
|
-
: {})),
|
860
|
-
];
|
861
|
-
})
|
862
|
-
.flat()
|
863
|
-
: []), true), [
|
864
|
-
__assign(__assign({ name: "ceilingHeight", label: "Ceiling height", type: "number", cornerLabel: "m.", isRequired: true }, inputProps), settings === null || settings === void 0 ? void 0 : settings.ceilingHeight),
|
865
|
-
__assign({ name: "numberOfWindows", label: "Windows", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.numberOfWindows),
|
866
|
-
__assign({ name: "renovation.year", label: "Year of last renovation", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.renovation.year),
|
867
|
-
__assign({ name: "renovation.type", label: "Type of renovation", variant: "select", options: kuiCrm.RenovationTypeValues, isRequired: true }, (_a = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _a === void 0 ? void 0 : _a.type),
|
868
|
-
__assign({ name: "renovation.style", label: "Renovation style", variant: "select", options: kuiCrm.RenovationStyleValues, isRequired: true }, (_b = settings === null || settings === void 0 ? void 0 : settings.renovation) === null || _b === void 0 ? void 0 : _b.style),
|
869
|
-
], false);
|
870
|
-
};
|
871
|
-
|
872
|
-
var DetailApartmentInfoFieldsSchema = {
|
873
|
-
area: yup__namespace.number().positive().required("This field is required"),
|
874
|
-
rooms: yup__namespace.array().of(yup__namespace.object({
|
875
|
-
type: yup__namespace.string().required("This field is required"),
|
876
|
-
})),
|
877
|
-
numberOfWindows: yup__namespace.number().min(0).required("This field is required"),
|
878
|
-
renovation: yup__namespace.object({
|
879
|
-
year: yup__namespace.number().positive().required("This field is required"),
|
880
|
-
type: yup__namespace.string().required("This field is required"),
|
881
|
-
style: yup__namespace.string().required("This field is required"),
|
882
|
-
}),
|
883
|
-
ceilingHeight: kuiCrm.positiveNumberSchema,
|
884
|
-
};
|
885
|
-
var DetailApartmentInfoStepSchema = yup__namespace.object(DetailApartmentInfoFieldsSchema);
|
886
|
-
|
887
|
-
var getRoomsApartmentInfoFields = function (roomsCount, settings) { return [
|
888
|
-
__assign({ label: "Floor", name: "floor", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.floor),
|
889
|
-
__assign({ label: "Floors", name: "floorCount", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.floorCount),
|
890
|
-
__assign({ label: "Rooms", name: "roomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.roomsNumber),
|
891
|
-
__assign({ label: "Bedrooms", name: "bedroomsNumber", type: "number", isRequired: true, disabled: roomsCount === 0 || roomsCount === "0" }, settings === null || settings === void 0 ? void 0 : settings.bedroomsNumber),
|
892
|
-
__assign({ label: "Bathrooms", name: "bathroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.bathroomsNumber),
|
893
|
-
__assign({ label: "Restrooms", name: "restroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.restroomsNumber),
|
894
|
-
__assign({ label: "Combined bathroom", name: "combinedBathroomsNumber", type: "number", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.combinedBathroomsNumber),
|
895
|
-
]; };
|
896
|
-
|
897
|
-
var RoomsApartmentInfoFieldsSchema = {
|
898
|
-
floor: yup__namespace
|
899
|
-
.number()
|
900
|
-
.integer()
|
901
|
-
.min(0)
|
902
|
-
.test("is less than floorCount", "Too much", function (value) {
|
903
|
-
return value <= this.parent.floorCount;
|
904
|
-
}),
|
905
|
-
floorCount: yup__namespace
|
906
|
-
.number()
|
907
|
-
.integer()
|
908
|
-
.positive()
|
909
|
-
.required("This field is required"),
|
910
|
-
roomsNumber: yup__namespace.number().integer().min(0).required("This field is required"),
|
911
|
-
bedroomsNumber: yup__namespace
|
912
|
-
.number()
|
913
|
-
.integer()
|
914
|
-
.min(0)
|
915
|
-
.required("This field is required"),
|
916
|
-
bathroomsNumber: yup__namespace
|
917
|
-
.number()
|
918
|
-
.integer()
|
919
|
-
.min(0)
|
920
|
-
.required("This field is required"),
|
921
|
-
restroomsNumber: yup__namespace
|
922
|
-
.number()
|
923
|
-
.integer()
|
924
|
-
.min(0)
|
925
|
-
.required("This field is required"),
|
926
|
-
combinedBathroomsNumber: yup__namespace
|
927
|
-
.number()
|
928
|
-
.integer()
|
929
|
-
.min(0)
|
930
|
-
.required("This field is required"),
|
931
|
-
};
|
932
|
-
var RoomsApartmentInfoStepSchema = yup__namespace.object(RoomsApartmentInfoFieldsSchema);
|
933
|
-
|
934
|
-
var getSecurityApartmentInfoFields = function (settings) { return [
|
935
|
-
__assign({ label: "Object type", name: "typeOfObject", variant: "select", options: kuiCrm.RoomTypesValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.typeOfObject),
|
936
|
-
__assign({ label: "Entrance", name: "entrance", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.entrance),
|
937
|
-
__assign({ name: "hasIntercom", label: "Intercom", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasIntercom),
|
938
|
-
__assign({ name: "intercomCode", label: "Intercom code", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasIntercom" }, settings === null || settings === void 0 ? void 0 : settings.intercomCode),
|
939
|
-
__assign({ name: "hasGate", label: "Gate", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasGate),
|
940
|
-
__assign({ name: "gateCode", label: "Gate code", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasGate" }, settings === null || settings === void 0 ? void 0 : settings.gateCode),
|
941
|
-
__assign({ name: "parkingType", label: "Parking", variant: "select", options: kuiCrm.ParkingTypesValues }, settings === null || settings === void 0 ? void 0 : settings.parkingType),
|
942
|
-
__assign({ name: "parkingNumber", label: "Parking number", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "parkingType" }, settings === null || settings === void 0 ? void 0 : settings.parkingNumber),
|
943
|
-
]; };
|
944
|
-
|
945
|
-
var SecurityApartmentInfoFieldsSchema = {
|
946
|
-
typeOfObject: yup__namespace.string().required("This field is required"),
|
947
|
-
entrance: yup__namespace.string().required("This field is required"),
|
948
|
-
hasIntercom: yup__namespace.string().required("This field is required"),
|
949
|
-
intercomCode: kuiCrm.fieldWithConditionSchema("hasIntercom"),
|
950
|
-
hasGate: yup__namespace.string().required("This field is required"),
|
951
|
-
gateCode: kuiCrm.fieldWithConditionSchema("hasGate"),
|
952
|
-
};
|
953
|
-
var SecurityApartmentInfoStepSchema = yup__namespace.object(SecurityApartmentInfoFieldsSchema);
|
954
|
-
|
955
|
-
var getAvailableResourcesFields = function (settings) { return [
|
956
|
-
__assign({ label: "Water", name: "availableResources.water", variant: "custom", CustomInput: kuiCrm.BigCheckbox }, settings === null || settings === void 0 ? void 0 : settings.water),
|
957
|
-
__assign({ label: "Electricity", name: "availableResources.electricity", variant: "custom", CustomInput: kuiCrm.BigCheckbox }, settings === null || settings === void 0 ? void 0 : settings.electricity),
|
958
|
-
__assign({ label: "Gas", name: "availableResources.gas", variant: "custom", CustomInput: kuiCrm.BigCheckbox }, settings === null || settings === void 0 ? void 0 : settings.gas),
|
959
|
-
__assign({ label: "Heating", name: "availableResources.heating", variant: "custom", CustomInput: kuiCrm.BigCheckbox }, settings === null || settings === void 0 ? void 0 : settings.heating),
|
960
|
-
]; };
|
961
|
-
|
962
|
-
var checkboxLabelProps = {
|
963
|
-
size: "s",
|
964
|
-
};
|
965
|
-
var getAdditionalInfoStepFields = function (settings) { return __spreadArray([
|
966
|
-
__assign({ label: "Pets", name: "withPets", variant: "custom", CustomInput: kuiComplex.CheckboxWithController, labelProps: checkboxLabelProps }, settings === null || settings === void 0 ? void 0 : settings.withPets),
|
967
|
-
__assign({ label: "Children", name: "withChildren", variant: "custom", CustomInput: kuiComplex.CheckboxWithController, labelProps: checkboxLabelProps }, settings === null || settings === void 0 ? void 0 : settings.withChildren),
|
968
|
-
__assign({ label: "Smoking", name: "withSmoking", variant: "custom", CustomInput: kuiComplex.CheckboxWithController, labelProps: checkboxLabelProps }, settings === null || settings === void 0 ? void 0 : settings.withSmoking),
|
969
|
-
__assign({ isTextArea: true, placeholder: "other terms", name: "additionalTerms" }, settings === null || settings === void 0 ? void 0 : settings.additionalTerms)
|
970
|
-
], kuiCrm.getApartmentPaymentFields(settings), true); };
|
971
|
-
|
972
|
-
var AdditionalInfoFieldsSchema = {
|
973
|
-
taxesType: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
974
|
-
countryOfResidence: yup__namespace.object({
|
975
|
-
name: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
976
|
-
}),
|
977
|
-
company: yup__namespace.object({
|
978
|
-
name: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
979
|
-
}),
|
980
|
-
};
|
981
|
-
var AdditionalInfoStepSchema = yup__namespace.object(AdditionalInfoFieldsSchema);
|
982
|
-
|
983
|
-
var getHouseServicesInfoStep = function (settings) { return [
|
984
|
-
__assign({ name: "hasBarrier", label: "Barrier", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasBarrier),
|
985
|
-
__assign({ name: "barrierPhone", label: "Barrier code", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasBarrier", Input: kuiComplex.InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.barrierPhone),
|
986
|
-
__assign({ name: "hasConcierge", label: "Concierge", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasConcierge),
|
987
|
-
__assign({ name: "conciergePhone", label: "Concierge", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasConcierge", Input: kuiComplex.InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.conciergePhone),
|
988
|
-
__assign({ name: "hasSecurity", label: "Security", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasSecurity),
|
989
|
-
__assign({ name: "securityPhone", label: "Security", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasSecurity", Input: kuiComplex.InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.securityPhone),
|
990
|
-
__assign({ name: "hasVideoControl", label: "Video surveillance", variant: "select", options: kuiCrm.BooleanValues, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.hasVideoControl),
|
991
|
-
__assign({ name: "videoControlPhone", label: "Video surveillance", variant: "custom", CustomInput: kuiComplex.DependentInput, dependentInputName: "hasVideoControl", Input: kuiComplex.InputPhoneWithForm }, settings === null || settings === void 0 ? void 0 : settings.videoControlPhone),
|
992
|
-
]; };
|
993
|
-
|
994
|
-
var HouseServicesInfoFieldsSchema = {
|
995
|
-
hasBarrier: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
996
|
-
barrierPhone: kuiCrm.phoneWithConditionSchema("hasBarrier"),
|
997
|
-
hasConcierge: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
998
|
-
conciergePhone: kuiCrm.phoneWithConditionSchema("hasConcierge"),
|
999
|
-
hasSecurity: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
1000
|
-
securityPhone: kuiCrm.phoneWithConditionSchema("hasSecurity"),
|
1001
|
-
hasVideoControl: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
1002
|
-
videoControlPhone: kuiCrm.phoneWithConditionSchema("hasVideoControl"),
|
1003
|
-
};
|
1004
|
-
var HouseServicesInfoStepSchema = yup__namespace.object(HouseServicesInfoFieldsSchema);
|
1005
|
-
|
1006
|
-
var metersOptions = kuiCrm.getNumbersValues(7);
|
1007
|
-
var getMetersInfoStepFields = function (settings) {
|
1008
|
-
var _a, _b, _c, _d;
|
1009
|
-
return [
|
1010
|
-
__assign({ name: "maxMeters.water", label: "Water", variant: "select", options: metersOptions, isRequired: true }, (_a = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _a === void 0 ? void 0 : _a.water),
|
1011
|
-
__assign({ name: "maxMeters.electricity", label: "Electricity", variant: "select", options: metersOptions, isRequired: true }, (_b = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _b === void 0 ? void 0 : _b.electricity),
|
1012
|
-
__assign({ name: "maxMeters.gas", label: "Gas", variant: "select", options: metersOptions, isRequired: true }, (_c = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _c === void 0 ? void 0 : _c.gas),
|
1013
|
-
__assign({ name: "maxMeters.heating", label: "Heating", variant: "select", options: metersOptions, isRequired: true }, (_d = settings === null || settings === void 0 ? void 0 : settings.maxMeters) === null || _d === void 0 ? void 0 : _d.heating),
|
1014
|
-
];
|
1015
|
-
};
|
1016
|
-
|
1017
|
-
var MetersInfoFieldsSchema = {
|
1018
|
-
maxMeters: yup__namespace.object({
|
1019
|
-
water: kuiCrm.positiveNumberSchema,
|
1020
|
-
electricity: kuiCrm.positiveNumberSchema,
|
1021
|
-
gas: kuiCrm.positiveNumberSchema,
|
1022
|
-
heating: kuiCrm.positiveNumberSchema,
|
1023
|
-
}),
|
1024
|
-
};
|
1025
|
-
var MetersInfoStepSchema = yup__namespace.object(MetersInfoFieldsSchema);
|
1026
|
-
|
1027
|
-
var getTelecommunicationsInfoStepFields = function (settings) {
|
1028
|
-
var _a, _b, _c, _d, _e;
|
1029
|
-
return [
|
1030
|
-
__assign({ name: "wifi.name", label: "Name of network" }, (_a = settings === null || settings === void 0 ? void 0 : settings.wifi) === null || _a === void 0 ? void 0 : _a.name),
|
1031
|
-
__assign({ name: "wifi.password", label: "WiFi password" }, (_b = settings === null || settings === void 0 ? void 0 : settings.wifi) === null || _b === void 0 ? void 0 : _b.password),
|
1032
|
-
__assign({ name: "internetProvider.link", label: "Link to provider", size: 12 }, (_c = settings === null || settings === void 0 ? void 0 : settings.internetProvider) === null || _c === void 0 ? void 0 : _c.link),
|
1033
|
-
__assign({ name: "internetProvider.login", label: "Login" }, (_d = settings === null || settings === void 0 ? void 0 : settings.internetProvider) === null || _d === void 0 ? void 0 : _d.login),
|
1034
|
-
__assign({ name: "internetProvider.password", label: "Password" }, (_e = settings === null || settings === void 0 ? void 0 : settings.internetProvider) === null || _e === void 0 ? void 0 : _e.password),
|
1035
|
-
__assign({ name: "tvType", label: "Television", variant: "select", options: kuiCrm.TVTypesValues }, settings === null || settings === void 0 ? void 0 : settings.tvType),
|
1036
|
-
__assign({ name: "homePhone", label: "Home phone", variant: "phone" }, settings === null || settings === void 0 ? void 0 : settings.homePhone),
|
1037
|
-
];
|
1038
|
-
};
|
1039
|
-
|
1040
|
-
var TelecommunicationsInfoFieldsSchema = {
|
1041
|
-
homePhone: kuiCrm.phoneNonRequiredSchema("homePhone"),
|
1042
|
-
};
|
1043
|
-
var TelecommunicationsInfoStepSchema = yup__namespace
|
1044
|
-
.object()
|
1045
|
-
.shape(TelecommunicationsInfoFieldsSchema, [["homePhone", "homePhone"]]);
|
1046
|
-
|
1047
|
-
var getFillingInfoFields = function (withType, type, setType, settings) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], kuiUtils.addToArrayByCondition(withType, __assign({ label: "Filling type", name: "type", variant: "select", options: kuiCrm.FillingTypeValues, handleChange: setType, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.type)), true), [
|
1048
|
-
__assign({ label: "Name (tag)", name: "tag", type: type, variant: "custom", CustomInput: kuiCrm.FillingTagsAutocomplete, isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.tag)
|
1049
|
-
], false), kuiUtils.addToArrayByCondition(type !== "finish", __assign({ label: "Model", name: "name", isRequired: true }, settings === null || settings === void 0 ? void 0 : settings.name)), true), kuiUtils.addToArrayByCondition(type !== "finish", __assign({ label: "Serial code", name: "serialNumber", size: 6 }, settings === null || settings === void 0 ? void 0 : settings.serialNumber)), true), kuiUtils.addToArrayByCondition(type !== "finish", __assign({ label: "Amount", name: "numberOfSubjects", type: "number", size: 6 }, settings === null || settings === void 0 ? void 0 : settings.numberOfSubjects)), true), [
|
1050
|
-
__assign({ label: "Description", name: "description", isTextArea: true }, settings === null || settings === void 0 ? void 0 : settings.description)
|
1051
|
-
], false), kuiUtils.addToArrayByCondition(type !== "finish", __assign({ label: "Instruction", name: "instruction", variant: "custom", CustomInput: kuiCrm.InputFileWithVisibility }, settings === null || settings === void 0 ? void 0 : settings.instruction)), true); };
|
1052
|
-
|
1053
|
-
var FillingInfoFieldsSchema = yup__namespace.object().shape({
|
1054
|
-
type: yup__namespace.string(),
|
1055
|
-
tag: yup__namespace.object({
|
1056
|
-
name: yup__namespace.string().required(kuiCrm.defaultRequiredMessage),
|
1057
|
-
}),
|
1058
|
-
name: yup__namespace.string().when("type", {
|
1059
|
-
is: function (value) { return value === "electronics"; },
|
1060
|
-
then: function (rule) { return rule.required(kuiCrm.defaultRequiredMessage); },
|
1061
|
-
}),
|
1062
|
-
});
|
1063
|
-
|
1064
|
-
var meterFeaturesFieldsSchema = {
|
1065
|
-
number: yup__namespace.string().required("This field is required"),
|
1066
|
-
};
|
1067
|
-
var getMeterFeaturesFieldsSchema = function (valuesFields) {
|
1068
|
-
var valuesSchema = kuiCrm.getMeterValuesFieldsSchema(valuesFields);
|
1069
|
-
return yup__namespace.object().shape(__assign(__assign({}, meterFeaturesFieldsSchema), Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))));
|
1070
|
-
};
|
1071
|
-
|
1072
|
-
var getInventoryMeterFields = function (settings, inputsSettings) { return __spreadArray(__spreadArray([], kuiCrm.basicFieldsOfNewResourceMeter(settings, inputsSettings), true), [
|
1073
|
-
__assign({ label: "Activation date", name: "startDate", variant: "date", max: luxon.DateTime.now() }, inputsSettings === null || inputsSettings === void 0 ? void 0 : inputsSettings.startDate),
|
1074
|
-
__assign({ label: "Passport", name: "passportFile", variant: "custom", CustomInput: kuiComplex.InputFile }, inputsSettings === null || inputsSettings === void 0 ? void 0 : inputsSettings.passportFile),
|
1075
|
-
], false); };
|
1076
|
-
|
1077
|
-
var AddedMeterItem = function (props) {
|
1078
|
-
var meter = props.meter, getMeterLabel = props.getMeterLabel;
|
1079
|
-
var resource = meter.resource, type = meter.type, number = meter.number;
|
1080
|
-
var initialValue = meter.initialValue, initialValueT1 = meter.initialValueT1, initialValueT2 = meter.initialValueT2, initialValueT3 = meter.initialValueT3;
|
1081
|
-
var meterValues = [
|
1082
|
-
initialValue,
|
1083
|
-
initialValueT1,
|
1084
|
-
initialValueT2,
|
1085
|
-
initialValueT3,
|
1086
|
-
]
|
1087
|
-
.filter(function (value) { return typeof value !== "undefined"; })
|
1088
|
-
.map(function (value) { return value; })
|
1089
|
-
.join(" / ");
|
1090
|
-
var getDefaultMeterLabel = function () {
|
1091
|
-
return ___default["default"].capitalize("".concat(type ? "".concat(type, " ") : "").concat(resource, " meter"));
|
1092
|
-
};
|
1093
|
-
var label = getMeterLabel
|
1094
|
-
? getMeterLabel(resource, type)
|
1095
|
-
: getDefaultMeterLabel();
|
1096
|
-
return (jsxRuntime.jsxs(kuiBasic.Caption, __assign({ "data-testid": "addedMeterLine", size: "s" }, { children: ["\u2022 ", label, " #", number, " -", " ", jsxRuntime.jsxs(StyledAccent, { children: [meterValues, " ", kuiCrm.meterUnitLabel[meter.resource]] })] })));
|
1097
|
-
};
|
1098
|
-
var StyledAccent = styled__default["default"].span(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n font-weight: 600;\n"], ["\n font-weight: 600;\n"])));
|
1099
|
-
var templateObject_1$a;
|
1100
|
-
|
1101
|
-
var AddedMetersBlock = function (props) {
|
1102
|
-
var _a, _b;
|
1103
|
-
var resource = props.resource, formStore = props.formStore, label = props.label, getMeterLabel = props.getMeterLabel;
|
1104
|
-
var addedMeters = (_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b.filter(function (meter) { return meter.resource === resource; });
|
1105
|
-
if (!(addedMeters === null || addedMeters === void 0 ? void 0 : addedMeters.length))
|
1106
|
-
return null;
|
1107
|
-
return (jsxRuntime.jsxs(StyledWrapper$5, __assign({ "data-testid": "addedMetersBlock" }, { children: [jsxRuntime.jsxs(StyledHeader, __assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(StyledIcon, {}), jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", color: "fiftyP" }, { children: label || "In the previous steps were added:" }))] })), addedMeters.map(function (meter) { return (jsxRuntime.jsx(AddedMeterItem, { getMeterLabel: getMeterLabel, meter: meter }, meter.number)); })] })));
|
1108
|
-
};
|
1109
|
-
var StyledWrapper$5 = styled__default["default"].div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n border-radius: 8px;\n border: 1px solid ", ";\n padding: 12px 16px;\n background: white;\n"], ["\n border-radius: 8px;\n border: 1px solid ", ";\n padding: 12px 16px;\n background: white;\n"])), kuiBasic.theme.palette.grey.fifteenB);
|
1110
|
-
var StyledIcon = styled__default["default"](kuiIcon.WarningIcon)(templateObject_2$6 || (templateObject_2$6 = __makeTemplateObject(["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ", ";\n }\n"], ["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ", ";\n }\n"])), kuiBasic.theme.palette.brand.main);
|
1111
|
-
var StyledHeader = styled__default["default"](kuiBasic.Grid)(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
|
1112
|
-
var templateObject_1$9, templateObject_2$6, templateObject_3$3;
|
1113
|
-
|
1114
|
-
function InventoryMeterInfoFields(props) {
|
1115
|
-
var _a, _b;
|
1116
|
-
var resource = props.resource, index = props.index, formStore = props.formStore;
|
1117
|
-
var defaultValues = (_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b[index];
|
1118
|
-
var withMeterType = resource === "water" || resource === "electricity";
|
1119
|
-
var defaultType = resource === "water" ? "cold" : "T1";
|
1120
|
-
var defaultMeterType = withMeterType ? defaultType : null;
|
1121
|
-
var _c = react.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.type) || defaultMeterType), meterType = _c[0], setMeterType = _c[1];
|
1122
|
-
var meterFields = getInventoryMeterFields({
|
1123
|
-
resource: resource,
|
1124
|
-
meterType: meterType,
|
1125
|
-
});
|
1126
|
-
var valueFieldsName = meterFields
|
1127
|
-
.filter(function (field) { return field.type === "number"; })
|
1128
|
-
.map(function (field) { return field.name; });
|
1129
|
-
var meterFeaturesFieldsSchema = getMeterFeaturesFieldsSchema(valueFieldsName);
|
1130
|
-
var form = react.useMemo(function () {
|
1131
|
-
return reactHookForm.useForm({
|
1132
|
-
resolver: yup$1.yupResolver(meterFeaturesFieldsSchema),
|
1133
|
-
defaultValues: __assign({}, defaultValues),
|
1134
|
-
values: defaultValues,
|
1135
|
-
});
|
1136
|
-
}, [meterFeaturesFieldsSchema]);
|
1137
|
-
var handleSubmit = function (data) {
|
1138
|
-
formStore.replaceFieldInArray("meters", __assign(__assign({}, data), { resource: resource }), index);
|
1139
|
-
formStore.nextStep();
|
1140
|
-
};
|
1141
|
-
return (jsxRuntime.jsx(kuiCrm.FormWrapper, __assign({ form: form, onSubmit: handleSubmit, label: "Next", variant: "next", withPrevStep: true, handlePrevClick: formStore.prevStep }, { children: jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, spacing: 2 }, { children: [jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(AddedMetersBlock, { formStore: formStore, resource: resource }) })), withMeterType && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(kuiCrm.MeterTypeRadioGroup, { form: form, resource: resource, handleChange: setMeterType }) }))), meterFields.map(function (_a) {
|
1142
|
-
var size = _a.size, field = __rest(_a, ["size"]);
|
1143
|
-
return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: size || 6 }, { children: jsxRuntime.jsx(kuiCrm.InputByType, __assign({ form: form }, field)) }), field.name));
|
1144
|
-
})] })) })));
|
1145
|
-
}
|
1146
|
-
|
1147
|
-
var renderMetersSteps = function (MeterStep, MeterPhotoStep, maxMeters) {
|
1148
|
-
var meters = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.water) || 0)).fill("water"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.electricity) || 0)).fill("electricity"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.gas) || 0)).fill("gas"), true), new Array(Number((maxMeters === null || maxMeters === void 0 ? void 0 : maxMeters.heating) || 0)).fill("heating"), true);
|
1149
|
-
return meters.map(function (resource, index) { return [
|
1150
|
-
jsxRuntime.jsx(MeterStep, { index: index, resource: resource }, "meter_info_".concat(index)),
|
1151
|
-
jsxRuntime.jsx(MeterPhotoStep, { index: index, resource: resource }, "meter_photo_".concat(index)),
|
1152
|
-
]; });
|
1153
|
-
};
|
1154
|
-
|
1155
|
-
var getRoomsImagesSteps = function (type, settings, roomsParams) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
1156
|
-
__assign({ type: "kitchen" }, settings.kitchen)
|
1157
|
-
], new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bedroomsNumber) || 0))
|
1158
|
-
.fill(0)
|
1159
|
-
.map(function (_, index) { return (__assign({ type: "bedroom" }, settings.bedroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bedroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Math.max(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.roomsNumber) || 0) -
|
1160
|
-
Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bedroomsNumber) || 0), 0))
|
1161
|
-
.fill(0)
|
1162
|
-
.map(function (_, index) { return (__assign({ type: "room" }, settings.room((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.roomsNumber)
|
1163
|
-
? "".concat(index + 1 + ((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bedroomsNumber) || 0), " ")
|
1164
|
-
: ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bathroomsNumber) || 0))
|
1165
|
-
.fill(0)
|
1166
|
-
.map(function (_, index) { return (__assign({ type: "bathroom" }, settings.bathroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.bathroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.restroomsNumber) || 0))
|
1167
|
-
.fill(0)
|
1168
|
-
.map(function (_, index) { return (__assign({ type: "toilet" }, settings.toilet((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.restroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), new Array(Number((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.combinedBathroomsNumber) || 0))
|
1169
|
-
.fill(0)
|
1170
|
-
.map(function (_, index) { return (__assign({ type: "combined_bathroom" }, settings.combinedBathroom((roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.combinedBathroomsNumber) ? "".concat(index + 1, " ") : ""))); }), true), [
|
1171
|
-
__assign({ type: "others" }, settings.others)
|
1172
|
-
], false), kuiUtils.addToArrayByCondition(type === "initial", __assign({ type: "entrance" }, settings.entrance)), true), kuiUtils.addToArrayByCondition(type !== "initial", __assign({ type: "keys" }, settings.keys)), true), kuiUtils.addToArrayByCondition(!!(type === "initial" && (roomsParams === null || roomsParams === void 0 ? void 0 : roomsParams.parkingType)), __assign({ type: "parking" }, settings.parking)), true), [
|
1173
|
-
__assign({ type: "additional" }, settings.additional),
|
1174
|
-
], false); };
|
1175
|
-
|
1176
|
-
var InspectionFeedbackBillet = function (props) {
|
1177
|
-
var feedback = props.feedback, label = props.label;
|
1178
|
-
return (jsxRuntime.jsx(StyledWrapper$4, __assign({ status: feedback.status }, { children: jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", weight: 500, color: "fiftyP" }, { children: label })), feedback.status !== "notSigned" && (jsxRuntime.jsxs(StyledIconWrapper, { children: [feedback.status === "signed" ? (jsxRuntime.jsx(StyledCheckIcon, {})) : (jsxRuntime.jsx(StyledErrorIcon, {})), !!feedback.comment && (jsxRuntime.jsx(kuiCrm.Tooltip, __assign({ placement: "bottom", content: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", color: "fiftyP" }, { children: "Comment" })), jsxRuntime.jsx(StyledComment, __assign({ size: "xs" }, { children: feedback.comment }))] }) }, { children: jsxRuntime.jsx(StyledCommentIcon, {}) })))] }))] })) })));
|
1179
|
-
};
|
1180
|
-
var StyledWrapper$4 = styled__default["default"].div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n background: ", ";\n border-radius: 66px;\n border: 1px solid ", ";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ", "px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"], ["\n background: ", ";\n border-radius: 66px;\n border: 1px solid ", ";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ", "px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"])), function (_a) {
|
1181
|
-
var status = _a.status;
|
1182
|
-
return status === "notSigned"
|
1183
|
-
? kuiBasic.theme.palette.background.light1
|
1184
|
-
: kuiBasic.theme.palette.grey.zero;
|
1185
|
-
}, kuiBasic.theme.palette.grey.fifteenB, kuiBasic.theme.breakpoints.sm);
|
1186
|
-
var StyledIconWrapper = styled__default["default"].div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"])));
|
1187
|
-
var StyledCheckIcon = styled__default["default"](kuiIcon.CheckIcon)(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n path {\n fill: ", ";\n }\n"], ["\n path {\n fill: ", ";\n }\n"])), kuiBasic.theme.palette.green.fiftyP);
|
1188
|
-
var StyledErrorIcon = styled__default["default"](kuiIcon.CancelIcon)(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n width: 12px;\n height: 12px;\n path {\n fill: ", ";\n }\n"], ["\n width: 12px;\n height: 12px;\n path {\n fill: ", ";\n }\n"])), kuiBasic.theme.palette.red.fiftyP);
|
1189
|
-
var StyledComment = styled__default["default"](kuiBasic.Caption)(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n margin-top: 8px;\n"], ["\n margin-top: 8px;\n"])));
|
1190
|
-
var StyledCommentIcon = styled__default["default"](kuiIcon.CommentIcon)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: 13px;\n cursor: pointer;\n path {\n fill: ", ";\n stroke: ", ";\n }\n"], ["\n width: 13px;\n cursor: pointer;\n path {\n fill: ", ";\n stroke: ", ";\n }\n"])), kuiBasic.theme.palette.grey.zero, kuiBasic.theme.palette.grey.thirty);
|
1191
|
-
var templateObject_1$8, templateObject_2$5, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6;
|
1192
|
-
|
1193
|
-
var InspectionFeedbackStatus = function (props) {
|
1194
|
-
var feedback = props.feedback, label = props.label, resendLabel = props.resendLabel, resend = props.resend;
|
1195
|
-
if (!feedback)
|
1196
|
-
return null;
|
1197
|
-
return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(InspectionFeedbackBillet, { feedback: feedback, label: label }), feedback.status === "rejected" && (jsxRuntime.jsx(StyledButton, __assign({ size: "xs", variant: "orange", onClick: resend, endIcon: jsxRuntime.jsx(kuiIcon.UpdateIcon, {}) }, { children: resendLabel })))] })) })));
|
1198
|
-
};
|
1199
|
-
var InspectionFeedbackStatus$1 = mobxReact.observer(InspectionFeedbackStatus);
|
1200
|
-
var StyledButton = styled__default["default"](kuiBasic.Button)(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n margin-left: 16px;\n @media (max-width: ", "px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"], ["\n margin-left: 16px;\n @media (max-width: ", "px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"])), kuiBasic.theme.breakpoints.sm);
|
1201
|
-
var templateObject_1$7;
|
1202
|
-
|
1203
|
-
var InspectionFeedback = function (props) {
|
1204
|
-
var tenantFeedback = props.tenantFeedback, landlordFeedback = props.landlordFeedback, resignInspection = props.resignInspection, resendLabel = props.resendLabel;
|
1205
|
-
var tenantLabel = props.tenantLabel, landlordLabel = props.landlordLabel;
|
1206
|
-
if (!tenantFeedback && !landlordFeedback)
|
1207
|
-
return null;
|
1208
|
-
return (jsxRuntime.jsxs(StyledWrapper$3, __assign({ container: true, spacing: 2, alignItems: "center" }, { children: [jsxRuntime.jsx(InspectionFeedbackStatus$1, { resend: resignInspection, resendLabel: resendLabel, feedback: tenantFeedback, label: tenantLabel }), jsxRuntime.jsx(InspectionFeedbackStatus$1, { resend: resignInspection, resendLabel: resendLabel, feedback: landlordFeedback, label: landlordLabel })] })));
|
1209
|
-
};
|
1210
|
-
var index = mobxReact.observer(InspectionFeedback);
|
1211
|
-
var StyledWrapper$3 = styled__default["default"](kuiBasic.Grid)(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n padding-top: 8px;\n"], ["\n padding-top: 8px;\n"])));
|
1212
|
-
var templateObject_1$6;
|
1213
|
-
|
1214
|
-
var FillingCardContent = function (props) {
|
1215
|
-
var filling = props.filling, warningLabel = props.warningLabel;
|
1216
|
-
return (jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, alignItems: "center" }, { children: [filling.wasMissing && (jsxRuntime.jsx(kuiCrm.Tooltip, __assign({ content: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs" }, { children: warningLabel })) }, { children: jsxRuntime.jsx(StyledWarningIcon, { width: 17, height: 17 }) }))), jsxRuntime.jsxs(StyledLabelWrapper, { children: [jsxRuntime.jsxs(kuiBasic.Caption, __assign({ size: "s" }, { children: [filling.tagName, " ", filling.name ? " | ".concat(filling.name) : ""] })), !!(filling.numberOfSubjects || filling.serialNumber) && (jsxRuntime.jsxs(StyledSubtitle, __assign({ size: "xs", color: "fiftyP" }, { children: [filling.numberOfSubjects
|
1217
|
-
? "".concat(filling.numberOfSubjects, " pieces")
|
1218
|
-
: "", filling.numberOfSubjects && filling.serialNumber ? " \u2022 " : "", filling.serialNumber] })))] })] })));
|
1219
|
-
};
|
1220
|
-
var StyledWarningIcon = styled__default["default"](kuiIcon.WarningIcon)(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n margin-left: 4px;\n path {\n fill: ", ";\n }\n"], ["\n margin-left: 4px;\n path {\n fill: ", ";\n }\n"])), kuiBasic.theme.palette.red.fiftyP);
|
1221
|
-
var StyledLabelWrapper = styled__default["default"].div(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["\n margin-left: 8px;\n"], ["\n margin-left: 8px;\n"])));
|
1222
|
-
var StyledSubtitle = styled__default["default"](kuiBasic.Caption)(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n margin-top: 4px;\n"], ["\n margin-top: 4px;\n"])));
|
1223
|
-
var templateObject_1$5, templateObject_2$4, templateObject_3$1;
|
1224
|
-
|
1225
|
-
var InspectionFillingCard = function (props) {
|
1226
|
-
var className = props.className, form = props.form, index = props.index, disabled = props.disabled, other = __rest(props, ["className", "form", "index", "disabled"]);
|
1227
|
-
return (jsxRuntime.jsx(StyledCard$1, __assign({ className: className }, { children: jsxRuntime.jsx(StyledCheckbox
|
1228
|
-
// @ts-ignore
|
1229
|
-
, {
|
1230
|
-
// @ts-ignore
|
1231
|
-
form: form, name: "fillingList.".concat(index, ".check"), label: jsxRuntime.jsx(FillingCardContent, __assign({}, other)), disabled: disabled }) })));
|
1232
|
-
};
|
1233
|
-
var StyledCard$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"], ["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"])));
|
1234
|
-
var StyledCheckbox = styled__default["default"](kuiComplex.CheckboxWithController)(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"], ["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"])));
|
1235
|
-
var templateObject_1$4, templateObject_2$3;
|
1236
|
-
|
1237
|
-
var useMetersValues = function (formStore, metersStore, shouldBeLoad, onLoad) {
|
1238
|
-
var finishLoad = function () {
|
1239
|
-
if (onLoad)
|
1240
|
-
onLoad();
|
1241
|
-
metersStore.loader.endLoading();
|
1242
|
-
};
|
1243
|
-
var loadMeters = function () { return __awaiter(void 0, void 0, void 0, function () {
|
1244
|
-
var _a, _b;
|
1245
|
-
return __generator(this, function (_c) {
|
1246
|
-
switch (_c.label) {
|
1247
|
-
case 0:
|
1248
|
-
if (!shouldBeLoad) return [3 /*break*/, 3];
|
1249
|
-
if (!!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b.length)) return [3 /*break*/, 2];
|
1250
|
-
return [4 /*yield*/, metersStore.fetchMeters()];
|
1251
|
-
case 1:
|
1252
|
-
_c.sent();
|
1253
|
-
_c.label = 2;
|
1254
|
-
case 2:
|
1255
|
-
finishLoad();
|
1256
|
-
return [3 /*break*/, 4];
|
1257
|
-
case 3:
|
1258
|
-
if (shouldBeLoad === false)
|
1259
|
-
finishLoad();
|
1260
|
-
_c.label = 4;
|
1261
|
-
case 4: return [2 /*return*/];
|
1262
|
-
}
|
1263
|
-
});
|
1264
|
-
}); };
|
1265
|
-
react.useEffect(function () {
|
1266
|
-
loadMeters();
|
1267
|
-
}, [shouldBeLoad]);
|
1268
|
-
react.useEffect(function () {
|
1269
|
-
var _a, _b;
|
1270
|
-
if (!metersStore.loader.isLoading && !((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b.length)) {
|
1271
|
-
formStore.updateFormFields({ meters: metersStore.meters });
|
1272
|
-
}
|
1273
|
-
}, [metersStore.meters, metersStore.loader.isLoading]);
|
1274
|
-
};
|
1275
|
-
|
1276
|
-
var FillingListStore = /** @class */ (function () {
|
1277
|
-
function FillingListStore() {
|
1278
|
-
var _this = this;
|
1279
|
-
this.fetchFillingList = function (apartmentId, fillingType) { return __awaiter(_this, void 0, void 0, function () {
|
1280
|
-
var response;
|
1281
|
-
return __generator(this, function (_a) {
|
1282
|
-
switch (_a.label) {
|
1283
|
-
case 0:
|
1284
|
-
this.loader.startLoading();
|
1285
|
-
return [4 /*yield*/, to__default["default"](kuiCrm.ApartmentsAgent.getFillingList(apartmentId, fillingType))];
|
1286
|
-
case 1:
|
1287
|
-
response = _a.sent();
|
1288
|
-
kuiUtils.resHandler(response, this.loader, this.updateFillingList);
|
1289
|
-
return [2 /*return*/];
|
1290
|
-
}
|
1291
|
-
});
|
1292
|
-
}); };
|
1293
|
-
this.updateFillingList = function (fillingList) {
|
1294
|
-
_this.fillingList =
|
1295
|
-
(fillingList === null || fillingList === void 0 ? void 0 : fillingList.map(function (filling) { return ({
|
1296
|
-
id: filling.id,
|
1297
|
-
name: filling.description,
|
1298
|
-
tagName: filling.feature_name,
|
1299
|
-
serialNumber: filling.serial_code,
|
1300
|
-
numberOfSubjects: filling.amount,
|
1301
|
-
wasMissing: filling.is_absent,
|
1302
|
-
}); })) || [];
|
1303
|
-
};
|
1304
|
-
this.fillingList = [];
|
1305
|
-
this.loader = new kuiUtils.Loader();
|
1306
|
-
mobx.makeAutoObservable(this);
|
1307
|
-
}
|
1308
|
-
return FillingListStore;
|
1309
|
-
}());
|
1310
|
-
|
1311
|
-
var useFillingList = function (apartmentId, formStore, fillingStore, shouldBeLoad, onLoad) {
|
1312
|
-
var finishLoad = function () {
|
1313
|
-
if (onLoad)
|
1314
|
-
onLoad();
|
1315
|
-
fillingStore.loader.endLoading();
|
1316
|
-
};
|
1317
|
-
var loadFillingList = function () { return __awaiter(void 0, void 0, void 0, function () {
|
1318
|
-
var _a, _b;
|
1319
|
-
return __generator(this, function (_c) {
|
1320
|
-
switch (_c.label) {
|
1321
|
-
case 0:
|
1322
|
-
if (!(shouldBeLoad && apartmentId)) return [3 /*break*/, 3];
|
1323
|
-
if (!!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.fillingList) === null || _b === void 0 ? void 0 : _b.length)) return [3 /*break*/, 2];
|
1324
|
-
return [4 /*yield*/, fillingStore.fetchFillingList(apartmentId, "appliance")];
|
1325
|
-
case 1:
|
1326
|
-
_c.sent();
|
1327
|
-
_c.label = 2;
|
1328
|
-
case 2:
|
1329
|
-
finishLoad();
|
1330
|
-
return [3 /*break*/, 4];
|
1331
|
-
case 3:
|
1332
|
-
if (shouldBeLoad === false)
|
1333
|
-
finishLoad();
|
1334
|
-
_c.label = 4;
|
1335
|
-
case 4: return [2 /*return*/];
|
1336
|
-
}
|
1337
|
-
});
|
1338
|
-
}); };
|
1339
|
-
react.useEffect(function () {
|
1340
|
-
loadFillingList();
|
1341
|
-
}, [apartmentId, shouldBeLoad]);
|
1342
|
-
react.useEffect(function () {
|
1343
|
-
var _a, _b;
|
1344
|
-
if (!fillingStore.loader.isLoading &&
|
1345
|
-
!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.fillingList) === null || _b === void 0 ? void 0 : _b.length)) {
|
1346
|
-
formStore.updateFormFields({
|
1347
|
-
fillingList: fillingStore.fillingList.map(function (filling) { return (__assign(__assign({}, filling), { check: false })); }),
|
1348
|
-
});
|
1349
|
-
}
|
1350
|
-
}, [fillingStore.fillingList, fillingStore.loader.isLoading]);
|
1351
|
-
};
|
1352
|
-
|
1353
|
-
var onInspectionModalOpen = function (apartmentStore, constants, openModal) {
|
1354
|
-
var inspectionsStore = apartmentStore.inspectionsStore, apartmentId = apartmentStore.apartmentId;
|
1355
|
-
var formStateName = constants.formStateName, formFieldsName = constants.formFieldsName;
|
1356
|
-
var fields = inspectionsStore.creationForm.fields;
|
1357
|
-
if (fields && fields.apartmentId !== apartmentId) {
|
1358
|
-
kuiUtils.clearIndexStores(inspectionsStore.indexDB, [formStateName, formFieldsName]);
|
1359
|
-
}
|
1360
|
-
inspectionsStore.setCanUpdateDB(true);
|
1361
|
-
if (openModal)
|
1362
|
-
openModal();
|
1363
|
-
};
|
1364
|
-
var onInspectionModalClose = function (apartmentStore, constants, closeModal) {
|
1365
|
-
var inspectionsStore = apartmentStore.inspectionsStore;
|
1366
|
-
var formStateName = constants.formStateName, formFieldsName = constants.formFieldsName;
|
1367
|
-
inspectionsStore.setCanUpdateDB(false);
|
1368
|
-
inspectionsStore.creationForm.resetForm();
|
1369
|
-
kuiUtils.clearIndexStores(inspectionsStore.indexDB, [formStateName, formFieldsName]);
|
1370
|
-
if (closeModal)
|
1371
|
-
closeModal();
|
1372
|
-
};
|
1373
|
-
|
1374
|
-
var useInspectionData = function (apartmentStore) {
|
1375
|
-
var _a;
|
1376
|
-
var apartmentId = apartmentStore.apartmentId, inspectionsStore = apartmentStore.inspectionsStore, metersStore = apartmentStore.metersStore, fillingStore = apartmentStore.fillingStore;
|
1377
|
-
var _b = react.useState(false), isMetersLoaded = _b[0], setIsMetersLoader = _b[1];
|
1378
|
-
var _c = react.useState(false), isFillingLoaded = _c[0], setIsFillingLoaded = _c[1];
|
1379
|
-
var formStore = inspectionsStore.creationForm;
|
1380
|
-
var inspectionType = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.type;
|
1381
|
-
var canBeLoad = inspectionType
|
1382
|
-
? inspectionType === "regular" || inspectionType === "transfer"
|
1383
|
-
: undefined;
|
1384
|
-
var fillingLoading = fillingStore.loader.isLoading;
|
1385
|
-
var metersLoading = metersStore.loader.isLoading;
|
1386
|
-
var handleMetersLoad = function () { return setIsMetersLoader(true); };
|
1387
|
-
var handleFillingLoad = function () { return setIsFillingLoaded(true); };
|
1388
|
-
react.useEffect(function () {
|
1389
|
-
if (isMetersLoaded &&
|
1390
|
-
isFillingLoaded &&
|
1391
|
-
!fillingLoading &&
|
1392
|
-
!metersLoading) {
|
1393
|
-
inspectionsStore.setCanLoadDB(true);
|
1394
|
-
}
|
1395
|
-
}, [isMetersLoaded, isFillingLoaded, fillingLoading, metersLoading]);
|
1396
|
-
useMetersValues(formStore, metersStore, canBeLoad, handleMetersLoad);
|
1397
|
-
useFillingList(apartmentId || null, formStore, fillingStore, canBeLoad, handleFillingLoad);
|
1398
|
-
};
|
1399
|
-
|
1400
|
-
var EXPIRATION_TIME = 24 * 60 * 60 * 1000; // 24 часа
|
1401
|
-
var useInspectionIndexDB = function (constants, apartmentStore, openModal) {
|
1402
|
-
var dbCreationTime = constants.dbCreationTime, formFieldsName = constants.formFieldsName, formStateName = constants.formStateName, inspectionCreationFormName = constants.inspectionCreationFormName;
|
1403
|
-
var inspectionsStore = apartmentStore.inspectionsStore, apartmentId = apartmentStore.apartmentId;
|
1404
|
-
var creationForm = inspectionsStore.creationForm, actionLoader = inspectionsStore.actionLoader, indexDB = inspectionsStore.indexDB, setCanUpdateDB = inspectionsStore.setCanUpdateDB, canUpdateDB = inspectionsStore.canUpdateDB;
|
1405
|
-
var dbName = inspectionCreationFormName;
|
1406
|
-
var onupgradeneeded = function (db) {
|
1407
|
-
kuiUtils.addIndexDBStore(db, formFieldsName);
|
1408
|
-
kuiUtils.addIndexDBStore(db, formStateName);
|
1409
|
-
};
|
1410
|
-
function checkAndDeleteDB() {
|
1411
|
-
var creationTime = localStorage.getItem(dbCreationTime);
|
1412
|
-
var currentTime = Date.now();
|
1413
|
-
if (creationTime && currentTime - Number(creationTime) > EXPIRATION_TIME) {
|
1414
|
-
kuiUtils.clearIndexStores(inspectionsStore.indexDB, [
|
1415
|
-
formStateName,
|
1416
|
-
formFieldsName,
|
1417
|
-
]);
|
1418
|
-
localStorage.removeItem(dbCreationTime);
|
1419
|
-
}
|
1420
|
-
}
|
1421
|
-
var initInspectionIndexDB = function () { return __awaiter(void 0, void 0, void 0, function () {
|
1422
|
-
return __generator(this, function (_a) {
|
1423
|
-
kuiUtils.initIndexDB(dbName, onupgradeneeded, actionLoader, function (db) { return __awaiter(void 0, void 0, void 0, function () {
|
1424
|
-
var formFields;
|
1425
|
-
return __generator(this, function (_a) {
|
1426
|
-
switch (_a.label) {
|
1427
|
-
case 0:
|
1428
|
-
inspectionsStore.setIndexDB(db);
|
1429
|
-
setCanUpdateDB(false);
|
1430
|
-
checkAndDeleteDB();
|
1431
|
-
return [4 /*yield*/, kuiUtils.readFromIndexDB(db, formFieldsName, actionLoader)];
|
1432
|
-
case 1:
|
1433
|
-
formFields = _a.sent();
|
1434
|
-
if (formFields) {
|
1435
|
-
if ((formFields === null || formFields === void 0 ? void 0 : formFields.apartmentId) === apartmentId) {
|
1436
|
-
creationForm.updateFormFields(__assign(__assign({}, formFields), { date: formFields.date ? luxon.DateTime.fromISO(formFields.date) : null }));
|
1437
|
-
if (openModal)
|
1438
|
-
openModal();
|
1439
|
-
}
|
1440
|
-
}
|
1441
|
-
else {
|
1442
|
-
setCanUpdateDB(true);
|
1443
|
-
}
|
1444
|
-
return [2 /*return*/];
|
1445
|
-
}
|
1446
|
-
});
|
1447
|
-
}); });
|
1448
|
-
return [2 /*return*/];
|
1449
|
-
});
|
1450
|
-
}); };
|
1451
|
-
var initFormState = function () { return __awaiter(void 0, void 0, void 0, function () {
|
1452
|
-
var formState, formFields;
|
1453
|
-
return __generator(this, function (_a) {
|
1454
|
-
switch (_a.label) {
|
1455
|
-
case 0: return [4 /*yield*/, kuiUtils.readFromIndexDB(indexDB, formStateName, actionLoader)];
|
1456
|
-
case 1:
|
1457
|
-
formState = _a.sent();
|
1458
|
-
return [4 /*yield*/, kuiUtils.readFromIndexDB(indexDB, formFieldsName, actionLoader)];
|
1459
|
-
case 2:
|
1460
|
-
formFields = _a.sent();
|
1461
|
-
if (formState && (formFields === null || formFields === void 0 ? void 0 : formFields.apartmentId) === apartmentId) {
|
1462
|
-
creationForm.setStep(Number(formState.step));
|
1463
|
-
}
|
1464
|
-
setCanUpdateDB(true);
|
1465
|
-
return [2 /*return*/];
|
1466
|
-
}
|
1467
|
-
});
|
1468
|
-
}); };
|
1469
|
-
react.useEffect(function () {
|
1470
|
-
if (apartmentId)
|
1471
|
-
initInspectionIndexDB();
|
1472
|
-
}, [apartmentId]);
|
1473
|
-
react.useEffect(function () {
|
1474
|
-
if (inspectionsStore.canLoadDB && indexDB) {
|
1475
|
-
initFormState();
|
1476
|
-
}
|
1477
|
-
}, [inspectionsStore.canLoadDB, indexDB]);
|
1478
|
-
react.useEffect(function () {
|
1479
|
-
if (canUpdateDB) {
|
1480
|
-
var formState = {
|
1481
|
-
step: creationForm.step,
|
1482
|
-
};
|
1483
|
-
kuiUtils.addToIndexDBWithQueue(indexDB, formStateName, formState, actionLoader);
|
1484
|
-
kuiUtils.addToIndexDBWithQueue(indexDB, formFieldsName, creationForm.fields, actionLoader);
|
1485
|
-
if (!localStorage.getItem(dbCreationTime)) {
|
1486
|
-
localStorage.setItem(dbCreationTime, Date.now().toString());
|
1487
|
-
}
|
1488
|
-
}
|
1489
|
-
}, [creationForm.step]);
|
1490
|
-
};
|
1491
|
-
|
1492
|
-
var ObjectForMapPoint = function (props) {
|
1493
|
-
var label = props.label, onClick = props.onClick, isActive = props.isActive;
|
1494
|
-
return (jsxRuntime.jsx(kuiBasic.Button, __assign({ size: "xs", variant: isActive ? "primary" : "white", onClick: onClick }, { children: label })));
|
1495
|
-
};
|
1496
|
-
|
1497
|
-
var MetroStation = function (props) {
|
1498
|
-
var metroStation = props.metroStation;
|
1499
|
-
var color = metroStation.color, name = metroStation.name;
|
1500
|
-
return (jsxRuntime.jsxs(StyledWrapper$2, __assign({ item: true, container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(StyledPoint, { style: { background: color } }), jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", color: "sixty" }, { children: name }))] })));
|
1501
|
-
};
|
1502
|
-
var StyledWrapper$2 = styled__default["default"](kuiBasic.Grid)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
|
1503
|
-
var StyledPoint = styled__default["default"].div(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"], ["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"])));
|
1504
|
-
var templateObject_1$3, templateObject_2$2;
|
1505
|
-
|
1506
|
-
var ContactPhone = function (props) {
|
1507
|
-
var phone = props.phone;
|
1508
|
-
var formattedPhone = kuiUtils.getPhoneNumberFromPhoneParams(phone, " ");
|
1509
|
-
var phoneLink = formattedPhone.replace(/\d/g, "");
|
1510
|
-
return (jsxRuntime.jsxs(StyledWrapper$1, __assign({ container: true, alignItems: "center", wrap: "nowrap" }, { children: [jsxRuntime.jsx(StyledPhoneIcon, { width: 14, height: 14 }), jsxRuntime.jsx("a", __assign({ href: "tel:+".concat(phoneLink) }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", weight: 500, color: "sixty" }, { children: formattedPhone })) }))] })));
|
1511
|
-
};
|
1512
|
-
var StyledWrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
|
1513
|
-
var StyledPhoneIcon = styled__default["default"](kuiIcon.PhoneIcon)(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ", ";\n }\n"], ["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ", ";\n }\n"])), kuiBasic.theme.palette.grey.sixty);
|
1514
|
-
var templateObject_1$2, templateObject_2$1;
|
1515
|
-
|
1516
|
-
var ObjectForMapCard = function (props) {
|
1517
|
-
var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getInspectionLink = props.getInspectionLink;
|
1518
|
-
var apartment = inspection.apartment, tenant = inspection.tenant, landlord = inspection.landlord, metroStations = inspection.metroStations;
|
1519
|
-
var client = tenant || landlord;
|
1520
|
-
var clientLink = getClientLink && client ? getClientLink(client === null || client === void 0 ? void 0 : client.id) : "";
|
1521
|
-
var apartmentLink = getInspectionLink(apartment.id, inspection.id);
|
1522
|
-
return (jsxRuntime.jsxs(StyledCard, { children: [jsxRuntime.jsx(kuiCrm.Link, __assign({ href: apartmentLink }, { children: jsxRuntime.jsx(StyledPreviewContent, { imageSrc: apartment.previewImage, description: apartment.address }) })), jsxRuntime.jsx(kuiBasic.Grid, __assign({ container: true, spacing: 2, alignItems: "center" }, { children: metroStations.map(function (station) { return (jsxRuntime.jsx(MetroStation, { metroStation: station }, station.name)); }) })), !!client && (jsxRuntime.jsxs(StyledTenantInfo, __assign({ container: true, alignItems: "center", justify: "space-between" }, { children: [clientLink ? (jsxRuntime.jsx(StyledClientLink, __assign({ href: clientLink }, { children: jsxRuntime.jsx(kuiCrm.UserBadge, { weight: 500, user: client }) }))) : (jsxRuntime.jsx(kuiCrm.UserBadge, { weight: 500, user: client })), !!(client === null || client === void 0 ? void 0 : client.phoneNumber) && (jsxRuntime.jsx(ContactPhone, { phone: client === null || client === void 0 ? void 0 : client.phoneNumber }))] }))), jsxRuntime.jsx(StyledCloseButton, __assign({ isCircle: true, size: "xs", variant: "whiteWithGray", onClick: onClose }, { children: jsxRuntime.jsx(kuiIcon.CloseIcon, { width: 6, height: 6 }) }))] }));
|
1523
|
-
};
|
1524
|
-
var StyledCard = styled__default["default"].div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n width: 330px;\n background: ", ";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"], ["\n width: 330px;\n background: ", ";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"])), kuiBasic.theme.palette.grey.zero);
|
1525
|
-
var StyledPreviewContent = styled__default["default"](kuiCrm.PreviewContent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"], ["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"])));
|
1526
|
-
var StyledTenantInfo = styled__default["default"](kuiBasic.Grid)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: 8px;\n border-top: 1px solid ", ";\n margin-top: 8px;\n"], ["\n padding-top: 8px;\n border-top: 1px solid ", ";\n margin-top: 8px;\n"])), kuiBasic.theme.palette.grey.fifteenB);
|
1527
|
-
var StyledCloseButton = styled__default["default"](kuiBasic.Button)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"], ["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"])));
|
1528
|
-
var StyledClientLink = styled__default["default"](kuiCrm.Link)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n max-width: calc(100% - 140px);\n"], ["\n max-width: calc(100% - 140px);\n"])));
|
1529
|
-
var templateObject_1$1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
1530
|
-
|
1531
|
-
var ObjectForMapOverlay = function (props) {
|
1532
|
-
var inspection = props.inspection, map = props.map, label = props.label, other = __rest(props, ["inspection", "map", "label"]);
|
1533
|
-
var _a = kuiCrm.useMapCards(inspection.location, map), ref = _a.ref, isOpen = _a.isOpen, closeCard = _a.closeCard, toggleCard = _a.toggleCard;
|
1534
|
-
return (jsxRuntime.jsx(kuiCrm.MapOverlay, __assign({ map: map, position: inspection.location }, { children: jsxRuntime.jsxs(StyledWrapper, __assign({ ref: ref }, { children: [jsxRuntime.jsx(ObjectForMapPoint, { label: label, isActive: isOpen, onClick: toggleCard }), isOpen && (jsxRuntime.jsx(ObjectForMapCard, __assign({ inspection: inspection, onClose: closeCard }, other)))] })) })));
|
1535
|
-
};
|
1536
|
-
var StyledWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
|
1537
|
-
var templateObject_1;
|
1538
|
-
|
1539
|
-
exports.AddedMetersBlock = AddedMetersBlock;
|
1540
|
-
exports.AdditionalInfoFieldsSchema = AdditionalInfoFieldsSchema;
|
1541
|
-
exports.AdditionalInfoStepSchema = AdditionalInfoStepSchema;
|
1542
|
-
exports.BasicApartmentInfoFieldsSchema = BasicApartmentInfoFieldsSchema;
|
1543
|
-
exports.BasicApartmentInfoStepSchema = BasicApartmentInfoStepSchema;
|
1544
|
-
exports.DetailApartmentInfoFieldsSchema = DetailApartmentInfoFieldsSchema;
|
1545
|
-
exports.DetailApartmentInfoStepSchema = DetailApartmentInfoStepSchema;
|
1546
|
-
exports.FillingInfoFieldsSchema = FillingInfoFieldsSchema;
|
1547
|
-
exports.FillingListStore = FillingListStore;
|
1548
|
-
exports.HouseInfoFieldsSchema = HouseInfoFieldsSchema;
|
1549
|
-
exports.HouseInfoStepSchema = HouseInfoStepSchema;
|
1550
|
-
exports.HouseServicesInfoFieldsSchema = HouseServicesInfoFieldsSchema;
|
1551
|
-
exports.HouseServicesInfoStepSchema = HouseServicesInfoStepSchema;
|
1552
|
-
exports.InspectionFeedback = index;
|
1553
|
-
exports.InspectionFillingCard = InspectionFillingCard;
|
1554
|
-
exports.InventoryMeterInfoFields = InventoryMeterInfoFields;
|
1555
|
-
exports.MetersInfoFieldsSchema = MetersInfoFieldsSchema;
|
1556
|
-
exports.MetersInfoStepSchema = MetersInfoStepSchema;
|
1557
|
-
exports.ObjectForMapCard = ObjectForMapCard;
|
1558
|
-
exports.ObjectForMapOverlay = ObjectForMapOverlay;
|
1559
|
-
exports.ObjectForMapPoint = ObjectForMapPoint;
|
1560
|
-
exports.RoomsApartmentInfoFieldsSchema = RoomsApartmentInfoFieldsSchema;
|
1561
|
-
exports.RoomsApartmentInfoStepSchema = RoomsApartmentInfoStepSchema;
|
1562
|
-
exports.SecurityApartmentInfoFieldsSchema = SecurityApartmentInfoFieldsSchema;
|
1563
|
-
exports.SecurityApartmentInfoStepSchema = SecurityApartmentInfoStepSchema;
|
1564
|
-
exports.TelecommunicationsInfoFieldsSchema = TelecommunicationsInfoFieldsSchema;
|
1565
|
-
exports.TelecommunicationsInfoStepSchema = TelecommunicationsInfoStepSchema;
|
1566
|
-
exports.WaterMeterFieldsSchema = WaterMeterFieldsSchema;
|
1567
|
-
exports.apartmentFields = apartmentFields;
|
1568
|
-
exports.getAdditionalInfoStepFields = getAdditionalInfoStepFields;
|
1569
|
-
exports.getAvailableResourcesFields = getAvailableResourcesFields;
|
1570
|
-
exports.getBasicApartmentInfoFields = getBasicApartmentInfoFields;
|
1571
|
-
exports.getDetailApartmentInfoFields = getDetailApartmentInfoFields;
|
1572
|
-
exports.getFillingInfoFields = getFillingInfoFields;
|
1573
|
-
exports.getHouseInfoStep = getHouseInfoStep;
|
1574
|
-
exports.getHouseServicesInfoStep = getHouseServicesInfoStep;
|
1575
|
-
exports.getInventoryMeterFields = getInventoryMeterFields;
|
1576
|
-
exports.getMetersInfoStepFields = getMetersInfoStepFields;
|
1577
|
-
exports.getPartialMeterInfoSchema = getPartialMeterInfoSchema;
|
1578
|
-
exports.getRoomsApartmentInfoFields = getRoomsApartmentInfoFields;
|
1579
|
-
exports.getRoomsImagesSteps = getRoomsImagesSteps;
|
1580
|
-
exports.getSecurityApartmentInfoFields = getSecurityApartmentInfoFields;
|
1581
|
-
exports.getTelecommunicationsInfoStepFields = getTelecommunicationsInfoStepFields;
|
1582
|
-
exports.getWaterMeterFields = getWaterMeterFields;
|
1583
|
-
exports.inspectionsRequestBody = inspectionsRequestBody;
|
1584
|
-
exports.inspectionsRequests = inspectionsRequests;
|
1585
|
-
exports.onInspectionModalClose = onInspectionModalClose;
|
1586
|
-
exports.onInspectionModalOpen = onInspectionModalOpen;
|
1587
|
-
exports.renderMetersSteps = renderMetersSteps;
|
1588
|
-
exports.useFillingList = useFillingList;
|
1589
|
-
exports.useInspectionData = useInspectionData;
|
1590
|
-
exports.useInspectionIndexDB = useInspectionIndexDB;
|
1591
|
-
exports.useMetersValues = useMetersValues;
|
1592
|
-
//# sourceMappingURL=index.js.map
|