@isettingkit/business-rules 0.1.30 → 0.1.32
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/index.es.js +362 -361
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ValueDataType as
|
|
3
|
-
import { Stack as
|
|
1
|
+
import { jsxs as u, Fragment as E, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ValueDataType as k, ValueHowToSetUp as b, DecisionConditionRender as $ } from "@isettingkit/input";
|
|
3
|
+
import { Stack as d } from "@inubekit/stack";
|
|
4
4
|
import { Divider as w } from "@inubekit/divider";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { useState as
|
|
5
|
+
import { Button as z } from "@inubekit/button";
|
|
6
|
+
import { useState as N, useEffect as te } from "react";
|
|
7
7
|
import { Text as x } from "@inubekit/text";
|
|
8
|
-
import { Date as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { Toggle as
|
|
8
|
+
import { Date as q } from "@inubekit/date";
|
|
9
|
+
import { Checkbox as re } from "@inubekit/checkbox";
|
|
10
|
+
import { Toggle as B } from "@inubekit/toggle";
|
|
11
11
|
import { inube as v } from "@inubekit/foundations";
|
|
12
|
-
import g, { keyframes as
|
|
13
|
-
import { useFormik as
|
|
14
|
-
import { mixed as
|
|
12
|
+
import g, { keyframes as ae } from "styled-components";
|
|
13
|
+
import { useFormik as ne } from "formik";
|
|
14
|
+
import { mixed as P, object as L, number as R, string as I, date as M, lazy as H } from "yup";
|
|
15
15
|
import { DecisionViewConditionRenderer as _ } from "@isettingkit/view";
|
|
16
|
-
import { SkeletonLine as
|
|
17
|
-
import { MdOutlineDelete as
|
|
18
|
-
import { Icon as
|
|
19
|
-
import { createPortal as
|
|
20
|
-
import { Blanket as
|
|
21
|
-
import { Grid as
|
|
22
|
-
import { useMediaQuery as
|
|
23
|
-
const
|
|
16
|
+
import { SkeletonLine as T } from "@inubekit/skeleton";
|
|
17
|
+
import { MdOutlineDelete as oe, MdClear as ie, MdAdd as de } from "react-icons/md";
|
|
18
|
+
import { Icon as Q } from "@inubekit/icon";
|
|
19
|
+
import { createPortal as le } from "react-dom";
|
|
20
|
+
import { Blanket as se } from "@inubekit/blanket";
|
|
21
|
+
import { Grid as ce } from "@inubekit/grid";
|
|
22
|
+
import { useMediaQuery as ue } from "@inubekit/hooks";
|
|
23
|
+
const he = (e) => {
|
|
24
24
|
const {
|
|
25
25
|
onHandleStartChange: t,
|
|
26
|
-
onHandleEndChange:
|
|
27
|
-
onCheckClosedChange:
|
|
28
|
-
labelStart:
|
|
29
|
-
labelEnd:
|
|
30
|
-
checkedClosed:
|
|
31
|
-
required:
|
|
32
|
-
valueStart:
|
|
33
|
-
valueEnd:
|
|
26
|
+
onHandleEndChange: n,
|
|
27
|
+
onCheckClosedChange: o,
|
|
28
|
+
labelStart: l,
|
|
29
|
+
labelEnd: a,
|
|
30
|
+
checkedClosed: s = !1,
|
|
31
|
+
required: c = !1,
|
|
32
|
+
valueStart: h = "",
|
|
33
|
+
valueEnd: i = "",
|
|
34
34
|
messageStart: m = "",
|
|
35
35
|
messageEnd: p = "",
|
|
36
36
|
statusStart: f = "pending",
|
|
37
|
-
statusEnd:
|
|
38
|
-
} = e, [
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */ r(
|
|
37
|
+
statusEnd: S = "pending"
|
|
38
|
+
} = e, [A, J] = N(s), [K, X] = N(h), [Z, ee] = N(i);
|
|
39
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
40
|
+
/* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
41
|
+
/* @__PURE__ */ r(d, { children: /* @__PURE__ */ r(
|
|
42
42
|
x,
|
|
43
43
|
{
|
|
44
44
|
appearance: "gray",
|
|
@@ -50,65 +50,65 @@ const ue = (e) => {
|
|
|
50
50
|
}
|
|
51
51
|
) }),
|
|
52
52
|
/* @__PURE__ */ r(
|
|
53
|
-
|
|
53
|
+
d,
|
|
54
54
|
{
|
|
55
55
|
alignContent: "center",
|
|
56
56
|
justifyContent: "center",
|
|
57
57
|
wrap: "wrap",
|
|
58
58
|
gap: "4px",
|
|
59
59
|
children: /* @__PURE__ */ r(
|
|
60
|
-
|
|
60
|
+
re,
|
|
61
61
|
{
|
|
62
62
|
label: "Cerrada",
|
|
63
63
|
onChange: ({ target: y }) => {
|
|
64
|
-
|
|
64
|
+
J(y.checked), o && o(y.checked);
|
|
65
65
|
},
|
|
66
|
-
checked:
|
|
66
|
+
checked: A,
|
|
67
67
|
value: ""
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
71
|
)
|
|
72
72
|
] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */ r(
|
|
75
|
-
|
|
73
|
+
/* @__PURE__ */ u(d, { justifyContent: "space-between", gap: "24px", children: [
|
|
74
|
+
/* @__PURE__ */ r(d, { width: "189px", children: /* @__PURE__ */ r(
|
|
75
|
+
q,
|
|
76
76
|
{
|
|
77
77
|
id: "dateStart",
|
|
78
|
-
label:
|
|
78
|
+
label: l,
|
|
79
79
|
onChange: (y) => {
|
|
80
|
-
|
|
80
|
+
X(y.target.value), t(y);
|
|
81
81
|
},
|
|
82
|
-
value:
|
|
83
|
-
required:
|
|
82
|
+
value: K,
|
|
83
|
+
required: c,
|
|
84
84
|
size: "compact",
|
|
85
85
|
status: f,
|
|
86
86
|
message: m
|
|
87
87
|
}
|
|
88
88
|
) }),
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
A && /* @__PURE__ */ r(d, { width: "189px", children: /* @__PURE__ */ r(
|
|
90
|
+
q,
|
|
91
91
|
{
|
|
92
92
|
id: "dateEnd",
|
|
93
|
-
label:
|
|
93
|
+
label: a,
|
|
94
94
|
onChange: (y) => {
|
|
95
|
-
|
|
95
|
+
ee(y.target.value), n(y);
|
|
96
96
|
},
|
|
97
|
-
value:
|
|
98
|
-
required:
|
|
97
|
+
value: Z,
|
|
98
|
+
required: c,
|
|
99
99
|
size: "compact",
|
|
100
|
-
status:
|
|
100
|
+
status: S,
|
|
101
101
|
message: p
|
|
102
102
|
}
|
|
103
103
|
) })
|
|
104
104
|
] })
|
|
105
105
|
] });
|
|
106
|
-
},
|
|
106
|
+
}, pe = g.div`
|
|
107
107
|
& > div {
|
|
108
108
|
border-radius: 8px;
|
|
109
109
|
border: 1px solid ${v.palette.neutral.N30};
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`, ge = g.div`
|
|
112
112
|
width: 100%;
|
|
113
113
|
height: 100%;
|
|
114
114
|
overflow-y: auto;
|
|
@@ -125,124 +125,121 @@ const ue = (e) => {
|
|
|
125
125
|
background-color: #ebecf0;
|
|
126
126
|
border-radius: 8px;
|
|
127
127
|
}
|
|
128
|
-
`,
|
|
128
|
+
`, me = (e) => {
|
|
129
129
|
const {
|
|
130
130
|
checked: t,
|
|
131
|
-
children:
|
|
132
|
-
handleToggleChange:
|
|
133
|
-
id:
|
|
134
|
-
labelToggle:
|
|
135
|
-
name:
|
|
136
|
-
valueToggle:
|
|
137
|
-
} = e, [
|
|
138
|
-
|
|
131
|
+
children: n,
|
|
132
|
+
handleToggleChange: o,
|
|
133
|
+
id: l,
|
|
134
|
+
labelToggle: a,
|
|
135
|
+
name: s,
|
|
136
|
+
valueToggle: c = ""
|
|
137
|
+
} = e, [h, i] = N(t), m = (p) => {
|
|
138
|
+
i(p.target.checked), o(p);
|
|
139
139
|
};
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
}, [t]), /* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */ r(
|
|
144
|
-
|
|
140
|
+
return te(() => {
|
|
141
|
+
i(t);
|
|
142
|
+
}, [t]), /* @__PURE__ */ u(E, { children: [
|
|
143
|
+
/* @__PURE__ */ r(d, { children: /* @__PURE__ */ r(
|
|
144
|
+
B,
|
|
145
145
|
{
|
|
146
|
-
checked:
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
146
|
+
checked: h,
|
|
147
|
+
id: l,
|
|
148
|
+
name: s,
|
|
149
149
|
onChange: m,
|
|
150
150
|
size: "small",
|
|
151
|
-
value:
|
|
152
|
-
children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children:
|
|
151
|
+
value: c,
|
|
152
|
+
children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: a })
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
|
|
155
|
+
h && /* @__PURE__ */ r(E, { children: n })
|
|
156
156
|
] });
|
|
157
|
-
},
|
|
158
|
-
schema:
|
|
157
|
+
}, be = (e) => ({
|
|
158
|
+
schema: P().test(
|
|
159
159
|
"isArrayOrString",
|
|
160
160
|
"Must be an array of strings/numbers or a single string",
|
|
161
161
|
(t) => Array.isArray(t) ? t.every(
|
|
162
|
-
(
|
|
162
|
+
(n) => typeof n == "string" || typeof n == "number"
|
|
163
163
|
) : typeof t == "string"
|
|
164
164
|
),
|
|
165
165
|
value: e
|
|
166
|
-
}),
|
|
167
|
-
schema:
|
|
166
|
+
}), fe = (e) => ({
|
|
167
|
+
schema: P().test(
|
|
168
168
|
"isArrayOrString",
|
|
169
169
|
"Must be an array of strings/numbers or a single string",
|
|
170
170
|
(t) => Array.isArray(t) ? t.every(
|
|
171
|
-
(
|
|
171
|
+
(n) => typeof n == "string" || typeof n == "number"
|
|
172
172
|
) : typeof t == "string"
|
|
173
173
|
),
|
|
174
174
|
value: e
|
|
175
|
-
}),
|
|
176
|
-
const t = (e == null ? void 0 : e.from) ?? 0,
|
|
175
|
+
}), xe = (e) => {
|
|
176
|
+
const t = (e == null ? void 0 : e.from) ?? 0, n = (e == null ? void 0 : e.to) ?? 0;
|
|
177
177
|
return {
|
|
178
|
-
schema:
|
|
179
|
-
from:
|
|
180
|
-
to:
|
|
178
|
+
schema: L({
|
|
179
|
+
from: R().required("Range From is required").max(n, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
180
|
+
to: R().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
181
|
+
"is-greater",
|
|
182
|
+
"To value must be greater than From value",
|
|
183
|
+
function(o) {
|
|
184
|
+
const { from: l } = this.parent;
|
|
185
|
+
return o > l;
|
|
186
|
+
}
|
|
187
|
+
)
|
|
181
188
|
}),
|
|
182
|
-
value: { from: t, to:
|
|
189
|
+
value: { from: t, to: n }
|
|
183
190
|
};
|
|
184
|
-
},
|
|
185
|
-
schema:
|
|
191
|
+
}, V = (e, t) => t === k.PERCENTAGE ? {
|
|
192
|
+
schema: R().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
186
193
|
value: e
|
|
187
194
|
} : {
|
|
188
|
-
schema:
|
|
195
|
+
schema: I().required("Required"),
|
|
189
196
|
value: e
|
|
190
|
-
},
|
|
191
|
-
schema:
|
|
197
|
+
}, ye = (e) => ({
|
|
198
|
+
schema: I().required("Required").test(
|
|
192
199
|
"non-empty",
|
|
193
200
|
"Value cannot be empty",
|
|
194
201
|
(t) => t != null && t.trim() !== ""
|
|
195
202
|
),
|
|
196
203
|
value: e
|
|
197
|
-
}),
|
|
198
|
-
[b.LIST_OF_VALUES]:
|
|
199
|
-
[b.LIST_OF_VALUES_MULTI]:
|
|
200
|
-
[b.RANGE]:
|
|
201
|
-
[b.GREATER_THAN]:
|
|
202
|
-
[b.LESS_THAN]:
|
|
203
|
-
[b.EQUAL]:
|
|
204
|
-
},
|
|
204
|
+
}), ve = {
|
|
205
|
+
[b.LIST_OF_VALUES]: be,
|
|
206
|
+
[b.LIST_OF_VALUES_MULTI]: fe,
|
|
207
|
+
[b.RANGE]: xe,
|
|
208
|
+
[b.GREATER_THAN]: V,
|
|
209
|
+
[b.LESS_THAN]: V,
|
|
210
|
+
[b.EQUAL]: V
|
|
211
|
+
}, O = (e) => ve[e] || ye;
|
|
205
212
|
function Ce({ decision: e, onSubmitEvent: t }) {
|
|
206
|
-
const
|
|
213
|
+
const n = {
|
|
207
214
|
name: e.name || "",
|
|
208
|
-
dataType: e.dataType ||
|
|
215
|
+
dataType: e.dataType || k.ALPHABETICAL,
|
|
209
216
|
valueUse: e.valueUse || "",
|
|
210
|
-
value: e.value ||
|
|
217
|
+
value: e.value || "",
|
|
211
218
|
startDate: e.startDate || "",
|
|
212
219
|
endDate: e.endDate || "",
|
|
213
220
|
toggleNone: !0,
|
|
214
221
|
conditions: {},
|
|
215
222
|
checkClosed: !1
|
|
216
|
-
},
|
|
217
|
-
name:
|
|
218
|
-
startDate:
|
|
219
|
-
endDate:
|
|
223
|
+
}, o = L({
|
|
224
|
+
name: I().required("Name is required"),
|
|
225
|
+
startDate: M().required("Start date is required"),
|
|
226
|
+
endDate: M().when("checkClosed", (s, c, { parent: h }) => (h == null ? void 0 : h.checkClosed) ? c.required("End date is required").test(
|
|
220
227
|
"is-after-startDate",
|
|
221
228
|
"End date must be greater than or equal to Start date",
|
|
222
229
|
function(m) {
|
|
223
230
|
const p = this.parent.startDate;
|
|
224
231
|
return !p || !m ? !0 : new Date(m) >= new Date(p);
|
|
225
232
|
}
|
|
226
|
-
) :
|
|
227
|
-
value:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"To value must be greater than From value",
|
|
232
|
-
function(l) {
|
|
233
|
-
const { from: o } = this.parent;
|
|
234
|
-
return l > o;
|
|
235
|
-
}
|
|
236
|
-
)
|
|
237
|
-
}).required("Range value is required"),
|
|
238
|
-
conditions: ae((l, { parent: o }) => {
|
|
239
|
-
var d, m;
|
|
240
|
-
return (o == null ? void 0 : o.toggleNone) && ((d = o == null ? void 0 : o.conditions) == null ? void 0 : d.length) > 0 ? E().shape({}) : E(
|
|
233
|
+
) : c.notRequired()),
|
|
234
|
+
value: H(() => O(l.values.valueUse)(l.values.value, l.values.dataType).schema),
|
|
235
|
+
conditions: H((s, { parent: c }) => {
|
|
236
|
+
var i, m;
|
|
237
|
+
return (c == null ? void 0 : c.toggleNone) && ((i = c == null ? void 0 : c.conditions) == null ? void 0 : i.length) > 0 ? L().shape({}) : L(
|
|
241
238
|
(m = e.conditions) == null ? void 0 : m.reduce(
|
|
242
239
|
(p, f) => {
|
|
243
|
-
if (
|
|
244
|
-
const
|
|
245
|
-
p[f.name] =
|
|
240
|
+
if (l.values.conditions[f.name] !== void 0) {
|
|
241
|
+
const S = O(f.valueUse);
|
|
242
|
+
p[f.name] = S(
|
|
246
243
|
f.value,
|
|
247
244
|
f.dataType
|
|
248
245
|
).schema;
|
|
@@ -253,135 +250,143 @@ function Ce({ decision: e, onSubmitEvent: t }) {
|
|
|
253
250
|
)
|
|
254
251
|
);
|
|
255
252
|
})
|
|
256
|
-
}),
|
|
257
|
-
initialValues:
|
|
258
|
-
validationSchema:
|
|
253
|
+
}), l = ne({
|
|
254
|
+
initialValues: n,
|
|
255
|
+
validationSchema: o,
|
|
259
256
|
validateOnBlur: !0,
|
|
260
|
-
onSubmit: (
|
|
261
|
-
var
|
|
262
|
-
const
|
|
257
|
+
onSubmit: (s) => {
|
|
258
|
+
var h;
|
|
259
|
+
const c = {
|
|
263
260
|
...e,
|
|
264
|
-
name:
|
|
265
|
-
dataType:
|
|
266
|
-
valueUse:
|
|
267
|
-
value:
|
|
268
|
-
startDate:
|
|
269
|
-
endDate:
|
|
270
|
-
conditions: (
|
|
271
|
-
...
|
|
272
|
-
value:
|
|
261
|
+
name: s.name,
|
|
262
|
+
dataType: s.dataType,
|
|
263
|
+
valueUse: s.valueUse,
|
|
264
|
+
value: s.value,
|
|
265
|
+
startDate: s.startDate,
|
|
266
|
+
endDate: s.endDate,
|
|
267
|
+
conditions: (h = e.conditions) == null ? void 0 : h.map((i) => ({
|
|
268
|
+
...i,
|
|
269
|
+
value: s.conditions[i.name]
|
|
273
270
|
}))
|
|
274
271
|
};
|
|
275
|
-
t(
|
|
272
|
+
t(c);
|
|
276
273
|
}
|
|
277
274
|
});
|
|
278
|
-
return { formik:
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
if (
|
|
282
|
-
|
|
275
|
+
return { formik: l, handleToggleNoneChange: (s) => {
|
|
276
|
+
var c;
|
|
277
|
+
l.setFieldValue("toggleNone", s), (c = e.conditions) == null || c.forEach((h) => {
|
|
278
|
+
if (s)
|
|
279
|
+
l.setFieldValue(`conditions.${h.name}`, void 0);
|
|
283
280
|
else {
|
|
284
|
-
const
|
|
285
|
-
|
|
281
|
+
const i = h.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
|
|
282
|
+
l.setFieldValue(`conditions.${h.name}`, i);
|
|
286
283
|
}
|
|
287
284
|
});
|
|
288
285
|
} };
|
|
289
286
|
}
|
|
290
287
|
const we = (e) => {
|
|
291
|
-
var
|
|
292
|
-
const { decision: t, onSubmitEvent:
|
|
288
|
+
var h;
|
|
289
|
+
const { decision: t, onSubmitEvent: n, textValues: o, onCancel: l } = e, { formik: a, handleToggleNoneChange: s } = Ce({
|
|
293
290
|
decision: t,
|
|
294
|
-
onSubmitEvent:
|
|
295
|
-
}),
|
|
291
|
+
onSubmitEvent: n
|
|
292
|
+
}), c = {
|
|
296
293
|
name: t.name,
|
|
297
294
|
valueUse: t.valueUse,
|
|
298
295
|
dataType: t.dataType,
|
|
299
296
|
possibleValue: t.possibleValue
|
|
300
297
|
};
|
|
301
|
-
return /* @__PURE__ */ r("form", { onSubmit:
|
|
302
|
-
|
|
303
|
-
condition:
|
|
304
|
-
formik:
|
|
298
|
+
return /* @__PURE__ */ r("form", { onSubmit: a.handleSubmit, children: /* @__PURE__ */ u(d, { direction: "column", gap: "24px", children: [
|
|
299
|
+
$({
|
|
300
|
+
condition: c,
|
|
301
|
+
formik: a,
|
|
305
302
|
isDecision: !0
|
|
306
303
|
}),
|
|
307
304
|
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
308
|
-
/* @__PURE__ */ r(
|
|
309
|
-
|
|
305
|
+
/* @__PURE__ */ r(pe, { children: /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ u(
|
|
306
|
+
d,
|
|
310
307
|
{
|
|
311
308
|
direction: "column",
|
|
312
309
|
padding: "6px 12px",
|
|
313
310
|
gap: "16px",
|
|
314
311
|
height: "272px",
|
|
315
312
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
313
|
+
/* @__PURE__ */ u(
|
|
314
|
+
d,
|
|
315
|
+
{
|
|
316
|
+
justifyContent: "space-between",
|
|
317
|
+
alignItems: "center",
|
|
318
|
+
gap: "64px",
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ r(x, { type: "title", size: "small", weight: "bold", appearance: "gray", children: o.factsThatConditionIt }),
|
|
321
|
+
/* @__PURE__ */ r(
|
|
322
|
+
B,
|
|
323
|
+
{
|
|
324
|
+
id: "toggleNone",
|
|
325
|
+
onChange: () => s(!a.values.toggleNone),
|
|
326
|
+
checked: a.values.toggleNone,
|
|
327
|
+
size: "small",
|
|
328
|
+
children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: o.none })
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ r(d, { direction: "column", gap: "20px", children: (h = t.conditions) == null ? void 0 : h.map((i) => /* @__PURE__ */ r(
|
|
335
|
+
me,
|
|
331
336
|
{
|
|
332
|
-
id: `toggle-${
|
|
333
|
-
name: `toggle.${
|
|
334
|
-
labelToggle:
|
|
335
|
-
checked: !
|
|
337
|
+
id: `toggle-${i.name}`,
|
|
338
|
+
name: `toggle.${i.name}`,
|
|
339
|
+
labelToggle: i.name,
|
|
340
|
+
checked: !a.values.toggleNone && a.values.conditions[i.name] !== void 0,
|
|
336
341
|
handleToggleChange: (m) => {
|
|
337
342
|
if (!m.target.checked)
|
|
338
|
-
|
|
339
|
-
`conditions.${
|
|
343
|
+
a.setFieldValue(
|
|
344
|
+
`conditions.${i.name}`,
|
|
340
345
|
void 0
|
|
341
|
-
),
|
|
342
|
-
`conditions.${
|
|
346
|
+
), a.setFieldTouched(
|
|
347
|
+
`conditions.${i.name}`,
|
|
343
348
|
!1,
|
|
344
349
|
!1
|
|
345
350
|
);
|
|
346
351
|
else {
|
|
347
|
-
const f =
|
|
348
|
-
|
|
349
|
-
`conditions.${
|
|
352
|
+
const f = i.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
|
|
353
|
+
a.setFieldValue(
|
|
354
|
+
`conditions.${i.name}`,
|
|
350
355
|
f
|
|
351
356
|
);
|
|
352
357
|
}
|
|
353
358
|
},
|
|
354
|
-
children:
|
|
359
|
+
children: $({ condition: i, formik: a })
|
|
355
360
|
},
|
|
356
|
-
|
|
361
|
+
i.name
|
|
357
362
|
)) })
|
|
358
363
|
]
|
|
359
364
|
}
|
|
360
365
|
) }) }),
|
|
361
366
|
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
362
367
|
/* @__PURE__ */ r(
|
|
363
|
-
|
|
368
|
+
he,
|
|
364
369
|
{
|
|
365
|
-
labelStart:
|
|
366
|
-
labelEnd:
|
|
367
|
-
valueStart:
|
|
368
|
-
valueEnd:
|
|
369
|
-
messageStart:
|
|
370
|
-
messageEnd:
|
|
371
|
-
statusStart:
|
|
372
|
-
statusEnd:
|
|
373
|
-
onHandleStartChange: (
|
|
374
|
-
onHandleEndChange: (
|
|
375
|
-
onCheckClosedChange: (
|
|
376
|
-
|
|
370
|
+
labelStart: o.termStart,
|
|
371
|
+
labelEnd: o.termEnd,
|
|
372
|
+
valueStart: a.values.startDate,
|
|
373
|
+
valueEnd: a.values.endDate,
|
|
374
|
+
messageStart: a.errors.startDate,
|
|
375
|
+
messageEnd: a.errors.endDate,
|
|
376
|
+
statusStart: a.touched.startDate ? a.errors.startDate ? "invalid" : "valid" : void 0,
|
|
377
|
+
statusEnd: a.touched.endDate ? a.errors.endDate ? "invalid" : "valid" : void 0,
|
|
378
|
+
onHandleStartChange: (i) => a.setFieldValue("startDate", i.target.value),
|
|
379
|
+
onHandleEndChange: (i) => a.setFieldValue("endDate", i.target.value),
|
|
380
|
+
onCheckClosedChange: (i) => {
|
|
381
|
+
a.setFieldValue("checkClosed", i), i && a.setFieldValue("endDate", "");
|
|
377
382
|
},
|
|
378
|
-
checkedClosed:
|
|
383
|
+
checkedClosed: a.values.checkClosed
|
|
379
384
|
}
|
|
380
385
|
),
|
|
381
386
|
/* @__PURE__ */ r(w, {}),
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */ r(
|
|
384
|
-
/* @__PURE__ */ r(
|
|
387
|
+
/* @__PURE__ */ u(d, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
388
|
+
/* @__PURE__ */ r(z, { appearance: "gray", onClick: l, children: o.cancel }),
|
|
389
|
+
/* @__PURE__ */ r(z, { type: "submit", children: o.confirm })
|
|
385
390
|
] })
|
|
386
391
|
] }) });
|
|
387
392
|
}, j = g.div`
|
|
@@ -389,7 +394,7 @@ const we = (e) => {
|
|
|
389
394
|
border-radius: 8px;
|
|
390
395
|
border: 1px solid ${v.palette.neutral.N30};
|
|
391
396
|
}
|
|
392
|
-
`,
|
|
397
|
+
`, G = g.div`
|
|
393
398
|
width: 100%;
|
|
394
399
|
height: 100%;
|
|
395
400
|
overflow-y: auto;
|
|
@@ -412,7 +417,7 @@ const we = (e) => {
|
|
|
412
417
|
to: e.to ?? ""
|
|
413
418
|
}), De = (e) => e.value, Ee = (e) => e.value, Ae = (e) => e.value;
|
|
414
419
|
var C = /* @__PURE__ */ ((e) => (e.EQUAL = "equal", e.GREATER_THAN = "greater_than", e.LESS_THAN = "less_than", e.LIST_OF_VALUES = "list_of_values", e.LIST_OF_VALUES_MULTI = "list_of_values_multi", e.RANGE = "range", e))(C || {});
|
|
415
|
-
const
|
|
420
|
+
const _e = (e) => e.value, Ne = {
|
|
416
421
|
[C.LIST_OF_VALUES]: ke,
|
|
417
422
|
[C.LIST_OF_VALUES_MULTI]: Se,
|
|
418
423
|
[C.RANGE]: Te,
|
|
@@ -420,29 +425,29 @@ const Ne = (e) => e.value, Re = {
|
|
|
420
425
|
[C.LESS_THAN]: Ee,
|
|
421
426
|
[C.EQUAL]: Ae
|
|
422
427
|
};
|
|
423
|
-
function
|
|
424
|
-
const t = e == null ? void 0 : e.value,
|
|
425
|
-
return
|
|
428
|
+
function D(e) {
|
|
429
|
+
const t = e == null ? void 0 : e.value, n = typeof t == "object" && t !== null && !Array.isArray(t), o = Ne[e == null ? void 0 : e.valueUse] || _e;
|
|
430
|
+
return n && o(t) || t || void 0;
|
|
426
431
|
}
|
|
427
|
-
const
|
|
428
|
-
const { decision: t, loading:
|
|
432
|
+
const Y = (e) => {
|
|
433
|
+
const { decision: t, loading: n = !1, textValues: o } = e, l = {
|
|
429
434
|
name: (t == null ? void 0 : t.name) || "",
|
|
430
435
|
dataType: (t == null ? void 0 : t.dataType) || "alphabetical",
|
|
431
|
-
value:
|
|
436
|
+
value: D(t),
|
|
432
437
|
valueUse: (t == null ? void 0 : t.valueUse) || "equal"
|
|
433
438
|
};
|
|
434
|
-
return !
|
|
435
|
-
t && /* @__PURE__ */ r(
|
|
439
|
+
return !n && t && o ? /* @__PURE__ */ u(d, { direction: "column", gap: "12px", children: [
|
|
440
|
+
t && /* @__PURE__ */ r(d, { direction: "column", alignItems: "center", children: /* @__PURE__ */ r(
|
|
436
441
|
_,
|
|
437
442
|
{
|
|
438
|
-
element:
|
|
439
|
-
valueData:
|
|
443
|
+
element: l,
|
|
444
|
+
valueData: D(l),
|
|
440
445
|
type: "decision"
|
|
441
446
|
}
|
|
442
447
|
) }, t.name),
|
|
443
448
|
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
444
|
-
/* @__PURE__ */ r(
|
|
445
|
-
|
|
449
|
+
/* @__PURE__ */ r(G, { children: /* @__PURE__ */ u(
|
|
450
|
+
d,
|
|
446
451
|
{
|
|
447
452
|
direction: "column",
|
|
448
453
|
gap: "12px",
|
|
@@ -457,103 +462,99 @@ const P = (e) => {
|
|
|
457
462
|
appearance: "dark",
|
|
458
463
|
weight: "bold",
|
|
459
464
|
textAlign: "center",
|
|
460
|
-
children:
|
|
465
|
+
children: o.factsThatConditionIt
|
|
461
466
|
}
|
|
462
467
|
),
|
|
463
|
-
t.conditions && t.conditions.map((
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
valueData: T(l)
|
|
474
|
-
}
|
|
475
|
-
) }) }, l.name);
|
|
476
|
-
}),
|
|
468
|
+
t.conditions && t.conditions.map((a) => a.hidden ? null : (console.log("condition: ", a), /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(d, { direction: "column", padding: "8px", children: /* @__PURE__ */ r(
|
|
469
|
+
_,
|
|
470
|
+
{
|
|
471
|
+
element: {
|
|
472
|
+
...a,
|
|
473
|
+
value: a.value
|
|
474
|
+
},
|
|
475
|
+
valueData: D(a)
|
|
476
|
+
}
|
|
477
|
+
) }) }, a.name))),
|
|
477
478
|
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ u(d, { direction: "column", gap: "12px", children: [
|
|
479
480
|
(t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */ r(
|
|
480
481
|
_,
|
|
481
482
|
{
|
|
482
483
|
element: {
|
|
483
|
-
name:
|
|
484
|
+
name: o.terms,
|
|
484
485
|
value: String(t.startDate),
|
|
485
486
|
valueUse: b.RANGE,
|
|
486
|
-
dataType:
|
|
487
|
+
dataType: k.DATE
|
|
487
488
|
},
|
|
488
|
-
valueData:
|
|
489
|
-
name:
|
|
489
|
+
valueData: D({
|
|
490
|
+
name: o.terms,
|
|
490
491
|
value: {
|
|
491
492
|
from: String(t.startDate),
|
|
492
493
|
to: String(t.endDate)
|
|
493
494
|
},
|
|
494
495
|
valueUse: b.RANGE,
|
|
495
|
-
dataType:
|
|
496
|
+
dataType: k.DATE
|
|
496
497
|
}),
|
|
497
498
|
type: "decision"
|
|
498
499
|
},
|
|
499
|
-
|
|
500
|
+
o.terms
|
|
500
501
|
),
|
|
501
502
|
(t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */ r(
|
|
502
503
|
_,
|
|
503
504
|
{
|
|
504
505
|
element: {
|
|
505
|
-
name:
|
|
506
|
+
name: o.terms,
|
|
506
507
|
value: String(t.startDate),
|
|
507
508
|
valueUse: b.EQUAL,
|
|
508
|
-
dataType:
|
|
509
|
+
dataType: k.DATE
|
|
509
510
|
},
|
|
510
|
-
valueData:
|
|
511
|
-
name:
|
|
511
|
+
valueData: D({
|
|
512
|
+
name: o.terms,
|
|
512
513
|
value: String(t.startDate),
|
|
513
514
|
valueUse: b.EQUAL,
|
|
514
|
-
dataType:
|
|
515
|
+
dataType: k.DATE
|
|
515
516
|
}),
|
|
516
517
|
type: "decision"
|
|
517
518
|
},
|
|
518
|
-
|
|
519
|
+
o.terms
|
|
519
520
|
)
|
|
520
521
|
] })
|
|
521
522
|
]
|
|
522
523
|
}
|
|
523
524
|
) })
|
|
524
|
-
] }) : /* @__PURE__ */
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */ r(
|
|
527
|
-
/* @__PURE__ */ r(
|
|
525
|
+
] }) : /* @__PURE__ */ u(d, { direction: "column", gap: "12px", children: [
|
|
526
|
+
/* @__PURE__ */ u(d, { direction: "column", alignItems: "center", gap: "4px", children: [
|
|
527
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
|
|
528
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "85px" })
|
|
528
529
|
] }, "loading"),
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ u(d, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
530
531
|
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
531
|
-
/* @__PURE__ */ r(
|
|
532
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "150px" })
|
|
532
533
|
] }),
|
|
533
|
-
/* @__PURE__ */ r(
|
|
534
|
-
|
|
534
|
+
/* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(
|
|
535
|
+
d,
|
|
535
536
|
{
|
|
536
537
|
direction: "column",
|
|
537
538
|
gap: "12px",
|
|
538
539
|
justifyContent: "space-between",
|
|
539
540
|
height: "203px",
|
|
540
|
-
children: Array.from({ length: 5 }).map((
|
|
541
|
-
|
|
541
|
+
children: Array.from({ length: 5 }).map((a, s) => /* @__PURE__ */ r(j, { children: /* @__PURE__ */ u(
|
|
542
|
+
d,
|
|
542
543
|
{
|
|
543
544
|
direction: "column",
|
|
544
545
|
gap: "12px",
|
|
545
546
|
alignItems: "start",
|
|
546
547
|
padding: "8px",
|
|
547
548
|
children: [
|
|
548
|
-
/* @__PURE__ */ r(
|
|
549
|
-
/* @__PURE__ */ r(
|
|
549
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
|
|
550
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "85px" })
|
|
550
551
|
]
|
|
551
552
|
}
|
|
552
|
-
) }, `condition-${
|
|
553
|
+
) }, `condition-${s}`))
|
|
553
554
|
}
|
|
554
555
|
) })
|
|
555
556
|
] });
|
|
556
|
-
},
|
|
557
|
+
}, Le = g.div`
|
|
557
558
|
border-radius: 8px;
|
|
558
559
|
border: 1px solid ${v.palette.neutral.N30};
|
|
559
560
|
box-sizing: border-box;
|
|
@@ -584,21 +585,21 @@ g.div`
|
|
|
584
585
|
border-radius: 8px;
|
|
585
586
|
}
|
|
586
587
|
`;
|
|
587
|
-
const
|
|
588
|
-
const { children: t, controls:
|
|
589
|
-
return /* @__PURE__ */ r(
|
|
588
|
+
const F = (e) => {
|
|
589
|
+
const { children: t, controls: n = !0, handleDelete: o, id: l } = e;
|
|
590
|
+
return /* @__PURE__ */ r(Le, { children: /* @__PURE__ */ u(d, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
590
591
|
t,
|
|
591
|
-
|
|
592
|
+
n && /* @__PURE__ */ u(E, { children: [
|
|
592
593
|
/* @__PURE__ */ r(w, {}),
|
|
593
|
-
/* @__PURE__ */ r(
|
|
594
|
-
|
|
594
|
+
/* @__PURE__ */ r(d, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ r(
|
|
595
|
+
Q,
|
|
595
596
|
{
|
|
596
597
|
cursorHover: !0,
|
|
597
598
|
appearance: "dark",
|
|
598
599
|
size: "24px",
|
|
599
|
-
icon: /* @__PURE__ */ r(
|
|
600
|
+
icon: /* @__PURE__ */ r(oe, {}),
|
|
600
601
|
onClick: () => {
|
|
601
|
-
|
|
602
|
+
o(l);
|
|
602
603
|
}
|
|
603
604
|
}
|
|
604
605
|
) })
|
|
@@ -609,10 +610,10 @@ const q = (e) => {
|
|
|
609
610
|
& > div {
|
|
610
611
|
padding: 24px 16px;
|
|
611
612
|
}
|
|
612
|
-
`,
|
|
613
|
+
`, Re = g.div`
|
|
613
614
|
background-color: ${({ theme: e }) => {
|
|
614
|
-
var t,
|
|
615
|
-
return ((
|
|
615
|
+
var t, n;
|
|
616
|
+
return ((n = (t = e == null ? void 0 : e.palette) == null ? void 0 : t.neutral) == null ? void 0 : n.N0) || v.palette.neutral.N0;
|
|
616
617
|
}};
|
|
617
618
|
max-width: 450px;
|
|
618
619
|
max-height: 90vh;
|
|
@@ -640,23 +641,23 @@ const q = (e) => {
|
|
|
640
641
|
background-color: #ebecf0;
|
|
641
642
|
border-radius: 8px;
|
|
642
643
|
}
|
|
643
|
-
`,
|
|
644
|
-
const { children: t, portalId:
|
|
645
|
-
if (!
|
|
644
|
+
`, Ue = (e) => {
|
|
645
|
+
const { children: t, portalId: n, onCloseModal: o, title: l } = e, a = document.getElementById(n);
|
|
646
|
+
if (!a)
|
|
646
647
|
throw new Error(
|
|
647
648
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
648
649
|
);
|
|
649
|
-
return
|
|
650
|
-
/* @__PURE__ */ r(Ve, { children: /* @__PURE__ */ r(
|
|
651
|
-
/* @__PURE__ */ r(
|
|
652
|
-
/* @__PURE__ */ r(x, { type: "title", size: "large", appearance: "dark", weight: "bold", children:
|
|
653
|
-
/* @__PURE__ */ r(
|
|
650
|
+
return le(
|
|
651
|
+
/* @__PURE__ */ r(Ve, { children: /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r(Re, { children: /* @__PURE__ */ u(d, { direction: "column", gap: "24px", children: [
|
|
652
|
+
/* @__PURE__ */ r(d, { direction: "column", gap: "24px", children: /* @__PURE__ */ u(d, { alignItems: "center", justifyContent: "space-between", children: [
|
|
653
|
+
/* @__PURE__ */ r(x, { type: "title", size: "large", appearance: "dark", weight: "bold", children: l }),
|
|
654
|
+
/* @__PURE__ */ r(ie, { size: "24px", cursor: "pointer", onClick: o })
|
|
654
655
|
] }) }),
|
|
655
656
|
t
|
|
656
657
|
] }) }) }) }),
|
|
657
|
-
|
|
658
|
+
a
|
|
658
659
|
);
|
|
659
|
-
},
|
|
660
|
+
}, Ie = ae`
|
|
660
661
|
from {
|
|
661
662
|
opacity: 0;
|
|
662
663
|
transform: translateY(20px);
|
|
@@ -665,11 +666,11 @@ const q = (e) => {
|
|
|
665
666
|
opacity: 1;
|
|
666
667
|
transform: translateY(0);
|
|
667
668
|
}
|
|
668
|
-
`,
|
|
669
|
+
`, W = g.div`
|
|
669
670
|
width: 100%;
|
|
670
671
|
height: 100%;
|
|
671
672
|
& > div {
|
|
672
|
-
animation: ${
|
|
673
|
+
animation: ${Ie} 600ms ease-out;
|
|
673
674
|
}
|
|
674
675
|
`;
|
|
675
676
|
g.div`
|
|
@@ -684,7 +685,7 @@ g.div`
|
|
|
684
685
|
height: 100%;
|
|
685
686
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
686
687
|
`;
|
|
687
|
-
const
|
|
688
|
+
const Fe = g.div`
|
|
688
689
|
& > div {
|
|
689
690
|
width: 100%;
|
|
690
691
|
height: 100%;
|
|
@@ -704,14 +705,14 @@ const qe = g.div`
|
|
|
704
705
|
border-radius: 8px;
|
|
705
706
|
}
|
|
706
707
|
}
|
|
707
|
-
`,
|
|
708
|
+
`, $e = g.div`
|
|
708
709
|
& > div > div {
|
|
709
710
|
border-radius: 8px;
|
|
710
711
|
border: 1px solid ${v.palette.neutral.N30};
|
|
711
712
|
box-sizing: border-box;
|
|
712
713
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
713
714
|
}
|
|
714
|
-
`,
|
|
715
|
+
`, ze = g.div`
|
|
715
716
|
& > div {
|
|
716
717
|
background-color: ${v.palette.neutral.N30};
|
|
717
718
|
justify-content: center;
|
|
@@ -727,130 +728,130 @@ g.div`
|
|
|
727
728
|
border: 1px solid ${v.palette.neutral.N30};
|
|
728
729
|
}
|
|
729
730
|
`;
|
|
730
|
-
function
|
|
731
|
+
function qe({
|
|
731
732
|
index: e,
|
|
732
733
|
handleOpenModal: t
|
|
733
734
|
}) {
|
|
734
735
|
return /* @__PURE__ */ r(
|
|
735
|
-
|
|
736
|
+
F,
|
|
736
737
|
{
|
|
737
738
|
id: `loading-card-${e}`,
|
|
738
739
|
handleDelete: () => {
|
|
739
740
|
},
|
|
740
741
|
handleView: () => t(),
|
|
741
742
|
controls: !1,
|
|
742
|
-
children: /* @__PURE__ */ r(
|
|
743
|
+
children: /* @__PURE__ */ r(Y, { loading: !0 })
|
|
743
744
|
},
|
|
744
745
|
`loading-card-${e}`
|
|
745
746
|
);
|
|
746
747
|
}
|
|
747
|
-
function
|
|
748
|
+
function Me({
|
|
748
749
|
decision: e,
|
|
749
750
|
controls: t,
|
|
750
|
-
handleOpenModal:
|
|
751
|
-
handleDelete:
|
|
752
|
-
textValues:
|
|
751
|
+
handleOpenModal: n,
|
|
752
|
+
handleDelete: o,
|
|
753
|
+
textValues: l
|
|
753
754
|
}) {
|
|
754
|
-
return e ? /* @__PURE__ */ r(
|
|
755
|
+
return e ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(d, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
|
|
755
756
|
/* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.id }),
|
|
756
757
|
/* @__PURE__ */ r(
|
|
757
|
-
|
|
758
|
+
F,
|
|
758
759
|
{
|
|
759
760
|
id: e.id,
|
|
760
|
-
handleDelete: () =>
|
|
761
|
-
handleView: () =>
|
|
761
|
+
handleDelete: () => o(e.id),
|
|
762
|
+
handleView: () => n(e),
|
|
762
763
|
controls: t,
|
|
763
|
-
children: /* @__PURE__ */ r(
|
|
764
|
+
children: /* @__PURE__ */ r(Y, { decision: e, textValues: l })
|
|
764
765
|
}
|
|
765
766
|
)
|
|
766
767
|
] }) }, e.id) : null;
|
|
767
768
|
}
|
|
768
|
-
function
|
|
769
|
+
function He({
|
|
769
770
|
index: e,
|
|
770
771
|
handleOpenModal: t
|
|
771
772
|
}) {
|
|
772
|
-
return /* @__PURE__ */ r(
|
|
773
|
+
return /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(d, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
|
|
773
774
|
/* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
|
|
774
|
-
/* @__PURE__ */ r(
|
|
775
|
-
|
|
775
|
+
/* @__PURE__ */ r(ze, { onClick: () => t(), children: /* @__PURE__ */ r(
|
|
776
|
+
F,
|
|
776
777
|
{
|
|
777
778
|
id: `add-decision-${e}`,
|
|
778
779
|
handleDelete: () => {
|
|
779
780
|
},
|
|
780
781
|
handleView: () => t(),
|
|
781
782
|
controls: !1,
|
|
782
|
-
children: /* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */ r(
|
|
783
|
+
children: /* @__PURE__ */ u(d, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
784
|
+
/* @__PURE__ */ r(Q, { appearance: "gray", icon: /* @__PURE__ */ r(de, {}), size: "35px" }),
|
|
784
785
|
/* @__PURE__ */ r(x, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
|
|
785
786
|
] })
|
|
786
787
|
}
|
|
787
788
|
) })
|
|
788
789
|
] }) }, `add-decision-${e}`);
|
|
789
790
|
}
|
|
790
|
-
const
|
|
791
|
-
loading:
|
|
792
|
-
decision:
|
|
793
|
-
add:
|
|
791
|
+
const Oe = {
|
|
792
|
+
loading: qe,
|
|
793
|
+
decision: Me,
|
|
794
|
+
add: He
|
|
794
795
|
};
|
|
795
|
-
function
|
|
796
|
-
const { type: t } = e,
|
|
797
|
-
return
|
|
796
|
+
function U(e) {
|
|
797
|
+
const { type: t } = e, n = Oe[t];
|
|
798
|
+
return n ? n(e) : null;
|
|
798
799
|
}
|
|
799
|
-
function
|
|
800
|
+
function je({
|
|
800
801
|
controls: e,
|
|
801
802
|
decisions: t,
|
|
802
|
-
loading:
|
|
803
|
-
handleOpenModal:
|
|
804
|
-
handleDelete:
|
|
805
|
-
textValues:
|
|
803
|
+
loading: n,
|
|
804
|
+
handleOpenModal: o,
|
|
805
|
+
handleDelete: l,
|
|
806
|
+
textValues: a
|
|
806
807
|
}) {
|
|
807
|
-
const
|
|
808
|
-
(
|
|
808
|
+
const s = n ? Array.from({ length: 3 }).map(
|
|
809
|
+
(h, i) => U({
|
|
809
810
|
type: "loading",
|
|
810
|
-
index:
|
|
811
|
+
index: i,
|
|
811
812
|
controls: e,
|
|
812
|
-
loading:
|
|
813
|
-
handleOpenModal:
|
|
814
|
-
handleDelete:
|
|
815
|
-
textValues:
|
|
813
|
+
loading: n,
|
|
814
|
+
handleOpenModal: o,
|
|
815
|
+
handleDelete: l,
|
|
816
|
+
textValues: a
|
|
816
817
|
})
|
|
817
818
|
) : t.map(
|
|
818
|
-
(
|
|
819
|
+
(h) => U({
|
|
819
820
|
type: "decision",
|
|
820
|
-
decision:
|
|
821
|
+
decision: h,
|
|
821
822
|
controls: e,
|
|
822
|
-
loading:
|
|
823
|
-
handleOpenModal:
|
|
824
|
-
handleDelete:
|
|
825
|
-
textValues:
|
|
823
|
+
loading: n,
|
|
824
|
+
handleOpenModal: o,
|
|
825
|
+
handleDelete: l,
|
|
826
|
+
textValues: a
|
|
826
827
|
})
|
|
827
|
-
),
|
|
828
|
-
return { renderedCards:
|
|
828
|
+
), c = (t.length === 0 || t.length < Math.floor(window.innerWidth / 300)) && !n && e;
|
|
829
|
+
return { renderedCards: s, shouldRenderAddCard: c };
|
|
829
830
|
}
|
|
830
831
|
const mt = (e) => {
|
|
831
832
|
const {
|
|
832
833
|
controls: t = !0,
|
|
833
|
-
decisions:
|
|
834
|
-
textValues:
|
|
835
|
-
decisionTemplate:
|
|
836
|
-
isModalOpen:
|
|
837
|
-
selectedDecision:
|
|
838
|
-
loading:
|
|
839
|
-
handleOpenModal:
|
|
840
|
-
handleCloseModal:
|
|
834
|
+
decisions: n,
|
|
835
|
+
textValues: o,
|
|
836
|
+
decisionTemplate: l,
|
|
837
|
+
isModalOpen: a,
|
|
838
|
+
selectedDecision: s,
|
|
839
|
+
loading: c,
|
|
840
|
+
handleOpenModal: h,
|
|
841
|
+
handleCloseModal: i,
|
|
841
842
|
handleSubmitForm: m,
|
|
842
843
|
handleDelete: p
|
|
843
|
-
} = e, f =
|
|
844
|
+
} = e, f = ue("(max-width: 681px)"), { renderedCards: S, shouldRenderAddCard: A } = je({
|
|
844
845
|
controls: t,
|
|
845
|
-
decisions:
|
|
846
|
-
loading:
|
|
847
|
-
handleOpenModal:
|
|
846
|
+
decisions: n,
|
|
847
|
+
loading: c,
|
|
848
|
+
handleOpenModal: h,
|
|
848
849
|
handleDelete: p,
|
|
849
|
-
textValues:
|
|
850
|
+
textValues: o
|
|
850
851
|
});
|
|
851
|
-
return /* @__PURE__ */
|
|
852
|
-
/* @__PURE__ */ r(
|
|
853
|
-
|
|
852
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
853
|
+
/* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ u(d, { direction: "column", gap: "16px", padding: "6px", children: [
|
|
854
|
+
n.length === 0 && !c && /* @__PURE__ */ u(x, { as: "span", type: "label", size: "large", appearance: "gray", children: [
|
|
854
855
|
"Aún no tienes definidas tasas de interés efectivas. Presiona",
|
|
855
856
|
/* @__PURE__ */ r(
|
|
856
857
|
x,
|
|
@@ -865,8 +866,8 @@ const mt = (e) => {
|
|
|
865
866
|
),
|
|
866
867
|
"para empezar."
|
|
867
868
|
] }),
|
|
868
|
-
/* @__PURE__ */
|
|
869
|
-
|
|
869
|
+
/* @__PURE__ */ u(
|
|
870
|
+
ce,
|
|
870
871
|
{
|
|
871
872
|
templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
872
873
|
autoFlow: "row dense",
|
|
@@ -878,33 +879,33 @@ const mt = (e) => {
|
|
|
878
879
|
padding: "6px",
|
|
879
880
|
height: f ? "auto" : "484px",
|
|
880
881
|
children: [
|
|
881
|
-
|
|
882
|
-
|
|
882
|
+
S,
|
|
883
|
+
A && U({
|
|
883
884
|
type: "add",
|
|
884
|
-
index:
|
|
885
|
+
index: n.length,
|
|
885
886
|
controls: t,
|
|
886
|
-
loading:
|
|
887
|
-
handleOpenModal:
|
|
887
|
+
loading: c,
|
|
888
|
+
handleOpenModal: h,
|
|
888
889
|
handleDelete: p,
|
|
889
|
-
textValues:
|
|
890
|
+
textValues: o
|
|
890
891
|
})
|
|
891
892
|
]
|
|
892
893
|
}
|
|
893
894
|
)
|
|
894
895
|
] }) }) }),
|
|
895
|
-
|
|
896
|
-
|
|
896
|
+
a && /* @__PURE__ */ r(
|
|
897
|
+
Ue,
|
|
897
898
|
{
|
|
898
899
|
portalId: "modal-portal",
|
|
899
|
-
onCloseModal:
|
|
900
|
-
title:
|
|
900
|
+
onCloseModal: i,
|
|
901
|
+
title: s ? "Editar Decisión" : "Nueva decisión",
|
|
901
902
|
children: /* @__PURE__ */ r(
|
|
902
903
|
we,
|
|
903
904
|
{
|
|
904
|
-
decision:
|
|
905
|
+
decision: s || l,
|
|
905
906
|
onSubmitEvent: m,
|
|
906
|
-
textValues:
|
|
907
|
-
onCancel: () =>
|
|
907
|
+
textValues: o,
|
|
908
|
+
onCancel: () => i()
|
|
908
909
|
}
|
|
909
910
|
)
|
|
910
911
|
}
|
|
@@ -912,9 +913,9 @@ const mt = (e) => {
|
|
|
912
913
|
] });
|
|
913
914
|
};
|
|
914
915
|
export {
|
|
915
|
-
|
|
916
|
-
|
|
916
|
+
F as BusinessRuleCard,
|
|
917
|
+
Y as BusinessRuleView,
|
|
917
918
|
mt as BusinessRules,
|
|
918
|
-
|
|
919
|
+
Ue as ModalRules,
|
|
919
920
|
we as RulesForm
|
|
920
921
|
};
|