@ttn-shared/ui 1.2.3 → 1.2.5
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.cjs +35 -7
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +35 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -77,6 +77,10 @@ var HTTP_ADMIN = (token, baseURL) => {
|
|
|
77
77
|
const url = `${baseURL}/admin`;
|
|
78
78
|
return import_axios.default.create(getBaseURL(url, token));
|
|
79
79
|
};
|
|
80
|
+
var HTTP_ASSISTANCE = (token, baseURL) => {
|
|
81
|
+
const url = `${baseURL}/assistance`;
|
|
82
|
+
return import_axios.default.create(getBaseURL(url, token));
|
|
83
|
+
};
|
|
80
84
|
|
|
81
85
|
// src/services/select.ts
|
|
82
86
|
var getDocumentTypes = async (token, baseURL) => {
|
|
@@ -310,7 +314,13 @@ var useIncomeGroups = ({
|
|
|
310
314
|
}) => {
|
|
311
315
|
const { token, baseUrl } = useTTNSharedContext();
|
|
312
316
|
const query = (0, import_react_query.useQuery)({
|
|
313
|
-
queryKey: [
|
|
317
|
+
queryKey: [
|
|
318
|
+
"income-groups",
|
|
319
|
+
filters?.corpclientId,
|
|
320
|
+
filters?.contractId,
|
|
321
|
+
filters?.affiliationTypeId,
|
|
322
|
+
filters?.eaccount
|
|
323
|
+
],
|
|
314
324
|
queryFn: () => getIncomeGroups(token, baseUrl, filters),
|
|
315
325
|
enabled
|
|
316
326
|
});
|
|
@@ -390,10 +400,12 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
390
400
|
}
|
|
391
401
|
});
|
|
392
402
|
const { data: incomeGroups } = useIncomeGroups({
|
|
393
|
-
enabled: Boolean(insuranceInfo.
|
|
403
|
+
enabled: Boolean(insuranceInfo.plan),
|
|
394
404
|
filters: {
|
|
395
405
|
eaccount: userInfo.accountId,
|
|
396
|
-
corpclientId: Number(insuranceInfo.companyId) || void 0
|
|
406
|
+
corpclientId: Number(insuranceInfo.companyId) || void 0,
|
|
407
|
+
contractId: Number(insuranceInfo.plan) || void 0,
|
|
408
|
+
affiliationTypeId: Number(form.values.affiliationTypeId) || void 0
|
|
397
409
|
}
|
|
398
410
|
});
|
|
399
411
|
const companyTypeOptions = (0, import_react2.useMemo)(() => {
|
|
@@ -724,7 +736,7 @@ var import_react_query4 = require("@tanstack/react-query");
|
|
|
724
736
|
|
|
725
737
|
// src/services/risk.ts
|
|
726
738
|
var getAdministrativeRisks = async (token, baseURL, filters) => {
|
|
727
|
-
const response = await
|
|
739
|
+
const response = await HTTP_ASSISTANCE(token, baseURL).get(
|
|
728
740
|
"/markups/",
|
|
729
741
|
{ params: filters }
|
|
730
742
|
);
|
|
@@ -1462,6 +1474,7 @@ var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
|
1462
1474
|
var PatientForm = ({
|
|
1463
1475
|
defaultMode,
|
|
1464
1476
|
patientId,
|
|
1477
|
+
initialDocumentNumber,
|
|
1465
1478
|
policyContent,
|
|
1466
1479
|
disabledFields,
|
|
1467
1480
|
onSavePatient,
|
|
@@ -1482,7 +1495,7 @@ var PatientForm = ({
|
|
|
1482
1495
|
mode: "controlled",
|
|
1483
1496
|
initialValues: {
|
|
1484
1497
|
documentTypeId: null,
|
|
1485
|
-
documentNumber: "",
|
|
1498
|
+
documentNumber: initialDocumentNumber ?? "",
|
|
1486
1499
|
firstName: "",
|
|
1487
1500
|
middleName: "",
|
|
1488
1501
|
surname: "",
|
|
@@ -1572,10 +1585,12 @@ var PatientForm = ({
|
|
|
1572
1585
|
}
|
|
1573
1586
|
});
|
|
1574
1587
|
const { data: incomeGroups } = useIncomeGroups({
|
|
1575
|
-
enabled: Boolean(form.values.mandatoryInsurance.
|
|
1588
|
+
enabled: Boolean(form.values.mandatoryInsurance.plan),
|
|
1576
1589
|
filters: {
|
|
1577
1590
|
eaccount: userInfo.accountId,
|
|
1578
|
-
corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0
|
|
1591
|
+
corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0,
|
|
1592
|
+
contractId: Number(form.values.mandatoryInsurance.plan) || void 0,
|
|
1593
|
+
affiliationTypeId: Number(form.values.affiliationTypeId) || void 0
|
|
1579
1594
|
}
|
|
1580
1595
|
});
|
|
1581
1596
|
const handleSubmit = (values) => {
|
|
@@ -1726,6 +1741,10 @@ var PatientForm = ({
|
|
|
1726
1741
|
const patientForm = createPatientForm(patientInfo);
|
|
1727
1742
|
form.setValues(patientForm);
|
|
1728
1743
|
}, [patientInfo, mode]);
|
|
1744
|
+
(0, import_react7.useEffect)(() => {
|
|
1745
|
+
if (mode !== "create") return;
|
|
1746
|
+
form.setFieldValue("documentNumber", initialDocumentNumber ?? "");
|
|
1747
|
+
}, [initialDocumentNumber, mode]);
|
|
1729
1748
|
const documentTypeOptions = (0, import_react7.useMemo)(() => {
|
|
1730
1749
|
return documentTypes?.map((dt) => ({
|
|
1731
1750
|
value: String(dt.id),
|
|
@@ -1957,6 +1976,15 @@ var PatientForm = ({
|
|
|
1957
1976
|
label: "Tipo de afiliaci\xF3n",
|
|
1958
1977
|
data: affiliationTypeOptions,
|
|
1959
1978
|
...form.getInputProps("affiliationTypeId"),
|
|
1979
|
+
onChange: (value) => {
|
|
1980
|
+
form.setFieldValue("affiliationTypeId", value);
|
|
1981
|
+
form.setFieldValue("mandatoryInsurance.companyId", null);
|
|
1982
|
+
form.setFieldValue("mandatoryInsurance.plan", null);
|
|
1983
|
+
form.setFieldValue("mandatoryInsurance.population", null);
|
|
1984
|
+
form.setFieldValue("mandatoryInsurance.groupId", null);
|
|
1985
|
+
form.setFieldValue("mandatoryInsurance.policyNumber", "");
|
|
1986
|
+
form.setFieldValue("voluntaryInsurance", []);
|
|
1987
|
+
},
|
|
1960
1988
|
"data-testid": "patient-form-affiliation-type-select"
|
|
1961
1989
|
}
|
|
1962
1990
|
) }),
|
package/dist/index.d.cts
CHANGED
|
@@ -186,13 +186,14 @@ interface PatientDetail {
|
|
|
186
186
|
interface PatientFormProps {
|
|
187
187
|
defaultMode: PatientFormMode;
|
|
188
188
|
patientId?: number;
|
|
189
|
+
initialDocumentNumber?: string;
|
|
189
190
|
policyContent?: string;
|
|
190
191
|
disabledFields?: (keyof PatientFormValues)[];
|
|
191
192
|
onSavePatient?: (payload: PatientPayload, mode: PatientFormMode) => void;
|
|
192
193
|
onSaveError?: (error: string) => void;
|
|
193
194
|
onBack?: () => void;
|
|
194
195
|
}
|
|
195
|
-
declare const PatientForm: ({ defaultMode, patientId, policyContent, disabledFields, onSavePatient, onSaveError, onBack, }: PatientFormProps) => react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare const PatientForm: ({ defaultMode, patientId, initialDocumentNumber, policyContent, disabledFields, onSavePatient, onSaveError, onBack, }: PatientFormProps) => react_jsx_runtime.JSX.Element;
|
|
196
197
|
|
|
197
198
|
interface Comment {
|
|
198
199
|
id: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -186,13 +186,14 @@ interface PatientDetail {
|
|
|
186
186
|
interface PatientFormProps {
|
|
187
187
|
defaultMode: PatientFormMode;
|
|
188
188
|
patientId?: number;
|
|
189
|
+
initialDocumentNumber?: string;
|
|
189
190
|
policyContent?: string;
|
|
190
191
|
disabledFields?: (keyof PatientFormValues)[];
|
|
191
192
|
onSavePatient?: (payload: PatientPayload, mode: PatientFormMode) => void;
|
|
192
193
|
onSaveError?: (error: string) => void;
|
|
193
194
|
onBack?: () => void;
|
|
194
195
|
}
|
|
195
|
-
declare const PatientForm: ({ defaultMode, patientId, policyContent, disabledFields, onSavePatient, onSaveError, onBack, }: PatientFormProps) => react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare const PatientForm: ({ defaultMode, patientId, initialDocumentNumber, policyContent, disabledFields, onSavePatient, onSaveError, onBack, }: PatientFormProps) => react_jsx_runtime.JSX.Element;
|
|
196
197
|
|
|
197
198
|
interface Comment {
|
|
198
199
|
id: number;
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,10 @@ var HTTP_ADMIN = (token, baseURL) => {
|
|
|
45
45
|
const url = `${baseURL}/admin`;
|
|
46
46
|
return axios.create(getBaseURL(url, token));
|
|
47
47
|
};
|
|
48
|
+
var HTTP_ASSISTANCE = (token, baseURL) => {
|
|
49
|
+
const url = `${baseURL}/assistance`;
|
|
50
|
+
return axios.create(getBaseURL(url, token));
|
|
51
|
+
};
|
|
48
52
|
|
|
49
53
|
// src/services/select.ts
|
|
50
54
|
var getDocumentTypes = async (token, baseURL) => {
|
|
@@ -278,7 +282,13 @@ var useIncomeGroups = ({
|
|
|
278
282
|
}) => {
|
|
279
283
|
const { token, baseUrl } = useTTNSharedContext();
|
|
280
284
|
const query = useQuery({
|
|
281
|
-
queryKey: [
|
|
285
|
+
queryKey: [
|
|
286
|
+
"income-groups",
|
|
287
|
+
filters?.corpclientId,
|
|
288
|
+
filters?.contractId,
|
|
289
|
+
filters?.affiliationTypeId,
|
|
290
|
+
filters?.eaccount
|
|
291
|
+
],
|
|
282
292
|
queryFn: () => getIncomeGroups(token, baseUrl, filters),
|
|
283
293
|
enabled
|
|
284
294
|
});
|
|
@@ -358,10 +368,12 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
358
368
|
}
|
|
359
369
|
});
|
|
360
370
|
const { data: incomeGroups } = useIncomeGroups({
|
|
361
|
-
enabled: Boolean(insuranceInfo.
|
|
371
|
+
enabled: Boolean(insuranceInfo.plan),
|
|
362
372
|
filters: {
|
|
363
373
|
eaccount: userInfo.accountId,
|
|
364
|
-
corpclientId: Number(insuranceInfo.companyId) || void 0
|
|
374
|
+
corpclientId: Number(insuranceInfo.companyId) || void 0,
|
|
375
|
+
contractId: Number(insuranceInfo.plan) || void 0,
|
|
376
|
+
affiliationTypeId: Number(form.values.affiliationTypeId) || void 0
|
|
365
377
|
}
|
|
366
378
|
});
|
|
367
379
|
const companyTypeOptions = useMemo(() => {
|
|
@@ -714,7 +726,7 @@ import { useMutation as useMutation2, useQuery as useQuery4 } from "@tanstack/re
|
|
|
714
726
|
|
|
715
727
|
// src/services/risk.ts
|
|
716
728
|
var getAdministrativeRisks = async (token, baseURL, filters) => {
|
|
717
|
-
const response = await
|
|
729
|
+
const response = await HTTP_ASSISTANCE(token, baseURL).get(
|
|
718
730
|
"/markups/",
|
|
719
731
|
{ params: filters }
|
|
720
732
|
);
|
|
@@ -1474,6 +1486,7 @@ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-run
|
|
|
1474
1486
|
var PatientForm = ({
|
|
1475
1487
|
defaultMode,
|
|
1476
1488
|
patientId,
|
|
1489
|
+
initialDocumentNumber,
|
|
1477
1490
|
policyContent,
|
|
1478
1491
|
disabledFields,
|
|
1479
1492
|
onSavePatient,
|
|
@@ -1494,7 +1507,7 @@ var PatientForm = ({
|
|
|
1494
1507
|
mode: "controlled",
|
|
1495
1508
|
initialValues: {
|
|
1496
1509
|
documentTypeId: null,
|
|
1497
|
-
documentNumber: "",
|
|
1510
|
+
documentNumber: initialDocumentNumber ?? "",
|
|
1498
1511
|
firstName: "",
|
|
1499
1512
|
middleName: "",
|
|
1500
1513
|
surname: "",
|
|
@@ -1584,10 +1597,12 @@ var PatientForm = ({
|
|
|
1584
1597
|
}
|
|
1585
1598
|
});
|
|
1586
1599
|
const { data: incomeGroups } = useIncomeGroups({
|
|
1587
|
-
enabled: Boolean(form.values.mandatoryInsurance.
|
|
1600
|
+
enabled: Boolean(form.values.mandatoryInsurance.plan),
|
|
1588
1601
|
filters: {
|
|
1589
1602
|
eaccount: userInfo.accountId,
|
|
1590
|
-
corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0
|
|
1603
|
+
corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0,
|
|
1604
|
+
contractId: Number(form.values.mandatoryInsurance.plan) || void 0,
|
|
1605
|
+
affiliationTypeId: Number(form.values.affiliationTypeId) || void 0
|
|
1591
1606
|
}
|
|
1592
1607
|
});
|
|
1593
1608
|
const handleSubmit = (values) => {
|
|
@@ -1738,6 +1753,10 @@ var PatientForm = ({
|
|
|
1738
1753
|
const patientForm = createPatientForm(patientInfo);
|
|
1739
1754
|
form.setValues(patientForm);
|
|
1740
1755
|
}, [patientInfo, mode]);
|
|
1756
|
+
useEffect3(() => {
|
|
1757
|
+
if (mode !== "create") return;
|
|
1758
|
+
form.setFieldValue("documentNumber", initialDocumentNumber ?? "");
|
|
1759
|
+
}, [initialDocumentNumber, mode]);
|
|
1741
1760
|
const documentTypeOptions = useMemo4(() => {
|
|
1742
1761
|
return documentTypes?.map((dt) => ({
|
|
1743
1762
|
value: String(dt.id),
|
|
@@ -1969,6 +1988,15 @@ var PatientForm = ({
|
|
|
1969
1988
|
label: "Tipo de afiliaci\xF3n",
|
|
1970
1989
|
data: affiliationTypeOptions,
|
|
1971
1990
|
...form.getInputProps("affiliationTypeId"),
|
|
1991
|
+
onChange: (value) => {
|
|
1992
|
+
form.setFieldValue("affiliationTypeId", value);
|
|
1993
|
+
form.setFieldValue("mandatoryInsurance.companyId", null);
|
|
1994
|
+
form.setFieldValue("mandatoryInsurance.plan", null);
|
|
1995
|
+
form.setFieldValue("mandatoryInsurance.population", null);
|
|
1996
|
+
form.setFieldValue("mandatoryInsurance.groupId", null);
|
|
1997
|
+
form.setFieldValue("mandatoryInsurance.policyNumber", "");
|
|
1998
|
+
form.setFieldValue("voluntaryInsurance", []);
|
|
1999
|
+
},
|
|
1972
2000
|
"data-testid": "patient-form-affiliation-type-select"
|
|
1973
2001
|
}
|
|
1974
2002
|
) }),
|