kui-crm_actions 0.0.46 → 0.0.48

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 CHANGED
@@ -1,11 +1,14 @@
1
1
  import { addToArrayByCondition, clearNotValidFields, getPhoneNumberFromPhoneParams, resHandler, callPromises } from 'kui-utils';
2
2
  import * as yup from 'yup';
3
- import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, ParkingTypesValues, fieldWithConditionSchema, defaultRequiredMessage, CompanyAutocomplete, TaxTypeValues, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete } from 'kui-crm';
3
+ import { requests, uploadImages, uploadFiles, CountryAutocomplete, RegionAutocomplete, CityAutocomplete, RenovationTypeValues, RenovationStyleValues, RoomTypeValues, RoomTypesValues, BooleanValues, ParkingTypesValues, fieldWithConditionSchema, defaultRequiredMessage, CompanyAutocomplete, TaxTypeValues, phoneWithConditionSchema, positiveNumberSchema, getNumbersValues, TVTypesValues, phoneNonRequiredSchema, InputFileWithVisibility, FillingTypeValues, FillingTagsAutocomplete, PreviewContent, Link, UserBadge } from 'kui-crm';
4
4
  import to from 'await-to-js';
5
5
  import { DateTime } from 'luxon';
6
6
  import { InputWithAddressAutocomplete, DependentInput, CheckboxWithController, InputPhoneWithForm } from 'kui-complex';
7
- import { jsx } from 'react/jsx-runtime';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
8
  import { useEffect } from 'react';
9
+ import styled from '@emotion/styled';
10
+ import { Grid, Caption, theme, Button } from 'kui-basic';
11
+ import { PhoneIcon, CloseIcon } from 'kui-icon';
9
12
 
10
13
  /******************************************************************************
11
14
  Copyright (c) Microsoft Corporation.
@@ -79,6 +82,11 @@ function __spreadArray(to, from, pack) {
79
82
  }
80
83
  }
81
84
  return to.concat(ar || Array.prototype.slice.call(from));
85
+ }
86
+
87
+ function __makeTemplateObject(cooked, raw) {
88
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
89
+ return cooked;
82
90
  }
83
91
 
84
92
  var getPartialMeterInfoFields = function (resource, type, name, settings) {
@@ -150,7 +158,7 @@ var inspectionsRequestBody = {
150
158
  renovation_style: (_c = inspection.renovation) === null || _c === void 0 ? void 0 : _c.style,
151
159
  rooms: inspection.rooms.map(function (room, index) { return ({
152
160
  room_type: room.type,
153
- order_number: index + 1,
161
+ order_number: index,
154
162
  }); }),
155
163
  };
156
164
  },
@@ -302,12 +310,14 @@ var inspectionsRequests = {
302
310
  bedroomIndex = 0;
303
311
  return [2 /*return*/, roomsImages.map(function (room, index) {
304
312
  if (room.type === "room") {
305
- roomIndex += 1;
306
- return __assign(__assign({}, _this.getRoomParams(room, images[index])), { room_order_number: roomIndex });
313
+ return __assign(__assign({}, _this.getRoomParams(room, images[index])), {
314
+ // eslint-disable-next-line no-plusplus
315
+ room_order_number: roomIndex++ });
307
316
  }
308
317
  if (room.type === "bedroom") {
309
- bedroomIndex += 1;
310
- return __assign(__assign({}, _this.getRoomParams(room, images[index])), { room_order_number: bedroomIndex });
318
+ return __assign(__assign({}, _this.getRoomParams(room, images[index])), {
319
+ // eslint-disable-next-line no-plusplus
320
+ room_order_number: bedroomIndex++ });
311
321
  }
312
322
  return _this.getRoomParams(room, images[index]);
313
323
  })];
@@ -712,5 +722,38 @@ var useMetersValues = function (formStore, metersStore) {
712
722
  }, [metersStore.meters, metersStore.loader.isLoading]);
713
723
  };
714
724
 
715
- export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, MetersInfoFieldsSchema, MetersInfoStepSchema, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
725
+ var MetroStation = function (props) {
726
+ var metroStation = props.metroStation;
727
+ var color = metroStation.color, name = metroStation.name;
728
+ return (jsxs(StyledWrapper$1, __assign({ item: true, container: true, alignItems: "center" }, { children: [jsx(StyledPoint, { style: { background: color } }), jsx(Caption, __assign({ size: "s", color: "sixty" }, { children: name }))] })));
729
+ };
730
+ var StyledWrapper$1 = styled(Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
731
+ var StyledPoint = styled.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"])));
732
+ var templateObject_1$2, templateObject_2$2;
733
+
734
+ var ContactPhone = function (props) {
735
+ var phone = props.phone;
736
+ var formattedPhone = getPhoneNumberFromPhoneParams(phone, " ");
737
+ var phoneLink = formattedPhone.replace(/\d/g, "");
738
+ return (jsxs(StyledWrapper, __assign({ container: true, alignItems: "center", wrap: "nowrap" }, { children: [jsx(StyledPhoneIcon, { width: 14, height: 14 }), jsx("a", __assign({ href: "tel:+".concat(phoneLink) }, { children: jsx(Caption, __assign({ size: "s", weight: 500, color: "sixty" }, { children: formattedPhone })) }))] })));
739
+ };
740
+ var StyledWrapper = styled(Grid)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
741
+ var StyledPhoneIcon = styled(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"])), theme.palette.grey.sixty);
742
+ var templateObject_1$1, templateObject_2$1;
743
+
744
+ var ApartmentInspectionCard = function (props) {
745
+ var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getApartmentLink = props.getApartmentLink;
746
+ var apartment = inspection.apartment, tenant = inspection.tenant, metroStations = inspection.metroStations;
747
+ var clientLink = getClientLink ? getClientLink(tenant.id) : "";
748
+ var apartmentLink = getApartmentLink(apartment.id);
749
+ return (jsxs(StyledCard, { children: [jsx(Link, __assign({ href: apartmentLink }, { children: jsx(StyledPreviewContent, { imageSrc: apartment.previewImage, description: "".concat(apartment.address, ", \u043A\u0432. ").concat(apartment.apartmentNumber) }) })), jsx(Grid, __assign({ container: true, spacing: 2, alignItems: "center" }, { children: metroStations.map(function (station) { return (jsx(MetroStation, { metroStation: station }, station.name)); }) })), jsxs(StyledTenantInfo, __assign({ container: true, alignItems: "center", justify: "space-between" }, { children: [clientLink ? (jsx(StyledClientLink, __assign({ href: clientLink }, { children: jsx(UserBadge, { weight: 500, user: tenant }) }))) : (jsx(UserBadge, { weight: 500, user: tenant })), !!tenant.phone && jsx(ContactPhone, { phone: tenant.phone })] })), jsx(StyledCloseButton, __assign({ isCircle: true, size: "xs", variant: "whiteWithGray", onClick: onClose }, { children: jsx(CloseIcon, { width: 6, height: 6 }) }))] }));
750
+ };
751
+ var StyledCard = styled.div(templateObject_1 || (templateObject_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"])), theme.palette.grey.zero);
752
+ var StyledPreviewContent = styled(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"])));
753
+ var StyledTenantInfo = styled(Grid)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: 8px;\n border-top: 1px solid ", ";\n margin-top: 8px;\n flex-wrap: nowrap;\n"], ["\n padding-top: 8px;\n border-top: 1px solid ", ";\n margin-top: 8px;\n flex-wrap: nowrap;\n"])), theme.palette.grey.fifteenB);
754
+ var StyledCloseButton = styled(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"])));
755
+ var StyledClientLink = styled(Link)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n max-width: calc(100% - 140px);\n"], ["\n max-width: calc(100% - 140px);\n"])));
756
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
757
+
758
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, ApartmentInspectionCard, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepSchema, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepSchema, FillingInfoFieldsSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepSchema, MetersInfoFieldsSchema, MetersInfoStepSchema, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepSchema, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepSchema, getAdditionalInfoStepFields, getApartmentPaymentFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseServicesInfoStep, getMetersInfoStepFields, getPartialMeterInfoFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, inspectionsRequestBody, inspectionsRequests, renderMetersSteps, useMetersValues };
716
759
  //# sourceMappingURL=index.js.map