kui-crm_actions 0.0.48 → 0.0.49

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,13 +1,13 @@
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, PreviewContent, Link, UserBadge } 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, useMapCards, MapOverlay } 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
7
  import { jsx, jsxs } from 'react/jsx-runtime';
8
8
  import { useEffect } from 'react';
9
9
  import styled from '@emotion/styled';
10
- import { Grid, Caption, theme, Button } from 'kui-basic';
10
+ import { Button, Grid, Caption, theme } from 'kui-basic';
11
11
  import { PhoneIcon, CloseIcon } from 'kui-icon';
12
12
 
13
13
  /******************************************************************************
@@ -36,6 +36,18 @@ var __assign = function() {
36
36
  return __assign.apply(this, arguments);
37
37
  };
38
38
 
39
+ function __rest(s, e) {
40
+ var t = {};
41
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
42
+ t[p] = s[p];
43
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
44
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
45
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
46
+ t[p[i]] = s[p[i]];
47
+ }
48
+ return t;
49
+ }
50
+
39
51
  function __awaiter(thisArg, _arguments, P, generator) {
40
52
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
53
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -722,24 +734,29 @@ var useMetersValues = function (formStore, metersStore) {
722
734
  }, [metersStore.meters, metersStore.loader.isLoading]);
723
735
  };
724
736
 
737
+ var ApartmentInspectionPoint = function (props) {
738
+ var date = props.date, onClick = props.onClick, isActive = props.isActive;
739
+ return (jsx(Button, __assign({ size: "xs", variant: isActive ? "primary" : "white", onClick: onClick }, { children: (date === null || date === void 0 ? void 0 : date.toFormat("dd.MM.yyyy")) || "-" })));
740
+ };
741
+
725
742
  var MetroStation = function (props) {
726
743
  var metroStation = props.metroStation;
727
744
  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 }))] })));
745
+ return (jsxs(StyledWrapper$2, __assign({ item: true, container: true, alignItems: "center" }, { children: [jsx(StyledPoint, { style: { background: color } }), jsx(Caption, __assign({ size: "s", color: "sixty" }, { children: name }))] })));
729
746
  };
730
- var StyledWrapper$1 = styled(Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
747
+ var StyledWrapper$2 = styled(Grid)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
731
748
  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;
749
+ var templateObject_1$3, templateObject_2$2;
733
750
 
734
751
  var ContactPhone = function (props) {
735
752
  var phone = props.phone;
736
753
  var formattedPhone = getPhoneNumberFromPhoneParams(phone, " ");
737
754
  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 })) }))] })));
755
+ return (jsxs(StyledWrapper$1, __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
756
  };
740
- var StyledWrapper = styled(Grid)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
757
+ var StyledWrapper$1 = styled(Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
741
758
  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;
759
+ var templateObject_1$2, templateObject_2$1;
743
760
 
744
761
  var ApartmentInspectionCard = function (props) {
745
762
  var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getApartmentLink = props.getApartmentLink;
@@ -748,12 +765,20 @@ var ApartmentInspectionCard = function (props) {
748
765
  var apartmentLink = getApartmentLink(apartment.id);
749
766
  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
767
  };
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);
768
+ var StyledCard = styled.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"])), theme.palette.grey.zero);
752
769
  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
770
  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
771
  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
772
  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;
773
+ var templateObject_1$1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
774
+
775
+ var ApartmentInspectionOverlay = function (props) {
776
+ var inspection = props.inspection, map = props.map, other = __rest(props, ["inspection", "map"]);
777
+ var _a = useMapCards(inspection.location, map), ref = _a.ref, isOpen = _a.isOpen, closeCard = _a.closeCard, toggleCard = _a.toggleCard;
778
+ return (jsx(MapOverlay, __assign({ map: map, position: inspection.location }, { children: jsxs(StyledWrapper, __assign({ ref: ref }, { children: [jsx(ApartmentInspectionPoint, { date: inspection.date, isActive: isOpen, onClick: toggleCard }), isOpen && (jsx(ApartmentInspectionCard, __assign({ inspection: inspection, onClose: closeCard }, other)))] })) })));
779
+ };
780
+ var StyledWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
781
+ var templateObject_1;
757
782
 
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 };
783
+ export { AdditionalInfoFieldsSchema, AdditionalInfoStepSchema, ApartmentInspectionOverlay, 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 };
759
784
  //# sourceMappingURL=index.js.map