kui-crm_actions 0.0.48 → 0.0.50

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
@@ -64,6 +64,18 @@ var __assign = function() {
64
64
  return __assign.apply(this, arguments);
65
65
  };
66
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
+
67
79
  function __awaiter(thisArg, _arguments, P, generator) {
68
80
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
69
81
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -750,42 +762,55 @@ var useMetersValues = function (formStore, metersStore) {
750
762
  }, [metersStore.meters, metersStore.loader.isLoading]);
751
763
  };
752
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
+
753
770
  var MetroStation = function (props) {
754
771
  var metroStation = props.metroStation;
755
772
  var color = metroStation.color, name = metroStation.name;
756
- return (jsxRuntime.jsxs(StyledWrapper$1, __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 }))] })));
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 }))] })));
757
774
  };
758
- var StyledWrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
775
+ var StyledWrapper$2 = styled__default["default"](kuiBasic.Grid)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
759
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"])));
760
- var templateObject_1$2, templateObject_2$2;
777
+ var templateObject_1$3, templateObject_2$2;
761
778
 
762
779
  var ContactPhone = function (props) {
763
780
  var phone = props.phone;
764
781
  var formattedPhone = kuiUtils.getPhoneNumberFromPhoneParams(phone, " ");
765
782
  var phoneLink = formattedPhone.replace(/\d/g, "");
766
- return (jsxRuntime.jsxs(StyledWrapper, __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 })) }))] })));
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 })) }))] })));
767
784
  };
768
- var StyledWrapper = styled__default["default"](kuiBasic.Grid)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
785
+ var StyledWrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
769
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);
770
- var templateObject_1$1, templateObject_2$1;
787
+ var templateObject_1$2, templateObject_2$1;
771
788
 
772
789
  var ApartmentInspectionCard = function (props) {
773
- var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getApartmentLink = props.getApartmentLink;
790
+ var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getInspectionLink = props.getInspectionLink;
774
791
  var apartment = inspection.apartment, tenant = inspection.tenant, metroStations = inspection.metroStations;
775
792
  var clientLink = getClientLink ? getClientLink(tenant.id) : "";
776
- var apartmentLink = getApartmentLink(apartment.id);
793
+ var apartmentLink = getInspectionLink(apartment.id, inspection.id);
777
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 }) }))] }));
778
795
  };
779
- var StyledCard = styled__default["default"].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"])), kuiBasic.theme.palette.grey.zero);
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);
780
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"])));
781
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);
782
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"])));
783
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"])));
784
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
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;
785
810
 
786
811
  exports.AdditionalInfoFieldsSchema = AdditionalInfoFieldsSchema;
787
812
  exports.AdditionalInfoStepSchema = AdditionalInfoStepSchema;
788
- exports.ApartmentInspectionCard = ApartmentInspectionCard;
813
+ exports.ApartmentInspectionOverlay = ApartmentInspectionOverlay;
789
814
  exports.BasicApartmentInfoFieldsSchema = BasicApartmentInfoFieldsSchema;
790
815
  exports.BasicApartmentInfoStepSchema = BasicApartmentInfoStepSchema;
791
816
  exports.DetailApartmentInfoFieldsSchema = DetailApartmentInfoFieldsSchema;