@arquimedes.co/eureka-forms 1.9.78-test → 1.9.80-test
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/dist/@Types/@Types.d.ts +2 -0
- package/dist/@Types/@Types.js +1 -0
- package/dist/@Types/AYFFormStep.d.ts +19 -0
- package/dist/@Types/AYFFormStep.js +1 -0
- package/dist/@Types/CBRFormStep.d.ts +74 -0
- package/dist/@Types/CBRFormStep.js +1 -0
- package/dist/@Types/Form.d.ts +65 -0
- package/dist/@Types/Form.js +1 -0
- package/dist/@Types/FormStep.d.ts +138 -0
- package/dist/@Types/FormStep.js +1 -0
- package/dist/@Types/GenericFormSteps.d.ts +60 -0
- package/dist/@Types/GenericFormSteps.js +1 -0
- package/dist/@Types/Organization.d.ts +17 -0
- package/dist/@Types/Organization.js +1 -0
- package/dist/@Types/index.d.ts +1 -0
- package/dist/@Types/index.js +1 -0
- package/dist/App.d.ts +58 -0
- package/dist/App.js +470 -0
- package/dist/App.module.css +34 -0
- package/dist/AxiosAPI.d.ts +2 -0
- package/dist/AxiosAPI.js +8 -0
- package/dist/AxiosWidget.d.ts +2 -0
- package/dist/AxiosWidget.js +8 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +7 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +379 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.module.css +51 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.d.ts +12 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +31 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +64 -0
- package/dist/FormComponents/Form/Form.d.ts +41 -0
- package/dist/FormComponents/Form/Form.js +147 -0
- package/dist/FormComponents/Form/Form.module.css +39 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.d.ts +4 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +6 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.module.css +0 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.d.ts +4 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +42 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.module.css +8 -0
- package/dist/FormComponents/Section/Section.d.ts +38 -0
- package/dist/FormComponents/Section/Section.js +23 -0
- package/dist/FormComponents/Step/@Construction/CBRElementStep/CBRElementStep.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRElementStep/CBRElementStep.js +139 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +9 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +23 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +49 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.module.css +60 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +11 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +121 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +34 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +138 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.module.css +54 -0
- package/dist/FormComponents/Step/AYFStepMapper.d.ts +12 -0
- package/dist/FormComponents/Step/AYFStepMapper.js +170 -0
- package/dist/FormComponents/Step/CBRStepMapper.d.ts +13 -0
- package/dist/FormComponents/Step/CBRStepMapper.js +202 -0
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.d.ts +9 -0
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +35 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +4 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +65 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +37 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +9 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +35 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +4 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +121 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/CollapsibleStep/CollapsibleStep.d.ts +9 -0
- package/dist/FormComponents/Step/CollapsibleStep/CollapsibleStep.js +37 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +4 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +75 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.module.css +62 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.d.ts +11 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +23 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +4 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +48 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css +9 -0
- package/dist/FormComponents/Step/EntityValueStep/EntityValuePickerStep.d.ts +15 -0
- package/dist/FormComponents/Step/EntityValueStep/EntityValuePickerStep.js +35 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +4 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +203 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +25 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.d.ts +9 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +23 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +13 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +123 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +60 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +16 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +272 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +59 -0
- package/dist/FormComponents/Step/MapperStep/MapperStep.d.ts +15 -0
- package/dist/FormComponents/Step/MapperStep/MapperStep.js +35 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +10 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +27 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.module.css +60 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.d.ts +13 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.js +33 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.module.css +60 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +15 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +275 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +42 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +4 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +71 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.module.css +30 -0
- package/dist/FormComponents/Step/RatingStep/RatingStep.d.ts +9 -0
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +23 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +4 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +104 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.d.ts +9 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +35 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +4 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +11 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.module.css +7 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.d.ts +9 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +35 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +10 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +241 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +9 -0
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +33 -0
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +23 -0
- package/dist/FormComponents/Step/Step.d.ts +11 -0
- package/dist/FormComponents/Step/Step.js +108 -0
- package/dist/FormComponents/Step/StepFunctions.d.ts +5 -0
- package/dist/FormComponents/Step/StepFunctions.js +65 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/DraftEditor.css +96 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +13 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +213 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +93 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +10 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +23 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +4 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +76 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.module.css +9 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.d.ts +13 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +23 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +4 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +20 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +19 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.d.ts +9 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +35 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.d.ts +4 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +88 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.module.css +83 -0
- package/dist/FormComponents/Term/Term.d.ts +15 -0
- package/dist/FormComponents/Term/Term.js +23 -0
- package/dist/Icons/Construction/LeakIcon.d.ts +3 -0
- package/dist/Icons/Construction/LeakIcon.js +16 -0
- package/dist/Icons/Construction/ProjectIcon.d.ts +3 -0
- package/dist/Icons/Construction/ProjectIcon.js +16 -0
- package/dist/Icons/Construction/PropertyIcon.d.ts +3 -0
- package/dist/Icons/Construction/PropertyIcon.js +16 -0
- package/dist/Icons/Construction/SpaceIcon.d.ts +3 -0
- package/dist/Icons/Construction/SpaceIcon.js +16 -0
- package/dist/Icons/DocumentIcon.d.ts +3 -0
- package/dist/Icons/DocumentIcon.js +16 -0
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -0
- package/dist/Icons/Entities/GenericEntityIcon.js +17 -0
- package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -0
- package/dist/Icons/Entities/HandshakeIcon.js +17 -0
- package/dist/Widget.d.ts +1 -0
- package/dist/Widget.js +61 -0
- package/dist/constants/AYFFormStepTypes.d.ts +9 -0
- package/dist/constants/AYFFormStepTypes.js +10 -0
- package/dist/constants/CBRFormStepTypes.d.ts +21 -0
- package/dist/constants/CBRFormStepTypes.js +22 -0
- package/dist/constants/Files/FileExtensions.d.ts +3 -0
- package/dist/constants/Files/FileExtensions.js +68 -0
- package/dist/constants/Files/FileMaxSize.d.ts +2 -0
- package/dist/constants/Files/FileMaxSize.js +2 -0
- package/dist/constants/FormStepTypes.d.ts +46 -0
- package/dist/constants/FormStepTypes.js +54 -0
- package/dist/constants/IconTypes.d.ts +10 -0
- package/dist/constants/IconTypes.js +11 -0
- package/dist/constants/InternalFormStyle.d.ts +3 -0
- package/dist/constants/InternalFormStyle.js +16 -0
- package/dist/constants/MaterialClassNameSeed.d.ts +1 -0
- package/dist/constants/MaterialClassNameSeed.js +1 -0
- package/dist/controllers/FileService.d.ts +5 -0
- package/dist/controllers/FileService.js +92 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -0
- package/dist/index.lib.d.ts +7 -0
- package/dist/index.lib.js +5 -0
- package/dist/index.module.css +14 -0
- package/dist/shared/InputIcon/InputIcon.d.ts +7 -0
- package/dist/shared/InputIcon/InputIcon.js +81 -0
- package/dist/shared/Loader/Loader.d.ts +18 -0
- package/dist/shared/Loader/Loader.js +26 -0
- package/dist/shared/Loader/Loader.module.css +12 -0
- package/dist/shared/Navbar/Navbar.d.ts +9 -0
- package/dist/shared/Navbar/Navbar.js +18 -0
- package/dist/shared/Navbar/Navbar.module.css +18 -0
- package/dist/shared/Rating/Rating.d.ts +16 -0
- package/dist/shared/Rating/Rating.js +41 -0
- package/dist/shared/Rating/Rating.module.css +32 -0
- package/dist/shared/Rating/Ratings/LikeRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/LikeRating.js +43 -0
- package/dist/shared/Rating/Ratings/SatisfactionRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +61 -0
- package/dist/shared/Rating/Ratings/ScaleRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/ScaleRating.js +63 -0
- package/dist/shared/RoundedButton/RoundedButton.d.ts +30 -0
- package/dist/shared/RoundedButton/RoundedButton.js +45 -0
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +24 -0
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +101 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +48 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +348 -0
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +68 -0
- package/dist/shared/RoundedSelect/RoundedSelect.js +214 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +66 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +234 -0
- package/dist/shared/RoundedTextField/RoundedTextField.d.ts +45 -0
- package/dist/shared/RoundedTextField/RoundedTextField.js +175 -0
- package/dist/utils/CbrFunctions.d.ts +8 -0
- package/dist/utils/CbrFunctions.js +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
32
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
|
+
/* eslint-disable no-console */
|
|
34
|
+
import { useEffect, useState } from 'react';
|
|
35
|
+
import { Controller } from 'react-hook-form';
|
|
36
|
+
import CBRFormStepTypes from '../../../../../constants/CBRFormStepTypes';
|
|
37
|
+
import IncidentComponent from './Incident/Incident';
|
|
38
|
+
import styles from './MaterialCBRIncidentsStep.module.css';
|
|
39
|
+
import { nanoid } from 'nanoid';
|
|
40
|
+
import RoundedButton from '../../../../../shared/RoundedButton/RoundedButton';
|
|
41
|
+
function Incidents(_a) {
|
|
42
|
+
var step = _a.step, form = _a.form, btnRef = _a.btnRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, incidents = _a.incidents, formStyle = _a.formStyle, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "btnRef", "editable", "postview", "onChange", "incidents", "formStyle", "dependencyStore", "setDependencyStore"]);
|
|
43
|
+
/** Form to pass down with aditional steps */
|
|
44
|
+
var _b = useState(__assign(__assign({}, form), { steps: __assign({}, form.steps) })), localForm = _b[0], setLocalForm = _b[1];
|
|
45
|
+
var _c = useState(false), firstRender = _c[0], setFirstRender = _c[1];
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
setFirstRender(true);
|
|
48
|
+
}, []);
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (firstRender && incidents.length === 0 && !postview && editable) {
|
|
51
|
+
handleAddIncident();
|
|
52
|
+
}
|
|
53
|
+
}, [firstRender]);
|
|
54
|
+
var handleAddIncident = function () {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
var current = incidents.filter(function (incident) { return !incident.deleted; });
|
|
57
|
+
var newIncident = {
|
|
58
|
+
idSpaceStep: CBRFormStepTypes.CBR_TIPO_ESPACIO + '-' + nanoid(),
|
|
59
|
+
idCommentStep: CBRFormStepTypes.CBR_COMENTARIO + '-' + nanoid(),
|
|
60
|
+
idElementStep: CBRFormStepTypes.CBR_LOCATIVAS + '-' + nanoid(),
|
|
61
|
+
num: current.length + 1,
|
|
62
|
+
};
|
|
63
|
+
var newSteps = __assign({}, localForm.steps);
|
|
64
|
+
newSteps[newIncident.idSpaceStep] = __assign(__assign({}, step.spaceStep), { id: newIncident.idSpaceStep, type: CBRFormStepTypes.CBR_TIPO_ESPACIO, dependencies: step.dependencies });
|
|
65
|
+
newSteps[newIncident.idCommentStep] = __assign(__assign({}, step.commentStep), { id: newIncident.idCommentStep, type: CBRFormStepTypes.CBR_COMENTARIO });
|
|
66
|
+
var deps = __assign({}, dependencyStore);
|
|
67
|
+
addRecursiveElementStep(newIncident.idElementStep, step.elementStep, null, newSteps, deps, (_b = (_a = step.dependencies) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
|
|
68
|
+
onChange(__spreadArray(__spreadArray([], incidents, true), [newIncident], false));
|
|
69
|
+
setLocalForm(__assign(__assign({}, localForm), { steps: newSteps }));
|
|
70
|
+
setDependencyStore(deps);
|
|
71
|
+
};
|
|
72
|
+
var addRecursiveElementStep = function (idStep, step, idParent, steps, dependencyStore, idProjectDep) {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
var idSubStep = CBRFormStepTypes.CBR_LOCATIVAS + '-' + nanoid();
|
|
75
|
+
var newSubStep = step.subStep ? __assign({}, step.subStep) : undefined;
|
|
76
|
+
var newStep = __assign(__assign({}, step), { id: idStep, type: CBRFormStepTypes.CBR_LOCATIVAS, dependencies: [idProjectDep], subStep: null });
|
|
77
|
+
if (newSubStep) {
|
|
78
|
+
newStep.subStep = idSubStep;
|
|
79
|
+
}
|
|
80
|
+
if (idParent) {
|
|
81
|
+
dependencyStore[idParent] = null;
|
|
82
|
+
(_b = (_a = newStep.dependencies) === null || _a === void 0 ? void 0 : _a.push) === null || _b === void 0 ? void 0 : _b.call(_a, idParent);
|
|
83
|
+
}
|
|
84
|
+
steps[idStep] = newStep;
|
|
85
|
+
if (newSubStep) {
|
|
86
|
+
addRecursiveElementStep(idSubStep, newSubStep, idStep, steps, dependencyStore, idProjectDep);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.label })), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
|
|
90
|
+
margin: step.description
|
|
91
|
+
? '10px 0px'
|
|
92
|
+
: '0px 0px 5px 0px',
|
|
93
|
+
} }, { children: step.description }))), incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, formStyle: formStyle, step: step, form: localForm, editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
|
|
94
|
+
var tempIncidents = __spreadArray([], incidents, true);
|
|
95
|
+
tempIncidents[index].deleted = true;
|
|
96
|
+
var n = 1;
|
|
97
|
+
for (var _i = 0, tempIncidents_1 = tempIncidents; _i < tempIncidents_1.length; _i++) {
|
|
98
|
+
var inc = tempIncidents_1[_i];
|
|
99
|
+
if (!inc.deleted) {
|
|
100
|
+
inc.num = n;
|
|
101
|
+
n++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
onChange(tempIncidents);
|
|
105
|
+
} }, others), index)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: styles.hiddenInput }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
106
|
+
if (editable && !postview) {
|
|
107
|
+
handleAddIncident();
|
|
108
|
+
}
|
|
109
|
+
} })] }))] })));
|
|
110
|
+
}
|
|
111
|
+
function CBRIncidentsStep(props) {
|
|
112
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: [], rules: {
|
|
113
|
+
required: props.step.required
|
|
114
|
+
? 'Este campo es obligatorio'
|
|
115
|
+
: undefined,
|
|
116
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
117
|
+
var _b = _a.field, ref = _b.ref, value = _b.value, field = __rest(_b, ["ref", "value"]);
|
|
118
|
+
return (_jsx(Incidents, __assign({}, props, field, { incidents: value, onChange: field.onChange, btnRef: ref })));
|
|
119
|
+
} }));
|
|
120
|
+
}
|
|
121
|
+
export default CBRIncidentsStep;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: calc(100% - 20px);
|
|
5
|
+
max-width: calc(100% - 20px);
|
|
6
|
+
padding: 5px 10px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.titleLbl {
|
|
10
|
+
font-size: 24px;
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
text-overflow: ellipsis;
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.descriptionPar {
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
white-space: pre-wrap;
|
|
21
|
+
cursor: default;
|
|
22
|
+
}
|
|
23
|
+
.btnContainer {
|
|
24
|
+
margin-top: 15px;
|
|
25
|
+
margin-left: 15px;
|
|
26
|
+
margin-bottom: 3px;
|
|
27
|
+
width: fit-content;
|
|
28
|
+
}
|
|
29
|
+
.hiddenInput {
|
|
30
|
+
height: 0;
|
|
31
|
+
width: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
border-width: 0;
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StepProps } from '../../Step';
|
|
3
|
+
import { CBRPropertyStep } from '../../../../@Types/CBRFormStep';
|
|
4
|
+
export interface PropertyRendererProps extends Omit<StepProps, 'step'> {
|
|
5
|
+
step: CBRPropertyStep;
|
|
6
|
+
}
|
|
7
|
+
declare function CBRPropertyStepComponent(props: PropertyRendererProps): JSX.Element;
|
|
8
|
+
export default CBRPropertyStepComponent;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import styles from './CBRPropertyStep.module.css';
|
|
50
|
+
import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
|
|
51
|
+
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
52
|
+
import WarningRoundedIcon from '@material-ui/icons/WarningRounded';
|
|
53
|
+
import axios from 'axios';
|
|
54
|
+
import React, { useState } from 'react';
|
|
55
|
+
import { Dialog } from '@material-ui/core';
|
|
56
|
+
import RoundedButton from '../../../../shared/RoundedButton/RoundedButton';
|
|
57
|
+
import InputIcon from '../../../../shared/InputIcon/InputIcon';
|
|
58
|
+
var baseUrl = "https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/");
|
|
59
|
+
function CBRPropertyStepComponent(props) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
var _a = useState(undefined), showWarning = _a[0], setShowWarning = _a[1];
|
|
62
|
+
var getInmueblesOptions = function (_a, step, dependencyStore) {
|
|
63
|
+
var idOrganization = _a.idOrganization;
|
|
64
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
65
|
+
var idProyecto, idMacroProyecto;
|
|
66
|
+
var _b, _c;
|
|
67
|
+
return __generator(this, function (_d) {
|
|
68
|
+
switch (_d.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
71
|
+
idProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.id;
|
|
72
|
+
idMacroProyecto = (_c = dependencyStore[step.dependencies[0]]) === null || _c === void 0 ? void 0 : _c.idMacroProyecto;
|
|
73
|
+
if (!idProyecto) {
|
|
74
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
75
|
+
}
|
|
76
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
77
|
+
'Inmuebles?idMacro=' +
|
|
78
|
+
idMacroProyecto +
|
|
79
|
+
'&idProyecto=' +
|
|
80
|
+
idProyecto +
|
|
81
|
+
'&idOrganization=' +
|
|
82
|
+
idOrganization)];
|
|
83
|
+
case 1: return [2 /*return*/, (_d.sent()).data];
|
|
84
|
+
case 2: return [2 /*return*/, null];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return (_jsxs(React.Fragment, { children: [_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(InputIcon, { icon: 'PROPERTY' }), getOptionSelected: function (option, value) {
|
|
90
|
+
return option.id === value.id;
|
|
91
|
+
}, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, getValueWarning: props.step.validation
|
|
92
|
+
? function (value) {
|
|
93
|
+
if (value &&
|
|
94
|
+
value.entrega !== undefined &&
|
|
95
|
+
props.step.validation) {
|
|
96
|
+
var date = new Date(value.entrega);
|
|
97
|
+
var today = new Date();
|
|
98
|
+
var time = today.getTime() - date.getTime();
|
|
99
|
+
var days = time / (1000 * 3600 * 24);
|
|
100
|
+
if (days > props.step.validation.maxDays) {
|
|
101
|
+
return props.step.validation.message;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
: undefined, changeListener: props.step.validation
|
|
107
|
+
? function (value) {
|
|
108
|
+
if (value &&
|
|
109
|
+
value.entrega !== undefined &&
|
|
110
|
+
props.step.validation) {
|
|
111
|
+
var date = new Date(value.entrega);
|
|
112
|
+
var today = new Date();
|
|
113
|
+
var time = today.getTime() - date.getTime();
|
|
114
|
+
var days = time / (1000 * 3600 * 24);
|
|
115
|
+
if (days > props.step.validation.maxDays) {
|
|
116
|
+
setShowWarning(new Date(date.getTime() +
|
|
117
|
+
(props.step.validation
|
|
118
|
+
.maxDays +
|
|
119
|
+
1) *
|
|
120
|
+
1000 *
|
|
121
|
+
3600 *
|
|
122
|
+
24));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
: undefined, getOptions: getInmueblesOptions })), showWarning !== undefined && (_jsx(Dialog, __assign({ PaperProps: {
|
|
127
|
+
style: {
|
|
128
|
+
borderRadius: '20px',
|
|
129
|
+
maxWidth: '100vw',
|
|
130
|
+
boxSizing: 'content-box',
|
|
131
|
+
},
|
|
132
|
+
}, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: props.formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
|
|
133
|
+
setShowWarning(undefined);
|
|
134
|
+
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.warningContainer, style: { color: props.formStyle.primaryColor } }, { children: _jsx(WarningRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }) })), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa", ' ', showWarning.toLocaleDateString(), "."] })), _jsx("div", __assign({ className: styles.btnContainer }, { children: _jsx(RoundedButton, { text: 'Continuar', color: props.formStyle.primaryContrastColor, backgroundColor: props.formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
135
|
+
setShowWarning(undefined);
|
|
136
|
+
} }) }))] }))] })) })))] }));
|
|
137
|
+
}
|
|
138
|
+
export default CBRPropertyStepComponent;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.confirmationContainer {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
max-height: 80vh;
|
|
6
|
+
max-width: 80vw;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.container {
|
|
11
|
+
max-height: 100%;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
overflow-y: auto;
|
|
16
|
+
}
|
|
17
|
+
.confirmationContainer,
|
|
18
|
+
.confirmationContainer *,
|
|
19
|
+
.confirmationContainer *::after,
|
|
20
|
+
.confirmationContainer *::before {
|
|
21
|
+
-webkit-box-sizing: content-box;
|
|
22
|
+
-moz-box-sizing: content-box;
|
|
23
|
+
box-sizing: content-box;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.warningContainer {
|
|
27
|
+
margin-left: auto;
|
|
28
|
+
margin-right: auto;
|
|
29
|
+
padding-top: 30px;
|
|
30
|
+
height: fit-content;
|
|
31
|
+
margin-bottom: 15px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.messageContainer {
|
|
35
|
+
margin-top: 5px;
|
|
36
|
+
margin-left: 20px;
|
|
37
|
+
margin-right: 20px;
|
|
38
|
+
font-size: 1.2rem;
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.btnContainer {
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
margin-right: auto;
|
|
45
|
+
margin-top: 30px;
|
|
46
|
+
margin-bottom: 20px;
|
|
47
|
+
}
|
|
48
|
+
.closeIcon {
|
|
49
|
+
right: 15px;
|
|
50
|
+
top: 10px;
|
|
51
|
+
font-size: 26px;
|
|
52
|
+
position: absolute;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AYFFormStep } from '../../@Types/AYFFormStep';
|
|
3
|
+
import { StepProps } from './Step';
|
|
4
|
+
interface AYFStepProps extends Omit<StepProps, 'step'> {
|
|
5
|
+
step: AYFFormStep;
|
|
6
|
+
}
|
|
7
|
+
export interface StepOptions {
|
|
8
|
+
id: string | number;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
declare function AYFStepMapper(props: AYFStepProps): JSX.Element;
|
|
12
|
+
export default AYFStepMapper;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import AYFFormStepTypes from '../../constants/AYFFormStepTypes';
|
|
50
|
+
import TextInputStep from './TextInputStep/TextInputStep';
|
|
51
|
+
import SmartSelectStep from './SmartSelectStep/SmartSelectStep';
|
|
52
|
+
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
53
|
+
import LocationOnRoundedIcon from '@material-ui/icons/LocationOnRounded';
|
|
54
|
+
import DescriptionIcon from '@material-ui/icons/Description';
|
|
55
|
+
import DatePickerStep from './DatePickerStep/DatePickerStep';
|
|
56
|
+
import axios from 'axios';
|
|
57
|
+
var baseUrl = "https://api.integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/ayf/");
|
|
58
|
+
function AYFStepMapper(props) {
|
|
59
|
+
var _this = this;
|
|
60
|
+
var getMonths = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
return [2 /*return*/, [
|
|
63
|
+
{ id: '1', label: 'Enero' },
|
|
64
|
+
{ id: '2', label: 'Febrero' },
|
|
65
|
+
{ id: '3', label: 'Marzo' },
|
|
66
|
+
{ id: '4', label: 'Abril' },
|
|
67
|
+
{ id: '5', label: 'Mayo' },
|
|
68
|
+
{ id: '6', label: 'Junio' },
|
|
69
|
+
{ id: '7', label: 'Julio' },
|
|
70
|
+
{ id: '8', label: 'Agosto' },
|
|
71
|
+
{ id: '9', label: 'Septiembre' },
|
|
72
|
+
{ id: '10', label: 'Octubre' },
|
|
73
|
+
{ id: '11', label: 'Noviembre ' },
|
|
74
|
+
{ id: '12', label: 'Diciembre' },
|
|
75
|
+
]];
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
var getCiudadesOptions = function (_a, step, dependencyStore) {
|
|
79
|
+
var idOrganization = _a.idOrganization, mainCity = _a.mainCity;
|
|
80
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
81
|
+
var nit, params, _i, _b, dep, value, error_1;
|
|
82
|
+
var _c, _d;
|
|
83
|
+
return __generator(this, function (_e) {
|
|
84
|
+
switch (_e.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
nit = dependencyStore[step.idNitStep];
|
|
87
|
+
if (!nit) {
|
|
88
|
+
return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
|
|
89
|
+
}
|
|
90
|
+
params = new URLSearchParams({
|
|
91
|
+
idOrganization: idOrganization,
|
|
92
|
+
idCompany: nit,
|
|
93
|
+
nit: 'true',
|
|
94
|
+
});
|
|
95
|
+
for (_i = 0, _b = (_c = step.dependencies) !== null && _c !== void 0 ? _c : []; _i < _b.length; _i++) {
|
|
96
|
+
dep = _b[_i];
|
|
97
|
+
value = dependencyStore[dep];
|
|
98
|
+
if (value && dep.startsWith('AYF')) {
|
|
99
|
+
switch ((_d = dep.split('-')) === null || _d === void 0 ? void 0 : _d[0]) {
|
|
100
|
+
case AYFFormStepTypes.AYF_START_MONTH:
|
|
101
|
+
params.set('startMonth', value.id);
|
|
102
|
+
break;
|
|
103
|
+
case AYFFormStepTypes.AYF_END_MONTH:
|
|
104
|
+
params.set('endMonth', value.id);
|
|
105
|
+
break;
|
|
106
|
+
case AYFFormStepTypes.AYF_YEAR:
|
|
107
|
+
params.set('year', value);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_e.label = 1;
|
|
115
|
+
case 1:
|
|
116
|
+
_e.trys.push([1, 3, , 4]);
|
|
117
|
+
return [4 /*yield*/, axios.get(baseUrl + 'CiudadesICA?' + params.toString())];
|
|
118
|
+
case 2: return [2 /*return*/, (_e.sent()).data];
|
|
119
|
+
case 3:
|
|
120
|
+
error_1 = _e.sent();
|
|
121
|
+
return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
|
|
122
|
+
case 4: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
switch (props.step.type) {
|
|
128
|
+
case AYFFormStepTypes.AYF_START_MONTH:
|
|
129
|
+
case AYFFormStepTypes.AYF_END_MONTH:
|
|
130
|
+
return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, getOptions: getMonths, getOptionSelected: function (option, value) {
|
|
131
|
+
return option.id === value.id;
|
|
132
|
+
}, defaultValue: props.step.type === AYFFormStepTypes.AYF_START_MONTH
|
|
133
|
+
? { id: '1', label: 'Enero' }
|
|
134
|
+
: { id: '12', label: 'Diciembre' }, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, icon: _jsx(CalendarTodayRoundedIcon, { fontSize: "inherit", style: {
|
|
135
|
+
color: '#757575',
|
|
136
|
+
fontSize: 20,
|
|
137
|
+
marginRight: 4,
|
|
138
|
+
marginTop: 2,
|
|
139
|
+
} }) })));
|
|
140
|
+
case AYFFormStepTypes.AYF_YEAR:
|
|
141
|
+
return (_jsx(TextInputStep, __assign({}, props, { step: props.step, defaultValue: new Date().getFullYear().toString() })));
|
|
142
|
+
case AYFFormStepTypes.AYF_BILL_NUM:
|
|
143
|
+
return (_jsx(TextInputStep, __assign({}, props, { step: props.step, icon: _jsx(DescriptionIcon, { style: { color: '#757575', fontSize: 23 } }) })));
|
|
144
|
+
case AYFFormStepTypes.AYF_CUT_OFF_DATE:
|
|
145
|
+
return (_jsx(DatePickerStep, __assign({}, props, { step: props.step, defaultValue: new Date() })));
|
|
146
|
+
case AYFFormStepTypes.AYF_ICA_CITY:
|
|
147
|
+
return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, getOptions: getCiudadesOptions, getOptionSelected: function (option, value) {
|
|
148
|
+
return option === value;
|
|
149
|
+
}, getValueString: function (value) { return value; }, calcInvalidDeps: function (step, depStore) {
|
|
150
|
+
var _a;
|
|
151
|
+
var missingDeps = [];
|
|
152
|
+
for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
|
|
153
|
+
var idDep = _b[_i];
|
|
154
|
+
if (depStore[idDep] === null) {
|
|
155
|
+
missingDeps.push(idDep);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return missingDeps;
|
|
159
|
+
}, icon: _jsx(LocationOnRoundedIcon, { fill: "#757575", style: {
|
|
160
|
+
display: 'flex',
|
|
161
|
+
height: 23,
|
|
162
|
+
width: 23,
|
|
163
|
+
marginRight: 3,
|
|
164
|
+
marginTop: 1,
|
|
165
|
+
} }) })));
|
|
166
|
+
default:
|
|
167
|
+
return _jsx("div", {});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export default AYFStepMapper;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CBRFormStep } from '../../@Types/CBRFormStep';
|
|
3
|
+
import { StepProps } from './Step';
|
|
4
|
+
interface CBRStepProps extends Omit<StepProps, 'step'> {
|
|
5
|
+
step: CBRFormStep;
|
|
6
|
+
}
|
|
7
|
+
export interface StepOptions {
|
|
8
|
+
id: string | number;
|
|
9
|
+
label: string;
|
|
10
|
+
idMacroProyecto?: number;
|
|
11
|
+
}
|
|
12
|
+
declare function CBRStepMapper(props: CBRStepProps): JSX.Element;
|
|
13
|
+
export default CBRStepMapper;
|