kui-crm_actions 0.0.47 → 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/cjs/index.js CHANGED
@@ -10,6 +10,9 @@ var luxon = require('luxon');
10
10
  var kuiComplex = require('kui-complex');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var react = require('react');
13
+ var styled = require('@emotion/styled');
14
+ var kuiBasic = require('kui-basic');
15
+ var kuiIcon = require('kui-icon');
13
16
 
14
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
18
 
@@ -33,6 +36,7 @@ function _interopNamespace(e) {
33
36
 
34
37
  var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
35
38
  var to__default = /*#__PURE__*/_interopDefaultLegacy(to);
39
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
36
40
 
37
41
  /******************************************************************************
38
42
  Copyright (c) Microsoft Corporation.
@@ -60,6 +64,18 @@ var __assign = function() {
60
64
  return __assign.apply(this, arguments);
61
65
  };
62
66
 
67
+ function __rest(s, e) {
68
+ var t = {};
69
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
70
+ t[p] = s[p];
71
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
72
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
73
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
74
+ t[p[i]] = s[p[i]];
75
+ }
76
+ return t;
77
+ }
78
+
63
79
  function __awaiter(thisArg, _arguments, P, generator) {
64
80
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
65
81
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -106,6 +122,11 @@ function __spreadArray(to, from, pack) {
106
122
  }
107
123
  }
108
124
  return to.concat(ar || Array.prototype.slice.call(from));
125
+ }
126
+
127
+ function __makeTemplateObject(cooked, raw) {
128
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
129
+ return cooked;
109
130
  }
110
131
 
111
132
  var getPartialMeterInfoFields = function (resource, type, name, settings) {
@@ -741,8 +762,55 @@ var useMetersValues = function (formStore, metersStore) {
741
762
  }, [metersStore.meters, metersStore.loader.isLoading]);
742
763
  };
743
764
 
765
+ var ApartmentInspectionPoint = function (props) {
766
+ var date = props.date, onClick = props.onClick, isActive = props.isActive;
767
+ return (jsxRuntime.jsx(kuiBasic.Button, __assign({ size: "xs", variant: isActive ? "primary" : "white", onClick: onClick }, { children: (date === null || date === void 0 ? void 0 : date.toFormat("dd.MM.yyyy")) || "-" })));
768
+ };
769
+
770
+ var MetroStation = function (props) {
771
+ var metroStation = props.metroStation;
772
+ var color = metroStation.color, name = metroStation.name;
773
+ 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 }))] })));
774
+ };
775
+ var StyledWrapper$2 = styled__default["default"](kuiBasic.Grid)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
776
+ 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"])));
777
+ var templateObject_1$3, templateObject_2$2;
778
+
779
+ var ContactPhone = function (props) {
780
+ var phone = props.phone;
781
+ var formattedPhone = kuiUtils.getPhoneNumberFromPhoneParams(phone, " ");
782
+ var phoneLink = formattedPhone.replace(/\d/g, "");
783
+ 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 })) }))] })));
784
+ };
785
+ var StyledWrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
786
+ 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);
787
+ var templateObject_1$2, templateObject_2$1;
788
+
789
+ var ApartmentInspectionCard = function (props) {
790
+ var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getApartmentLink = props.getApartmentLink;
791
+ var apartment = inspection.apartment, tenant = inspection.tenant, metroStations = inspection.metroStations;
792
+ var clientLink = getClientLink ? getClientLink(tenant.id) : "";
793
+ var apartmentLink = getApartmentLink(apartment.id);
794
+ return (jsxRuntime.jsxs(StyledCard, { children: [jsxRuntime.jsx(kuiCrm.Link, __assign({ href: apartmentLink }, { children: jsxRuntime.jsx(StyledPreviewContent, { imageSrc: apartment.previewImage, description: "".concat(apartment.address, ", \u043A\u0432. ").concat(apartment.apartmentNumber) }) })), jsxRuntime.jsx(kuiBasic.Grid, __assign({ container: true, spacing: 2, alignItems: "center" }, { children: metroStations.map(function (station) { return (jsxRuntime.jsx(MetroStation, { metroStation: station }, station.name)); }) })), 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: tenant }) }))) : (jsxRuntime.jsx(kuiCrm.UserBadge, { weight: 500, user: tenant })), !!tenant.phone && jsxRuntime.jsx(ContactPhone, { phone: tenant.phone })] })), jsxRuntime.jsx(StyledCloseButton, __assign({ isCircle: true, size: "xs", variant: "whiteWithGray", onClick: onClose }, { children: jsxRuntime.jsx(kuiIcon.CloseIcon, { width: 6, height: 6 }) }))] }));
795
+ };
796
+ 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);
797
+ 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"])));
798
+ 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 flex-wrap: nowrap;\n"], ["\n padding-top: 8px;\n border-top: 1px solid ", ";\n margin-top: 8px;\n flex-wrap: nowrap;\n"])), kuiBasic.theme.palette.grey.fifteenB);
799
+ 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"])));
800
+ 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"])));
801
+ var templateObject_1$1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
802
+
803
+ var ApartmentInspectionOverlay = function (props) {
804
+ var inspection = props.inspection, map = props.map, other = __rest(props, ["inspection", "map"]);
805
+ var _a = kuiCrm.useMapCards(inspection.location, map), ref = _a.ref, isOpen = _a.isOpen, closeCard = _a.closeCard, toggleCard = _a.toggleCard;
806
+ return (jsxRuntime.jsx(kuiCrm.MapOverlay, __assign({ map: map, position: inspection.location }, { children: jsxRuntime.jsxs(StyledWrapper, __assign({ ref: ref }, { children: [jsxRuntime.jsx(ApartmentInspectionPoint, { date: inspection.date, isActive: isOpen, onClick: toggleCard }), isOpen && (jsxRuntime.jsx(ApartmentInspectionCard, __assign({ inspection: inspection, onClose: closeCard }, other)))] })) })));
807
+ };
808
+ var StyledWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
809
+ var templateObject_1;
810
+
744
811
  exports.AdditionalInfoFieldsSchema = AdditionalInfoFieldsSchema;
745
812
  exports.AdditionalInfoStepSchema = AdditionalInfoStepSchema;
813
+ exports.ApartmentInspectionOverlay = ApartmentInspectionOverlay;
746
814
  exports.BasicApartmentInfoFieldsSchema = BasicApartmentInfoFieldsSchema;
747
815
  exports.BasicApartmentInfoStepSchema = BasicApartmentInfoStepSchema;
748
816
  exports.DetailApartmentInfoFieldsSchema = DetailApartmentInfoFieldsSchema;