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 +68 -0
- package/cjs/index.js.map +1 -1
- package/index.d.ts +46 -4
- package/index.js +69 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
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, 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
|
-
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 { Button, Grid, Caption, theme } from 'kui-basic';
|
11
|
+
import { PhoneIcon, CloseIcon } from 'kui-icon';
|
9
12
|
|
10
13
|
/******************************************************************************
|
11
14
|
Copyright (c) Microsoft Corporation.
|
@@ -33,6 +36,18 @@ var __assign = function() {
|
|
33
36
|
return __assign.apply(this, arguments);
|
34
37
|
};
|
35
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
|
+
|
36
51
|
function __awaiter(thisArg, _arguments, P, generator) {
|
37
52
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
38
53
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -79,6 +94,11 @@ function __spreadArray(to, from, pack) {
|
|
79
94
|
}
|
80
95
|
}
|
81
96
|
return to.concat(ar || Array.prototype.slice.call(from));
|
97
|
+
}
|
98
|
+
|
99
|
+
function __makeTemplateObject(cooked, raw) {
|
100
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
101
|
+
return cooked;
|
82
102
|
}
|
83
103
|
|
84
104
|
var getPartialMeterInfoFields = function (resource, type, name, settings) {
|
@@ -714,5 +734,51 @@ var useMetersValues = function (formStore, metersStore) {
|
|
714
734
|
}, [metersStore.meters, metersStore.loader.isLoading]);
|
715
735
|
};
|
716
736
|
|
717
|
-
|
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
|
+
|
742
|
+
var MetroStation = function (props) {
|
743
|
+
var metroStation = props.metroStation;
|
744
|
+
var color = metroStation.color, name = metroStation.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 }))] })));
|
746
|
+
};
|
747
|
+
var StyledWrapper$2 = styled(Grid)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
|
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"])));
|
749
|
+
var templateObject_1$3, templateObject_2$2;
|
750
|
+
|
751
|
+
var ContactPhone = function (props) {
|
752
|
+
var phone = props.phone;
|
753
|
+
var formattedPhone = getPhoneNumberFromPhoneParams(phone, " ");
|
754
|
+
var phoneLink = formattedPhone.replace(/\d/g, "");
|
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 })) }))] })));
|
756
|
+
};
|
757
|
+
var StyledWrapper$1 = styled(Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n width: auto;\n"], ["\n width: auto;\n"])));
|
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);
|
759
|
+
var templateObject_1$2, templateObject_2$1;
|
760
|
+
|
761
|
+
var ApartmentInspectionCard = function (props) {
|
762
|
+
var inspection = props.inspection, onClose = props.onClose, getClientLink = props.getClientLink, getApartmentLink = props.getApartmentLink;
|
763
|
+
var apartment = inspection.apartment, tenant = inspection.tenant, metroStations = inspection.metroStations;
|
764
|
+
var clientLink = getClientLink ? getClientLink(tenant.id) : "";
|
765
|
+
var apartmentLink = getApartmentLink(apartment.id);
|
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 }) }))] }));
|
767
|
+
};
|
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);
|
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"])));
|
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);
|
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"])));
|
772
|
+
var StyledClientLink = styled(Link)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n max-width: calc(100% - 140px);\n"], ["\n max-width: calc(100% - 140px);\n"])));
|
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;
|
782
|
+
|
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 };
|
718
784
|
//# sourceMappingURL=index.js.map
|