kui-crm 0.0.21 → 0.0.23
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/agent/cjs/index.js +3 -0
- package/agent/cjs/index.js.map +1 -1
- package/agent/index.d.ts +8 -6
- package/agent/index.js +3 -0
- package/agent/index.js.map +1 -1
- package/cjs/index.js +385 -205
- package/cjs/index.js.map +1 -1
- package/index.d.ts +148 -63
- package/index.js +390 -219
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +11 -9
package/cjs/index.js
CHANGED
|
@@ -17,10 +17,11 @@ var react$1 = require('@emotion/react');
|
|
|
17
17
|
var reactRouterDom = require('react-router-dom');
|
|
18
18
|
var yup$1 = require('@hookform/resolvers/yup');
|
|
19
19
|
var yup = require('yup');
|
|
20
|
+
var reactDom = require('react-dom');
|
|
20
21
|
var kuiIcon = require('kui-icon');
|
|
21
22
|
var jsxRuntime$1 = require('@emotion/react/jsx-runtime');
|
|
22
|
-
var reactDom = require('react-dom');
|
|
23
23
|
var _ = require('lodash');
|
|
24
|
+
var luxon = require('luxon');
|
|
24
25
|
|
|
25
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
27
|
|
|
@@ -179,6 +180,9 @@ var CompaniesAgent = {
|
|
|
179
180
|
createLogo: function (companyId, logo) {
|
|
180
181
|
return requests.put("/companies/".concat(companyId, "/logo"), logo);
|
|
181
182
|
},
|
|
183
|
+
findCompanyByINN: function (body) {
|
|
184
|
+
return requests.post("/companies/info-by-new-tin", body);
|
|
185
|
+
},
|
|
182
186
|
};
|
|
183
187
|
|
|
184
188
|
var UploadAgent = {
|
|
@@ -592,64 +596,328 @@ var usePortalPosition = function (portalParentRef) {
|
|
|
592
596
|
|
|
593
597
|
function TwoOptionForAutocomplete(_a) {
|
|
594
598
|
var option = _a.option;
|
|
595
|
-
return (jsxRuntime.jsxs(StyledWrapper$
|
|
599
|
+
return (jsxRuntime.jsxs(StyledWrapper$8, __assign({ container: true, justify: "space-between" }, { children: [jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", weight: 500 }, { children: option.name })) })), jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", weight: 500, color: "fiftyP" }, { children: option.right })) }))] })));
|
|
596
600
|
}
|
|
597
|
-
var StyledWrapper$
|
|
598
|
-
var templateObject_1$
|
|
601
|
+
var StyledWrapper$8 = styled__default["default"](kuiBasic.Grid)(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n &:hover {\n background: ", ";\n },\n"], ["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n &:hover {\n background: ", ";\n },\n"])), kuiBasic.theme.palette.background.light2);
|
|
602
|
+
var templateObject_1$j;
|
|
599
603
|
|
|
600
604
|
function SquarePreviewImage(_a) {
|
|
601
605
|
var imageSrc = _a.imageSrc, name = _a.name, size = _a.size, other = __rest(_a, ["imageSrc", "name", "size"]);
|
|
602
606
|
var formattedName = name === null || name === void 0 ? void 0 : name.split(" ").map(function (el) { return el[0]; }).slice(0, 2).join("").toUpperCase();
|
|
603
|
-
return (jsxRuntime.jsx(StyledWrapper$
|
|
607
|
+
return (jsxRuntime.jsx(StyledWrapper$7, __assign({ size: size || "lg" }, other, { children: imageSrc ? (jsxRuntime.jsx(StyledImage$1, { src: imageSrc, alt: "preview image" })) : (jsxRuntime.jsx(StyledNameWrapper, __assign({ alignItems: "center", justify: "center" }, { children: jsxRuntime.jsx(kuiBasic.Heading, __assign({ size: size === "sm" ? "h4" : "h1", colorGroup: "brand", color: "main" }, { children: formattedName !== null && formattedName !== void 0 ? formattedName : "?" })) }))) })));
|
|
604
608
|
}
|
|
605
609
|
var previewSizesStyles = {
|
|
606
|
-
lg: react$1.css(templateObject_1$
|
|
607
|
-
sm: react$1.css(templateObject_2$
|
|
610
|
+
lg: react$1.css(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "], ["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "]))),
|
|
611
|
+
sm: react$1.css(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "], ["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "]))),
|
|
608
612
|
};
|
|
609
|
-
var StyledImage$1 = styled__default["default"].img(templateObject_3$
|
|
610
|
-
var StyledWrapper$
|
|
613
|
+
var StyledImage$1 = styled__default["default"].img(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n"], ["\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n"])));
|
|
614
|
+
var StyledWrapper$7 = styled__default["default"].div(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n overflow: hidden;\n ", ";\n"], ["\n overflow: hidden;\n ", ";\n"])), function (_a) {
|
|
611
615
|
var size = _a.size;
|
|
612
616
|
return previewSizesStyles[size];
|
|
613
617
|
});
|
|
614
|
-
var StyledNameWrapper = styled__default["default"](kuiBasic.Grid)(templateObject_5$
|
|
615
|
-
var templateObject_1$
|
|
618
|
+
var StyledNameWrapper = styled__default["default"](kuiBasic.Grid)(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n background: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n background: ", ";\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), kuiBasic.theme.palette.brand.light);
|
|
619
|
+
var templateObject_1$i, templateObject_2$9, templateObject_3$8, templateObject_4$4, templateObject_5$3;
|
|
616
620
|
|
|
617
621
|
function Modal(_a) {
|
|
618
622
|
var open = _a.open, other = __rest(_a, ["open"]);
|
|
619
623
|
return jsxRuntime.jsx(StyledModal$1, __assign({ isOpen: open }, other));
|
|
620
624
|
}
|
|
621
|
-
var StyledModal$1 = styled__default["default"](kuiBasic.Modal)(templateObject_1$
|
|
622
|
-
var templateObject_1$
|
|
625
|
+
var StyledModal$1 = styled__default["default"](kuiBasic.Modal)(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n max-height: calc(100% - 64px);\n .KUI-Modal_header {\n text-align: left;\n }\n .KUI-Modal_title {\n font-size: 24px;\n line-height: 32px;\n padding-bottom: 20px;\n }\n"], ["\n max-height: calc(100% - 64px);\n .KUI-Modal_header {\n text-align: left;\n }\n .KUI-Modal_title {\n font-size: 24px;\n line-height: 32px;\n padding-bottom: 20px;\n }\n"])));
|
|
626
|
+
var templateObject_1$h;
|
|
627
|
+
|
|
628
|
+
const isValidWithMaskExp = /^[^_]+$/;
|
|
623
629
|
|
|
624
630
|
var CompanyCreationSchema = yup__namespace.object().shape({
|
|
625
631
|
name: yup__namespace.string().required("Enter the company name"),
|
|
632
|
+
inn: yup__namespace.string().required("Enter the company TIN"),
|
|
626
633
|
office: yup__namespace.object({
|
|
627
|
-
address: yup__namespace
|
|
628
|
-
.string()
|
|
629
|
-
.required("Enter the company address")
|
|
630
|
-
.test("check-latitude-longitude", "Please select an address from the dropdown", function (value) {
|
|
631
|
-
var _a = this.parent.location, lat = _a.lat, lon = _a.lon;
|
|
632
|
-
return !!(lat && lon);
|
|
633
|
-
}),
|
|
634
|
-
location: yup__namespace.object({
|
|
635
|
-
lat: yup__namespace.number(),
|
|
636
|
-
lon: yup__namespace.number(),
|
|
637
|
-
}),
|
|
634
|
+
address: yup__namespace.string().required("Enter the company address"),
|
|
638
635
|
}),
|
|
639
636
|
phone: yup__namespace.object({
|
|
640
637
|
phoneNumber: yup__namespace
|
|
641
638
|
.string()
|
|
642
|
-
.matches(
|
|
639
|
+
.matches(isValidWithMaskExp, "Enter correct the company phone")
|
|
643
640
|
.required("Enter the company phone"),
|
|
644
641
|
}),
|
|
645
|
-
email: yup__namespace.string().email(),
|
|
642
|
+
email: yup__namespace.string().email().required("This field is required"),
|
|
646
643
|
type: yup__namespace.string().required("Choose the provider type of company"),
|
|
647
|
-
zipCode: yup__namespace
|
|
648
|
-
.string()
|
|
649
|
-
.matches(kuiUtils.isValidWithMaskExp, "Enter correct the company zip code")
|
|
650
|
-
.required("Enter the company zip code"),
|
|
651
644
|
});
|
|
652
645
|
|
|
646
|
+
var TaxTypeValues = [
|
|
647
|
+
{ value: "resident", label: "Individual Resident" },
|
|
648
|
+
{ value: "nonresident", label: "Individual Non-resident" },
|
|
649
|
+
{ value: "self-employed", label: "Self-employed" },
|
|
650
|
+
{ value: "individual-entrepreneur", label: "Individual entrepreneur" },
|
|
651
|
+
{ value: "company", label: "Company" },
|
|
652
|
+
];
|
|
653
|
+
var BooleanValues = [
|
|
654
|
+
{ value: true, label: "Yes" },
|
|
655
|
+
{ value: false, label: "No" },
|
|
656
|
+
];
|
|
657
|
+
var ElectricityValues = [
|
|
658
|
+
{ value: "T1", label: "One-part" },
|
|
659
|
+
{ value: "T2", label: "Two-part" },
|
|
660
|
+
{ value: "T3", label: "Three-part" },
|
|
661
|
+
];
|
|
662
|
+
var WaterValues = [
|
|
663
|
+
{ value: "cold", label: "Cold" },
|
|
664
|
+
{ value: "hot", label: "Hot" },
|
|
665
|
+
];
|
|
666
|
+
var getNumbersValues = function (count) {
|
|
667
|
+
return new Array(count).fill(0).map(function (value, key) { return ({
|
|
668
|
+
value: "".concat(key),
|
|
669
|
+
label: key,
|
|
670
|
+
}); });
|
|
671
|
+
};
|
|
672
|
+
var ParkingTypesValues = [
|
|
673
|
+
{ value: "public", label: "Public" },
|
|
674
|
+
{ value: "house", label: "House" },
|
|
675
|
+
{ value: "underground", label: "Underground" },
|
|
676
|
+
{ value: "private", label: "Private" },
|
|
677
|
+
];
|
|
678
|
+
var TVTypesValues = [
|
|
679
|
+
{ value: "cable", label: "Cable" },
|
|
680
|
+
{ value: "satellite", label: "Satellite" },
|
|
681
|
+
{ value: "smart_tv", label: "Smart TV" },
|
|
682
|
+
{ value: "no", label: "No" },
|
|
683
|
+
];
|
|
684
|
+
var TaxResidenceValues = [
|
|
685
|
+
{ value: "resident", label: "Resident" },
|
|
686
|
+
{ value: "not_resident", label: "Non-resident" },
|
|
687
|
+
];
|
|
688
|
+
var RenovationTypeValues = [
|
|
689
|
+
{ value: "capital", label: "Capital" },
|
|
690
|
+
{ value: "euro", label: "Euro" },
|
|
691
|
+
{ value: "designer", label: "Designer" },
|
|
692
|
+
{ value: "cosmetic", label: "Cosmetic" },
|
|
693
|
+
{ value: "required", label: "Required" },
|
|
694
|
+
];
|
|
695
|
+
var RenovationStyleValues = [
|
|
696
|
+
{ value: "classic", label: "Classic" },
|
|
697
|
+
{ value: "scandinavian", label: "Scandinavian" },
|
|
698
|
+
{ value: "loft", label: "Loft" },
|
|
699
|
+
{ value: "contemporary", label: "Contemporary" },
|
|
700
|
+
{ value: "minimalism", label: "Minimalism" },
|
|
701
|
+
{ value: "neoclassic", label: "Neoclassic" },
|
|
702
|
+
{ value: "eco", label: "Eco" },
|
|
703
|
+
{ value: "provence", label: "Provence" },
|
|
704
|
+
{ value: "hi_tech", label: "Hi-tech" },
|
|
705
|
+
{ value: "mediterranean", label: "Mediterranean" },
|
|
706
|
+
{ value: "eclectic", label: "Eclectic" },
|
|
707
|
+
{ value: "ethno", label: "Ethno" },
|
|
708
|
+
{ value: "gothic", label: "Gothic" },
|
|
709
|
+
];
|
|
710
|
+
var RoomTypeValues = [
|
|
711
|
+
{ value: "connected", label: "Connected" },
|
|
712
|
+
{ value: "separate", label: "Separate" },
|
|
713
|
+
];
|
|
714
|
+
var InspectionTypeValues = [
|
|
715
|
+
{ value: "quarterly", label: "Quarterly" },
|
|
716
|
+
{ value: "transfer", label: "Transfer" },
|
|
717
|
+
{ value: "appraisal", label: "Appraisal" },
|
|
718
|
+
{ value: "impairments", label: "Impairments" },
|
|
719
|
+
{ value: "inventory", label: "Inventory" },
|
|
720
|
+
{ value: "initial", label: "Initial" },
|
|
721
|
+
];
|
|
722
|
+
var ImpairmentsTypeValues = [
|
|
723
|
+
{ value: "damages", label: "Damages" },
|
|
724
|
+
{ value: "wear_tear", label: "Wear&tear" },
|
|
725
|
+
];
|
|
726
|
+
var FillingTypeValues = [
|
|
727
|
+
{ value: "finish", label: "Finish" },
|
|
728
|
+
{ value: "furniture", label: "Furniture" },
|
|
729
|
+
{ value: "electronics", label: "Electronics" },
|
|
730
|
+
{ value: "accessories", label: "Accessories" },
|
|
731
|
+
];
|
|
732
|
+
var RoomTypesValues = [
|
|
733
|
+
{ value: "residential", label: "Residential" },
|
|
734
|
+
{ value: "non-residential", label: "Nonresidential" },
|
|
735
|
+
{ value: "commercial", label: "Commercial" },
|
|
736
|
+
{ value: "garage", label: "Garage" },
|
|
737
|
+
{ value: "car_space", label: "Parking" },
|
|
738
|
+
];
|
|
739
|
+
var CompanyTypesValues = [
|
|
740
|
+
{ value: "administrative", label: "Administrative provider" },
|
|
741
|
+
{ value: "service", label: "Service provider" },
|
|
742
|
+
{ value: "resource", label: "Resource provider" },
|
|
743
|
+
];
|
|
744
|
+
var ResourceValues = [
|
|
745
|
+
{ value: "electricity", label: "Electricity" },
|
|
746
|
+
{ value: "water", label: "Water" },
|
|
747
|
+
{ value: "gas", label: "Gas" },
|
|
748
|
+
{ value: "heating", label: "Heating" },
|
|
749
|
+
];
|
|
750
|
+
var APIPayerValues = [
|
|
751
|
+
{ value: "owner", label: "Landlord" },
|
|
752
|
+
{ value: "renter", label: "Tenant" },
|
|
753
|
+
{ value: "maroom", label: "Maroom" },
|
|
754
|
+
];
|
|
755
|
+
var UnitOfPaymentValues = [
|
|
756
|
+
{ value: "percent", label: "%" },
|
|
757
|
+
{ value: "value", label: "₽" },
|
|
758
|
+
];
|
|
759
|
+
var PartialPayerValues = [
|
|
760
|
+
{ value: "owner", label: "Landlord" },
|
|
761
|
+
{ value: "renter", label: "Tenant" },
|
|
762
|
+
{ value: "maroom", label: "Maroom" },
|
|
763
|
+
{ value: "partial", label: "Partial" },
|
|
764
|
+
];
|
|
765
|
+
|
|
766
|
+
function AutocompleteOption(_a) {
|
|
767
|
+
var label = _a.label;
|
|
768
|
+
return (jsxRuntime.jsx(StyledWrapper$6, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "s", weight: 500 }, { children: label })) }));
|
|
769
|
+
}
|
|
770
|
+
var StyledWrapper$6 = styled__default["default"].div(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n &:hover {\n background: ", ";\n },\n"], ["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n &:hover {\n background: ", ";\n },\n"])), kuiBasic.theme.palette.background.light2);
|
|
771
|
+
var templateObject_1$g;
|
|
772
|
+
|
|
773
|
+
var parentClassName$1 = "KUI-ErrorPopup_container";
|
|
774
|
+
var timeout = 3000;
|
|
775
|
+
var createParentNode$1 = function () {
|
|
776
|
+
var node = document.createElement("div");
|
|
777
|
+
node.classList.add(parentClassName$1);
|
|
778
|
+
document.body.append(node);
|
|
779
|
+
return node;
|
|
780
|
+
};
|
|
781
|
+
function ErrorPopup(_a) {
|
|
782
|
+
var label = _a.label, onClose = _a.onClose;
|
|
783
|
+
var isHoverRef = react.useRef(false);
|
|
784
|
+
var _b = react.useState(true), open = _b[0], setOpen = _b[1];
|
|
785
|
+
var startHover = function () {
|
|
786
|
+
isHoverRef.current = true;
|
|
787
|
+
};
|
|
788
|
+
var checkIsHoverAndClose = function () {
|
|
789
|
+
if (!isHoverRef.current && open)
|
|
790
|
+
handleClose();
|
|
791
|
+
};
|
|
792
|
+
var handleClose = function () {
|
|
793
|
+
setOpen(false);
|
|
794
|
+
if (onClose) {
|
|
795
|
+
onClose();
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
var handleMouseLeave = function () {
|
|
799
|
+
isHoverRef.current = false;
|
|
800
|
+
handleClose();
|
|
801
|
+
};
|
|
802
|
+
react.useEffect(function () {
|
|
803
|
+
var timeoutId;
|
|
804
|
+
if (open) {
|
|
805
|
+
timeoutId = setTimeout(checkIsHoverAndClose, timeout);
|
|
806
|
+
}
|
|
807
|
+
return function () {
|
|
808
|
+
clearTimeout(timeoutId);
|
|
809
|
+
// handleClose()
|
|
810
|
+
};
|
|
811
|
+
}, [open]);
|
|
812
|
+
if (!open) {
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
var parentNode = document.querySelector(".".concat(parentClassName$1)) || createParentNode$1();
|
|
816
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react$1.Global, { styles: containerCSS$1 }), reactDom.createPortal(jsxRuntime.jsx(StyledWrapper$5, __assign({ onMouseEnter: startHover, onMouseLeave: handleMouseLeave, className: "KUI-ErrorPopup", container: true, alignItems: "center" }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", weight: 600, color: "zero" }, { children: jsxRuntime.jsx(StyledContent, { children: label ? "Error in ".concat(label) : "Error" }) })) })), parentNode)] }));
|
|
817
|
+
}
|
|
818
|
+
var containerCSS$1 = react$1.css(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
|
|
819
|
+
var StyledWrapper$5 = styled__default["default"](kuiBasic.Grid)(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n height: 46px;\n border-radius: 12px;\n background: rgba(25, 25, 25, 0.8);\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n padding: 0 24px;\n margin-bottom: 16px;\n width: max-content;\n &:last-child {\n margin-bottom: 0;\n }\n"], ["\n height: 46px;\n border-radius: 12px;\n background: rgba(25, 25, 25, 0.8);\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n padding: 0 24px;\n margin-bottom: 16px;\n width: max-content;\n &:last-child {\n margin-bottom: 0;\n }\n"])));
|
|
820
|
+
var StyledContent = styled__default["default"].pre(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n margin: 0;\n padding: 0;\n"], ["\n margin: 0;\n padding: 0;\n"])));
|
|
821
|
+
var templateObject_1$f, templateObject_2$8, templateObject_3$7;
|
|
822
|
+
|
|
823
|
+
var parentClassName = "KUI-LoadingPopup_container";
|
|
824
|
+
var createParentNode = function () {
|
|
825
|
+
var node = document.createElement("div");
|
|
826
|
+
node.classList.add(parentClassName);
|
|
827
|
+
document.body.append(node);
|
|
828
|
+
return node;
|
|
829
|
+
};
|
|
830
|
+
function LoaderPopup(_a) {
|
|
831
|
+
var label = _a.label, onClose = _a.onClose;
|
|
832
|
+
var _b = react.useState(true), isOpen = _b[0], setIsOpen = _b[1];
|
|
833
|
+
if (!isOpen) {
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
var handleClose = function () {
|
|
837
|
+
setIsOpen(false);
|
|
838
|
+
if (onClose) {
|
|
839
|
+
onClose();
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
var parentNode = document.querySelector(".".concat(parentClassName)) || createParentNode();
|
|
843
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react$1.Global, { styles: containerCSS }), reactDom.createPortal(jsxRuntime.jsxs(StyledWrapper$4, __assign({ className: "KUI-LoadingPopup", container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(StyledLoader, {}), jsxRuntime.jsxs(StyledCaption, __assign({ size: "xs", weight: 600, color: "zero" }, { children: ["Loading ", label] })), jsxRuntime.jsx(CloseIconWrapper, __assign({ onClick: handleClose }, { children: jsxRuntime.jsx(kuiIcon.CrossWithCircleIcon, {}) }))] })), parentNode)] }));
|
|
844
|
+
}
|
|
845
|
+
var containerCSS = react$1.css(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
|
|
846
|
+
var StyledWrapper$4 = styled__default["default"](kuiBasic.Grid)(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n height: 48px;\n border-radius: 66px;\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n background: rgba(25, 25, 25, 0.8);\n padding: 4px 12px 4px 8px;\n margin-top: 16px;\n width: max-content;\n min-width: 247px;\n &:last-child {\n margin-top: 0;\n }\n"], ["\n height: 48px;\n border-radius: 66px;\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n background: rgba(25, 25, 25, 0.8);\n padding: 4px 12px 4px 8px;\n margin-top: 16px;\n width: max-content;\n min-width: 247px;\n &:last-child {\n margin-top: 0;\n }\n"])));
|
|
847
|
+
var StyledCaption = styled__default["default"](kuiBasic.Caption)(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["\n padding: 0 14px;\n"], ["\n padding: 0 14px;\n"])));
|
|
848
|
+
var StyledLoader = styled__default["default"](kuiBasic.CircularProgress)(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n color: #f1f1f1;\n width: 28px !important;\n height: 28px !important;\n"], ["\n color: #f1f1f1;\n width: 28px !important;\n height: 28px !important;\n"])));
|
|
849
|
+
var CloseIconWrapper = styled__default["default"].div(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["\n cursor: pointer;\n margin-left: auto;\n height: 22px;\n"], ["\n cursor: pointer;\n margin-left: auto;\n height: 22px;\n"])));
|
|
850
|
+
var templateObject_1$e, templateObject_2$7, templateObject_3$6, templateObject_4$3, templateObject_5$2;
|
|
851
|
+
|
|
852
|
+
function LoaderState(_a) {
|
|
853
|
+
var loader = _a.loader, onlyError = _a.onlyError;
|
|
854
|
+
react.useEffect(function () { return function () {
|
|
855
|
+
loader === null || loader === void 0 ? void 0 : loader.cleanError();
|
|
856
|
+
if (!onlyError)
|
|
857
|
+
loader === null || loader === void 0 ? void 0 : loader.endLoading();
|
|
858
|
+
}; }, []);
|
|
859
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(loader === null || loader === void 0 ? void 0 : loader.hasError) && (jsxRuntime.jsx(ErrorPopup, { label: loader.errorMessage, onClose: loader === null || loader === void 0 ? void 0 : loader.cleanError })), (loader === null || loader === void 0 ? void 0 : loader.isLoading) && !onlyError && (jsxRuntime.jsx(LoaderPopup, { label: loader.loadingMessage, onClose: loader.endLoading }))] }));
|
|
860
|
+
}
|
|
861
|
+
var LoaderState$1 = mobxReact.observer(LoaderState);
|
|
862
|
+
|
|
863
|
+
var name = "inn";
|
|
864
|
+
var CompanyInnAutocomplete = function (props) {
|
|
865
|
+
var form = props.form, otherProps = __rest(props, ["form"]);
|
|
866
|
+
var loaderRef = react.useRef(new kuiUtils.Loader());
|
|
867
|
+
var loader = loaderRef.current;
|
|
868
|
+
var _a = react.useState(""), searchQuery = _a[0], setSearchQuery = _a[1];
|
|
869
|
+
var _b = react.useState([]), companies = _b[0], setCompanies = _b[1];
|
|
870
|
+
var updateFormFields = function (company) {
|
|
871
|
+
if (company) {
|
|
872
|
+
form.setValue("inn", company.inn);
|
|
873
|
+
form.setValue("name", company.name);
|
|
874
|
+
form.setValue("office", company.office);
|
|
875
|
+
if (company.phone)
|
|
876
|
+
form.setValue("phone", company.phone);
|
|
877
|
+
form.setValue("email", company.email);
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
var findCompanyByINN = function (tin) { return __awaiter(void 0, void 0, void 0, function () {
|
|
881
|
+
var _a, err, res;
|
|
882
|
+
return __generator(this, function (_b) {
|
|
883
|
+
switch (_b.label) {
|
|
884
|
+
case 0:
|
|
885
|
+
form.clearErrors(name);
|
|
886
|
+
loader.startLoading();
|
|
887
|
+
return [4 /*yield*/, to__default["default"](CompaniesAgent.findCompanyByINN({ tin: tin }))];
|
|
888
|
+
case 1:
|
|
889
|
+
_a = _b.sent(), err = _a[0], res = _a[1];
|
|
890
|
+
if (err) {
|
|
891
|
+
if (err.tin) {
|
|
892
|
+
form.setError(name, {
|
|
893
|
+
type: "manual",
|
|
894
|
+
message: "A company with this TIN already exists",
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
loader.setError(err);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
else if (res === null || res === void 0 ? void 0 : res.tin) {
|
|
902
|
+
setCompanies([CompaniesStore.getCompanyFields(res)]);
|
|
903
|
+
}
|
|
904
|
+
else
|
|
905
|
+
setCompanies([]);
|
|
906
|
+
loader.endLoading();
|
|
907
|
+
return [2 /*return*/];
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
}); };
|
|
911
|
+
kuiUtils.useDebounce(searchQuery, 500, function () {
|
|
912
|
+
if (searchQuery)
|
|
913
|
+
findCompanyByINN(searchQuery);
|
|
914
|
+
else
|
|
915
|
+
setCompanies([]);
|
|
916
|
+
});
|
|
917
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(kuiComplex.InputWithAutocomplete, __assign({ renderOption: function (option) { return (jsxRuntime.jsx(AutocompleteOption, { label: option.name })); }, options: companies, label: "TIN", form: form, name: name, isLoading: loader.isLoading, onSearchItem: setSearchQuery, onSelectItem: updateFormFields }, otherProps)), jsxRuntime.jsx(LoaderState$1, { loader: loader, onlyError: true })] }));
|
|
918
|
+
};
|
|
919
|
+
var CompanyInnAutocomplete$1 = mobxReact.observer(CompanyInnAutocomplete);
|
|
920
|
+
|
|
653
921
|
function MapComponent(props) {
|
|
654
922
|
var center = props.center, zoom = props.zoom, withMarker = props.withMarker, setMapProp = props.setMap;
|
|
655
923
|
var _a = react.useState(null), map = _a[0], setMap = _a[1];
|
|
@@ -866,35 +1134,22 @@ var StyledInput$2 = styled__default["default"].input(templateObject_4$1 || (temp
|
|
|
866
1134
|
var StyledErrorMessage = styled__default["default"](kuiBasic.Caption)(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n margin-top: 4px;\n"], ["\n margin-top: 4px;\n"])));
|
|
867
1135
|
var templateObject_1$a, templateObject_2$4, templateObject_3$3, templateObject_4$1, templateObject_5$1;
|
|
868
1136
|
|
|
869
|
-
var
|
|
1137
|
+
var companyFields = [
|
|
870
1138
|
{
|
|
871
|
-
label: "
|
|
872
|
-
name: "
|
|
873
|
-
variant: "
|
|
874
|
-
|
|
875
|
-
size: 6,
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
name: "country",
|
|
879
|
-
label: "Country",
|
|
880
|
-
variant: "custom",
|
|
881
|
-
CustomInput: CountryAutocomplete$1,
|
|
882
|
-
size: 6,
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
name: "region",
|
|
886
|
-
label: "Region",
|
|
887
|
-
variant: "custom",
|
|
888
|
-
CustomInput: RegionAutocomplete$1,
|
|
889
|
-
size: 6,
|
|
1139
|
+
label: "Provider type",
|
|
1140
|
+
name: "type",
|
|
1141
|
+
variant: "select",
|
|
1142
|
+
options: CompanyTypesValues,
|
|
890
1143
|
},
|
|
891
1144
|
{
|
|
892
|
-
|
|
893
|
-
|
|
1145
|
+
label: "INN",
|
|
1146
|
+
name: "inn",
|
|
894
1147
|
variant: "custom",
|
|
895
|
-
CustomInput:
|
|
896
|
-
size: 6,
|
|
1148
|
+
CustomInput: CompanyInnAutocomplete$1,
|
|
897
1149
|
},
|
|
1150
|
+
{ label: "Name", name: "name" },
|
|
1151
|
+
];
|
|
1152
|
+
var companyOfficeFields = [
|
|
898
1153
|
{
|
|
899
1154
|
label: "Address",
|
|
900
1155
|
name: "office",
|
|
@@ -912,126 +1167,6 @@ var companyOfficeFields = [
|
|
|
912
1167
|
},
|
|
913
1168
|
];
|
|
914
1169
|
|
|
915
|
-
var TaxTypeValues = [
|
|
916
|
-
{ value: "resident", label: "Individual Resident" },
|
|
917
|
-
{ value: "nonresident", label: "Individual Non-resident" },
|
|
918
|
-
{ value: "self-employed", label: "Self-employed" },
|
|
919
|
-
{ value: "individual-entrepreneur", label: "Individual entrepreneur" },
|
|
920
|
-
{ value: "company", label: "Company" },
|
|
921
|
-
];
|
|
922
|
-
var BooleanValues = [
|
|
923
|
-
{ value: true, label: "Yes" },
|
|
924
|
-
{ value: false, label: "No" },
|
|
925
|
-
];
|
|
926
|
-
var ElectricityValues = [
|
|
927
|
-
{ value: "T1", label: "One-part" },
|
|
928
|
-
{ value: "T2", label: "Two-part" },
|
|
929
|
-
{ value: "T3", label: "Three-part" },
|
|
930
|
-
];
|
|
931
|
-
var WaterValues = [
|
|
932
|
-
{ value: "cold", label: "Cold" },
|
|
933
|
-
{ value: "hot", label: "Hot" },
|
|
934
|
-
];
|
|
935
|
-
var getNumbersValues = function (count) {
|
|
936
|
-
return new Array(count).fill(0).map(function (value, key) { return ({
|
|
937
|
-
value: "".concat(key),
|
|
938
|
-
label: key,
|
|
939
|
-
}); });
|
|
940
|
-
};
|
|
941
|
-
var ParkingTypesValues = [
|
|
942
|
-
{ value: "public", label: "Public" },
|
|
943
|
-
{ value: "house", label: "House" },
|
|
944
|
-
{ value: "underground", label: "Underground" },
|
|
945
|
-
{ value: "private", label: "Private" },
|
|
946
|
-
];
|
|
947
|
-
var TVTypesValues = [
|
|
948
|
-
{ value: "cable", label: "Cable" },
|
|
949
|
-
{ value: "satellite", label: "Satellite" },
|
|
950
|
-
{ value: "smart_tv", label: "Smart TV" },
|
|
951
|
-
{ value: "no", label: "No" },
|
|
952
|
-
];
|
|
953
|
-
var TaxResidenceValues = [
|
|
954
|
-
{ value: "resident", label: "Resident" },
|
|
955
|
-
{ value: "not_resident", label: "Non-resident" },
|
|
956
|
-
];
|
|
957
|
-
var RenovationTypeValues = [
|
|
958
|
-
{ value: "capital", label: "Capital" },
|
|
959
|
-
{ value: "euro", label: "Euro" },
|
|
960
|
-
{ value: "designer", label: "Designer" },
|
|
961
|
-
{ value: "cosmetic", label: "Cosmetic" },
|
|
962
|
-
{ value: "required", label: "Required" },
|
|
963
|
-
];
|
|
964
|
-
var RenovationStyleValues = [
|
|
965
|
-
{ value: "classic", label: "Classic" },
|
|
966
|
-
{ value: "scandinavian", label: "Scandinavian" },
|
|
967
|
-
{ value: "loft", label: "Loft" },
|
|
968
|
-
{ value: "contemporary", label: "Contemporary" },
|
|
969
|
-
{ value: "minimalism", label: "Minimalism" },
|
|
970
|
-
{ value: "neoclassic", label: "Neoclassic" },
|
|
971
|
-
{ value: "eco", label: "Eco" },
|
|
972
|
-
{ value: "provence", label: "Provence" },
|
|
973
|
-
{ value: "hi_tech", label: "Hi-tech" },
|
|
974
|
-
{ value: "mediterranean", label: "Mediterranean" },
|
|
975
|
-
{ value: "eclectic", label: "Eclectic" },
|
|
976
|
-
{ value: "ethno", label: "Ethno" },
|
|
977
|
-
{ value: "gothic", label: "Gothic" },
|
|
978
|
-
];
|
|
979
|
-
var RoomTypeValues = [
|
|
980
|
-
{ value: "connected", label: "Connected" },
|
|
981
|
-
{ value: "separate", label: "Separate" },
|
|
982
|
-
];
|
|
983
|
-
var InspectionTypeValues = [
|
|
984
|
-
{ value: "quarterly", label: "Quarterly" },
|
|
985
|
-
{ value: "transfer", label: "Transfer" },
|
|
986
|
-
{ value: "appraisal", label: "Appraisal" },
|
|
987
|
-
{ value: "impairments", label: "Impairments" },
|
|
988
|
-
{ value: "inventory", label: "Inventory" },
|
|
989
|
-
{ value: "initial", label: "Initial" },
|
|
990
|
-
];
|
|
991
|
-
var ImpairmentsTypeValues = [
|
|
992
|
-
{ value: "damages", label: "Damages" },
|
|
993
|
-
{ value: "wear_tear", label: "Wear&tear" },
|
|
994
|
-
];
|
|
995
|
-
var FillingTypeValues = [
|
|
996
|
-
{ value: "finish", label: "Finish" },
|
|
997
|
-
{ value: "furniture", label: "Furniture" },
|
|
998
|
-
{ value: "electronics", label: "Electronics" },
|
|
999
|
-
{ value: "accessories", label: "Accessories" },
|
|
1000
|
-
];
|
|
1001
|
-
var RoomTypesValues = [
|
|
1002
|
-
{ value: "residential", label: "Residential" },
|
|
1003
|
-
{ value: "non-residential", label: "Nonresidential" },
|
|
1004
|
-
{ value: "commercial", label: "Commercial" },
|
|
1005
|
-
{ value: "garage", label: "Garage" },
|
|
1006
|
-
{ value: "car_space", label: "Parking" },
|
|
1007
|
-
];
|
|
1008
|
-
var CompanyTypesValues = [
|
|
1009
|
-
{ value: "administrative", label: "Administrative provider" },
|
|
1010
|
-
{ value: "service", label: "Service provider" },
|
|
1011
|
-
{ value: "resource", label: "Resource provider" },
|
|
1012
|
-
];
|
|
1013
|
-
var ResourceValues = [
|
|
1014
|
-
{ value: "electricity", label: "Electricity" },
|
|
1015
|
-
{ value: "water", label: "Water" },
|
|
1016
|
-
{ value: "gas", label: "Gas" },
|
|
1017
|
-
{ value: "heating", label: "Heating" },
|
|
1018
|
-
];
|
|
1019
|
-
var APIPayerValues = [
|
|
1020
|
-
{ value: "owner", label: "Landlord" },
|
|
1021
|
-
{ value: "renter", label: "Tenant" },
|
|
1022
|
-
{ value: "maroom", label: "Maroom" },
|
|
1023
|
-
];
|
|
1024
|
-
var UnitOfPaymentValues = [
|
|
1025
|
-
{ value: "percent", label: "%" },
|
|
1026
|
-
{ value: "value", label: "₽" },
|
|
1027
|
-
];
|
|
1028
|
-
var PartialPayerValues = [
|
|
1029
|
-
{ value: "owner", label: "Landlord" },
|
|
1030
|
-
{ value: "renter", label: "Tenant" },
|
|
1031
|
-
{ value: "maroom", label: "Maroom" },
|
|
1032
|
-
{ value: "partial", label: "Partial" },
|
|
1033
|
-
];
|
|
1034
|
-
|
|
1035
1170
|
function FormBottom(_a) {
|
|
1036
1171
|
var label = _a.label, variant = _a.variant, handleClick = _a.handleClick, withPrevStep = _a.withPrevStep, handlePrevClick = _a.handlePrevClick, withDeleteButton = _a.withDeleteButton, handleDelete = _a.handleDelete, isFixed = _a.isFixed, isLoading = _a.isLoading, endButton = _a.endButton, otherProps = __rest(_a, ["label", "variant", "handleClick", "withPrevStep", "handlePrevClick", "withDeleteButton", "handleDelete", "isFixed", "isLoading", "endButton"]);
|
|
1037
1172
|
return (jsxRuntime$1.jsxs(StyledFooter, __assign({ isFixed: Boolean(isFixed) }, { children: [jsxRuntime$1.jsx(kuiBasic.Divider, {}), jsxRuntime$1.jsx("div", __assign({ css: { padding: "0 40px" } }, { children: jsxRuntime$1.jsxs(kuiBasic.Grid, __assign({ container: true, justify: "space-between", css: { padding: "12px 0" } }, { children: [jsxRuntime$1.jsxs(kuiBasic.Grid, __assign({ item: true }, { children: [withPrevStep && (jsxRuntime$1.jsx(kuiBasic.Button, __assign({ isCircle: true, "data-testid": "prev_button", onClick: handlePrevClick, size: "s", variant: "transparentWithBorder" }, { children: jsxRuntime$1.jsx(kuiIcon.PrevArrowIcon, {}) }))), withDeleteButton && (jsxRuntime$1.jsx(kuiBasic.Button, __assign({ "data-testid": "delete_button", size: "s", onClick: handleDelete, variant: "white" }, { children: "Delete" })))] })), jsxRuntime$1.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime$1.jsxs(kuiBasic.Grid, __assign({ container: true, alignItems: "center", justify: "flex-end" }, { children: [endButton && (jsxRuntime$1.jsx(StyledEndButtonWrapper, { children: endButton })), jsxRuntime$1.jsx(kuiBasic.Button, __assign({ "data-testid": "submit_button", size: "s", onClick: handleClick, endIcon: variant === "create" ? jsxRuntime$1.jsx(kuiIcon.CheckIcon, {}) : jsxRuntime$1.jsx(kuiIcon.NextArrowIcon, {}), disabled: isLoading }, otherProps, { children: isLoading ? jsxRuntime$1.jsx(StyledLoading, {}) : label }))] })) }))] })) }))] })));
|
|
@@ -1067,7 +1202,7 @@ function CompanyCreationForm(_a) {
|
|
|
1067
1202
|
var form = reactHookForm.useForm({
|
|
1068
1203
|
resolver: yup$1.yupResolver(CompanyCreationSchema),
|
|
1069
1204
|
});
|
|
1070
|
-
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(kuiBasic.Box, __assign({ pr: 5, pl: 5, pb: 3 }, { children: jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, spacing: 2 }, { children: [
|
|
1205
|
+
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(kuiBasic.Box, __assign({ pr: 5, pl: 5, pb: 3 }, { children: jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, spacing: 2 }, { children: [companyFields.map(function (field) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(InputByType, __assign({ form: form }, field)) }), field.name)); }), jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ weight: 600, size: "s" }, { children: "MAIN OFFICE" })) })), companyOfficeFields.map(function (_a) {
|
|
1071
1206
|
var size = _a.size, field = __rest(_a, ["size"]);
|
|
1072
1207
|
return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: size || 12 }, { children: jsxRuntime.jsx(InputByType, __assign({ form: form }, field)) }), field.name));
|
|
1073
1208
|
})] })) })), jsxRuntime.jsx(FormBottom, { label: "Add", type: "button", handleClick: form.handleSubmit(handleSubmit) })] }));
|
|
@@ -1181,7 +1316,8 @@ var CompaniesStore = /** @class */ (function () {
|
|
|
1181
1316
|
_this.companies = _this.paginator.getPageResponse(res, _this.companies, mapper);
|
|
1182
1317
|
}
|
|
1183
1318
|
else {
|
|
1184
|
-
_this.
|
|
1319
|
+
_this.companies = [];
|
|
1320
|
+
_this.loader.setError("fetch companies", err);
|
|
1185
1321
|
}
|
|
1186
1322
|
_this.loader.endLoading();
|
|
1187
1323
|
});
|
|
@@ -1212,10 +1348,10 @@ var CompaniesStore = /** @class */ (function () {
|
|
|
1212
1348
|
this.paginator.startFetching();
|
|
1213
1349
|
}
|
|
1214
1350
|
else {
|
|
1215
|
-
this.creationLoader.setError("company creation");
|
|
1351
|
+
this.creationLoader.setError("company creation", err);
|
|
1216
1352
|
}
|
|
1217
1353
|
this.creationLoader.endLoading();
|
|
1218
|
-
return [2 /*return*/, this.companies[0]];
|
|
1354
|
+
return [2 /*return*/, res ? this.companies[0] : null];
|
|
1219
1355
|
}
|
|
1220
1356
|
});
|
|
1221
1357
|
}); };
|
|
@@ -1230,7 +1366,7 @@ var CompaniesStore = /** @class */ (function () {
|
|
|
1230
1366
|
case 1:
|
|
1231
1367
|
_a = _b.sent(), err = _a[0], res = _a[1];
|
|
1232
1368
|
if (err) {
|
|
1233
|
-
this.creationLoader.setError("logo creation");
|
|
1369
|
+
this.creationLoader.setError("logo creation", err);
|
|
1234
1370
|
}
|
|
1235
1371
|
return [2 /*return*/, res === null || res === void 0 ? void 0 : res.logo];
|
|
1236
1372
|
}
|
|
@@ -1243,26 +1379,38 @@ var CompaniesStore = /** @class */ (function () {
|
|
|
1243
1379
|
this.filter = new kuiUtils.SortingFilter();
|
|
1244
1380
|
mobx.makeAutoObservable(this);
|
|
1245
1381
|
}
|
|
1246
|
-
CompaniesStore.getCompanyParams = function (company) { return ({
|
|
1247
|
-
|
|
1248
|
-
name:
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
zip_code: data.zipCode,
|
|
1262
|
-
geolocation: {
|
|
1382
|
+
CompaniesStore.getCompanyParams = function (company) { return (__assign({ id: company.id, logo: company.logo }, CompaniesStore.getCompanyFields(company))); };
|
|
1383
|
+
CompaniesStore.getCreationBody = function (data) { return ({
|
|
1384
|
+
name: data.name,
|
|
1385
|
+
provider_type: data.type
|
|
1386
|
+
? matchesCompanyTypes[data.type]
|
|
1387
|
+
: undefined,
|
|
1388
|
+
tin: data.inn,
|
|
1389
|
+
main_office: {
|
|
1390
|
+
address: data.office.address,
|
|
1391
|
+
email: data.email,
|
|
1392
|
+
phone: data.phone
|
|
1393
|
+
? "+".concat(data.phone.phoneCode).concat(data.phone.phoneNumber)
|
|
1394
|
+
: null,
|
|
1395
|
+
geolocation: data.office.location
|
|
1396
|
+
? {
|
|
1263
1397
|
lat: data.office.location.lat,
|
|
1264
1398
|
lon: data.office.location.lon,
|
|
1265
|
-
}
|
|
1399
|
+
}
|
|
1400
|
+
: undefined,
|
|
1401
|
+
},
|
|
1402
|
+
}); };
|
|
1403
|
+
CompaniesStore.getCompanyFields = function (company) {
|
|
1404
|
+
var _a, _b, _c;
|
|
1405
|
+
return ({
|
|
1406
|
+
inn: company.tin,
|
|
1407
|
+
name: company.name,
|
|
1408
|
+
phone: ((_a = company.main_office) === null || _a === void 0 ? void 0 : _a.phone)
|
|
1409
|
+
? kuiUtils.getPhoneParamsFromString(company.main_office.phone)
|
|
1410
|
+
: null,
|
|
1411
|
+
email: ((_b = company.main_office) === null || _b === void 0 ? void 0 : _b.email) || "",
|
|
1412
|
+
office: {
|
|
1413
|
+
address: ((_c = company.main_office) === null || _c === void 0 ? void 0 : _c.address) || "",
|
|
1266
1414
|
},
|
|
1267
1415
|
});
|
|
1268
1416
|
};
|
|
@@ -1323,6 +1471,11 @@ CompanyAutocomplete.defaultProps = {
|
|
|
1323
1471
|
};
|
|
1324
1472
|
var CompanyAutocomplete$1 = mobxReact.observer(CompanyAutocomplete);
|
|
1325
1473
|
|
|
1474
|
+
var ChangeReasonSchemaParams = {
|
|
1475
|
+
// reason: yup.mixed().required("Choose a reason file"),
|
|
1476
|
+
};
|
|
1477
|
+
var ChangeReasonSchema = yup__namespace.object().shape(ChangeReasonSchemaParams);
|
|
1478
|
+
|
|
1326
1479
|
function ChangeReasonFields(_a) {
|
|
1327
1480
|
var form = _a.form, customReasons = _a.customReasons;
|
|
1328
1481
|
return (jsxRuntime.jsxs(kuiBasic.Grid, __assign({ container: true, spacing: 2 }, { children: [customReasons ? (customReasons.map(function (field) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(InputFileWithVisibility, { form: form, name: field.name || "reason", label: field.label }) }))); })) : (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(InputFileWithVisibility, { form: form, name: "reason", label: "Reason" }) }))), jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(kuiComplex.InputWithController, { isTextArea: true, form: form, name: "comment", label: "Comment" }) }))] })));
|
|
@@ -1506,12 +1659,21 @@ var getMeterFeaturesFieldsSchema = function (valuesFields, isReplacementRequired
|
|
|
1506
1659
|
.number()
|
|
1507
1660
|
.required("The maximum number of counters has been created in this object, select the one to replace")
|
|
1508
1661
|
.transform(function (value) { return (Number.isNaN(value) ? undefined : value); }),
|
|
1509
|
-
})), { startDate: yup__namespace
|
|
1662
|
+
})), { startDate: yup__namespace
|
|
1663
|
+
.mixed()
|
|
1664
|
+
.when("replaceableCounter", {
|
|
1510
1665
|
is: function (value) { return value; },
|
|
1511
1666
|
then: function (rule) { return rule.required("This field is required"); },
|
|
1512
|
-
})
|
|
1667
|
+
})
|
|
1668
|
+
.when("startDate", {
|
|
1669
|
+
is: function (value) { return value; },
|
|
1670
|
+
then: function (rule) {
|
|
1671
|
+
return rule.test("check-start-date", "Select a date in the past", function (value) { return Number(value === null || value === void 0 ? void 0 : value.diffNow("days").days) <= 0; });
|
|
1672
|
+
},
|
|
1673
|
+
})
|
|
1674
|
+
.nullable() }));
|
|
1513
1675
|
});
|
|
1514
|
-
return yup__namespace.object().shape(__assign(__assign({}, meterFeaturesFieldsSchema), Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))));
|
|
1676
|
+
return yup__namespace.object().shape(__assign(__assign({}, meterFeaturesFieldsSchema), Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))), [["startDate", "startDate"]]);
|
|
1515
1677
|
};
|
|
1516
1678
|
|
|
1517
1679
|
var getPartialPayerFields = function (mainPayer, refundFromRef, variant, utilityType) { return [
|
|
@@ -2094,7 +2256,12 @@ var getValuesFields = function (resource, variant, meterType) {
|
|
|
2094
2256
|
var commonMeterFields = function (_a) {
|
|
2095
2257
|
var withPassport = _a.withPassport, isNewResource = _a.isNewResource, withLastValue = _a.withLastValue, resource = _a.resource, tariffFilter = _a.tariffFilter, disableOperatingAccount = _a.disableOperatingAccount, handleCompanyChange = _a.handleCompanyChange, withNextCheck = _a.withNextCheck, apartmentId = _a.apartmentId;
|
|
2096
2258
|
return __spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
2097
|
-
{
|
|
2259
|
+
{
|
|
2260
|
+
label: "Activation date",
|
|
2261
|
+
name: "startDate",
|
|
2262
|
+
variant: "date",
|
|
2263
|
+
max: luxon.DateTime.now(),
|
|
2264
|
+
}
|
|
2098
2265
|
], kuiUtils.addToArrayByCondition(withPassport, {
|
|
2099
2266
|
label: "Passport",
|
|
2100
2267
|
name: "passportFile",
|
|
@@ -2110,6 +2277,7 @@ var commonMeterFields = function (_a) {
|
|
|
2110
2277
|
variant: "custom",
|
|
2111
2278
|
size: 12,
|
|
2112
2279
|
CustomInput: PartialPayer,
|
|
2280
|
+
utilityType: resource,
|
|
2113
2281
|
}), true), [
|
|
2114
2282
|
{
|
|
2115
2283
|
label: "Tariff group",
|
|
@@ -2152,7 +2320,7 @@ var getMeterFields = function (settings) {
|
|
|
2152
2320
|
function ReplaceableCountersBlock(_a) {
|
|
2153
2321
|
var form = _a.form, counters = _a.counters, setIsReplaceable = _a.setIsReplaceable;
|
|
2154
2322
|
var options = counters.map(function (counter) { return ({
|
|
2155
|
-
label: counter.
|
|
2323
|
+
label: counter.number,
|
|
2156
2324
|
value: counter.id,
|
|
2157
2325
|
}); });
|
|
2158
2326
|
var handleChange = function (e, value) {
|
|
@@ -2179,6 +2347,9 @@ function MeterFeaturesFields(props) {
|
|
|
2179
2347
|
form.setValue("operationalAccountNumber", administrativeCompany === null || administrativeCompany === void 0 ? void 0 : administrativeCompany.operatingAccount);
|
|
2180
2348
|
setDisableOperatingAccount(true);
|
|
2181
2349
|
}
|
|
2350
|
+
else {
|
|
2351
|
+
setDisableOperatingAccount(false);
|
|
2352
|
+
}
|
|
2182
2353
|
};
|
|
2183
2354
|
var meterFields = getMeterFields({
|
|
2184
2355
|
resource: resource,
|
|
@@ -2220,12 +2391,12 @@ function MeterTypeRadioGroup(props) {
|
|
|
2220
2391
|
}
|
|
2221
2392
|
|
|
2222
2393
|
function MeterFeaturesForm(props) {
|
|
2223
|
-
var formStore = props.formStore, handleSubmit = props.handleSubmit, resource = props.resource, maxMeters = props.maxMeters, handleMeterTypeChange = props.handleMeterTypeChange, other = __rest(props, ["formStore", "handleSubmit", "resource", "maxMeters", "handleMeterTypeChange"]);
|
|
2394
|
+
var formStore = props.formStore, handleSubmit = props.handleSubmit, resource = props.resource, maxMeters = props.maxMeters, handleMeterTypeChange = props.handleMeterTypeChange, defaultValues = props.defaultValues, other = __rest(props, ["formStore", "handleSubmit", "resource", "maxMeters", "handleMeterTypeChange", "defaultValues"]);
|
|
2224
2395
|
var _a = react.useState(false), isReplaceable = _a[0], setIsReplaceable = _a[1];
|
|
2225
2396
|
var withMeterType = (resource === "water" && maxMeters !== 1) || resource === "electricity";
|
|
2226
2397
|
var defaultType = resource === "water" ? "cold" : "T1";
|
|
2227
2398
|
var defaultMeterType = withMeterType ? defaultType : null;
|
|
2228
|
-
var _b = react.useState(defaultMeterType), meterType = _b[0], setMeterType = _b[1];
|
|
2399
|
+
var _b = react.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.type) || defaultMeterType), meterType = _b[0], setMeterType = _b[1];
|
|
2229
2400
|
react.useEffect(function () {
|
|
2230
2401
|
if (handleMeterTypeChange) {
|
|
2231
2402
|
handleMeterTypeChange(meterType);
|
|
@@ -2240,7 +2411,7 @@ function MeterFeaturesForm(props) {
|
|
|
2240
2411
|
handleSubmit(data);
|
|
2241
2412
|
}
|
|
2242
2413
|
};
|
|
2243
|
-
return (jsxRuntime.jsx(MeterFeaturesFields, __assign({ resource: resource, handleSubmit: handleFormSubmit, meterType: meterType, maxMeters: maxMeters, withLastValue: isReplaceable, setIsReplaceable: setIsReplaceable, renderMeterType: withMeterType
|
|
2414
|
+
return (jsxRuntime.jsx(MeterFeaturesFields, __assign({ resource: resource, handleSubmit: handleFormSubmit, meterType: meterType, maxMeters: maxMeters, withLastValue: isReplaceable, setIsReplaceable: setIsReplaceable, defaultValues: defaultValues, renderMeterType: withMeterType
|
|
2244
2415
|
? function (form) { return (jsxRuntime.jsx(MeterTypeRadioGroup, { form: form, resource: resource, handleChange: setMeterType })); }
|
|
2245
2416
|
: null }, other)));
|
|
2246
2417
|
}
|
|
@@ -2554,19 +2725,23 @@ exports.APIPayerValues = APIPayerValues;
|
|
|
2554
2725
|
exports.BooleanValues = BooleanValues;
|
|
2555
2726
|
exports.CatalogsAgent = CatalogsAgent;
|
|
2556
2727
|
exports.ChangeReasonFields = ChangeReasonFields;
|
|
2728
|
+
exports.ChangeReasonSchema = ChangeReasonSchema;
|
|
2557
2729
|
exports.CitiesStore = CitiesStore;
|
|
2558
2730
|
exports.CityAutocomplete = CityAutocomplete$1;
|
|
2731
|
+
exports.CommonTariffFieldsSchema = CommonTariffFieldsSchema;
|
|
2559
2732
|
exports.CompaniesAgent = CompaniesAgent;
|
|
2560
2733
|
exports.CompaniesStore = CompaniesStore;
|
|
2561
2734
|
exports.CompanyAutocomplete = CompanyAutocomplete$1;
|
|
2562
2735
|
exports.CompanyCreationForm = CompanyCreationForm;
|
|
2563
2736
|
exports.CompanyCreationModal = CompanyCreationModal$1;
|
|
2737
|
+
exports.CompanyInnAutocomplete = CompanyInnAutocomplete$1;
|
|
2564
2738
|
exports.CompanyTypesValues = CompanyTypesValues;
|
|
2565
2739
|
exports.CountriesStore = CountriesStore;
|
|
2566
2740
|
exports.CountryAutocomplete = CountryAutocomplete$1;
|
|
2567
2741
|
exports.DistrictAutocomplete = DistrictAutocomplete$1;
|
|
2568
2742
|
exports.DistrictsStore = DistrictsStore;
|
|
2569
2743
|
exports.ElectricityValues = ElectricityValues;
|
|
2744
|
+
exports.ErrorPopup = ErrorPopup;
|
|
2570
2745
|
exports.FileUploaderWithPreview = FileUploaderWithPreview;
|
|
2571
2746
|
exports.FillingTagCreationForm = FillingTagCreationForm;
|
|
2572
2747
|
exports.FillingTagCreationModal = FillingTagCreationModal$1;
|
|
@@ -2583,6 +2758,8 @@ exports.InputFileWithVisibility = InputFileWithVisibility;
|
|
|
2583
2758
|
exports.InputWithMap = InputWithMap;
|
|
2584
2759
|
exports.InspectionTypeValues = InspectionTypeValues;
|
|
2585
2760
|
exports.KUISettings = kuiSettings;
|
|
2761
|
+
exports.LoaderPopup = LoaderPopup;
|
|
2762
|
+
exports.LoaderState = LoaderState$1;
|
|
2586
2763
|
exports.MapComponent = MapComponent$1;
|
|
2587
2764
|
exports.MeterFeaturesFields = MeterFeaturesFields;
|
|
2588
2765
|
exports.MeterFeaturesForm = MeterFeaturesForm;
|
|
@@ -2623,7 +2800,10 @@ exports.csrfTokenKey = csrfTokenKey;
|
|
|
2623
2800
|
exports.defaultRequiredMessage = defaultRequiredMessage;
|
|
2624
2801
|
exports.genderMatches = genderMatches;
|
|
2625
2802
|
exports.getFillingInfoFields = getFillingInfoFields;
|
|
2803
|
+
exports.getMeterFeaturesFieldsSchema = getMeterFeaturesFieldsSchema;
|
|
2804
|
+
exports.getMeterFields = getMeterFields;
|
|
2626
2805
|
exports.getNumbersValues = getNumbersValues;
|
|
2806
|
+
exports.getPartialPayerFields = getPartialPayerFields;
|
|
2627
2807
|
exports.matchesAPICompanyTypes = matchesAPICompanyTypes;
|
|
2628
2808
|
exports.matchesAPIFillingTypes = matchesAPIFillingTypes;
|
|
2629
2809
|
exports.matchesAPISubjectRoles = matchesAPISubjectRoles;
|