@ttn-shared/ui 1.2.4 → 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 +30 -6
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +30 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -314,7 +314,13 @@ var useIncomeGroups = ({
|
|
|
314
314
|
}) => {
|
|
315
315
|
const { token, baseUrl } = useTTNSharedContext();
|
|
316
316
|
const query = (0, import_react_query.useQuery)({
|
|
317
|
-
queryKey: [
|
|
317
|
+
queryKey: [
|
|
318
|
+
"income-groups",
|
|
319
|
+
filters?.corpclientId,
|
|
320
|
+
filters?.contractId,
|
|
321
|
+
filters?.affiliationTypeId,
|
|
322
|
+
filters?.eaccount
|
|
323
|
+
],
|
|
318
324
|
queryFn: () => getIncomeGroups(token, baseUrl, filters),
|
|
319
325
|
enabled
|
|
320
326
|
});
|
|
@@ -394,10 +400,12 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
394
400
|
}
|
|
395
401
|
});
|
|
396
402
|
const { data: incomeGroups } = useIncomeGroups({
|
|
397
|
-
enabled: Boolean(insuranceInfo.
|
|
403
|
+
enabled: Boolean(insuranceInfo.plan),
|
|
398
404
|
filters: {
|
|
399
405
|
eaccount: userInfo.accountId,
|
|
400
|
-
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
|
|
401
409
|
}
|
|
402
410
|
});
|
|
403
411
|
const companyTypeOptions = (0, import_react2.useMemo)(() => {
|
|
@@ -1466,6 +1474,7 @@ var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
|
1466
1474
|
var PatientForm = ({
|
|
1467
1475
|
defaultMode,
|
|
1468
1476
|
patientId,
|
|
1477
|
+
initialDocumentNumber,
|
|
1469
1478
|
policyContent,
|
|
1470
1479
|
disabledFields,
|
|
1471
1480
|
onSavePatient,
|
|
@@ -1486,7 +1495,7 @@ var PatientForm = ({
|
|
|
1486
1495
|
mode: "controlled",
|
|
1487
1496
|
initialValues: {
|
|
1488
1497
|
documentTypeId: null,
|
|
1489
|
-
documentNumber: "",
|
|
1498
|
+
documentNumber: initialDocumentNumber ?? "",
|
|
1490
1499
|
firstName: "",
|
|
1491
1500
|
middleName: "",
|
|
1492
1501
|
surname: "",
|
|
@@ -1576,10 +1585,12 @@ var PatientForm = ({
|
|
|
1576
1585
|
}
|
|
1577
1586
|
});
|
|
1578
1587
|
const { data: incomeGroups } = useIncomeGroups({
|
|
1579
|
-
enabled: Boolean(form.values.mandatoryInsurance.
|
|
1588
|
+
enabled: Boolean(form.values.mandatoryInsurance.plan),
|
|
1580
1589
|
filters: {
|
|
1581
1590
|
eaccount: userInfo.accountId,
|
|
1582
|
-
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
|
|
1583
1594
|
}
|
|
1584
1595
|
});
|
|
1585
1596
|
const handleSubmit = (values) => {
|
|
@@ -1730,6 +1741,10 @@ var PatientForm = ({
|
|
|
1730
1741
|
const patientForm = createPatientForm(patientInfo);
|
|
1731
1742
|
form.setValues(patientForm);
|
|
1732
1743
|
}, [patientInfo, mode]);
|
|
1744
|
+
(0, import_react7.useEffect)(() => {
|
|
1745
|
+
if (mode !== "create") return;
|
|
1746
|
+
form.setFieldValue("documentNumber", initialDocumentNumber ?? "");
|
|
1747
|
+
}, [initialDocumentNumber, mode]);
|
|
1733
1748
|
const documentTypeOptions = (0, import_react7.useMemo)(() => {
|
|
1734
1749
|
return documentTypes?.map((dt) => ({
|
|
1735
1750
|
value: String(dt.id),
|
|
@@ -1961,6 +1976,15 @@ var PatientForm = ({
|
|
|
1961
1976
|
label: "Tipo de afiliaci\xF3n",
|
|
1962
1977
|
data: affiliationTypeOptions,
|
|
1963
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
|
+
},
|
|
1964
1988
|
"data-testid": "patient-form-affiliation-type-select"
|
|
1965
1989
|
}
|
|
1966
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
|
@@ -282,7 +282,13 @@ var useIncomeGroups = ({
|
|
|
282
282
|
}) => {
|
|
283
283
|
const { token, baseUrl } = useTTNSharedContext();
|
|
284
284
|
const query = useQuery({
|
|
285
|
-
queryKey: [
|
|
285
|
+
queryKey: [
|
|
286
|
+
"income-groups",
|
|
287
|
+
filters?.corpclientId,
|
|
288
|
+
filters?.contractId,
|
|
289
|
+
filters?.affiliationTypeId,
|
|
290
|
+
filters?.eaccount
|
|
291
|
+
],
|
|
286
292
|
queryFn: () => getIncomeGroups(token, baseUrl, filters),
|
|
287
293
|
enabled
|
|
288
294
|
});
|
|
@@ -362,10 +368,12 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
362
368
|
}
|
|
363
369
|
});
|
|
364
370
|
const { data: incomeGroups } = useIncomeGroups({
|
|
365
|
-
enabled: Boolean(insuranceInfo.
|
|
371
|
+
enabled: Boolean(insuranceInfo.plan),
|
|
366
372
|
filters: {
|
|
367
373
|
eaccount: userInfo.accountId,
|
|
368
|
-
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
|
|
369
377
|
}
|
|
370
378
|
});
|
|
371
379
|
const companyTypeOptions = useMemo(() => {
|
|
@@ -1478,6 +1486,7 @@ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-run
|
|
|
1478
1486
|
var PatientForm = ({
|
|
1479
1487
|
defaultMode,
|
|
1480
1488
|
patientId,
|
|
1489
|
+
initialDocumentNumber,
|
|
1481
1490
|
policyContent,
|
|
1482
1491
|
disabledFields,
|
|
1483
1492
|
onSavePatient,
|
|
@@ -1498,7 +1507,7 @@ var PatientForm = ({
|
|
|
1498
1507
|
mode: "controlled",
|
|
1499
1508
|
initialValues: {
|
|
1500
1509
|
documentTypeId: null,
|
|
1501
|
-
documentNumber: "",
|
|
1510
|
+
documentNumber: initialDocumentNumber ?? "",
|
|
1502
1511
|
firstName: "",
|
|
1503
1512
|
middleName: "",
|
|
1504
1513
|
surname: "",
|
|
@@ -1588,10 +1597,12 @@ var PatientForm = ({
|
|
|
1588
1597
|
}
|
|
1589
1598
|
});
|
|
1590
1599
|
const { data: incomeGroups } = useIncomeGroups({
|
|
1591
|
-
enabled: Boolean(form.values.mandatoryInsurance.
|
|
1600
|
+
enabled: Boolean(form.values.mandatoryInsurance.plan),
|
|
1592
1601
|
filters: {
|
|
1593
1602
|
eaccount: userInfo.accountId,
|
|
1594
|
-
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
|
|
1595
1606
|
}
|
|
1596
1607
|
});
|
|
1597
1608
|
const handleSubmit = (values) => {
|
|
@@ -1742,6 +1753,10 @@ var PatientForm = ({
|
|
|
1742
1753
|
const patientForm = createPatientForm(patientInfo);
|
|
1743
1754
|
form.setValues(patientForm);
|
|
1744
1755
|
}, [patientInfo, mode]);
|
|
1756
|
+
useEffect3(() => {
|
|
1757
|
+
if (mode !== "create") return;
|
|
1758
|
+
form.setFieldValue("documentNumber", initialDocumentNumber ?? "");
|
|
1759
|
+
}, [initialDocumentNumber, mode]);
|
|
1745
1760
|
const documentTypeOptions = useMemo4(() => {
|
|
1746
1761
|
return documentTypes?.map((dt) => ({
|
|
1747
1762
|
value: String(dt.id),
|
|
@@ -1973,6 +1988,15 @@ var PatientForm = ({
|
|
|
1973
1988
|
label: "Tipo de afiliaci\xF3n",
|
|
1974
1989
|
data: affiliationTypeOptions,
|
|
1975
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
|
+
},
|
|
1976
2000
|
"data-testid": "patient-form-affiliation-type-select"
|
|
1977
2001
|
}
|
|
1978
2002
|
) }),
|