@isettingkit/business-rules 0.2.1 → 1.0.0
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.d.ts +55 -12
- package/dist/index.es.js +955 -729
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,185 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
) : typeof e == "string"
|
|
25
|
-
),
|
|
26
|
-
value: t
|
|
27
|
-
}), fe = (t) => ({
|
|
28
|
-
schema: K().test(
|
|
29
|
-
"isArrayOrString",
|
|
30
|
-
"Must be an array of strings/numbers or a single string",
|
|
31
|
-
(e) => Array.isArray(e) ? e.every(
|
|
32
|
-
(n) => typeof n == "string" || typeof n == "number"
|
|
33
|
-
) : typeof e == "string"
|
|
34
|
-
),
|
|
35
|
-
value: t
|
|
36
|
-
}), ye = (t) => {
|
|
37
|
-
const e = (t == null ? void 0 : t.from) ?? 0, n = (t == null ? void 0 : t.to) ?? 0;
|
|
38
|
-
return {
|
|
39
|
-
schema: V({
|
|
40
|
-
from: _().required("Range From is required").max(n, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
41
|
-
to: _().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
42
|
-
"is-greater",
|
|
43
|
-
"To value must be greater than From value",
|
|
44
|
-
function(a) {
|
|
45
|
-
const { from: o } = this.parent;
|
|
46
|
-
return a > o;
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
}),
|
|
50
|
-
value: { from: e, to: n }
|
|
51
|
-
};
|
|
52
|
-
}, O = (t, e) => e === C.PERCENTAGE ? {
|
|
53
|
-
schema: _().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
54
|
-
value: t
|
|
55
|
-
} : {
|
|
56
|
-
schema: q().required("Required"),
|
|
57
|
-
value: t
|
|
58
|
-
};
|
|
59
|
-
var b = /* @__PURE__ */ ((t) => (t.EQUAL = "EqualTo", t.GREATER_THAN = "GreaterThan", t.LESS_THAN = "LessThan", t.LIST_OF_VALUES = "ListOfValues", t.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", t.RANGE = "Range", t))(b || {});
|
|
60
|
-
const ve = {
|
|
61
|
-
[b.LIST_OF_VALUES]: Te,
|
|
62
|
-
[b.LIST_OF_VALUES_MULTI]: fe,
|
|
63
|
-
[b.RANGE]: ye,
|
|
64
|
-
[b.GREATER_THAN]: O,
|
|
65
|
-
[b.LESS_THAN]: O,
|
|
66
|
-
[b.EQUAL]: O
|
|
67
|
-
}, Y = (t) => ve[t] || be;
|
|
68
|
-
function xe({ decision: t, onSubmitEvent: e }) {
|
|
69
|
-
const n = {
|
|
70
|
-
ruleName: t.ruleName || "",
|
|
71
|
-
decisionDataType: t.decisionDataType || C.ALPHABETICAL,
|
|
72
|
-
howToSetTheDecision: t.howToSetTheDecision || "",
|
|
73
|
-
value: t.value || "",
|
|
74
|
-
effectiveFrom: t.effectiveFrom || "",
|
|
75
|
-
validUntil: t.validUntil || "",
|
|
76
|
-
toggleNone: !0,
|
|
77
|
-
conditionsThatEstablishesTheDecision: {},
|
|
78
|
-
checkClosed: !1
|
|
79
|
-
}, a = V({
|
|
80
|
-
ruleName: q().required("Name is required"),
|
|
81
|
-
effectiveFrom: B().required("effective From date is required"),
|
|
82
|
-
validUntil: B().when(
|
|
83
|
-
"checkClosed",
|
|
84
|
-
(s, c, { parent: d }) => (d == null ? void 0 : d.checkClosed) ? c.required("valid Until date is required").test(
|
|
85
|
-
"is-after-startDate",
|
|
86
|
-
"valid Until date must be greater than or equal to Start date",
|
|
87
|
-
function(p) {
|
|
88
|
-
const l = this.parent.effectiveFrom;
|
|
89
|
-
return !l || !p ? !0 : new Date(p) >= new Date(l);
|
|
90
|
-
}
|
|
91
|
-
) : c.notRequired()
|
|
92
|
-
),
|
|
93
|
-
value: P(() => Y(
|
|
94
|
-
o.values.howToSetTheDecision
|
|
95
|
-
)(
|
|
96
|
-
o.values.value,
|
|
97
|
-
o.values.decisionDataType
|
|
98
|
-
).schema),
|
|
99
|
-
conditionsThatEstablishesTheDecision: P((s, { parent: c }) => {
|
|
100
|
-
var p;
|
|
101
|
-
if ((c == null ? void 0 : c.toggleNone) && Object.keys(c.conditionsThatEstablishesTheDecision || {}).length > 0) return V().shape({});
|
|
102
|
-
const h = (p = t.conditionsThatEstablishesTheDecision) == null ? void 0 : p.reduce(
|
|
103
|
-
(l, m) => {
|
|
104
|
-
if (o.values.conditionsThatEstablishesTheDecision[m.conditionName] !== void 0) {
|
|
105
|
-
const f = Y(
|
|
106
|
-
m.howToSetTheCondition
|
|
107
|
-
);
|
|
108
|
-
l[m.conditionName] = f(
|
|
109
|
-
m.value,
|
|
110
|
-
m.conditionDataType
|
|
111
|
-
).schema;
|
|
112
|
-
}
|
|
113
|
-
return l;
|
|
114
|
-
},
|
|
115
|
-
{}
|
|
116
|
-
);
|
|
117
|
-
return V(h).test(
|
|
118
|
-
"at-least-one-condition",
|
|
119
|
-
"It must be at least one condition in order for the decision to be validated correctly.",
|
|
120
|
-
(l) => l ? Object.values(l).some(
|
|
121
|
-
(m) => m != null && m !== ""
|
|
122
|
-
) : !1
|
|
123
|
-
);
|
|
124
|
-
})
|
|
125
|
-
}), o = le({
|
|
126
|
-
initialValues: n,
|
|
127
|
-
validationSchema: a,
|
|
128
|
-
validateOnBlur: !0,
|
|
129
|
-
onSubmit: (s) => {
|
|
130
|
-
var d;
|
|
131
|
-
const c = {
|
|
132
|
-
...t,
|
|
133
|
-
ruleName: s.ruleName,
|
|
134
|
-
decisionDataType: s.decisionDataType,
|
|
135
|
-
howToSetTheDecision: s.howToSetTheDecision,
|
|
136
|
-
value: s.value,
|
|
137
|
-
effectiveFrom: s.effectiveFrom,
|
|
138
|
-
validUntil: s.validUntil,
|
|
139
|
-
conditionsThatEstablishesTheDecision: (d = t.conditionsThatEstablishesTheDecision) == null ? void 0 : d.filter((h) => {
|
|
140
|
-
const p = s.conditionsThatEstablishesTheDecision[h.conditionName];
|
|
141
|
-
return p != null && p !== "";
|
|
142
|
-
}).map((h) => ({
|
|
143
|
-
...h,
|
|
144
|
-
value: s.conditionsThatEstablishesTheDecision[h.conditionName]
|
|
145
|
-
}))
|
|
146
|
-
};
|
|
147
|
-
e(c);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
return { formik: o, handleToggleNoneChange: (s) => {
|
|
151
|
-
var c;
|
|
152
|
-
o.setFieldValue("toggleNone", s), (c = t.conditionsThatEstablishesTheDecision) == null || c.forEach((d) => {
|
|
153
|
-
if (s)
|
|
154
|
-
o.setFieldValue(
|
|
155
|
-
`conditionsThatEstablishesTheDecision.${d.conditionName}`,
|
|
156
|
-
void 0
|
|
157
|
-
);
|
|
158
|
-
else {
|
|
159
|
-
const h = d.howToSetTheCondition === b.LIST_OF_VALUES_MULTI ? [] : "";
|
|
160
|
-
o.setFieldValue(
|
|
161
|
-
`conditionsThatEstablishesTheDecision.${d.conditionName}`,
|
|
162
|
-
h
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
} };
|
|
167
|
-
}
|
|
168
|
-
const De = T.div`
|
|
169
|
-
& > div {
|
|
170
|
-
border-radius: 8px;
|
|
171
|
-
border: 1px solid
|
|
172
|
-
${({ theme: t }) => {
|
|
173
|
-
var e, n;
|
|
174
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || w.palette.neutral.N30;
|
|
175
|
-
}};
|
|
176
|
-
}
|
|
177
|
-
`, we = T.div`
|
|
1
|
+
import { jsx as a, jsxs as u, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { MdOutlineDelete as he, MdClear as Z, MdAdd as ee, MdOutlineFilterAltOff as ue, MdOutlineFilterAlt as pe } from "react-icons/md";
|
|
3
|
+
import { inube as v, Stack as h, Divider as D, Icon as O, Text as y, SkeletonLine as A, useMediaQuery as I, Blanket as te, Button as N, Grid as ne, Box as ge, Tag as me, Checkpicker as be, Toggle as ie, Checkbox as Te, Date as G } from "@inubekit/inubekit";
|
|
4
|
+
import f, { keyframes as fe } from "styled-components";
|
|
5
|
+
import { ValueDataType as k, ValueHowToSetUp as L, DecisionConditionRender as Q } from "@isettingkit/input";
|
|
6
|
+
import { DecisionViewConditionRenderer as _ } from "@isettingkit/view";
|
|
7
|
+
import { createPortal as ae } from "react-dom";
|
|
8
|
+
import { useFormik as xe } from "formik";
|
|
9
|
+
import { string as B, mixed as oe, object as M, number as q, lazy as Y, date as W } from "yup";
|
|
10
|
+
import { useState as V, useEffect as ye } from "react";
|
|
11
|
+
const ve = f.div`
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
// height: 364px;
|
|
18
|
+
// width: 332px;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
22
|
+
`;
|
|
23
|
+
f.div`
|
|
178
24
|
width: 100%;
|
|
179
25
|
height: 100%;
|
|
180
26
|
overflow-y: auto;
|
|
27
|
+
|
|
181
28
|
&::-webkit-scrollbar {
|
|
182
|
-
width:
|
|
29
|
+
width: 8px;
|
|
183
30
|
}
|
|
184
31
|
|
|
185
32
|
&::-webkit-scrollbar-thumb {
|
|
@@ -191,279 +38,37 @@ const De = T.div`
|
|
|
191
38
|
background-color: #ebecf0;
|
|
192
39
|
border-radius: 8px;
|
|
193
40
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
} = t, [d, h] = L(e), p = (l) => {
|
|
204
|
-
h(l.target.checked), a(l);
|
|
205
|
-
};
|
|
206
|
-
return ue(() => {
|
|
207
|
-
h(e);
|
|
208
|
-
}, [e]), /* @__PURE__ */ g(S, { children: [
|
|
209
|
-
/* @__PURE__ */ i(u, { children: /* @__PURE__ */ i(
|
|
210
|
-
X,
|
|
211
|
-
{
|
|
212
|
-
checked: d,
|
|
213
|
-
id: o,
|
|
214
|
-
name: s,
|
|
215
|
-
onChange: p,
|
|
216
|
-
size: "small",
|
|
217
|
-
value: c,
|
|
218
|
-
children: /* @__PURE__ */ i(y, { size: "medium", type: "label", weight: "bold", children: r })
|
|
219
|
-
}
|
|
220
|
-
) }),
|
|
221
|
-
d && /* @__PURE__ */ i(S, { children: n })
|
|
222
|
-
] });
|
|
223
|
-
}, Se = (t) => {
|
|
224
|
-
const {
|
|
225
|
-
onHandleStartChange: e,
|
|
226
|
-
onHandleEndChange: n,
|
|
227
|
-
onCheckClosedChange: a,
|
|
228
|
-
labelStart: o,
|
|
229
|
-
labelEnd: r,
|
|
230
|
-
checkedClosed: s = !1,
|
|
231
|
-
required: c = !1,
|
|
232
|
-
valueStart: d = "",
|
|
233
|
-
valueEnd: h = "",
|
|
234
|
-
messageStart: p = "",
|
|
235
|
-
messageEnd: l = "",
|
|
236
|
-
statusStart: m = "pending",
|
|
237
|
-
statusEnd: v = "pending"
|
|
238
|
-
} = t, [f, E] = L(s), [N, k] = L(d), [I, H] = L(h), ie = ({ target: x }) => {
|
|
239
|
-
E(x.checked), a && a(x.checked);
|
|
240
|
-
}, ae = (x) => {
|
|
241
|
-
k(x.target.value), e(x);
|
|
242
|
-
}, oe = (x) => {
|
|
243
|
-
H(x.target.value), n(x);
|
|
244
|
-
}, re = M("(max-width: 400px)");
|
|
245
|
-
return /* @__PURE__ */ g(S, { children: [
|
|
246
|
-
/* @__PURE__ */ g(u, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
247
|
-
/* @__PURE__ */ i(
|
|
248
|
-
y,
|
|
249
|
-
{
|
|
250
|
-
appearance: "gray",
|
|
251
|
-
margin: "10px 0",
|
|
252
|
-
size: "medium",
|
|
253
|
-
type: "title",
|
|
254
|
-
weight: "bold",
|
|
255
|
-
children: "Vigencia"
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
/* @__PURE__ */ i(
|
|
259
|
-
u,
|
|
41
|
+
`;
|
|
42
|
+
const H = (t) => {
|
|
43
|
+
const { children: e, controls: n = !0, handleDelete: i, id: o } = t;
|
|
44
|
+
return /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
45
|
+
e,
|
|
46
|
+
n && /* @__PURE__ */ u(E, { children: [
|
|
47
|
+
/* @__PURE__ */ a(D, {}),
|
|
48
|
+
/* @__PURE__ */ a(h, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ a(
|
|
49
|
+
O,
|
|
260
50
|
{
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
label: "Cerrada",
|
|
269
|
-
onChange: ie,
|
|
270
|
-
checked: f,
|
|
271
|
-
value: ""
|
|
272
|
-
}
|
|
273
|
-
)
|
|
51
|
+
cursorHover: !0,
|
|
52
|
+
appearance: "danger",
|
|
53
|
+
size: "24px",
|
|
54
|
+
icon: /* @__PURE__ */ a(he, {}),
|
|
55
|
+
onClick: () => {
|
|
56
|
+
i(o);
|
|
57
|
+
}
|
|
274
58
|
}
|
|
275
|
-
)
|
|
276
|
-
] }),
|
|
277
|
-
/* @__PURE__ */ g(
|
|
278
|
-
u,
|
|
279
|
-
{
|
|
280
|
-
direction: re ? "column" : "row",
|
|
281
|
-
justifyContent: "space-between",
|
|
282
|
-
gap: "24px",
|
|
283
|
-
children: [
|
|
284
|
-
/* @__PURE__ */ i(
|
|
285
|
-
Q,
|
|
286
|
-
{
|
|
287
|
-
id: "dateStart",
|
|
288
|
-
label: o,
|
|
289
|
-
onChange: ae,
|
|
290
|
-
value: N,
|
|
291
|
-
required: c,
|
|
292
|
-
size: "compact",
|
|
293
|
-
status: m,
|
|
294
|
-
message: p
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
f && /* @__PURE__ */ i(
|
|
298
|
-
Q,
|
|
299
|
-
{
|
|
300
|
-
id: "dateEnd",
|
|
301
|
-
label: r,
|
|
302
|
-
onChange: oe,
|
|
303
|
-
value: I,
|
|
304
|
-
required: c,
|
|
305
|
-
size: "compact",
|
|
306
|
-
status: v,
|
|
307
|
-
message: l
|
|
308
|
-
}
|
|
309
|
-
)
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
)
|
|
313
|
-
] });
|
|
314
|
-
}, Ee = (t) => {
|
|
315
|
-
const {
|
|
316
|
-
formik: e,
|
|
317
|
-
textValues: n,
|
|
318
|
-
onCancel: a,
|
|
319
|
-
visibleConditions: o,
|
|
320
|
-
normalizedDecision: r,
|
|
321
|
-
handleToggleNoneChange: s,
|
|
322
|
-
handleConditionToggleChange: c,
|
|
323
|
-
showConditionsError: d,
|
|
324
|
-
termStartStatus: h,
|
|
325
|
-
termEndStatus: p
|
|
326
|
-
} = t;
|
|
327
|
-
return /* @__PURE__ */ i("form", { onSubmit: e.handleSubmit, children: /* @__PURE__ */ g(u, { direction: "column", gap: "24px", children: [
|
|
328
|
-
G({
|
|
329
|
-
condition: r,
|
|
330
|
-
formik: e,
|
|
331
|
-
isDecision: !0
|
|
332
|
-
}),
|
|
333
|
-
/* @__PURE__ */ i(D, { dashed: !0 }),
|
|
334
|
-
/* @__PURE__ */ i(De, { children: /* @__PURE__ */ i(we, { children: /* @__PURE__ */ g(
|
|
335
|
-
u,
|
|
336
|
-
{
|
|
337
|
-
direction: "column",
|
|
338
|
-
padding: "6px 12px",
|
|
339
|
-
gap: "16px",
|
|
340
|
-
height: "272px",
|
|
341
|
-
children: [
|
|
342
|
-
/* @__PURE__ */ g(
|
|
343
|
-
u,
|
|
344
|
-
{
|
|
345
|
-
justifyContent: "space-between",
|
|
346
|
-
alignItems: "center",
|
|
347
|
-
gap: "64px",
|
|
348
|
-
children: [
|
|
349
|
-
/* @__PURE__ */ i(y, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
|
|
350
|
-
/* @__PURE__ */ i(
|
|
351
|
-
X,
|
|
352
|
-
{
|
|
353
|
-
id: "toggleNone",
|
|
354
|
-
onChange: () => s(!e.values.toggleNone),
|
|
355
|
-
checked: e.values.toggleNone,
|
|
356
|
-
size: "small",
|
|
357
|
-
children: /* @__PURE__ */ i(y, { as: "span", size: "medium", type: "label", weight: "bold", children: n.none })
|
|
358
|
-
}
|
|
359
|
-
)
|
|
360
|
-
]
|
|
361
|
-
}
|
|
362
|
-
),
|
|
363
|
-
/* @__PURE__ */ i(u, { direction: "column", gap: "20px", children: o == null ? void 0 : o.map((l) => /* @__PURE__ */ i(
|
|
364
|
-
Ce,
|
|
365
|
-
{
|
|
366
|
-
id: `toggle-${l.conditionName}`,
|
|
367
|
-
name: `toggle.${l.conditionName}`,
|
|
368
|
-
labelToggle: l.labelName,
|
|
369
|
-
checked: !e.values.toggleNone && e.values.conditionsThatEstablishesTheDecision[l.conditionName] !== void 0,
|
|
370
|
-
handleToggleChange: (m) => c(
|
|
371
|
-
l.conditionName,
|
|
372
|
-
l.howToSetTheCondition === b.LIST_OF_VALUES_MULTI
|
|
373
|
-
)(m.target.checked),
|
|
374
|
-
children: G({ condition: l, formik: e })
|
|
375
|
-
},
|
|
376
|
-
l.conditionName
|
|
377
|
-
)) })
|
|
378
|
-
]
|
|
379
|
-
}
|
|
380
|
-
) }) }),
|
|
381
|
-
/* @__PURE__ */ i(D, { dashed: !0 }),
|
|
382
|
-
/* @__PURE__ */ i(
|
|
383
|
-
Se,
|
|
384
|
-
{
|
|
385
|
-
labelStart: n.termStart,
|
|
386
|
-
labelEnd: n.termEnd,
|
|
387
|
-
valueStart: e.values.effectiveFrom,
|
|
388
|
-
valueEnd: e.values.validUntil,
|
|
389
|
-
messageStart: e.errors.effectiveFrom,
|
|
390
|
-
messageEnd: e.errors.validUntil,
|
|
391
|
-
statusStart: h,
|
|
392
|
-
statusEnd: p,
|
|
393
|
-
onHandleStartChange: (l) => e.setFieldValue("effectiveFrom", l.target.value),
|
|
394
|
-
onHandleEndChange: (l) => e.setFieldValue("validUntil", l.target.value),
|
|
395
|
-
onCheckClosedChange: (l) => {
|
|
396
|
-
e.setFieldValue("checkClosed", l), l && e.setFieldValue("validUntil", "");
|
|
397
|
-
},
|
|
398
|
-
checkedClosed: e.values.checkClosed
|
|
399
|
-
}
|
|
400
|
-
),
|
|
401
|
-
/* @__PURE__ */ i(D, {}),
|
|
402
|
-
d && /* @__PURE__ */ i(y, { type: "label", size: "medium", appearance: "danger", children: String(e.errors.conditionsThatEstablishesTheDecision) }),
|
|
403
|
-
/* @__PURE__ */ g(u, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
404
|
-
/* @__PURE__ */ i(z, { appearance: "gray", onClick: a, children: n.cancel }),
|
|
405
|
-
/* @__PURE__ */ i(z, { type: "submit", children: n.confirm })
|
|
59
|
+
) })
|
|
406
60
|
] })
|
|
407
61
|
] }) });
|
|
408
|
-
},
|
|
409
|
-
var v;
|
|
410
|
-
const { decision: e, onSubmitEvent: n, textValues: a, onCancel: o } = t, { formik: r, handleToggleNoneChange: s } = xe({
|
|
411
|
-
decision: e,
|
|
412
|
-
onSubmitEvent: n
|
|
413
|
-
}), c = {
|
|
414
|
-
ruleName: e.ruleName,
|
|
415
|
-
labelName: e.labelName,
|
|
416
|
-
howToSetTheCondition: e.howToSetTheDecision,
|
|
417
|
-
decisionDataType: e.decisionDataType,
|
|
418
|
-
listOfPossibleValues: e.listOfPossibleValues
|
|
419
|
-
}, d = ((v = e.conditionsThatEstablishesTheDecision) == null ? void 0 : v.filter(
|
|
420
|
-
(f) => !f.hidden
|
|
421
|
-
)) || [], h = !!r.errors.conditionsThatEstablishesTheDecision && r.submitCount > 0, p = r.touched.effectiveFrom ? r.errors.effectiveFrom ? "invalid" : "valid" : void 0, l = r.touched.validUntil ? r.errors.validUntil ? "invalid" : "valid" : void 0;
|
|
422
|
-
return /* @__PURE__ */ i(
|
|
423
|
-
Ee,
|
|
424
|
-
{
|
|
425
|
-
formik: r,
|
|
426
|
-
onCancel: o,
|
|
427
|
-
textValues: a,
|
|
428
|
-
decision: e,
|
|
429
|
-
visibleConditions: d,
|
|
430
|
-
normalizedDecision: c,
|
|
431
|
-
handleToggleNoneChange: s,
|
|
432
|
-
handleConditionToggleChange: (f, E) => (N) => {
|
|
433
|
-
if (!N)
|
|
434
|
-
r.setFieldValue(
|
|
435
|
-
`conditionsThatEstablishesTheDecision.${f}`,
|
|
436
|
-
void 0
|
|
437
|
-
), r.setFieldTouched(
|
|
438
|
-
`conditionsThatEstablishesTheDecision.${f}`,
|
|
439
|
-
!1,
|
|
440
|
-
!1
|
|
441
|
-
);
|
|
442
|
-
else {
|
|
443
|
-
const k = E ? [] : "";
|
|
444
|
-
r.setFieldValue(
|
|
445
|
-
`conditionsThatEstablishesTheDecision.${f}`,
|
|
446
|
-
k
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
showConditionsError: h,
|
|
451
|
-
termStartStatus: p,
|
|
452
|
-
termEndStatus: l,
|
|
453
|
-
onSubmitEvent: () => {
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
);
|
|
457
|
-
}, W = T.div`
|
|
62
|
+
}, J = f.div`
|
|
458
63
|
& > div {
|
|
459
64
|
border-radius: 8px;
|
|
460
65
|
border: 1px solid
|
|
461
66
|
${({ theme: t }) => {
|
|
462
67
|
var e, n;
|
|
463
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) ||
|
|
68
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
|
|
464
69
|
}};
|
|
465
70
|
}
|
|
466
|
-
`,
|
|
71
|
+
`, K = f.div`
|
|
467
72
|
width: 100%;
|
|
468
73
|
height: 100%;
|
|
469
74
|
overflow-y: auto;
|
|
@@ -481,50 +86,53 @@ const De = T.div`
|
|
|
481
86
|
background-color: #ebecf0;
|
|
482
87
|
border-radius: 8px;
|
|
483
88
|
}
|
|
484
|
-
`,
|
|
89
|
+
`, Ce = (t) => t.value, we = (t) => t.value, Se = (t) => t.value, De = (t) => ({
|
|
485
90
|
from: t.from ?? "",
|
|
486
91
|
to: t.to ?? ""
|
|
487
|
-
}),
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
[
|
|
491
|
-
[
|
|
492
|
-
[
|
|
493
|
-
[
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
92
|
+
}), Ee = (t) => t.value, Ne = (t) => t.value, ke = (t) => t.value;
|
|
93
|
+
var x = /* @__PURE__ */ ((t) => (t.EQUAL = "EqualTo", t.GREATER_THAN = "GreaterThan", t.LESS_THAN = "LessThan", t.LIST_OF_VALUES = "ListOfValues", t.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", t.RANGE = "Range", t))(x || {});
|
|
94
|
+
const Fe = {
|
|
95
|
+
[x.LIST_OF_VALUES]: we,
|
|
96
|
+
[x.LIST_OF_VALUES_MULTI]: Se,
|
|
97
|
+
[x.RANGE]: De,
|
|
98
|
+
[x.GREATER_THAN]: Ee,
|
|
99
|
+
[x.LESS_THAN]: Ne,
|
|
100
|
+
[x.EQUAL]: ke
|
|
101
|
+
}, $ = (t) => {
|
|
102
|
+
const e = t == null ? void 0 : t.value, n = typeof e == "object" && e !== null && !Array.isArray(e), i = Fe[t == null ? void 0 : t.howToSetTheDecision] || Ce;
|
|
103
|
+
return n && i(e) || e || void 0;
|
|
104
|
+
}, Ae = (t) => {
|
|
498
105
|
const {
|
|
499
106
|
loading: e,
|
|
500
107
|
textValues: n,
|
|
501
|
-
decision:
|
|
108
|
+
decision: i,
|
|
502
109
|
decisionMapper: o,
|
|
503
110
|
visibleConditions: r,
|
|
504
|
-
decisionDateElement:
|
|
505
|
-
skeleton:
|
|
111
|
+
decisionDateElement: p,
|
|
112
|
+
skeleton: g,
|
|
113
|
+
terms: s
|
|
506
114
|
} = t;
|
|
507
|
-
return e ? /* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
|
|
115
|
+
return e ? /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
|
|
116
|
+
/* @__PURE__ */ a(h, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
|
|
117
|
+
_,
|
|
510
118
|
{
|
|
511
119
|
element: o,
|
|
512
|
-
valueData:
|
|
120
|
+
valueData: $(
|
|
513
121
|
o
|
|
514
122
|
),
|
|
515
123
|
type: "decision"
|
|
516
124
|
}
|
|
517
|
-
) },
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
|
|
125
|
+
) }, i.ruleName),
|
|
126
|
+
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
127
|
+
/* @__PURE__ */ a(K, { children: /* @__PURE__ */ u(
|
|
128
|
+
h,
|
|
521
129
|
{
|
|
522
130
|
direction: "column",
|
|
523
131
|
gap: "12px",
|
|
524
132
|
justifyContent: "space-between",
|
|
525
133
|
height: "203px",
|
|
526
134
|
children: [
|
|
527
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ a(
|
|
528
136
|
y,
|
|
529
137
|
{
|
|
530
138
|
type: "label",
|
|
@@ -535,171 +143,123 @@ const De = T.div`
|
|
|
535
143
|
children: n.factsThatConditionIt
|
|
536
144
|
}
|
|
537
145
|
),
|
|
538
|
-
r.map((d) => /* @__PURE__ */
|
|
539
|
-
|
|
146
|
+
r.map((d) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(h, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
|
|
147
|
+
_,
|
|
540
148
|
{
|
|
541
149
|
element: { ...d, value: d.value },
|
|
542
|
-
valueData:
|
|
150
|
+
valueData: $(
|
|
543
151
|
d
|
|
544
152
|
)
|
|
545
153
|
}
|
|
546
154
|
) }) }, d.conditionName)),
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
155
|
+
s && /* @__PURE__ */ u(E, { children: [
|
|
156
|
+
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
157
|
+
p && /* @__PURE__ */ a(
|
|
158
|
+
_,
|
|
159
|
+
{
|
|
160
|
+
element: p.element,
|
|
161
|
+
valueData: p.valueData,
|
|
162
|
+
type: "decision"
|
|
163
|
+
},
|
|
164
|
+
n.terms
|
|
165
|
+
)
|
|
166
|
+
] })
|
|
557
167
|
]
|
|
558
168
|
}
|
|
559
169
|
) })
|
|
560
|
-
] }) : /* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
170
|
+
] }) : /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
|
|
171
|
+
/* @__PURE__ */ u(h, { direction: "column", alignItems: "center", gap: "4px", children: [
|
|
172
|
+
/* @__PURE__ */ a(A, { animated: !0, width: "180px" }),
|
|
173
|
+
/* @__PURE__ */ a(A, { animated: !0, width: "85px" })
|
|
564
174
|
] }, "loading"),
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ u(h, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
176
|
+
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
177
|
+
/* @__PURE__ */ a(A, { animated: !0, width: "150px" })
|
|
568
178
|
] }),
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
|
|
179
|
+
/* @__PURE__ */ a(K, { children: /* @__PURE__ */ a(
|
|
180
|
+
h,
|
|
571
181
|
{
|
|
572
182
|
direction: "column",
|
|
573
183
|
gap: "12px",
|
|
574
184
|
justifyContent: "space-between",
|
|
575
185
|
height: "203px",
|
|
576
|
-
children:
|
|
577
|
-
|
|
186
|
+
children: g.map((d, c) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ u(
|
|
187
|
+
h,
|
|
578
188
|
{
|
|
579
189
|
direction: "column",
|
|
580
190
|
gap: "12px",
|
|
581
191
|
alignItems: "start",
|
|
582
192
|
padding: "8px",
|
|
583
193
|
children: [
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ a(A, { animated: !0, width: "180px" }),
|
|
195
|
+
/* @__PURE__ */ a(A, { animated: !0, width: "85px" })
|
|
586
196
|
]
|
|
587
197
|
}
|
|
588
|
-
) }, `condition-${
|
|
198
|
+
) }, `condition-${c}`))
|
|
589
199
|
}
|
|
590
200
|
) })
|
|
591
201
|
] });
|
|
592
|
-
},
|
|
202
|
+
}, re = (t) => {
|
|
593
203
|
var l;
|
|
594
|
-
const { decision: e, loading: n = !1, textValues:
|
|
204
|
+
const { decision: e, loading: n = !1, textValues: i } = t, o = !!(e != null && e.effectiveFrom), r = !!(e != null && e.validUntil), p = o && r ? {
|
|
595
205
|
element: {
|
|
596
|
-
labelName:
|
|
206
|
+
labelName: i == null ? void 0 : i.terms,
|
|
597
207
|
value: String(e.effectiveFrom),
|
|
598
|
-
howToSetTheDecision:
|
|
599
|
-
decisionDataType:
|
|
208
|
+
howToSetTheDecision: L.RANGE,
|
|
209
|
+
decisionDataType: k.DATE
|
|
600
210
|
},
|
|
601
|
-
valueData:
|
|
602
|
-
labelName:
|
|
211
|
+
valueData: $({
|
|
212
|
+
labelName: i == null ? void 0 : i.terms,
|
|
603
213
|
value: {
|
|
604
214
|
from: String(e.effectiveFrom),
|
|
605
215
|
to: String(e.validUntil)
|
|
606
216
|
},
|
|
607
|
-
howToSetTheDecision:
|
|
608
|
-
decisionDataType:
|
|
217
|
+
howToSetTheDecision: L.RANGE,
|
|
218
|
+
decisionDataType: k.DATE
|
|
609
219
|
})
|
|
610
220
|
} : o && !r ? {
|
|
611
221
|
element: {
|
|
612
|
-
labelName:
|
|
222
|
+
labelName: i == null ? void 0 : i.terms,
|
|
613
223
|
value: String(e.effectiveFrom),
|
|
614
|
-
howToSetTheDecision:
|
|
615
|
-
decisionDataType:
|
|
224
|
+
howToSetTheDecision: L.EQUAL,
|
|
225
|
+
decisionDataType: k.DATE
|
|
616
226
|
},
|
|
617
|
-
valueData:
|
|
618
|
-
labelName:
|
|
227
|
+
valueData: $({
|
|
228
|
+
labelName: i == null ? void 0 : i.terms,
|
|
619
229
|
value: String(e.effectiveFrom),
|
|
620
|
-
howToSetTheDecision:
|
|
621
|
-
decisionDataType:
|
|
230
|
+
howToSetTheDecision: L.EQUAL,
|
|
231
|
+
decisionDataType: k.DATE
|
|
622
232
|
})
|
|
623
|
-
} : null,
|
|
233
|
+
} : null, g = e ? {
|
|
624
234
|
labelName: e.labelName || "",
|
|
625
235
|
decisionDataType: e.decisionDataType || "alphabetical",
|
|
626
|
-
value:
|
|
236
|
+
value: $(e),
|
|
627
237
|
howToSetTheDecision: e.howToSetTheDecision || "EqualTo"
|
|
628
|
-
} : null,
|
|
629
|
-
(
|
|
630
|
-
)) || [],
|
|
631
|
-
return /* @__PURE__ */
|
|
632
|
-
|
|
238
|
+
} : null, s = ((l = e == null ? void 0 : e.conditionsThatEstablishesTheDecision) == null ? void 0 : l.filter(
|
|
239
|
+
(b) => !b.hidden
|
|
240
|
+
)) || [], d = Array.from({ length: 5 });
|
|
241
|
+
return /* @__PURE__ */ a(
|
|
242
|
+
Ae,
|
|
633
243
|
{
|
|
634
|
-
loading: !!(!n && e &&
|
|
635
|
-
textValues:
|
|
244
|
+
loading: !!(!n && e && i && g),
|
|
245
|
+
textValues: i,
|
|
636
246
|
decision: e,
|
|
637
|
-
decisionMapper:
|
|
638
|
-
visibleConditions:
|
|
639
|
-
decisionDateElement:
|
|
640
|
-
skeleton:
|
|
247
|
+
decisionMapper: g,
|
|
248
|
+
visibleConditions: s,
|
|
249
|
+
decisionDateElement: p,
|
|
250
|
+
skeleton: d,
|
|
251
|
+
terms: !!(i != null && i.terms)
|
|
641
252
|
}
|
|
642
253
|
);
|
|
643
|
-
},
|
|
644
|
-
border-radius: 8px;
|
|
645
|
-
border: 1px solid ${w.palette.neutral.N30};
|
|
646
|
-
box-sizing: border-box;
|
|
647
|
-
display: flex;
|
|
648
|
-
flex-direction: column;
|
|
649
|
-
// height: 364px;
|
|
650
|
-
// width: 332px;
|
|
651
|
-
width: 100%;
|
|
652
|
-
height: 100%;
|
|
653
|
-
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
654
|
-
`;
|
|
655
|
-
T.div`
|
|
656
|
-
width: 100%;
|
|
657
|
-
height: 100%;
|
|
658
|
-
overflow-y: auto;
|
|
659
|
-
|
|
660
|
-
&::-webkit-scrollbar {
|
|
661
|
-
width: 8px;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
&::-webkit-scrollbar-thumb {
|
|
665
|
-
background-color: #c1c7d0;
|
|
666
|
-
border-radius: 8px;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
&::-webkit-scrollbar-track {
|
|
670
|
-
background-color: #ebecf0;
|
|
671
|
-
border-radius: 8px;
|
|
672
|
-
}
|
|
673
|
-
`;
|
|
674
|
-
const j = (t) => {
|
|
675
|
-
const { children: e, controls: n = !0, handleDelete: a, id: o } = t;
|
|
676
|
-
return /* @__PURE__ */ i(Oe, { children: /* @__PURE__ */ g(u, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
677
|
-
e,
|
|
678
|
-
n && /* @__PURE__ */ g(S, { children: [
|
|
679
|
-
/* @__PURE__ */ i(D, {}),
|
|
680
|
-
/* @__PURE__ */ i(u, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ i(
|
|
681
|
-
Z,
|
|
682
|
-
{
|
|
683
|
-
cursorHover: !0,
|
|
684
|
-
appearance: "danger",
|
|
685
|
-
size: "24px",
|
|
686
|
-
icon: /* @__PURE__ */ i(pe, {}),
|
|
687
|
-
onClick: () => {
|
|
688
|
-
a(o);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
) })
|
|
692
|
-
] })
|
|
693
|
-
] }) });
|
|
694
|
-
}, _e = T.div`
|
|
254
|
+
}, $e = f.div`
|
|
695
255
|
position: relative;
|
|
696
256
|
& > div {
|
|
697
257
|
padding: 24px 16px;
|
|
698
258
|
}
|
|
699
|
-
`,
|
|
259
|
+
`, Ie = f.div`
|
|
700
260
|
background-color: ${({ theme: t }) => {
|
|
701
261
|
var e, n;
|
|
702
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) ||
|
|
262
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) || v.palette.neutral.N0;
|
|
703
263
|
}};
|
|
704
264
|
max-width: 450px;
|
|
705
265
|
max-height: 90vh;
|
|
@@ -727,24 +287,24 @@ const j = (t) => {
|
|
|
727
287
|
background-color: #ebecf0;
|
|
728
288
|
border-radius: 8px;
|
|
729
289
|
}
|
|
730
|
-
`,
|
|
731
|
-
const { children: e, portalId: n, onCloseModal:
|
|
290
|
+
`, Re = (t) => {
|
|
291
|
+
const { children: e, portalId: n, onCloseModal: i, title: o } = t, r = document.getElementById(n);
|
|
732
292
|
if (!r)
|
|
733
293
|
throw new Error(
|
|
734
294
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
735
295
|
);
|
|
736
|
-
const
|
|
737
|
-
return
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
296
|
+
const p = I("(max-width: 400px)");
|
|
297
|
+
return ae(
|
|
298
|
+
/* @__PURE__ */ a($e, { smallScreen: p, children: /* @__PURE__ */ a(te, { children: /* @__PURE__ */ a(Ie, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
|
|
299
|
+
/* @__PURE__ */ a(h, { direction: "column", gap: "24px", children: /* @__PURE__ */ u(h, { alignItems: "center", justifyContent: "space-between", children: [
|
|
300
|
+
/* @__PURE__ */ a(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: o }),
|
|
301
|
+
/* @__PURE__ */ a(Z, { size: "24px", cursor: "pointer", onClick: i })
|
|
742
302
|
] }) }),
|
|
743
303
|
e
|
|
744
304
|
] }) }) }) }),
|
|
745
305
|
r
|
|
746
306
|
);
|
|
747
|
-
},
|
|
307
|
+
}, Le = fe`
|
|
748
308
|
from {
|
|
749
309
|
opacity: 0;
|
|
750
310
|
transform: translateY(20px);
|
|
@@ -754,12 +314,12 @@ const j = (t) => {
|
|
|
754
314
|
transform: translateY(0);
|
|
755
315
|
}
|
|
756
316
|
`;
|
|
757
|
-
|
|
317
|
+
f.div`
|
|
758
318
|
border-radius: 8px;
|
|
759
319
|
border: 1px solid
|
|
760
320
|
${({ theme: t }) => {
|
|
761
321
|
var e, n;
|
|
762
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) ||
|
|
322
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
|
|
763
323
|
}};
|
|
764
324
|
box-sizing: border-box;
|
|
765
325
|
display: flex;
|
|
@@ -768,21 +328,21 @@ T.div`
|
|
|
768
328
|
height: 100%;
|
|
769
329
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
770
330
|
`;
|
|
771
|
-
|
|
331
|
+
f.div`
|
|
772
332
|
& > div {
|
|
773
333
|
border-radius: 8px;
|
|
774
334
|
border: 1px solid
|
|
775
335
|
${({ theme: t }) => {
|
|
776
336
|
var e, n;
|
|
777
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) ||
|
|
337
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
|
|
778
338
|
}};
|
|
779
339
|
}
|
|
780
340
|
`;
|
|
781
|
-
const
|
|
341
|
+
const Me = f.div`
|
|
782
342
|
& > div {
|
|
783
343
|
background-color: ${({ theme: t }) => {
|
|
784
344
|
var e, n;
|
|
785
|
-
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N10) ||
|
|
345
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N10) || v.palette.neutral.N10;
|
|
786
346
|
}};
|
|
787
347
|
justify-content: center;
|
|
788
348
|
}
|
|
@@ -790,18 +350,18 @@ const je = T.div`
|
|
|
790
350
|
width: 100%;
|
|
791
351
|
height: 100%;
|
|
792
352
|
padding-bottom: 12px;
|
|
793
|
-
`,
|
|
353
|
+
`, le = f.div`
|
|
794
354
|
width: 100%;
|
|
795
355
|
height: 100%;
|
|
796
356
|
& > div {
|
|
797
|
-
animation: ${
|
|
357
|
+
animation: ${Le} 600ms ease-out;
|
|
798
358
|
}
|
|
799
|
-
`,
|
|
359
|
+
`, Ve = f.div`
|
|
800
360
|
& > div > div {
|
|
801
361
|
border-radius: 8px;
|
|
802
362
|
box-sizing: border-box;
|
|
803
363
|
}
|
|
804
|
-
`,
|
|
364
|
+
`, Oe = f.div`
|
|
805
365
|
& > div {
|
|
806
366
|
width: 100%;
|
|
807
367
|
height: 100%;
|
|
@@ -822,61 +382,61 @@ const je = T.div`
|
|
|
822
382
|
}
|
|
823
383
|
}
|
|
824
384
|
`;
|
|
825
|
-
function
|
|
385
|
+
function Ue(t) {
|
|
826
386
|
const { index: e, handleOpenModal: n } = t;
|
|
827
|
-
return /* @__PURE__ */
|
|
828
|
-
|
|
387
|
+
return /* @__PURE__ */ a(
|
|
388
|
+
H,
|
|
829
389
|
{
|
|
830
390
|
id: `loading-card-${e}`,
|
|
831
391
|
handleDelete: () => {
|
|
832
392
|
},
|
|
833
393
|
handleView: () => n ? n() : null,
|
|
834
394
|
controls: !1,
|
|
835
|
-
children: /* @__PURE__ */
|
|
395
|
+
children: /* @__PURE__ */ a(re, { loading: !0 })
|
|
836
396
|
},
|
|
837
397
|
`loading-card-${e}`
|
|
838
398
|
);
|
|
839
399
|
}
|
|
840
|
-
function
|
|
841
|
-
const { decision: e, controls: n, handleOpenModal:
|
|
842
|
-
return e ? /* @__PURE__ */
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
|
|
400
|
+
function _e(t) {
|
|
401
|
+
const { decision: e, controls: n, handleOpenModal: i, handleDelete: o, textValues: r } = t;
|
|
402
|
+
return e ? /* @__PURE__ */ a(le, { children: /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
|
|
403
|
+
/* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.decisionId }),
|
|
404
|
+
/* @__PURE__ */ a(
|
|
405
|
+
H,
|
|
846
406
|
{
|
|
847
407
|
id: e.decisionId,
|
|
848
408
|
handleDelete: () => o ? o(e.decisionId) : null,
|
|
849
|
-
handleView: () =>
|
|
409
|
+
handleView: () => i ? i(e) : null,
|
|
850
410
|
controls: n,
|
|
851
|
-
children: /* @__PURE__ */
|
|
411
|
+
children: /* @__PURE__ */ a(re, { decision: e, textValues: r })
|
|
852
412
|
}
|
|
853
413
|
)
|
|
854
414
|
] }) }, e.decisionId) : null;
|
|
855
415
|
}
|
|
856
|
-
function
|
|
416
|
+
function ze(t) {
|
|
857
417
|
const {
|
|
858
418
|
customTitleContentAddCard: e,
|
|
859
419
|
index: n,
|
|
860
|
-
handleOpenModal:
|
|
420
|
+
handleOpenModal: i,
|
|
861
421
|
shouldRenderEmptyMessage: o
|
|
862
422
|
} = t, r = e || "Agregar decisión";
|
|
863
|
-
return /* @__PURE__ */
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
|
|
423
|
+
return /* @__PURE__ */ a(le, { children: o ? null : /* @__PURE__ */ u(h, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
|
|
424
|
+
/* @__PURE__ */ a(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
|
|
425
|
+
/* @__PURE__ */ a(
|
|
426
|
+
Me,
|
|
867
427
|
{
|
|
868
|
-
onClick: () =>
|
|
869
|
-
children: /* @__PURE__ */
|
|
870
|
-
|
|
428
|
+
onClick: () => i ? i() : null,
|
|
429
|
+
children: /* @__PURE__ */ a(
|
|
430
|
+
H,
|
|
871
431
|
{
|
|
872
432
|
id: `add-decision-${n}`,
|
|
873
433
|
handleDelete: () => {
|
|
874
434
|
},
|
|
875
|
-
handleView: () =>
|
|
435
|
+
handleView: () => i ? i() : null,
|
|
876
436
|
controls: !1,
|
|
877
|
-
children: /* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
437
|
+
children: /* @__PURE__ */ u(h, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
438
|
+
/* @__PURE__ */ a(O, { appearance: "gray", icon: /* @__PURE__ */ a(ee, {}), size: "35px" }),
|
|
439
|
+
/* @__PURE__ */ a(y, { appearance: "gray", type: "body", size: "large", children: r })
|
|
880
440
|
] })
|
|
881
441
|
}
|
|
882
442
|
)
|
|
@@ -884,84 +444,85 @@ function Qe(t) {
|
|
|
884
444
|
)
|
|
885
445
|
] }) }, `add-decision-${n}`);
|
|
886
446
|
}
|
|
887
|
-
const
|
|
888
|
-
loading:
|
|
889
|
-
decision:
|
|
890
|
-
add:
|
|
891
|
-
},
|
|
892
|
-
const { type: e } = t, n =
|
|
447
|
+
const qe = {
|
|
448
|
+
loading: Ue,
|
|
449
|
+
decision: _e,
|
|
450
|
+
add: ze
|
|
451
|
+
}, j = (t) => {
|
|
452
|
+
const { type: e } = t, n = qe[e];
|
|
893
453
|
return n ? n(t) : null;
|
|
894
|
-
},
|
|
454
|
+
}, je = (t) => {
|
|
895
455
|
const {
|
|
896
456
|
controls: e,
|
|
897
457
|
customTitleContentAddCard: n,
|
|
898
|
-
decisions:
|
|
458
|
+
decisions: i,
|
|
899
459
|
loading: o,
|
|
900
460
|
handleOpenModal: r,
|
|
901
|
-
handleDelete:
|
|
902
|
-
textValues:
|
|
903
|
-
} = t,
|
|
904
|
-
(
|
|
461
|
+
handleDelete: p,
|
|
462
|
+
textValues: g
|
|
463
|
+
} = t, s = o ? Array.from({ length: 3 }).map(
|
|
464
|
+
(c, l) => j({
|
|
905
465
|
type: "loading",
|
|
906
466
|
index: l,
|
|
907
467
|
controls: e,
|
|
908
468
|
customTitleContentAddCard: n,
|
|
909
469
|
loading: o,
|
|
910
470
|
handleOpenModal: r,
|
|
911
|
-
handleDelete:
|
|
912
|
-
textValues:
|
|
471
|
+
handleDelete: p,
|
|
472
|
+
textValues: g
|
|
913
473
|
})
|
|
914
|
-
) :
|
|
915
|
-
(
|
|
474
|
+
) : i == null ? void 0 : i.map(
|
|
475
|
+
(c) => j({
|
|
916
476
|
type: "decision",
|
|
917
|
-
decision:
|
|
477
|
+
decision: c,
|
|
918
478
|
controls: e,
|
|
919
479
|
customTitleContentAddCard: n,
|
|
920
480
|
loading: o,
|
|
921
481
|
handleOpenModal: r,
|
|
922
|
-
handleDelete:
|
|
923
|
-
textValues:
|
|
482
|
+
handleDelete: p,
|
|
483
|
+
textValues: g
|
|
924
484
|
})
|
|
925
|
-
),
|
|
926
|
-
return { renderedCards:
|
|
927
|
-
},
|
|
485
|
+
), d = ((i == null ? void 0 : i.length) === 0 || i.length < Math.floor(window.innerWidth / 300)) && !o && e;
|
|
486
|
+
return { renderedCards: s, shouldRenderAddCard: d };
|
|
487
|
+
}, gt = (t) => {
|
|
928
488
|
const {
|
|
929
489
|
controls: e = !0,
|
|
930
490
|
customTitleContentAddCard: n,
|
|
931
|
-
customMessageEmptyDecisions:
|
|
491
|
+
customMessageEmptyDecisions: i,
|
|
932
492
|
decisions: o,
|
|
933
493
|
textValues: r,
|
|
934
|
-
decisionTemplate:
|
|
935
|
-
isModalOpen:
|
|
936
|
-
selectedDecision:
|
|
937
|
-
loading:
|
|
938
|
-
handleOpenModal:
|
|
494
|
+
decisionTemplate: p,
|
|
495
|
+
isModalOpen: g,
|
|
496
|
+
selectedDecision: s,
|
|
497
|
+
loading: d,
|
|
498
|
+
handleOpenModal: c,
|
|
939
499
|
handleCloseModal: l,
|
|
940
|
-
handleSubmitForm:
|
|
941
|
-
handleDelete:
|
|
942
|
-
|
|
500
|
+
handleSubmitForm: b,
|
|
501
|
+
handleDelete: T,
|
|
502
|
+
terms: m = !0
|
|
503
|
+
} = t, C = I("(max-width: 681px)"), w = I("(max-width: 400px)"), { renderedCards: F, shouldRenderAddCard: U } = je({
|
|
943
504
|
controls: e,
|
|
944
505
|
customTitleContentAddCard: n,
|
|
945
506
|
decisions: o,
|
|
946
|
-
loading:
|
|
947
|
-
handleOpenModal:
|
|
948
|
-
handleDelete:
|
|
507
|
+
loading: d,
|
|
508
|
+
handleOpenModal: c,
|
|
509
|
+
handleDelete: T,
|
|
949
510
|
textValues: r
|
|
950
|
-
}),
|
|
951
|
-
return /* @__PURE__ */
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
|
|
511
|
+
}), R = (o == null ? void 0 : o.length) === 0 && !d;
|
|
512
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
513
|
+
/* @__PURE__ */ a(Ve, { children: /* @__PURE__ */ a(Oe, { children: /* @__PURE__ */ a(h, { direction: "column", gap: "16px", padding: "6px", children: R ? /* @__PURE__ */ u(
|
|
514
|
+
h,
|
|
954
515
|
{
|
|
955
516
|
direction: "column",
|
|
956
517
|
gap: "28px",
|
|
957
518
|
width: "100%",
|
|
958
|
-
height:
|
|
519
|
+
height: C ? "auto" : "435px",
|
|
959
520
|
justifyContent: "center",
|
|
960
521
|
alignItems: "center",
|
|
961
522
|
children: [
|
|
962
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ a(y, { as: "span", type: "label", size: "large", appearance: "gray", children: i || /* @__PURE__ */ u(E, { children: [
|
|
963
524
|
"Aún NO tienes definidas tasas de interés efectivas . Presiona",
|
|
964
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ u(
|
|
965
526
|
y,
|
|
966
527
|
{
|
|
967
528
|
as: "span",
|
|
@@ -978,20 +539,20 @@ const Ye = {
|
|
|
978
539
|
),
|
|
979
540
|
"para empezar."
|
|
980
541
|
] }) }),
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
|
|
542
|
+
/* @__PURE__ */ a(
|
|
543
|
+
N,
|
|
983
544
|
{
|
|
984
|
-
iconBefore: /* @__PURE__ */
|
|
985
|
-
onClick: () =>
|
|
545
|
+
iconBefore: /* @__PURE__ */ a(ee, {}),
|
|
546
|
+
onClick: () => c ? c() : null,
|
|
986
547
|
children: n || "Agregar decisión"
|
|
987
548
|
}
|
|
988
549
|
)
|
|
989
550
|
]
|
|
990
551
|
}
|
|
991
|
-
) : /* @__PURE__ */
|
|
992
|
-
|
|
552
|
+
) : /* @__PURE__ */ u(
|
|
553
|
+
ne,
|
|
993
554
|
{
|
|
994
|
-
templateColumns:
|
|
555
|
+
templateColumns: w ? "repeat(auto-fill, minmax(200px, 1fr))" : "repeat(auto-fill, minmax(300px, 1fr))",
|
|
995
556
|
autoFlow: "row dense",
|
|
996
557
|
gap: "24px",
|
|
997
558
|
alignItems: "start",
|
|
@@ -999,35 +560,36 @@ const Ye = {
|
|
|
999
560
|
autoRows: "1fr",
|
|
1000
561
|
justifyItems: "center",
|
|
1001
562
|
padding: "6px",
|
|
1002
|
-
height:
|
|
563
|
+
height: C ? "auto" : "484px",
|
|
1003
564
|
children: [
|
|
1004
|
-
|
|
1005
|
-
|
|
565
|
+
F,
|
|
566
|
+
U && j({
|
|
1006
567
|
type: "add",
|
|
1007
568
|
index: o == null ? void 0 : o.length,
|
|
1008
569
|
controls: e,
|
|
1009
570
|
customTitleContentAddCard: n,
|
|
1010
|
-
customMessageEmptyDecisions:
|
|
1011
|
-
loading:
|
|
1012
|
-
handleOpenModal:
|
|
1013
|
-
handleDelete:
|
|
571
|
+
customMessageEmptyDecisions: i,
|
|
572
|
+
loading: d,
|
|
573
|
+
handleOpenModal: c,
|
|
574
|
+
handleDelete: T,
|
|
1014
575
|
textValues: r,
|
|
1015
|
-
shouldRenderEmptyMessage:
|
|
576
|
+
shouldRenderEmptyMessage: R,
|
|
577
|
+
terms: m
|
|
1016
578
|
})
|
|
1017
579
|
]
|
|
1018
580
|
}
|
|
1019
581
|
) }) }) }),
|
|
1020
|
-
|
|
1021
|
-
|
|
582
|
+
g && /* @__PURE__ */ a(
|
|
583
|
+
Re,
|
|
1022
584
|
{
|
|
1023
585
|
portalId: "modal-portal",
|
|
1024
586
|
onCloseModal: l,
|
|
1025
|
-
title:
|
|
1026
|
-
children: /* @__PURE__ */
|
|
1027
|
-
|
|
587
|
+
title: s ? "Editar Decisión" : "Nueva decisión",
|
|
588
|
+
children: /* @__PURE__ */ a(
|
|
589
|
+
it,
|
|
1028
590
|
{
|
|
1029
|
-
decision:
|
|
1030
|
-
onSubmitEvent:
|
|
591
|
+
decision: s || p,
|
|
592
|
+
onSubmitEvent: b,
|
|
1031
593
|
textValues: r,
|
|
1032
594
|
onCancel: () => l ? l() : () => {
|
|
1033
595
|
}
|
|
@@ -1036,44 +598,216 @@ const Ye = {
|
|
|
1036
598
|
}
|
|
1037
599
|
)
|
|
1038
600
|
] });
|
|
1039
|
-
},
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
601
|
+
}, Be = f.div`
|
|
602
|
+
display: flex;
|
|
603
|
+
justify-content: ${({ justifyContent: t }) => t};
|
|
604
|
+
align-items: ${({ alignItems: t }) => t};
|
|
605
|
+
align-content: ${({ alignContent: t }) => t};
|
|
606
|
+
flex-direction: ${({ direction: t }) => t};
|
|
607
|
+
flex-wrap: ${({ wrap: t }) => t};
|
|
608
|
+
height: ${({ height: t }) => t};
|
|
609
|
+
width: ${({ width: t }) => t};
|
|
610
|
+
gap: ${({ gap: t }) => t};
|
|
611
|
+
margin: ${({ margin: t }) => t};
|
|
612
|
+
padding: ${({ padding: t }) => t};
|
|
613
|
+
background: ${({ background: t, theme: e }) => {
|
|
614
|
+
var n, i, o, r;
|
|
615
|
+
return t ? `${((i = (n = e == null ? void 0 : e.palette) == null ? void 0 : n.neutral) == null ? void 0 : i.N10) || v.palette.neutral.N10}` : `${((r = (o = e == null ? void 0 : e.palette) == null ? void 0 : o.neutral) == null ? void 0 : r.N0) || v.palette.neutral.N0}`;
|
|
616
|
+
}};
|
|
617
|
+
border: ${({ border: t, theme: e }) => {
|
|
618
|
+
var n, i;
|
|
619
|
+
return t ? `1px solid ${((i = (n = e == null ? void 0 : e.palette) == null ? void 0 : n.neutral) == null ? void 0 : i.N40) || v.palette.neutral.N40}` : "none";
|
|
620
|
+
}};
|
|
621
|
+
border-radius: ${({ borderRadius: t }) => t};
|
|
622
|
+
box-sizing: ${({ boxSizing: t }) => t};
|
|
623
|
+
overflow-y: ${({ scroll: t }) => t ? "scroll" : "none"};
|
|
624
|
+
`, He = (t) => {
|
|
625
|
+
const {
|
|
626
|
+
children: e,
|
|
627
|
+
wrap: n,
|
|
628
|
+
direction: i = "column",
|
|
629
|
+
justifyContent: o,
|
|
630
|
+
alignItems: r,
|
|
631
|
+
alignContent: p,
|
|
632
|
+
height: g,
|
|
633
|
+
width: s,
|
|
634
|
+
gap: d,
|
|
635
|
+
background: c,
|
|
636
|
+
borderRadius: l,
|
|
637
|
+
border: b,
|
|
638
|
+
margin: T = "0px",
|
|
639
|
+
padding: m = "0px",
|
|
640
|
+
boxSizing: C,
|
|
641
|
+
scroll: w = !1
|
|
642
|
+
} = t;
|
|
643
|
+
return /* @__PURE__ */ a(
|
|
644
|
+
Be,
|
|
645
|
+
{
|
|
646
|
+
direction: i,
|
|
647
|
+
justifyContent: o,
|
|
648
|
+
alignItems: r,
|
|
649
|
+
alignContent: p,
|
|
650
|
+
height: g,
|
|
651
|
+
width: s,
|
|
652
|
+
wrap: n,
|
|
653
|
+
gap: d,
|
|
654
|
+
background: c,
|
|
655
|
+
border: b,
|
|
656
|
+
margin: T,
|
|
657
|
+
padding: m,
|
|
658
|
+
borderRadius: l,
|
|
659
|
+
boxSizing: C,
|
|
660
|
+
scroll: w,
|
|
661
|
+
children: e
|
|
662
|
+
}
|
|
1043
663
|
);
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
664
|
+
}, mt = (t) => {
|
|
665
|
+
const { appliedFilters: e, onClear: n, onClick: i, titleClearFilter: o, titleFilter: r } = t, p = !e || e.length === 0;
|
|
666
|
+
return /* @__PURE__ */ a(ge, { borderRadius: "8px", children: /* @__PURE__ */ u(ne, { gap: "12px", templateColumns: "1fr auto auto", children: [
|
|
667
|
+
/* @__PURE__ */ a(
|
|
668
|
+
He,
|
|
669
|
+
{
|
|
670
|
+
background: !0,
|
|
671
|
+
borderRadius: "8px",
|
|
672
|
+
height: "100%",
|
|
673
|
+
direction: "row",
|
|
674
|
+
gap: "8px",
|
|
675
|
+
alignItems: "center",
|
|
676
|
+
padding: "0px 8px",
|
|
677
|
+
children: e == null ? void 0 : e.map((g) => /* @__PURE__ */ a(
|
|
678
|
+
me,
|
|
679
|
+
{
|
|
680
|
+
appearance: "primary",
|
|
681
|
+
displayIcon: !0,
|
|
682
|
+
icon: g.icon,
|
|
683
|
+
label: g.label
|
|
684
|
+
},
|
|
685
|
+
g.label
|
|
686
|
+
))
|
|
687
|
+
}
|
|
688
|
+
),
|
|
689
|
+
/* @__PURE__ */ a(
|
|
690
|
+
N,
|
|
691
|
+
{
|
|
692
|
+
cursorHover: !0,
|
|
693
|
+
disabled: p,
|
|
694
|
+
iconBefore: /* @__PURE__ */ a(ue, {}),
|
|
695
|
+
onClick: n,
|
|
696
|
+
variant: "outlined",
|
|
697
|
+
children: o
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ a(
|
|
701
|
+
N,
|
|
702
|
+
{
|
|
703
|
+
cursorHover: !0,
|
|
704
|
+
iconBefore: /* @__PURE__ */ a(pe, {}),
|
|
705
|
+
onClick: i,
|
|
706
|
+
variant: "outlined",
|
|
707
|
+
children: r
|
|
708
|
+
}
|
|
1053
709
|
)
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
710
|
+
] }) });
|
|
711
|
+
}, Pe = f.div`
|
|
712
|
+
display: flex;
|
|
713
|
+
flex-direction: column;
|
|
714
|
+
background-color: ${({ theme: t }) => {
|
|
715
|
+
var e, n;
|
|
716
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N0) || v.palette.neutral.N0;
|
|
717
|
+
}};
|
|
718
|
+
width: ${({ smallScreen: t }) => t ? "335px" : "450px"};
|
|
719
|
+
height: auto;
|
|
720
|
+
border-radius: 8px;
|
|
721
|
+
padding: 24px;
|
|
722
|
+
gap: 24px;
|
|
723
|
+
box-sizing: border-box;
|
|
724
|
+
`, bt = (t) => {
|
|
725
|
+
const {
|
|
726
|
+
actionButtonLabel: e,
|
|
727
|
+
cancelButtonLabel: n,
|
|
728
|
+
children: i,
|
|
729
|
+
loading: o,
|
|
730
|
+
onClick: r,
|
|
731
|
+
onCloseModal: p,
|
|
732
|
+
portalId: g,
|
|
733
|
+
title: s
|
|
734
|
+
} = t, d = I("(max-width: 768px)"), c = document.getElementById(g);
|
|
735
|
+
if (!c)
|
|
736
|
+
throw new Error(
|
|
737
|
+
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
1061
738
|
);
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
739
|
+
return ae(
|
|
740
|
+
/* @__PURE__ */ a(te, { children: /* @__PURE__ */ u(Pe, { $smallScreen: d, children: [
|
|
741
|
+
/* @__PURE__ */ u(h, { direction: "column", gap: "16px", children: [
|
|
742
|
+
/* @__PURE__ */ u(h, { alignContent: "center", justifyContent: "space-between", children: [
|
|
743
|
+
/* @__PURE__ */ a(y, { appearance: "dark", size: "small", type: "headline", children: s }),
|
|
744
|
+
/* @__PURE__ */ u(h, { alignItems: "center", children: [
|
|
745
|
+
/* @__PURE__ */ a(y, { children: "Cerrar" }),
|
|
746
|
+
/* @__PURE__ */ a(
|
|
747
|
+
O,
|
|
748
|
+
{
|
|
749
|
+
appearance: "dark",
|
|
750
|
+
icon: /* @__PURE__ */ a(Z, {}),
|
|
751
|
+
onClick: p,
|
|
752
|
+
cursorHover: !0
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] })
|
|
756
|
+
] }),
|
|
757
|
+
/* @__PURE__ */ a(D, {})
|
|
758
|
+
] }),
|
|
759
|
+
i,
|
|
760
|
+
/* @__PURE__ */ u(h, { gap: "20px", justifyContent: "flex-end", children: [
|
|
761
|
+
/* @__PURE__ */ a(
|
|
762
|
+
N,
|
|
763
|
+
{
|
|
764
|
+
appearance: "gray",
|
|
765
|
+
onClick: p,
|
|
766
|
+
spacing: "wide",
|
|
767
|
+
variant: "outlined",
|
|
768
|
+
children: n
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ a(
|
|
772
|
+
N,
|
|
773
|
+
{
|
|
774
|
+
appearance: "primary",
|
|
775
|
+
loading: o,
|
|
776
|
+
onClick: r,
|
|
777
|
+
spacing: "wide",
|
|
778
|
+
variant: "filled",
|
|
779
|
+
children: e
|
|
780
|
+
}
|
|
781
|
+
)
|
|
782
|
+
] })
|
|
783
|
+
] }) }),
|
|
784
|
+
c
|
|
785
|
+
);
|
|
786
|
+
}, Tt = (t) => {
|
|
787
|
+
const { fields: e, onChange: n } = t;
|
|
788
|
+
return /* @__PURE__ */ a(h, { direction: "column", gap: "16px", children: e.map((i) => /* @__PURE__ */ u(h, { gap: "6px", alignItems: "center", children: [
|
|
789
|
+
/* @__PURE__ */ a(h, { padding: "22px 0 0 0", children: /* @__PURE__ */ a(O, { appearance: "primary", icon: i.icon }) }),
|
|
790
|
+
/* @__PURE__ */ a(
|
|
791
|
+
be,
|
|
792
|
+
{
|
|
793
|
+
disabled: i.disabled,
|
|
794
|
+
invalid: i.invalid,
|
|
795
|
+
label: i.label,
|
|
796
|
+
message: i.message,
|
|
797
|
+
name: i.name,
|
|
798
|
+
onChange: n,
|
|
799
|
+
options: i.options,
|
|
800
|
+
placeholder: i.placeholder,
|
|
801
|
+
required: i.required,
|
|
802
|
+
values: i.values,
|
|
803
|
+
fullwidth: !0
|
|
804
|
+
},
|
|
805
|
+
i.name
|
|
806
|
+
)
|
|
807
|
+
] }, i.name)) });
|
|
808
|
+
}, ft = (t) => {
|
|
1075
809
|
console.log(t);
|
|
1076
|
-
const { dataDecision: e, originalDecision: n } = t,
|
|
810
|
+
const { dataDecision: e, originalDecision: n } = t, i = {
|
|
1077
811
|
conditionName: e.ruleName || "",
|
|
1078
812
|
labelName: e.labelName || "",
|
|
1079
813
|
conditionDataType: e.decisionDataType || "alphabetical",
|
|
@@ -1085,17 +819,17 @@ const Ye = {
|
|
|
1085
819
|
return {
|
|
1086
820
|
...n,
|
|
1087
821
|
conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
|
|
1088
|
-
(o) => o.hidden ? { ...
|
|
822
|
+
(o) => o.hidden ? { ...i } : o
|
|
1089
823
|
)
|
|
1090
824
|
};
|
|
1091
|
-
},
|
|
825
|
+
}, xt = (t) => {
|
|
1092
826
|
const { decisions: e } = t;
|
|
1093
827
|
return e == null ? void 0 : e.map((n) => {
|
|
1094
828
|
var o;
|
|
1095
|
-
const
|
|
829
|
+
const i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
|
|
1096
830
|
(r) => r.hidden
|
|
1097
831
|
);
|
|
1098
|
-
return
|
|
832
|
+
return i ? {
|
|
1099
833
|
...n,
|
|
1100
834
|
ruleName: n.ruleName,
|
|
1101
835
|
labelName: n.labelName,
|
|
@@ -1103,19 +837,511 @@ const Ye = {
|
|
|
1103
837
|
value: n.value,
|
|
1104
838
|
howToSetTheDecision: n.howToSetTheDecision,
|
|
1105
839
|
conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
|
|
1106
|
-
(r) => r.hidden ? { ...
|
|
840
|
+
(r) => r.hidden ? { ...i, hidden: !1 } : r
|
|
841
|
+
)
|
|
842
|
+
} : n;
|
|
843
|
+
});
|
|
844
|
+
}, Ge = (t) => ({
|
|
845
|
+
schema: B().required("Required").test(
|
|
846
|
+
"non-empty",
|
|
847
|
+
"Value cannot be empty",
|
|
848
|
+
(e) => e != null && e.trim() !== ""
|
|
849
|
+
),
|
|
850
|
+
value: t
|
|
851
|
+
}), Qe = (t) => ({
|
|
852
|
+
schema: oe().test(
|
|
853
|
+
"isArrayOrString",
|
|
854
|
+
"Must be an array of strings/numbers or a single string",
|
|
855
|
+
(e) => Array.isArray(e) ? e.every(
|
|
856
|
+
(n) => typeof n == "string" || typeof n == "number"
|
|
857
|
+
) : typeof e == "string"
|
|
858
|
+
),
|
|
859
|
+
value: t
|
|
860
|
+
}), Ye = (t) => ({
|
|
861
|
+
schema: oe().test(
|
|
862
|
+
"isArrayOrString",
|
|
863
|
+
"Must be an array of strings/numbers or a single string",
|
|
864
|
+
(e) => Array.isArray(e) ? e.every(
|
|
865
|
+
(n) => typeof n == "string" || typeof n == "number"
|
|
866
|
+
) : typeof e == "string"
|
|
867
|
+
),
|
|
868
|
+
value: t
|
|
869
|
+
}), We = (t) => {
|
|
870
|
+
const e = (t == null ? void 0 : t.from) ?? 0, n = (t == null ? void 0 : t.to) ?? 0;
|
|
871
|
+
return {
|
|
872
|
+
schema: M({
|
|
873
|
+
from: q().required("Range From is required").max(n, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
874
|
+
to: q().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
875
|
+
"is-greater",
|
|
876
|
+
"To value must be greater than From value",
|
|
877
|
+
function(i) {
|
|
878
|
+
const { from: o } = this.parent;
|
|
879
|
+
return i > o;
|
|
880
|
+
}
|
|
881
|
+
)
|
|
882
|
+
}),
|
|
883
|
+
value: { from: e, to: n }
|
|
884
|
+
};
|
|
885
|
+
}, z = (t, e) => e === k.PERCENTAGE ? {
|
|
886
|
+
schema: q().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
887
|
+
value: t
|
|
888
|
+
} : {
|
|
889
|
+
schema: B().required("Required"),
|
|
890
|
+
value: t
|
|
891
|
+
}, Je = {
|
|
892
|
+
[x.LIST_OF_VALUES]: Qe,
|
|
893
|
+
[x.LIST_OF_VALUES_MULTI]: Ye,
|
|
894
|
+
[x.RANGE]: We,
|
|
895
|
+
[x.GREATER_THAN]: z,
|
|
896
|
+
[x.LESS_THAN]: z,
|
|
897
|
+
[x.EQUAL]: z
|
|
898
|
+
}, X = (t) => Je[t] || Ge;
|
|
899
|
+
function Ke({
|
|
900
|
+
decision: t,
|
|
901
|
+
onSubmitEvent: e,
|
|
902
|
+
textValues: n
|
|
903
|
+
}) {
|
|
904
|
+
const i = {
|
|
905
|
+
ruleName: t.ruleName || "",
|
|
906
|
+
decisionDataType: t.decisionDataType || k.ALPHABETICAL,
|
|
907
|
+
howToSetTheDecision: t.howToSetTheDecision || "",
|
|
908
|
+
value: t.value || "",
|
|
909
|
+
effectiveFrom: t.effectiveFrom || "",
|
|
910
|
+
validUntil: t.validUntil || "",
|
|
911
|
+
toggleNone: !0,
|
|
912
|
+
conditionsThatEstablishesTheDecision: {},
|
|
913
|
+
checkClosed: !1,
|
|
914
|
+
terms: !0
|
|
915
|
+
};
|
|
916
|
+
let o;
|
|
917
|
+
const r = {
|
|
918
|
+
ruleName: B().required("Name is required"),
|
|
919
|
+
value: Y(() => X(
|
|
920
|
+
o.values.howToSetTheDecision
|
|
921
|
+
)(
|
|
922
|
+
o.values.value,
|
|
923
|
+
o.values.decisionDataType
|
|
924
|
+
).schema),
|
|
925
|
+
conditionsThatEstablishesTheDecision: Y((s, { parent: d }) => {
|
|
926
|
+
var b;
|
|
927
|
+
if ((d == null ? void 0 : d.toggleNone) && Object.keys(d.conditionsThatEstablishesTheDecision || {}).length > 0) return M().shape({});
|
|
928
|
+
const l = (b = t.conditionsThatEstablishesTheDecision) == null ? void 0 : b.reduce(
|
|
929
|
+
(T, m) => {
|
|
930
|
+
if (o.values.conditionsThatEstablishesTheDecision[m.conditionName] !== void 0) {
|
|
931
|
+
const w = X(
|
|
932
|
+
m.howToSetTheCondition
|
|
933
|
+
);
|
|
934
|
+
T[m.conditionName] = w(
|
|
935
|
+
m.value,
|
|
936
|
+
m.conditionDataType
|
|
937
|
+
).schema;
|
|
938
|
+
}
|
|
939
|
+
return T;
|
|
940
|
+
},
|
|
941
|
+
{}
|
|
942
|
+
);
|
|
943
|
+
return M(l).test(
|
|
944
|
+
"at-least-one-condition",
|
|
945
|
+
"It must be at least one condition in order for the decision to be validated correctly.",
|
|
946
|
+
(T) => T ? Object.values(T).some(
|
|
947
|
+
(m) => m != null && m !== ""
|
|
948
|
+
) : !1
|
|
949
|
+
);
|
|
950
|
+
})
|
|
951
|
+
};
|
|
952
|
+
n.terms && (r.effectiveFrom = W().required(
|
|
953
|
+
"effective From date is required"
|
|
954
|
+
), r.validUntil = W().when(
|
|
955
|
+
"checkClosed",
|
|
956
|
+
(s, d, { parent: c }) => (c == null ? void 0 : c.checkClosed) ? d.required("valid Until date is required").test(
|
|
957
|
+
"is-after-startDate",
|
|
958
|
+
"valid Until date must be greater than or equal to Start date",
|
|
959
|
+
function(b) {
|
|
960
|
+
const T = this.parent.effectiveFrom;
|
|
961
|
+
return !T || !b ? !0 : new Date(b) >= new Date(T);
|
|
962
|
+
}
|
|
963
|
+
) : d.notRequired()
|
|
964
|
+
));
|
|
965
|
+
const p = M(r);
|
|
966
|
+
return o = xe({
|
|
967
|
+
initialValues: i,
|
|
968
|
+
validationSchema: p,
|
|
969
|
+
validateOnBlur: !0,
|
|
970
|
+
onSubmit: (s) => {
|
|
971
|
+
var c;
|
|
972
|
+
const d = {
|
|
973
|
+
...t,
|
|
974
|
+
ruleName: s.ruleName,
|
|
975
|
+
decisionDataType: s.decisionDataType,
|
|
976
|
+
howToSetTheDecision: s.howToSetTheDecision,
|
|
977
|
+
value: s.value,
|
|
978
|
+
effectiveFrom: s.effectiveFrom,
|
|
979
|
+
validUntil: s.validUntil,
|
|
980
|
+
conditionsThatEstablishesTheDecision: (c = t.conditionsThatEstablishesTheDecision) == null ? void 0 : c.filter((l) => {
|
|
981
|
+
const b = s.conditionsThatEstablishesTheDecision[l.conditionName];
|
|
982
|
+
return b != null && b !== "";
|
|
983
|
+
}).map((l) => ({
|
|
984
|
+
...l,
|
|
985
|
+
value: s.conditionsThatEstablishesTheDecision[l.conditionName]
|
|
986
|
+
}))
|
|
987
|
+
};
|
|
988
|
+
e(d);
|
|
989
|
+
}
|
|
990
|
+
}), { formik: o, handleToggleNoneChange: (s) => {
|
|
991
|
+
var d;
|
|
992
|
+
o.setFieldValue("toggleNone", s), (d = t.conditionsThatEstablishesTheDecision) == null || d.forEach((c) => {
|
|
993
|
+
if (s)
|
|
994
|
+
o.setFieldValue(
|
|
995
|
+
`conditionsThatEstablishesTheDecision.${c.conditionName}`,
|
|
996
|
+
void 0
|
|
997
|
+
);
|
|
998
|
+
else {
|
|
999
|
+
const l = c.howToSetTheCondition === x.LIST_OF_VALUES_MULTI ? [] : "";
|
|
1000
|
+
o.setFieldValue(
|
|
1001
|
+
`conditionsThatEstablishesTheDecision.${c.conditionName}`,
|
|
1002
|
+
l
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
} };
|
|
1007
|
+
}
|
|
1008
|
+
const Xe = f.div`
|
|
1009
|
+
& > div {
|
|
1010
|
+
border-radius: 8px;
|
|
1011
|
+
border: 1px solid
|
|
1012
|
+
${({ theme: t }) => {
|
|
1013
|
+
var e, n;
|
|
1014
|
+
return ((n = (e = t == null ? void 0 : t.palette) == null ? void 0 : e.neutral) == null ? void 0 : n.N30) || v.palette.neutral.N30;
|
|
1015
|
+
}};
|
|
1016
|
+
}
|
|
1017
|
+
`, Ze = f.div`
|
|
1018
|
+
width: 100%;
|
|
1019
|
+
height: 100%;
|
|
1020
|
+
overflow-y: auto;
|
|
1021
|
+
&::-webkit-scrollbar {
|
|
1022
|
+
width: 4px;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
&::-webkit-scrollbar-thumb {
|
|
1026
|
+
background-color: #c1c7d0;
|
|
1027
|
+
border-radius: 8px;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
&::-webkit-scrollbar-track {
|
|
1031
|
+
background-color: #ebecf0;
|
|
1032
|
+
border-radius: 8px;
|
|
1033
|
+
}
|
|
1034
|
+
`, et = (t) => {
|
|
1035
|
+
const {
|
|
1036
|
+
checked: e,
|
|
1037
|
+
children: n,
|
|
1038
|
+
handleToggleChange: i,
|
|
1039
|
+
id: o,
|
|
1040
|
+
labelToggle: r,
|
|
1041
|
+
name: p,
|
|
1042
|
+
valueToggle: g = ""
|
|
1043
|
+
} = t, [s, d] = V(e), c = (l) => {
|
|
1044
|
+
d(l.target.checked), i(l);
|
|
1045
|
+
};
|
|
1046
|
+
return ye(() => {
|
|
1047
|
+
d(e);
|
|
1048
|
+
}, [e]), /* @__PURE__ */ u(E, { children: [
|
|
1049
|
+
/* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(
|
|
1050
|
+
ie,
|
|
1051
|
+
{
|
|
1052
|
+
checked: s,
|
|
1053
|
+
id: o,
|
|
1054
|
+
name: p,
|
|
1055
|
+
onChange: c,
|
|
1056
|
+
size: "small",
|
|
1057
|
+
value: g,
|
|
1058
|
+
children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: r })
|
|
1059
|
+
}
|
|
1060
|
+
) }),
|
|
1061
|
+
s && /* @__PURE__ */ a(E, { children: n })
|
|
1062
|
+
] });
|
|
1063
|
+
}, tt = (t) => {
|
|
1064
|
+
const {
|
|
1065
|
+
onHandleStartChange: e,
|
|
1066
|
+
onHandleEndChange: n,
|
|
1067
|
+
onCheckClosedChange: i,
|
|
1068
|
+
labelStart: o,
|
|
1069
|
+
labelEnd: r,
|
|
1070
|
+
checkedClosed: p = !1,
|
|
1071
|
+
required: g = !1,
|
|
1072
|
+
valueStart: s = "",
|
|
1073
|
+
valueEnd: d = "",
|
|
1074
|
+
messageStart: c = "",
|
|
1075
|
+
messageEnd: l = "",
|
|
1076
|
+
statusStart: b = "pending",
|
|
1077
|
+
statusEnd: T = "pending"
|
|
1078
|
+
} = t, [m, C] = V(p), [w, F] = V(s), [U, R] = V(d), P = ({ target: S }) => {
|
|
1079
|
+
C(S.checked), i && i(S.checked);
|
|
1080
|
+
}, de = (S) => {
|
|
1081
|
+
F(S.target.value), e(S);
|
|
1082
|
+
}, se = (S) => {
|
|
1083
|
+
R(S.target.value), n(S);
|
|
1084
|
+
}, ce = I("(max-width: 400px)");
|
|
1085
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
1086
|
+
/* @__PURE__ */ u(h, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
1087
|
+
/* @__PURE__ */ a(
|
|
1088
|
+
y,
|
|
1089
|
+
{
|
|
1090
|
+
appearance: "gray",
|
|
1091
|
+
margin: "10px 0",
|
|
1092
|
+
size: "medium",
|
|
1093
|
+
type: "title",
|
|
1094
|
+
weight: "bold",
|
|
1095
|
+
children: "Vigencia"
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
/* @__PURE__ */ a(
|
|
1099
|
+
h,
|
|
1100
|
+
{
|
|
1101
|
+
alignContent: "center",
|
|
1102
|
+
justifyContent: "center",
|
|
1103
|
+
wrap: "wrap",
|
|
1104
|
+
gap: "4px",
|
|
1105
|
+
children: /* @__PURE__ */ a(
|
|
1106
|
+
Te,
|
|
1107
|
+
{
|
|
1108
|
+
label: "Cerrada",
|
|
1109
|
+
onChange: P,
|
|
1110
|
+
checked: m,
|
|
1111
|
+
value: ""
|
|
1112
|
+
}
|
|
1113
|
+
)
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
] }),
|
|
1117
|
+
/* @__PURE__ */ u(
|
|
1118
|
+
h,
|
|
1119
|
+
{
|
|
1120
|
+
direction: ce ? "column" : "row",
|
|
1121
|
+
justifyContent: "space-between",
|
|
1122
|
+
gap: "24px",
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ a(
|
|
1125
|
+
G,
|
|
1126
|
+
{
|
|
1127
|
+
id: "dateStart",
|
|
1128
|
+
label: o,
|
|
1129
|
+
onChange: de,
|
|
1130
|
+
value: w,
|
|
1131
|
+
required: g,
|
|
1132
|
+
size: "compact",
|
|
1133
|
+
status: b,
|
|
1134
|
+
message: c
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
m && /* @__PURE__ */ a(
|
|
1138
|
+
G,
|
|
1139
|
+
{
|
|
1140
|
+
id: "dateEnd",
|
|
1141
|
+
label: r,
|
|
1142
|
+
onChange: se,
|
|
1143
|
+
value: U,
|
|
1144
|
+
required: g,
|
|
1145
|
+
size: "compact",
|
|
1146
|
+
status: T,
|
|
1147
|
+
message: l
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1150
|
+
]
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] });
|
|
1154
|
+
}, nt = (t) => {
|
|
1155
|
+
const {
|
|
1156
|
+
formik: e,
|
|
1157
|
+
textValues: n,
|
|
1158
|
+
onCancel: i,
|
|
1159
|
+
visibleConditions: o,
|
|
1160
|
+
normalizedDecision: r,
|
|
1161
|
+
handleToggleNoneChange: p,
|
|
1162
|
+
handleConditionToggleChange: g,
|
|
1163
|
+
showConditionsError: s,
|
|
1164
|
+
termStartStatus: d,
|
|
1165
|
+
termEndStatus: c
|
|
1166
|
+
} = t;
|
|
1167
|
+
return /* @__PURE__ */ a("form", { onSubmit: e.handleSubmit, children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
|
|
1168
|
+
Q({
|
|
1169
|
+
condition: r,
|
|
1170
|
+
formik: e,
|
|
1171
|
+
isDecision: !0
|
|
1172
|
+
}),
|
|
1173
|
+
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
1174
|
+
/* @__PURE__ */ a(Xe, { children: /* @__PURE__ */ a(Ze, { children: /* @__PURE__ */ u(
|
|
1175
|
+
h,
|
|
1176
|
+
{
|
|
1177
|
+
direction: "column",
|
|
1178
|
+
padding: "6px 12px",
|
|
1179
|
+
gap: "16px",
|
|
1180
|
+
height: "272px",
|
|
1181
|
+
children: [
|
|
1182
|
+
/* @__PURE__ */ u(
|
|
1183
|
+
h,
|
|
1184
|
+
{
|
|
1185
|
+
justifyContent: "space-between",
|
|
1186
|
+
alignItems: "center",
|
|
1187
|
+
gap: "64px",
|
|
1188
|
+
children: [
|
|
1189
|
+
/* @__PURE__ */ a(y, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
|
|
1190
|
+
/* @__PURE__ */ a(
|
|
1191
|
+
ie,
|
|
1192
|
+
{
|
|
1193
|
+
id: "toggleNone",
|
|
1194
|
+
onChange: () => p(!e.values.toggleNone),
|
|
1195
|
+
checked: e.values.toggleNone,
|
|
1196
|
+
size: "small",
|
|
1197
|
+
children: /* @__PURE__ */ a(y, { as: "span", size: "medium", type: "label", weight: "bold", children: n.none })
|
|
1198
|
+
}
|
|
1199
|
+
)
|
|
1200
|
+
]
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ a(h, { direction: "column", gap: "20px", children: o == null ? void 0 : o.map((l) => /* @__PURE__ */ a(
|
|
1204
|
+
et,
|
|
1205
|
+
{
|
|
1206
|
+
id: `toggle-${l.conditionName}`,
|
|
1207
|
+
name: `toggle.${l.conditionName}`,
|
|
1208
|
+
labelToggle: l.labelName,
|
|
1209
|
+
checked: !e.values.toggleNone && e.values.conditionsThatEstablishesTheDecision[l.conditionName] !== void 0,
|
|
1210
|
+
handleToggleChange: (b) => g(
|
|
1211
|
+
l.conditionName,
|
|
1212
|
+
l.howToSetTheCondition === x.LIST_OF_VALUES_MULTI
|
|
1213
|
+
)(b.target.checked),
|
|
1214
|
+
children: Q({ condition: l, formik: e })
|
|
1215
|
+
},
|
|
1216
|
+
l.conditionName
|
|
1217
|
+
)) })
|
|
1218
|
+
]
|
|
1219
|
+
}
|
|
1220
|
+
) }) }),
|
|
1221
|
+
n.terms && /* @__PURE__ */ u(E, { children: [
|
|
1222
|
+
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
1223
|
+
/* @__PURE__ */ a(
|
|
1224
|
+
tt,
|
|
1225
|
+
{
|
|
1226
|
+
labelStart: n.termStart,
|
|
1227
|
+
labelEnd: n.termEnd,
|
|
1228
|
+
valueStart: e.values.effectiveFrom,
|
|
1229
|
+
valueEnd: e.values.validUntil,
|
|
1230
|
+
messageStart: e.errors.effectiveFrom,
|
|
1231
|
+
messageEnd: e.errors.validUntil,
|
|
1232
|
+
statusStart: d,
|
|
1233
|
+
statusEnd: c,
|
|
1234
|
+
onHandleStartChange: (l) => e.setFieldValue("effectiveFrom", l.target.value),
|
|
1235
|
+
onHandleEndChange: (l) => e.setFieldValue("validUntil", l.target.value),
|
|
1236
|
+
onCheckClosedChange: (l) => {
|
|
1237
|
+
e.setFieldValue("checkClosed", l), l && e.setFieldValue("validUntil", "");
|
|
1238
|
+
},
|
|
1239
|
+
checkedClosed: e.values.checkClosed
|
|
1240
|
+
}
|
|
1241
|
+
)
|
|
1242
|
+
] }),
|
|
1243
|
+
/* @__PURE__ */ a(D, {}),
|
|
1244
|
+
s && /* @__PURE__ */ a(y, { type: "label", size: "medium", appearance: "danger", children: String(e.errors.conditionsThatEstablishesTheDecision) }),
|
|
1245
|
+
/* @__PURE__ */ u(h, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
1246
|
+
/* @__PURE__ */ a(N, { appearance: "gray", onClick: i, children: n.cancel }),
|
|
1247
|
+
/* @__PURE__ */ a(N, { type: "submit", children: n.confirm })
|
|
1248
|
+
] })
|
|
1249
|
+
] }) });
|
|
1250
|
+
}, it = (t) => {
|
|
1251
|
+
var T;
|
|
1252
|
+
const { decision: e, onSubmitEvent: n, textValues: i, onCancel: o } = t, { formik: r, handleToggleNoneChange: p } = Ke({
|
|
1253
|
+
decision: e,
|
|
1254
|
+
onSubmitEvent: n,
|
|
1255
|
+
textValues: i
|
|
1256
|
+
}), g = {
|
|
1257
|
+
ruleName: e.ruleName,
|
|
1258
|
+
labelName: e.labelName,
|
|
1259
|
+
howToSetTheCondition: e.howToSetTheDecision,
|
|
1260
|
+
decisionDataType: e.decisionDataType,
|
|
1261
|
+
listOfPossibleValues: e.listOfPossibleValues
|
|
1262
|
+
}, s = ((T = e.conditionsThatEstablishesTheDecision) == null ? void 0 : T.filter(
|
|
1263
|
+
(m) => !m.hidden
|
|
1264
|
+
)) || [], d = !!r.errors.conditionsThatEstablishesTheDecision && r.submitCount > 0, c = r.touched.effectiveFrom ? r.errors.effectiveFrom ? "invalid" : "valid" : void 0, l = r.touched.validUntil ? r.errors.validUntil ? "invalid" : "valid" : void 0;
|
|
1265
|
+
return /* @__PURE__ */ a(
|
|
1266
|
+
nt,
|
|
1267
|
+
{
|
|
1268
|
+
formik: r,
|
|
1269
|
+
onCancel: o,
|
|
1270
|
+
textValues: i,
|
|
1271
|
+
decision: e,
|
|
1272
|
+
visibleConditions: s,
|
|
1273
|
+
normalizedDecision: g,
|
|
1274
|
+
handleToggleNoneChange: p,
|
|
1275
|
+
handleConditionToggleChange: (m, C) => (w) => {
|
|
1276
|
+
if (!w)
|
|
1277
|
+
r.setFieldValue(
|
|
1278
|
+
`conditionsThatEstablishesTheDecision.${m}`,
|
|
1279
|
+
void 0
|
|
1280
|
+
), r.setFieldTouched(
|
|
1281
|
+
`conditionsThatEstablishesTheDecision.${m}`,
|
|
1282
|
+
!1,
|
|
1283
|
+
!1
|
|
1284
|
+
);
|
|
1285
|
+
else {
|
|
1286
|
+
const F = C ? [] : "";
|
|
1287
|
+
r.setFieldValue(
|
|
1288
|
+
`conditionsThatEstablishesTheDecision.${m}`,
|
|
1289
|
+
F
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
showConditionsError: d,
|
|
1294
|
+
termStartStatus: c,
|
|
1295
|
+
termEndStatus: l
|
|
1296
|
+
}
|
|
1297
|
+
);
|
|
1298
|
+
}, yt = (t) => {
|
|
1299
|
+
var o;
|
|
1300
|
+
const { decisionTemplate: e } = t, n = { ...e }, i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
|
|
1301
|
+
(r) => r.switchPlaces
|
|
1302
|
+
);
|
|
1303
|
+
return i ? {
|
|
1304
|
+
...n,
|
|
1305
|
+
ruleName: i.conditionName,
|
|
1306
|
+
labelName: i.labelName,
|
|
1307
|
+
decisionDataType: i.conditionDataType,
|
|
1308
|
+
value: i.value,
|
|
1309
|
+
howToSetTheDecision: i.howToSetTheCondition,
|
|
1310
|
+
conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
|
|
1311
|
+
(r) => r.conditionName === i.conditionName ? { ...r, hidden: !0 } : r
|
|
1312
|
+
)
|
|
1313
|
+
} : n;
|
|
1314
|
+
}, vt = (t) => {
|
|
1315
|
+
const { decisions: e } = t;
|
|
1316
|
+
return e == null ? void 0 : e.map((n) => {
|
|
1317
|
+
var o;
|
|
1318
|
+
const i = (o = n.conditionsThatEstablishesTheDecision) == null ? void 0 : o.find(
|
|
1319
|
+
(r) => r.switchPlaces
|
|
1320
|
+
);
|
|
1321
|
+
return i ? {
|
|
1322
|
+
...n,
|
|
1323
|
+
ruleName: i.conditionName,
|
|
1324
|
+
labelName: i.labelName,
|
|
1325
|
+
decisionDataType: i.conditionDataType,
|
|
1326
|
+
value: i.value,
|
|
1327
|
+
howToSetTheDecision: i.howToSetTheCondition,
|
|
1328
|
+
conditionsThatEstablishesTheDecision: n.conditionsThatEstablishesTheDecision.map(
|
|
1329
|
+
(r) => r.conditionName === i.conditionName ? { ...r, hidden: !0 } : r
|
|
1107
1330
|
)
|
|
1108
1331
|
} : n;
|
|
1109
1332
|
});
|
|
1110
1333
|
};
|
|
1111
1334
|
export {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1335
|
+
H as BusinessRuleCard,
|
|
1336
|
+
re as BusinessRuleView,
|
|
1337
|
+
gt as BusinessRules,
|
|
1338
|
+
mt as Filter,
|
|
1339
|
+
bt as FilterModal,
|
|
1340
|
+
Tt as FormFilter,
|
|
1341
|
+
Re as ModalRules,
|
|
1342
|
+
it as RulesForm,
|
|
1343
|
+
ft as revertSortedDataSampleSwitchPlaces,
|
|
1344
|
+
xt as revertSortedDataSwitchPlaces,
|
|
1345
|
+
yt as sortDisplayDataSampleSwitchPlaces,
|
|
1346
|
+
vt as sortDisplayDataSwitchPlaces
|
|
1121
1347
|
};
|