@isettingkit/business-rules 0.1.27 → 0.1.28
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 +389 -380
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as c, Fragment as
|
|
2
|
-
import { ValueDataType as V, ValueHowToSetUp as
|
|
1
|
+
import { jsxs as c, Fragment as F, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { ValueDataType as V, ValueHowToSetUp as g, InputRange as te, MultipleChoices as re, DynamicField as ae } from "@isettingkit/input";
|
|
3
3
|
import { Stack as s } from "@inubekit/stack";
|
|
4
|
-
import { Divider as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { useState as _, useEffect as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { Date as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { Toggle as
|
|
11
|
-
import { inube as
|
|
12
|
-
import
|
|
13
|
-
import { useFormik as
|
|
14
|
-
import { mixed as
|
|
4
|
+
import { Divider as k } from "@inubekit/divider";
|
|
5
|
+
import { Button as G } from "@inubekit/button";
|
|
6
|
+
import { useState as _, useEffect as ne } from "react";
|
|
7
|
+
import { Text as y } from "@inubekit/text";
|
|
8
|
+
import { Date as P } from "@inubekit/date";
|
|
9
|
+
import { Checkbox as oe } from "@inubekit/checkbox";
|
|
10
|
+
import { Toggle as J } from "@inubekit/toggle";
|
|
11
|
+
import { inube as S } from "@inubekit/foundations";
|
|
12
|
+
import f, { keyframes as le } from "styled-components";
|
|
13
|
+
import { useFormik as ie } from "formik";
|
|
14
|
+
import { mixed as K, object as A, number as R, string as B, date as Q, lazy as de } from "yup";
|
|
15
15
|
import { DecisionViewConditionRenderer as q } from "@isettingkit/view";
|
|
16
16
|
import { SkeletonLine as D } from "@inubekit/skeleton";
|
|
17
|
-
import { MdOutlineDelete as
|
|
18
|
-
import { Icon as
|
|
19
|
-
import { createPortal as
|
|
20
|
-
import { Blanket as
|
|
21
|
-
import { Grid as
|
|
17
|
+
import { MdOutlineDelete as se, MdClear as ce, MdAdd as ue } from "react-icons/md";
|
|
18
|
+
import { Icon as X } from "@inubekit/icon";
|
|
19
|
+
import { createPortal as he } from "react-dom";
|
|
20
|
+
import { Blanket as pe } from "@inubekit/blanket";
|
|
21
|
+
import { Grid as ge } from "@inubekit/grid";
|
|
22
22
|
import { useMediaQuery as me } from "@inubekit/hooks";
|
|
23
|
-
const
|
|
23
|
+
const be = (r) => {
|
|
24
24
|
const {
|
|
25
25
|
onHandleStartChange: e,
|
|
26
|
-
onHandleEndChange:
|
|
27
|
-
onCheckClosedChange:
|
|
26
|
+
onHandleEndChange: o,
|
|
27
|
+
onCheckClosedChange: i,
|
|
28
28
|
labelStart: h,
|
|
29
29
|
labelEnd: a,
|
|
30
|
-
checkedClosed:
|
|
31
|
-
required:
|
|
30
|
+
checkedClosed: d = !1,
|
|
31
|
+
required: l = !1,
|
|
32
32
|
valueStart: u = "",
|
|
33
33
|
valueEnd: p = "",
|
|
34
|
-
messageStart:
|
|
35
|
-
messageEnd:
|
|
36
|
-
statusStart:
|
|
37
|
-
statusEnd:
|
|
38
|
-
} = r, [n,
|
|
39
|
-
return /* @__PURE__ */ c(
|
|
34
|
+
messageStart: b = "",
|
|
35
|
+
messageEnd: m = "",
|
|
36
|
+
statusStart: x = "pending",
|
|
37
|
+
statusEnd: w = "pending"
|
|
38
|
+
} = r, [n, N] = _(d), [U, I] = _(u), [L, $] = _(p);
|
|
39
|
+
return /* @__PURE__ */ c(F, { children: [
|
|
40
40
|
/* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
41
41
|
/* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
42
|
-
|
|
42
|
+
y,
|
|
43
43
|
{
|
|
44
44
|
appearance: "gray",
|
|
45
45
|
margin: "10px 0",
|
|
@@ -57,11 +57,11 @@ const ge = (r) => {
|
|
|
57
57
|
wrap: "wrap",
|
|
58
58
|
gap: "4px",
|
|
59
59
|
children: /* @__PURE__ */ t(
|
|
60
|
-
|
|
60
|
+
oe,
|
|
61
61
|
{
|
|
62
62
|
label: "Cerrada",
|
|
63
|
-
onChange: ({ target:
|
|
64
|
-
|
|
63
|
+
onChange: ({ target: v }) => {
|
|
64
|
+
N(v.checked), i && i(v.checked);
|
|
65
65
|
},
|
|
66
66
|
checked: n,
|
|
67
67
|
value: ""
|
|
@@ -72,43 +72,43 @@ const ge = (r) => {
|
|
|
72
72
|
] }),
|
|
73
73
|
/* @__PURE__ */ c(s, { justifyContent: "space-between", gap: "24px", children: [
|
|
74
74
|
/* @__PURE__ */ t(s, { width: "189px", children: /* @__PURE__ */ t(
|
|
75
|
-
|
|
75
|
+
P,
|
|
76
76
|
{
|
|
77
77
|
id: "dateStart",
|
|
78
78
|
label: h,
|
|
79
|
-
onChange: (
|
|
80
|
-
I(
|
|
79
|
+
onChange: (v) => {
|
|
80
|
+
I(v.target.value), e(v);
|
|
81
81
|
},
|
|
82
|
-
value:
|
|
83
|
-
required:
|
|
82
|
+
value: U,
|
|
83
|
+
required: l,
|
|
84
84
|
size: "compact",
|
|
85
|
-
status:
|
|
86
|
-
message:
|
|
85
|
+
status: x,
|
|
86
|
+
message: b
|
|
87
87
|
}
|
|
88
88
|
) }),
|
|
89
89
|
n && /* @__PURE__ */ t(s, { width: "189px", children: /* @__PURE__ */ t(
|
|
90
|
-
|
|
90
|
+
P,
|
|
91
91
|
{
|
|
92
92
|
id: "dateEnd",
|
|
93
93
|
label: a,
|
|
94
|
-
onChange: (
|
|
95
|
-
|
|
94
|
+
onChange: (v) => {
|
|
95
|
+
$(v.target.value), o(v);
|
|
96
96
|
},
|
|
97
|
-
value:
|
|
98
|
-
required:
|
|
97
|
+
value: L,
|
|
98
|
+
required: l,
|
|
99
99
|
size: "compact",
|
|
100
|
-
status:
|
|
101
|
-
message:
|
|
100
|
+
status: w,
|
|
101
|
+
message: m
|
|
102
102
|
}
|
|
103
103
|
) })
|
|
104
104
|
] })
|
|
105
105
|
] });
|
|
106
|
-
},
|
|
106
|
+
}, fe = f.div`
|
|
107
107
|
& > div {
|
|
108
108
|
border-radius: 8px;
|
|
109
|
-
border: 1px solid ${
|
|
109
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`, xe = f.div`
|
|
112
112
|
width: 100%;
|
|
113
113
|
height: 100%;
|
|
114
114
|
overflow-y: auto;
|
|
@@ -125,85 +125,85 @@ const ge = (r) => {
|
|
|
125
125
|
background-color: #ebecf0;
|
|
126
126
|
border-radius: 8px;
|
|
127
127
|
}
|
|
128
|
-
`,
|
|
128
|
+
`, ve = (r) => {
|
|
129
129
|
const {
|
|
130
130
|
checked: e,
|
|
131
|
-
children:
|
|
132
|
-
handleToggleChange:
|
|
131
|
+
children: o,
|
|
132
|
+
handleToggleChange: i,
|
|
133
133
|
id: h,
|
|
134
134
|
labelToggle: a,
|
|
135
|
-
name:
|
|
136
|
-
valueToggle:
|
|
137
|
-
} = r, [u, p] = _(e),
|
|
138
|
-
p(
|
|
135
|
+
name: d,
|
|
136
|
+
valueToggle: l = ""
|
|
137
|
+
} = r, [u, p] = _(e), b = (m) => {
|
|
138
|
+
p(m.target.checked), i(m);
|
|
139
139
|
};
|
|
140
|
-
return
|
|
140
|
+
return ne(() => {
|
|
141
141
|
p(e);
|
|
142
|
-
}, [e]), /* @__PURE__ */ c(
|
|
142
|
+
}, [e]), /* @__PURE__ */ c(F, { children: [
|
|
143
143
|
/* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
144
|
-
|
|
144
|
+
J,
|
|
145
145
|
{
|
|
146
146
|
checked: u,
|
|
147
147
|
id: h,
|
|
148
|
-
name:
|
|
149
|
-
onChange:
|
|
148
|
+
name: d,
|
|
149
|
+
onChange: b,
|
|
150
150
|
size: "small",
|
|
151
|
-
value:
|
|
152
|
-
children: /* @__PURE__ */ t(
|
|
151
|
+
value: l,
|
|
152
|
+
children: /* @__PURE__ */ t(y, { size: "medium", type: "label", weight: "bold", children: a })
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
u && /* @__PURE__ */ t(
|
|
155
|
+
u && /* @__PURE__ */ t(F, { children: o })
|
|
156
156
|
] });
|
|
157
|
-
},
|
|
158
|
-
schema:
|
|
157
|
+
}, ye = (r) => ({
|
|
158
|
+
schema: K().test(
|
|
159
159
|
"isArrayOrString",
|
|
160
160
|
"Must be an array of strings/numbers or a single string",
|
|
161
161
|
(e) => Array.isArray(e) ? e.every(
|
|
162
|
-
(
|
|
162
|
+
(o) => typeof o == "string" || typeof o == "number"
|
|
163
163
|
) : typeof e == "string"
|
|
164
164
|
),
|
|
165
165
|
value: r
|
|
166
|
-
}),
|
|
167
|
-
schema:
|
|
166
|
+
}), Ce = (r) => ({
|
|
167
|
+
schema: K().test(
|
|
168
168
|
"isArrayOrString",
|
|
169
169
|
"Must be an array of strings/numbers or a single string",
|
|
170
170
|
(e) => Array.isArray(e) ? e.every(
|
|
171
|
-
(
|
|
171
|
+
(o) => typeof o == "string" || typeof o == "number"
|
|
172
172
|
) : typeof e == "string"
|
|
173
173
|
),
|
|
174
174
|
value: r
|
|
175
|
-
}),
|
|
176
|
-
const e = (r == null ? void 0 : r.from) ?? 0,
|
|
175
|
+
}), we = (r) => {
|
|
176
|
+
const e = (r == null ? void 0 : r.from) ?? 0, o = (r == null ? void 0 : r.to) ?? 0;
|
|
177
177
|
return {
|
|
178
|
-
schema:
|
|
179
|
-
from:
|
|
180
|
-
to:
|
|
178
|
+
schema: A({
|
|
179
|
+
from: R().required("Range From is required").max(o, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
180
|
+
to: R().required("Range To is required").min(e, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
|
|
181
181
|
}),
|
|
182
|
-
value: { from: e, to:
|
|
182
|
+
value: { from: e, to: o }
|
|
183
183
|
};
|
|
184
|
-
},
|
|
185
|
-
schema:
|
|
184
|
+
}, M = (r, e) => e === V.PERCENTAGE ? {
|
|
185
|
+
schema: R().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
186
186
|
value: r
|
|
187
187
|
} : {
|
|
188
|
-
schema:
|
|
188
|
+
schema: B().required("Required"),
|
|
189
189
|
value: r
|
|
190
|
-
},
|
|
191
|
-
schema:
|
|
190
|
+
}, Se = (r) => ({
|
|
191
|
+
schema: B().required("Required").test(
|
|
192
192
|
"non-empty",
|
|
193
193
|
"Value cannot be empty",
|
|
194
194
|
(e) => e != null && e.trim() !== ""
|
|
195
195
|
),
|
|
196
196
|
value: r
|
|
197
197
|
}), ke = {
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
},
|
|
205
|
-
function
|
|
206
|
-
const
|
|
198
|
+
[g.LIST_OF_VALUES]: ye,
|
|
199
|
+
[g.LIST_OF_VALUES_MULTI]: Ce,
|
|
200
|
+
[g.RANGE]: we,
|
|
201
|
+
[g.GREATER_THAN]: M,
|
|
202
|
+
[g.LESS_THAN]: M,
|
|
203
|
+
[g.EQUAL]: M
|
|
204
|
+
}, Te = (r) => ke[r] || Se;
|
|
205
|
+
function De({ decision: r, onSubmitEvent: e }) {
|
|
206
|
+
const o = {
|
|
207
207
|
name: r.name || "",
|
|
208
208
|
dataType: r.dataType || "",
|
|
209
209
|
valueUse: r.valueUse || "",
|
|
@@ -213,89 +213,89 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
213
213
|
toggleNone: !0,
|
|
214
214
|
conditions: {},
|
|
215
215
|
checkClosed: !1
|
|
216
|
-
},
|
|
217
|
-
name:
|
|
218
|
-
startDate:
|
|
219
|
-
endDate:
|
|
216
|
+
}, i = A({
|
|
217
|
+
name: B().required("Name is required"),
|
|
218
|
+
startDate: Q().required("Start date is required"),
|
|
219
|
+
endDate: Q().when("checkClosed", (d, l, { parent: u }) => (u == null ? void 0 : u.checkClosed) ? l.required("End date is required").test(
|
|
220
220
|
"is-after-startDate",
|
|
221
221
|
"End date must be greater than or equal to Start date",
|
|
222
|
-
function(
|
|
223
|
-
const
|
|
224
|
-
return !
|
|
222
|
+
function(b) {
|
|
223
|
+
const m = this.parent.startDate;
|
|
224
|
+
return !m || !b ? !0 : new Date(b) >= new Date(m);
|
|
225
225
|
}
|
|
226
|
-
) :
|
|
227
|
-
value:
|
|
228
|
-
from:
|
|
229
|
-
to:
|
|
226
|
+
) : l.notRequired()),
|
|
227
|
+
value: A({
|
|
228
|
+
from: R().min(0, "From value must be greater than or equal to 0").required("From value is required"),
|
|
229
|
+
to: R().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
230
230
|
"is-greater",
|
|
231
231
|
"To value must be greater than From value",
|
|
232
|
-
function(
|
|
233
|
-
const { from:
|
|
234
|
-
return
|
|
232
|
+
function(d) {
|
|
233
|
+
const { from: l } = this.parent;
|
|
234
|
+
return d > l;
|
|
235
235
|
}
|
|
236
236
|
)
|
|
237
237
|
}).required("Range value is required"),
|
|
238
|
-
conditions:
|
|
239
|
-
var p,
|
|
240
|
-
return (
|
|
241
|
-
(
|
|
242
|
-
(
|
|
243
|
-
if (h.values.conditions[
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
conditions: de((d, { parent: l }) => {
|
|
239
|
+
var p, b;
|
|
240
|
+
return (l == null ? void 0 : l.toggleNone) && ((p = l == null ? void 0 : l.conditions) == null ? void 0 : p.length) > 0 ? A().shape({}) : A(
|
|
241
|
+
(b = r.conditions) == null ? void 0 : b.reduce(
|
|
242
|
+
(m, x) => {
|
|
243
|
+
if (h.values.conditions[x.name] !== void 0) {
|
|
244
|
+
const w = Te(x.valueUse);
|
|
245
|
+
m[x.name] = w(
|
|
246
|
+
x.value,
|
|
247
|
+
x.dataType
|
|
248
248
|
).schema;
|
|
249
249
|
}
|
|
250
|
-
return
|
|
250
|
+
return m;
|
|
251
251
|
},
|
|
252
252
|
{}
|
|
253
253
|
)
|
|
254
254
|
);
|
|
255
255
|
})
|
|
256
|
-
}), h =
|
|
257
|
-
initialValues:
|
|
258
|
-
validationSchema:
|
|
256
|
+
}), h = ie({
|
|
257
|
+
initialValues: o,
|
|
258
|
+
validationSchema: i,
|
|
259
259
|
validateOnBlur: !0,
|
|
260
|
-
onSubmit: (
|
|
260
|
+
onSubmit: (d) => {
|
|
261
261
|
var u;
|
|
262
|
-
const
|
|
262
|
+
const l = {
|
|
263
263
|
...r,
|
|
264
|
-
name:
|
|
265
|
-
dataType:
|
|
266
|
-
valueUse:
|
|
267
|
-
value:
|
|
268
|
-
startDate:
|
|
269
|
-
endDate:
|
|
264
|
+
name: d.name,
|
|
265
|
+
dataType: d.dataType,
|
|
266
|
+
valueUse: d.valueUse,
|
|
267
|
+
value: d.value,
|
|
268
|
+
startDate: d.startDate,
|
|
269
|
+
endDate: d.endDate,
|
|
270
270
|
conditions: (u = r.conditions) == null ? void 0 : u.map((p) => ({
|
|
271
271
|
...p,
|
|
272
|
-
value:
|
|
272
|
+
value: d.conditions[p.name]
|
|
273
273
|
}))
|
|
274
274
|
};
|
|
275
|
-
e(
|
|
275
|
+
e(l);
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
-
return { formik: h, handleToggleNoneChange: (
|
|
279
|
-
var
|
|
280
|
-
h.setFieldValue("toggleNone",
|
|
281
|
-
if (
|
|
278
|
+
return { formik: h, handleToggleNoneChange: (d) => {
|
|
279
|
+
var l;
|
|
280
|
+
h.setFieldValue("toggleNone", d), (l = r.conditions) == null || l.forEach((u) => {
|
|
281
|
+
if (d)
|
|
282
282
|
h.setFieldValue(`conditions.${u.name}`, void 0);
|
|
283
283
|
else {
|
|
284
|
-
const p = u.valueUse ===
|
|
284
|
+
const p = u.valueUse === g.LIST_OF_VALUES_MULTI ? [] : "";
|
|
285
285
|
h.setFieldValue(`conditions.${u.name}`, p);
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
288
|
} };
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
var
|
|
292
|
-
const { decision: e, onSubmitEvent:
|
|
290
|
+
const Ee = (r) => {
|
|
291
|
+
var l, u, p, b, m, x, w;
|
|
292
|
+
const { decision: e, onSubmitEvent: o, textValues: i, onCancel: h } = r, { formik: a, handleToggleNoneChange: d } = De({
|
|
293
293
|
decision: e,
|
|
294
|
-
onSubmitEvent:
|
|
294
|
+
onSubmitEvent: o
|
|
295
295
|
});
|
|
296
296
|
return /* @__PURE__ */ t("form", { onSubmit: a.handleSubmit, children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
|
|
297
297
|
/* @__PURE__ */ t(
|
|
298
|
-
|
|
298
|
+
te,
|
|
299
299
|
{
|
|
300
300
|
id: "valueRange",
|
|
301
301
|
typeInput: e.dataType.toLowerCase(),
|
|
@@ -304,15 +304,15 @@ const De = (r) => {
|
|
|
304
304
|
valueTo: a.values.value.to,
|
|
305
305
|
handleInputChangeFrom: (n) => a.setFieldValue("value.from", n),
|
|
306
306
|
handleInputChangeTo: (n) => a.setFieldValue("value.to", n),
|
|
307
|
-
messageFrom: (
|
|
307
|
+
messageFrom: (l = a.errors.value) == null ? void 0 : l.from,
|
|
308
308
|
messageTo: (u = a.errors.value) == null ? void 0 : u.to,
|
|
309
|
-
statusFrom: (p = a.touched.value) != null && p.from ? (
|
|
310
|
-
statusTo: (
|
|
309
|
+
statusFrom: (p = a.touched.value) != null && p.from ? (b = a.errors.value) != null && b.from ? "invalid" : "valid" : "pending",
|
|
310
|
+
statusTo: (m = a.touched.value) != null && m.to ? (x = a.errors.value) != null && x.to ? "invalid" : "valid" : "pending",
|
|
311
311
|
onBlur: a.handleBlur
|
|
312
312
|
}
|
|
313
313
|
),
|
|
314
|
-
/* @__PURE__ */ t(
|
|
315
|
-
/* @__PURE__ */ t(
|
|
314
|
+
/* @__PURE__ */ t(k, { dashed: !0 }),
|
|
315
|
+
/* @__PURE__ */ t(fe, { children: /* @__PURE__ */ t(xe, { children: /* @__PURE__ */ c(
|
|
316
316
|
s,
|
|
317
317
|
{
|
|
318
318
|
direction: "column",
|
|
@@ -321,29 +321,29 @@ const De = (r) => {
|
|
|
321
321
|
height: "272px",
|
|
322
322
|
children: [
|
|
323
323
|
/* @__PURE__ */ c(s, { direction: "row", justifyContent: "space-between", children: [
|
|
324
|
-
/* @__PURE__ */ t(
|
|
324
|
+
/* @__PURE__ */ t(y, { children: i.factsThatConditionIt }),
|
|
325
325
|
/* @__PURE__ */ t(
|
|
326
|
-
|
|
326
|
+
J,
|
|
327
327
|
{
|
|
328
328
|
id: "toggleNone",
|
|
329
|
-
onChange: () =>
|
|
329
|
+
onChange: () => d(!a.values.toggleNone),
|
|
330
330
|
checked: a.values.toggleNone,
|
|
331
331
|
size: "small",
|
|
332
|
-
children: /* @__PURE__ */ t(
|
|
332
|
+
children: /* @__PURE__ */ t(y, { size: "medium", type: "label", weight: "bold", children: i.none })
|
|
333
333
|
}
|
|
334
334
|
)
|
|
335
335
|
] }),
|
|
336
|
-
/* @__PURE__ */ t(s, { direction: "column", gap: "20px", children: (
|
|
337
|
-
var U,
|
|
336
|
+
/* @__PURE__ */ t(s, { direction: "column", gap: "20px", children: (w = e.conditions) == null ? void 0 : w.map((n) => {
|
|
337
|
+
var N, U, I, L, $, z, j;
|
|
338
338
|
return /* @__PURE__ */ t(
|
|
339
|
-
|
|
339
|
+
ve,
|
|
340
340
|
{
|
|
341
341
|
id: `toggle-${n.name}`,
|
|
342
342
|
name: `toggle.${n.name}`,
|
|
343
343
|
labelToggle: n.name,
|
|
344
344
|
checked: !a.values.toggleNone && a.values.conditions[n.name] !== void 0,
|
|
345
|
-
handleToggleChange: (
|
|
346
|
-
if (!
|
|
345
|
+
handleToggleChange: (C) => {
|
|
346
|
+
if (!C.target.checked)
|
|
347
347
|
a.setFieldValue(
|
|
348
348
|
`conditions.${n.name}`,
|
|
349
349
|
void 0
|
|
@@ -353,29 +353,29 @@ const De = (r) => {
|
|
|
353
353
|
!1
|
|
354
354
|
);
|
|
355
355
|
else {
|
|
356
|
-
const T = n.valueUse ===
|
|
356
|
+
const T = n.valueUse === g.LIST_OF_VALUES_MULTI ? [] : "";
|
|
357
357
|
a.setFieldValue(
|
|
358
358
|
`conditions.${n.name}`,
|
|
359
359
|
T
|
|
360
360
|
);
|
|
361
361
|
}
|
|
362
362
|
},
|
|
363
|
-
children: n.valueUse ===
|
|
364
|
-
|
|
363
|
+
children: n.valueUse === g.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ t(
|
|
364
|
+
re,
|
|
365
365
|
{
|
|
366
366
|
id: n.name,
|
|
367
367
|
labelSelect: n.name,
|
|
368
368
|
labelSelected: `Selected ${n.name}`,
|
|
369
|
-
options: (
|
|
370
|
-
id:
|
|
371
|
-
label:
|
|
372
|
-
checked: (a.values.conditions[n.name] || []).includes(
|
|
369
|
+
options: (U = (N = n.possibleValue) == null ? void 0 : N.list) == null ? void 0 : U.map((C) => ({
|
|
370
|
+
id: C,
|
|
371
|
+
label: C,
|
|
372
|
+
checked: (a.values.conditions[n.name] || []).includes(C)
|
|
373
373
|
})),
|
|
374
|
-
onHandleSelectCheckChange: (
|
|
375
|
-
const
|
|
374
|
+
onHandleSelectCheckChange: (C) => {
|
|
375
|
+
const v = C.filter((T) => T.checked).map((T) => T.id);
|
|
376
376
|
a.setFieldValue(
|
|
377
377
|
`conditions.${n.name}`,
|
|
378
|
-
|
|
378
|
+
v
|
|
379
379
|
), a.setFieldTouched(
|
|
380
380
|
`conditions.${n.name}`,
|
|
381
381
|
!0,
|
|
@@ -383,7 +383,7 @@ const De = (r) => {
|
|
|
383
383
|
);
|
|
384
384
|
},
|
|
385
385
|
placeholderSelect: `Select ${n.name}`,
|
|
386
|
-
message: (I = a.touched.conditions) != null && I[n.name] && ((
|
|
386
|
+
message: (I = a.touched.conditions) != null && I[n.name] && ((L = a.errors.conditions) != null && L[n.name]) ? a.errors.conditions[n.name] : void 0,
|
|
387
387
|
onBlur: () => a.setFieldTouched(
|
|
388
388
|
`conditions.${n.name}`,
|
|
389
389
|
!0,
|
|
@@ -397,14 +397,14 @@ const De = (r) => {
|
|
|
397
397
|
name: `conditions.${n.name}`,
|
|
398
398
|
label: n.name,
|
|
399
399
|
value: a.values.conditions[n.name],
|
|
400
|
-
onChange: (
|
|
400
|
+
onChange: (C) => a.setFieldValue(
|
|
401
401
|
`conditions.${n.name}`,
|
|
402
|
-
|
|
402
|
+
C
|
|
403
403
|
),
|
|
404
404
|
messageValidate: String(
|
|
405
|
-
(
|
|
405
|
+
($ = a.errors.conditions) == null ? void 0 : $[n.name]
|
|
406
406
|
),
|
|
407
|
-
statusValidate: (z = a.touched.conditions) != null && z[n.name] ? (
|
|
407
|
+
statusValidate: (z = a.touched.conditions) != null && z[n.name] ? (j = a.errors.conditions) != null && j[n.name] ? "invalid" : "valid" : void 0,
|
|
408
408
|
onBlur: a.handleBlur
|
|
409
409
|
}
|
|
410
410
|
)
|
|
@@ -415,12 +415,12 @@ const De = (r) => {
|
|
|
415
415
|
]
|
|
416
416
|
}
|
|
417
417
|
) }) }),
|
|
418
|
-
/* @__PURE__ */ t(
|
|
418
|
+
/* @__PURE__ */ t(k, { dashed: !0 }),
|
|
419
419
|
/* @__PURE__ */ t(
|
|
420
|
-
|
|
420
|
+
be,
|
|
421
421
|
{
|
|
422
|
-
labelStart:
|
|
423
|
-
labelEnd:
|
|
422
|
+
labelStart: i.termStart,
|
|
423
|
+
labelEnd: i.termEnd,
|
|
424
424
|
valueStart: a.values.startDate,
|
|
425
425
|
valueEnd: a.values.endDate,
|
|
426
426
|
messageStart: a.errors.startDate,
|
|
@@ -435,10 +435,10 @@ const De = (r) => {
|
|
|
435
435
|
checkedClosed: a.values.checkClosed
|
|
436
436
|
}
|
|
437
437
|
),
|
|
438
|
-
/* @__PURE__ */ t(
|
|
438
|
+
/* @__PURE__ */ t(k, {}),
|
|
439
439
|
/* @__PURE__ */ c(s, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
440
|
-
/* @__PURE__ */ t(
|
|
441
|
-
/* @__PURE__ */ t(
|
|
440
|
+
/* @__PURE__ */ t(G, { appearance: "gray", onClick: h, children: i.cancel }),
|
|
441
|
+
/* @__PURE__ */ t(G, { type: "submit", children: i.confirm })
|
|
442
442
|
] })
|
|
443
443
|
] }) });
|
|
444
444
|
}, E = (r) => {
|
|
@@ -447,31 +447,31 @@ const De = (r) => {
|
|
|
447
447
|
const e = r.value;
|
|
448
448
|
if (!e)
|
|
449
449
|
return;
|
|
450
|
-
if (((
|
|
450
|
+
if (((i) => typeof i == "object" && i !== null)(e))
|
|
451
451
|
switch (r.valueUse) {
|
|
452
|
-
case
|
|
452
|
+
case g.LIST_OF_VALUES_MULTI:
|
|
453
453
|
return e;
|
|
454
|
-
case
|
|
454
|
+
case g.LIST_OF_VALUES:
|
|
455
455
|
return e;
|
|
456
|
-
case
|
|
456
|
+
case g.RANGE:
|
|
457
457
|
return {
|
|
458
458
|
from: e.from,
|
|
459
459
|
to: e.to
|
|
460
460
|
};
|
|
461
|
-
case
|
|
462
|
-
case
|
|
463
|
-
case
|
|
461
|
+
case g.GREATER_THAN:
|
|
462
|
+
case g.LESS_THAN:
|
|
463
|
+
case g.EQUAL:
|
|
464
464
|
return e.value;
|
|
465
465
|
default:
|
|
466
466
|
return e.value;
|
|
467
467
|
}
|
|
468
468
|
return e;
|
|
469
|
-
},
|
|
469
|
+
}, Y = f.div`
|
|
470
470
|
& > div {
|
|
471
471
|
border-radius: 8px;
|
|
472
|
-
border: 1px solid ${
|
|
472
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
473
473
|
}
|
|
474
|
-
`,
|
|
474
|
+
`, W = f.div`
|
|
475
475
|
width: 100%;
|
|
476
476
|
height: 100%;
|
|
477
477
|
overflow-y: auto;
|
|
@@ -489,14 +489,14 @@ const De = (r) => {
|
|
|
489
489
|
background-color: #ebecf0;
|
|
490
490
|
border-radius: 8px;
|
|
491
491
|
}
|
|
492
|
-
`,
|
|
493
|
-
const { decision: e, loading:
|
|
492
|
+
`, Z = (r) => {
|
|
493
|
+
const { decision: e, loading: o = !1, textValues: i } = r, h = (d) => d && Object.keys(d).length > 0, a = {
|
|
494
494
|
name: (e == null ? void 0 : e.name) || "",
|
|
495
495
|
dataType: (e == null ? void 0 : e.dataType) || "alphabetical",
|
|
496
496
|
value: E(e),
|
|
497
497
|
valueUse: (e == null ? void 0 : e.valueUse) || "equal"
|
|
498
498
|
};
|
|
499
|
-
return !
|
|
499
|
+
return !o && e && i ? /* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
|
|
500
500
|
e && /* @__PURE__ */ t(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ t(
|
|
501
501
|
q,
|
|
502
502
|
{
|
|
@@ -505,8 +505,8 @@ const De = (r) => {
|
|
|
505
505
|
type: "decision"
|
|
506
506
|
}
|
|
507
507
|
) }, e.name),
|
|
508
|
-
/* @__PURE__ */ t(
|
|
509
|
-
/* @__PURE__ */ t(
|
|
508
|
+
/* @__PURE__ */ t(k, { dashed: !0 }),
|
|
509
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ c(
|
|
510
510
|
s,
|
|
511
511
|
{
|
|
512
512
|
direction: "column",
|
|
@@ -515,72 +515,72 @@ const De = (r) => {
|
|
|
515
515
|
height: "203px",
|
|
516
516
|
children: [
|
|
517
517
|
/* @__PURE__ */ t(
|
|
518
|
-
|
|
518
|
+
y,
|
|
519
519
|
{
|
|
520
520
|
type: "label",
|
|
521
521
|
size: "large",
|
|
522
522
|
appearance: "dark",
|
|
523
523
|
weight: "bold",
|
|
524
524
|
textAlign: "center",
|
|
525
|
-
children:
|
|
525
|
+
children: i.factsThatConditionIt
|
|
526
526
|
}
|
|
527
527
|
),
|
|
528
|
-
e.conditions && e.conditions.map((
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
return (typeof
|
|
528
|
+
e.conditions && e.conditions.map((d) => {
|
|
529
|
+
if (d.hidden) return null;
|
|
530
|
+
const l = d.value;
|
|
531
|
+
return (typeof l == "object" && h(l) || l !== void 0 && typeof l == "string" && l.length > 0) && /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ t(
|
|
532
532
|
q,
|
|
533
533
|
{
|
|
534
534
|
element: {
|
|
535
|
-
...
|
|
536
|
-
value:
|
|
535
|
+
...d,
|
|
536
|
+
value: l
|
|
537
537
|
},
|
|
538
|
-
valueData: E(
|
|
538
|
+
valueData: E(d)
|
|
539
539
|
}
|
|
540
|
-
) }) },
|
|
540
|
+
) }) }, d.name);
|
|
541
541
|
}),
|
|
542
|
-
/* @__PURE__ */ t(
|
|
542
|
+
/* @__PURE__ */ t(k, { dashed: !0 }),
|
|
543
543
|
/* @__PURE__ */ c(s, { direction: "column", gap: "12px", children: [
|
|
544
544
|
(e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ t(
|
|
545
545
|
q,
|
|
546
546
|
{
|
|
547
547
|
element: {
|
|
548
|
-
name:
|
|
548
|
+
name: i.terms,
|
|
549
549
|
value: String(e.startDate),
|
|
550
|
-
valueUse:
|
|
550
|
+
valueUse: g.RANGE,
|
|
551
551
|
dataType: V.DATE
|
|
552
552
|
},
|
|
553
553
|
valueData: E({
|
|
554
|
-
name:
|
|
554
|
+
name: i.terms,
|
|
555
555
|
value: {
|
|
556
556
|
from: String(e.startDate),
|
|
557
557
|
to: String(e.endDate)
|
|
558
558
|
},
|
|
559
|
-
valueUse:
|
|
559
|
+
valueUse: g.RANGE,
|
|
560
560
|
dataType: V.DATE
|
|
561
561
|
}),
|
|
562
562
|
type: "decision"
|
|
563
563
|
},
|
|
564
|
-
|
|
564
|
+
i.terms
|
|
565
565
|
),
|
|
566
566
|
(e == null ? void 0 : e.startDate) && !(e != null && e.endDate) && /* @__PURE__ */ t(
|
|
567
567
|
q,
|
|
568
568
|
{
|
|
569
569
|
element: {
|
|
570
|
-
name:
|
|
570
|
+
name: i.terms,
|
|
571
571
|
value: String(e.startDate),
|
|
572
|
-
valueUse:
|
|
572
|
+
valueUse: g.EQUAL,
|
|
573
573
|
dataType: V.DATE
|
|
574
574
|
},
|
|
575
575
|
valueData: E({
|
|
576
|
-
name:
|
|
576
|
+
name: i.terms,
|
|
577
577
|
value: String(e.startDate),
|
|
578
|
-
valueUse:
|
|
578
|
+
valueUse: g.EQUAL,
|
|
579
579
|
dataType: V.DATE
|
|
580
580
|
}),
|
|
581
581
|
type: "decision"
|
|
582
582
|
},
|
|
583
|
-
|
|
583
|
+
i.terms
|
|
584
584
|
)
|
|
585
585
|
] })
|
|
586
586
|
]
|
|
@@ -592,17 +592,17 @@ const De = (r) => {
|
|
|
592
592
|
/* @__PURE__ */ t(D, { animated: !0, width: "85px" })
|
|
593
593
|
] }, "loading"),
|
|
594
594
|
/* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
595
|
-
/* @__PURE__ */ t(
|
|
595
|
+
/* @__PURE__ */ t(k, { dashed: !0 }),
|
|
596
596
|
/* @__PURE__ */ t(D, { animated: !0, width: "150px" })
|
|
597
597
|
] }),
|
|
598
|
-
/* @__PURE__ */ t(
|
|
598
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(
|
|
599
599
|
s,
|
|
600
600
|
{
|
|
601
601
|
direction: "column",
|
|
602
602
|
gap: "12px",
|
|
603
603
|
justifyContent: "space-between",
|
|
604
604
|
height: "203px",
|
|
605
|
-
children: Array.from({ length: 5 }).map((
|
|
605
|
+
children: Array.from({ length: 5 }).map((d, l) => /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ c(
|
|
606
606
|
s,
|
|
607
607
|
{
|
|
608
608
|
direction: "column",
|
|
@@ -614,13 +614,13 @@ const De = (r) => {
|
|
|
614
614
|
/* @__PURE__ */ t(D, { animated: !0, width: "85px" })
|
|
615
615
|
]
|
|
616
616
|
}
|
|
617
|
-
) }, `condition-${
|
|
617
|
+
) }, `condition-${l}`))
|
|
618
618
|
}
|
|
619
619
|
) })
|
|
620
620
|
] });
|
|
621
|
-
},
|
|
621
|
+
}, Ve = f.div`
|
|
622
622
|
border-radius: 8px;
|
|
623
|
-
border: 1px solid ${
|
|
623
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
624
624
|
box-sizing: border-box;
|
|
625
625
|
display: flex;
|
|
626
626
|
flex-direction: column;
|
|
@@ -630,7 +630,7 @@ const De = (r) => {
|
|
|
630
630
|
height: 100%;
|
|
631
631
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
632
632
|
`;
|
|
633
|
-
|
|
633
|
+
f.div`
|
|
634
634
|
width: 100%;
|
|
635
635
|
height: 100%;
|
|
636
636
|
overflow-y: auto;
|
|
@@ -649,35 +649,35 @@ x.div`
|
|
|
649
649
|
border-radius: 8px;
|
|
650
650
|
}
|
|
651
651
|
`;
|
|
652
|
-
const
|
|
653
|
-
const { children: e, controls:
|
|
654
|
-
return /* @__PURE__ */ t(
|
|
652
|
+
const H = (r) => {
|
|
653
|
+
const { children: e, controls: o = !0, handleDelete: i, id: h } = r;
|
|
654
|
+
return /* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
655
655
|
e,
|
|
656
|
-
|
|
657
|
-
/* @__PURE__ */ t(
|
|
656
|
+
o && /* @__PURE__ */ c(F, { children: [
|
|
657
|
+
/* @__PURE__ */ t(k, {}),
|
|
658
658
|
/* @__PURE__ */ t(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ t(
|
|
659
|
-
|
|
659
|
+
X,
|
|
660
660
|
{
|
|
661
661
|
cursorHover: !0,
|
|
662
662
|
appearance: "dark",
|
|
663
663
|
size: "24px",
|
|
664
|
-
icon: /* @__PURE__ */ t(
|
|
664
|
+
icon: /* @__PURE__ */ t(se, {}),
|
|
665
665
|
onClick: () => {
|
|
666
|
-
|
|
666
|
+
i(h);
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
) })
|
|
670
670
|
] })
|
|
671
671
|
] }) });
|
|
672
|
-
},
|
|
672
|
+
}, Ae = f.div`
|
|
673
673
|
position: relative;
|
|
674
674
|
& > div {
|
|
675
675
|
padding: 24px 16px;
|
|
676
676
|
}
|
|
677
|
-
`, Fe =
|
|
677
|
+
`, Fe = f.div`
|
|
678
678
|
background-color: ${({ theme: r }) => {
|
|
679
|
-
var e,
|
|
680
|
-
return ((
|
|
679
|
+
var e, o;
|
|
680
|
+
return ((o = (e = r == null ? void 0 : r.palette) == null ? void 0 : e.neutral) == null ? void 0 : o.N0) || S.palette.neutral.N0;
|
|
681
681
|
}};
|
|
682
682
|
max-width: 450px;
|
|
683
683
|
max-height: 90vh;
|
|
@@ -705,23 +705,23 @@ const O = (r) => {
|
|
|
705
705
|
background-color: #ebecf0;
|
|
706
706
|
border-radius: 8px;
|
|
707
707
|
}
|
|
708
|
-
`,
|
|
709
|
-
const { children: e, portalId:
|
|
708
|
+
`, Re = (r) => {
|
|
709
|
+
const { children: e, portalId: o, onCloseModal: i, title: h } = r, a = document.getElementById(o);
|
|
710
710
|
if (!a)
|
|
711
711
|
throw new Error(
|
|
712
712
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
713
713
|
);
|
|
714
|
-
return
|
|
715
|
-
/* @__PURE__ */ t(
|
|
714
|
+
return he(
|
|
715
|
+
/* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(pe, { children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "24px", children: [
|
|
716
716
|
/* @__PURE__ */ t(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(s, { alignItems: "center", justifyContent: "space-between", children: [
|
|
717
|
-
/* @__PURE__ */ t(
|
|
718
|
-
/* @__PURE__ */ t(
|
|
717
|
+
/* @__PURE__ */ t(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: h }),
|
|
718
|
+
/* @__PURE__ */ t(ce, { size: "24px", cursor: "pointer", onClick: i })
|
|
719
719
|
] }) }),
|
|
720
720
|
e
|
|
721
721
|
] }) }) }) }),
|
|
722
722
|
a
|
|
723
723
|
);
|
|
724
|
-
}, Ne =
|
|
724
|
+
}, Ne = le`
|
|
725
725
|
from {
|
|
726
726
|
opacity: 0;
|
|
727
727
|
transform: translateY(20px);
|
|
@@ -730,16 +730,16 @@ const O = (r) => {
|
|
|
730
730
|
opacity: 1;
|
|
731
731
|
transform: translateY(0);
|
|
732
732
|
}
|
|
733
|
-
`,
|
|
733
|
+
`, ee = f.div`
|
|
734
734
|
width: 100%;
|
|
735
735
|
height: 100%;
|
|
736
736
|
& > div {
|
|
737
737
|
animation: ${Ne} 600ms ease-out;
|
|
738
738
|
}
|
|
739
739
|
`;
|
|
740
|
-
|
|
740
|
+
f.div`
|
|
741
741
|
border-radius: 8px;
|
|
742
|
-
border: 1px solid ${
|
|
742
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
743
743
|
box-sizing: border-box;
|
|
744
744
|
display: flex;
|
|
745
745
|
flex-direction: column;
|
|
@@ -749,7 +749,7 @@ x.div`
|
|
|
749
749
|
height: 100%;
|
|
750
750
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
751
751
|
`;
|
|
752
|
-
const Ue =
|
|
752
|
+
const Ue = f.div`
|
|
753
753
|
& > div {
|
|
754
754
|
width: 100%;
|
|
755
755
|
height: 100%;
|
|
@@ -769,16 +769,16 @@ const Ue = x.div`
|
|
|
769
769
|
border-radius: 8px;
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
`,
|
|
772
|
+
`, Ie = f.div`
|
|
773
773
|
& > div > div {
|
|
774
774
|
border-radius: 8px;
|
|
775
|
-
border: 1px solid ${
|
|
775
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
776
776
|
box-sizing: border-box;
|
|
777
777
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
778
778
|
}
|
|
779
|
-
`,
|
|
779
|
+
`, Le = f.div`
|
|
780
780
|
& > div {
|
|
781
|
-
background-color: ${
|
|
781
|
+
background-color: ${S.palette.neutral.N30};
|
|
782
782
|
justify-content: center;
|
|
783
783
|
}
|
|
784
784
|
min-height: 300px;
|
|
@@ -786,33 +786,139 @@ const Ue = x.div`
|
|
|
786
786
|
height: 100%;
|
|
787
787
|
padding-bottom: 12px;
|
|
788
788
|
`;
|
|
789
|
-
|
|
789
|
+
f.div`
|
|
790
790
|
& > div {
|
|
791
791
|
border-radius: 8px;
|
|
792
|
-
border: 1px solid ${
|
|
792
|
+
border: 1px solid ${S.palette.neutral.N30};
|
|
793
793
|
}
|
|
794
794
|
`;
|
|
795
|
-
|
|
795
|
+
function $e({
|
|
796
|
+
index: r,
|
|
797
|
+
handleOpenModal: e
|
|
798
|
+
}) {
|
|
799
|
+
return /* @__PURE__ */ t(
|
|
800
|
+
H,
|
|
801
|
+
{
|
|
802
|
+
id: `loading-card-${r}`,
|
|
803
|
+
handleDelete: () => {
|
|
804
|
+
},
|
|
805
|
+
handleView: () => e(),
|
|
806
|
+
controls: !1,
|
|
807
|
+
children: /* @__PURE__ */ t(Z, { loading: !0 })
|
|
808
|
+
},
|
|
809
|
+
`loading-card-${r}`
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
function qe({
|
|
813
|
+
decision: r,
|
|
814
|
+
controls: e,
|
|
815
|
+
handleOpenModal: o,
|
|
816
|
+
handleDelete: i,
|
|
817
|
+
textValues: h
|
|
818
|
+
}) {
|
|
819
|
+
return r ? /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
|
|
820
|
+
/* @__PURE__ */ t(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: r.id }),
|
|
821
|
+
/* @__PURE__ */ t(
|
|
822
|
+
H,
|
|
823
|
+
{
|
|
824
|
+
id: r.id,
|
|
825
|
+
handleDelete: () => i(r.id),
|
|
826
|
+
handleView: () => o(r),
|
|
827
|
+
controls: e,
|
|
828
|
+
children: /* @__PURE__ */ t(Z, { decision: r, textValues: h })
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
] }) }, r.id) : null;
|
|
832
|
+
}
|
|
833
|
+
function _e({
|
|
834
|
+
index: r,
|
|
835
|
+
handleOpenModal: e
|
|
836
|
+
}) {
|
|
837
|
+
return /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
|
|
838
|
+
/* @__PURE__ */ t(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
|
|
839
|
+
/* @__PURE__ */ t(Le, { onClick: () => e(), children: /* @__PURE__ */ t(
|
|
840
|
+
H,
|
|
841
|
+
{
|
|
842
|
+
id: `add-decision-${r}`,
|
|
843
|
+
handleDelete: () => {
|
|
844
|
+
},
|
|
845
|
+
handleView: () => e(),
|
|
846
|
+
controls: !1,
|
|
847
|
+
children: /* @__PURE__ */ c(s, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
848
|
+
/* @__PURE__ */ t(X, { appearance: "gray", icon: /* @__PURE__ */ t(ue, {}), size: "35px" }),
|
|
849
|
+
/* @__PURE__ */ t(y, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
|
|
850
|
+
] })
|
|
851
|
+
}
|
|
852
|
+
) })
|
|
853
|
+
] }) }, `add-decision-${r}`);
|
|
854
|
+
}
|
|
855
|
+
const ze = {
|
|
856
|
+
loading: $e,
|
|
857
|
+
decision: qe,
|
|
858
|
+
add: _e
|
|
859
|
+
};
|
|
860
|
+
function O(r) {
|
|
861
|
+
const { type: e } = r, o = ze[e];
|
|
862
|
+
return o ? o(r) : null;
|
|
863
|
+
}
|
|
864
|
+
function je({
|
|
865
|
+
controls: r,
|
|
866
|
+
decisions: e,
|
|
867
|
+
loading: o,
|
|
868
|
+
handleOpenModal: i,
|
|
869
|
+
handleDelete: h,
|
|
870
|
+
textValues: a
|
|
871
|
+
}) {
|
|
872
|
+
const d = o ? Array.from({ length: 3 }).map(
|
|
873
|
+
(u, p) => O({
|
|
874
|
+
type: "loading",
|
|
875
|
+
index: p,
|
|
876
|
+
controls: r,
|
|
877
|
+
loading: o,
|
|
878
|
+
handleOpenModal: i,
|
|
879
|
+
handleDelete: h,
|
|
880
|
+
textValues: a
|
|
881
|
+
})
|
|
882
|
+
) : e.map(
|
|
883
|
+
(u) => O({
|
|
884
|
+
type: "decision",
|
|
885
|
+
decision: u,
|
|
886
|
+
controls: r,
|
|
887
|
+
loading: o,
|
|
888
|
+
handleOpenModal: i,
|
|
889
|
+
handleDelete: h,
|
|
890
|
+
textValues: a
|
|
891
|
+
})
|
|
892
|
+
), l = (e.length === 0 || e.length < Math.floor(window.innerWidth / 300)) && !o && r;
|
|
893
|
+
return { renderedCards: d, shouldRenderAddCard: l };
|
|
894
|
+
}
|
|
895
|
+
const st = (r) => {
|
|
796
896
|
const {
|
|
797
897
|
controls: e = !0,
|
|
798
|
-
decisions:
|
|
799
|
-
textValues:
|
|
898
|
+
decisions: o,
|
|
899
|
+
textValues: i,
|
|
800
900
|
decisionTemplate: h,
|
|
801
901
|
isModalOpen: a,
|
|
802
|
-
selectedDecision:
|
|
803
|
-
loading:
|
|
902
|
+
selectedDecision: d,
|
|
903
|
+
loading: l,
|
|
804
904
|
handleOpenModal: u,
|
|
805
905
|
handleCloseModal: p,
|
|
806
|
-
handleSubmitForm:
|
|
807
|
-
handleDelete:
|
|
808
|
-
} = r,
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
906
|
+
handleSubmitForm: b,
|
|
907
|
+
handleDelete: m
|
|
908
|
+
} = r, x = me("(max-width: 681px)"), { renderedCards: w, shouldRenderAddCard: n } = je({
|
|
909
|
+
controls: e,
|
|
910
|
+
decisions: o,
|
|
911
|
+
loading: l,
|
|
912
|
+
handleOpenModal: u,
|
|
913
|
+
handleDelete: m,
|
|
914
|
+
textValues: i
|
|
915
|
+
});
|
|
916
|
+
return /* @__PURE__ */ c(F, { children: [
|
|
917
|
+
/* @__PURE__ */ t(Ie, { children: /* @__PURE__ */ t(Ue, { children: /* @__PURE__ */ c(s, { direction: "column", gap: "16px", padding: "6px", children: [
|
|
918
|
+
o.length === 0 && !l && /* @__PURE__ */ c(y, { as: "span", type: "label", size: "large", appearance: "gray", children: [
|
|
812
919
|
"Aún no tienes definidas tasas de interés efectivas. Presiona",
|
|
813
|
-
" ",
|
|
814
920
|
/* @__PURE__ */ t(
|
|
815
|
-
|
|
921
|
+
y,
|
|
816
922
|
{
|
|
817
923
|
as: "span",
|
|
818
924
|
type: "label",
|
|
@@ -822,11 +928,10 @@ const rt = (r) => {
|
|
|
822
928
|
children: "“+ Agregar decisión”"
|
|
823
929
|
}
|
|
824
930
|
),
|
|
825
|
-
" ",
|
|
826
931
|
"para empezar."
|
|
827
932
|
] }),
|
|
828
933
|
/* @__PURE__ */ c(
|
|
829
|
-
|
|
934
|
+
ge,
|
|
830
935
|
{
|
|
831
936
|
templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
832
937
|
autoFlow: "row dense",
|
|
@@ -836,130 +941,34 @@ const rt = (r) => {
|
|
|
836
941
|
autoRows: "1fr",
|
|
837
942
|
justifyItems: "center",
|
|
838
943
|
padding: "6px",
|
|
839
|
-
height:
|
|
944
|
+
height: x ? "auto" : "484px",
|
|
840
945
|
children: [
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
`loading-card-${n}`
|
|
852
|
-
)) : l.map((b) => /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
|
|
853
|
-
s,
|
|
854
|
-
{
|
|
855
|
-
direction: "column",
|
|
856
|
-
gap: "4px",
|
|
857
|
-
width: "100%",
|
|
858
|
-
padding: "0 0 12px 0",
|
|
859
|
-
children: [
|
|
860
|
-
/* @__PURE__ */ t(
|
|
861
|
-
C,
|
|
862
|
-
{
|
|
863
|
-
type: "title",
|
|
864
|
-
size: "medium",
|
|
865
|
-
appearance: "gray",
|
|
866
|
-
weight: "bold",
|
|
867
|
-
children: b.id
|
|
868
|
-
}
|
|
869
|
-
),
|
|
870
|
-
/* @__PURE__ */ t(
|
|
871
|
-
O,
|
|
872
|
-
{
|
|
873
|
-
id: b.id,
|
|
874
|
-
handleDelete: () => g(b.id),
|
|
875
|
-
handleView: () => u(b),
|
|
876
|
-
controls: e,
|
|
877
|
-
children: /* @__PURE__ */ t(
|
|
878
|
-
W,
|
|
879
|
-
{
|
|
880
|
-
decision: b,
|
|
881
|
-
textValues: d
|
|
882
|
-
}
|
|
883
|
-
)
|
|
884
|
-
}
|
|
885
|
-
)
|
|
886
|
-
]
|
|
887
|
-
},
|
|
888
|
-
b.id
|
|
889
|
-
) }, b.id)),
|
|
890
|
-
(l.length === 0 || l.length < Math.floor(window.innerWidth / 300)) && !o && e && /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
|
|
891
|
-
s,
|
|
892
|
-
{
|
|
893
|
-
direction: "column",
|
|
894
|
-
gap: "4px",
|
|
895
|
-
width: "100%",
|
|
896
|
-
height: "100%",
|
|
897
|
-
children: [
|
|
898
|
-
/* @__PURE__ */ t(
|
|
899
|
-
C,
|
|
900
|
-
{
|
|
901
|
-
type: "title",
|
|
902
|
-
size: "medium",
|
|
903
|
-
appearance: "gray",
|
|
904
|
-
weight: "bold",
|
|
905
|
-
children: "Nueva decisión"
|
|
906
|
-
}
|
|
907
|
-
),
|
|
908
|
-
/* @__PURE__ */ t(
|
|
909
|
-
Ie,
|
|
910
|
-
{
|
|
911
|
-
onClick: () => u(),
|
|
912
|
-
children: /* @__PURE__ */ t(
|
|
913
|
-
O,
|
|
914
|
-
{
|
|
915
|
-
id: `add-decision-${l.length}`,
|
|
916
|
-
handleDelete: () => {
|
|
917
|
-
},
|
|
918
|
-
handleView: () => u(),
|
|
919
|
-
controls: !1,
|
|
920
|
-
children: /* @__PURE__ */ c(
|
|
921
|
-
s,
|
|
922
|
-
{
|
|
923
|
-
direction: "column",
|
|
924
|
-
gap: "12px",
|
|
925
|
-
alignItems: "center",
|
|
926
|
-
children: [
|
|
927
|
-
/* @__PURE__ */ t(
|
|
928
|
-
Z,
|
|
929
|
-
{
|
|
930
|
-
appearance: "gray",
|
|
931
|
-
icon: /* @__PURE__ */ t(ce, {}),
|
|
932
|
-
size: "35px"
|
|
933
|
-
}
|
|
934
|
-
),
|
|
935
|
-
/* @__PURE__ */ t(C, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
|
|
936
|
-
]
|
|
937
|
-
}
|
|
938
|
-
)
|
|
939
|
-
}
|
|
940
|
-
)
|
|
941
|
-
}
|
|
942
|
-
)
|
|
943
|
-
]
|
|
944
|
-
},
|
|
945
|
-
`add-decision-${l.length}`
|
|
946
|
-
) }, `add-decision-${l.length}`)
|
|
946
|
+
w,
|
|
947
|
+
n && O({
|
|
948
|
+
type: "add",
|
|
949
|
+
index: o.length,
|
|
950
|
+
controls: e,
|
|
951
|
+
loading: l,
|
|
952
|
+
handleOpenModal: u,
|
|
953
|
+
handleDelete: m,
|
|
954
|
+
textValues: i
|
|
955
|
+
})
|
|
947
956
|
]
|
|
948
957
|
}
|
|
949
958
|
)
|
|
950
959
|
] }) }) }),
|
|
951
960
|
a && /* @__PURE__ */ t(
|
|
952
|
-
|
|
961
|
+
Re,
|
|
953
962
|
{
|
|
954
963
|
portalId: "modal-portal",
|
|
955
964
|
onCloseModal: p,
|
|
956
|
-
title:
|
|
965
|
+
title: d ? "Editar Decisión" : "Nueva decisión",
|
|
957
966
|
children: /* @__PURE__ */ t(
|
|
958
|
-
|
|
967
|
+
Ee,
|
|
959
968
|
{
|
|
960
|
-
decision:
|
|
961
|
-
onSubmitEvent:
|
|
962
|
-
textValues:
|
|
969
|
+
decision: d || h,
|
|
970
|
+
onSubmitEvent: b,
|
|
971
|
+
textValues: i,
|
|
963
972
|
onCancel: () => p()
|
|
964
973
|
}
|
|
965
974
|
)
|
|
@@ -968,9 +977,9 @@ const rt = (r) => {
|
|
|
968
977
|
] });
|
|
969
978
|
};
|
|
970
979
|
export {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
980
|
+
H as BusinessRuleCard,
|
|
981
|
+
Z as BusinessRuleView,
|
|
982
|
+
st as BusinessRules,
|
|
983
|
+
Re as ModalRules,
|
|
984
|
+
Ee as RulesForm
|
|
976
985
|
};
|