@ttn-shared/ui 1.0.3 → 1.2.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.cjs +455 -101
- package/dist/index.css +56 -0
- package/dist/index.d.cts +90 -24
- package/dist/index.d.ts +90 -24
- package/dist/index.js +451 -101
- package/package.json +13 -9
package/dist/index.js
CHANGED
|
@@ -331,24 +331,24 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
331
331
|
mode,
|
|
332
332
|
form
|
|
333
333
|
}) => {
|
|
334
|
-
const {
|
|
334
|
+
const { userInfo } = useTTNSharedContext();
|
|
335
335
|
const insuranceInfo = form.values.voluntaryInsurance[index];
|
|
336
336
|
const { data: companyTypes } = useCompanyTypes({
|
|
337
337
|
filters: {
|
|
338
|
-
eaccount:
|
|
338
|
+
eaccount: userInfo.accountId,
|
|
339
339
|
status: "enabled"
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
342
|
const { data: companyClients } = useCompanyClients({
|
|
343
343
|
filters: {
|
|
344
|
-
eaccount:
|
|
344
|
+
eaccount: userInfo.accountId,
|
|
345
345
|
status: "enabled"
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
348
|
const { data: contracts } = useContracts({
|
|
349
349
|
enabled: Boolean(insuranceInfo.companyId),
|
|
350
350
|
filters: {
|
|
351
|
-
eaccount:
|
|
351
|
+
eaccount: userInfo.accountId,
|
|
352
352
|
cType: "particular",
|
|
353
353
|
client: Number(insuranceInfo.companyId) || void 0,
|
|
354
354
|
status: "enabled"
|
|
@@ -357,7 +357,7 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
357
357
|
const { data: contractPopulations } = useContractPopulations({
|
|
358
358
|
enabled: Boolean(insuranceInfo.plan),
|
|
359
359
|
filters: {
|
|
360
|
-
eaccount:
|
|
360
|
+
eaccount: userInfo.accountId,
|
|
361
361
|
contract: Number(insuranceInfo.plan) || void 0,
|
|
362
362
|
status: "enabled"
|
|
363
363
|
}
|
|
@@ -365,7 +365,7 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
365
365
|
const { data: incomeGroups } = useIncomeGroups({
|
|
366
366
|
enabled: Boolean(insuranceInfo.companyId),
|
|
367
367
|
filters: {
|
|
368
|
-
eaccount:
|
|
368
|
+
eaccount: userInfo.accountId,
|
|
369
369
|
corpclientId: Number(insuranceInfo.companyId) || void 0
|
|
370
370
|
}
|
|
371
371
|
});
|
|
@@ -431,11 +431,11 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
431
431
|
companyTypeTag || ""
|
|
432
432
|
);
|
|
433
433
|
}
|
|
434
|
-
form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value
|
|
435
|
-
form.setFieldValue(`voluntaryInsurance.${index}.companyId`,
|
|
436
|
-
form.setFieldValue(`voluntaryInsurance.${index}.plan`,
|
|
437
|
-
form.setFieldValue(`voluntaryInsurance.${index}.population`,
|
|
438
|
-
form.setFieldValue(`voluntaryInsurance.${index}.groupId`,
|
|
434
|
+
form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value);
|
|
435
|
+
form.setFieldValue(`voluntaryInsurance.${index}.companyId`, null);
|
|
436
|
+
form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
|
|
437
|
+
form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
|
|
438
|
+
form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
|
|
439
439
|
form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
|
|
440
440
|
},
|
|
441
441
|
"data-testid": `patient-form-voluntary-insurance-company-type-select-${index}`
|
|
@@ -450,10 +450,10 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
450
450
|
data: companyClientOptions,
|
|
451
451
|
...form.getInputProps(`voluntaryInsurance.${index}.companyId`),
|
|
452
452
|
onChange: (value) => {
|
|
453
|
-
form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value
|
|
454
|
-
form.setFieldValue(`voluntaryInsurance.${index}.plan`,
|
|
455
|
-
form.setFieldValue(`voluntaryInsurance.${index}.population`,
|
|
456
|
-
form.setFieldValue(`voluntaryInsurance.${index}.groupId`,
|
|
453
|
+
form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value);
|
|
454
|
+
form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
|
|
455
|
+
form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
|
|
456
|
+
form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
|
|
457
457
|
form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
|
|
458
458
|
},
|
|
459
459
|
"data-testid": `patient-form-voluntary-insurance-company-select-${index}`
|
|
@@ -468,9 +468,9 @@ var PatientVoluntaryInsuranceForm = ({
|
|
|
468
468
|
data: contractOptions,
|
|
469
469
|
...form.getInputProps(`voluntaryInsurance.${index}.plan`),
|
|
470
470
|
onChange: (value) => {
|
|
471
|
-
form.setFieldValue(`voluntaryInsurance.${index}.plan`, value
|
|
472
|
-
form.setFieldValue(`voluntaryInsurance.${index}.population`,
|
|
473
|
-
form.setFieldValue(`voluntaryInsurance.${index}.groupId`,
|
|
471
|
+
form.setFieldValue(`voluntaryInsurance.${index}.plan`, value);
|
|
472
|
+
form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
|
|
473
|
+
form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
|
|
474
474
|
form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
|
|
475
475
|
},
|
|
476
476
|
"data-testid": `patient-form-voluntary-insurance-plan-select-${index}`
|
|
@@ -613,7 +613,7 @@ var PatientNotes = ({
|
|
|
613
613
|
closeOnSave = true,
|
|
614
614
|
onAttemptRemoveNote
|
|
615
615
|
}) => {
|
|
616
|
-
const {
|
|
616
|
+
const { userInfo } = useTTNSharedContext();
|
|
617
617
|
const [comment, setComment] = useState("");
|
|
618
618
|
const { data: notes } = useComments({
|
|
619
619
|
enabled: isOpen && Boolean(patientId),
|
|
@@ -624,7 +624,7 @@ var PatientNotes = ({
|
|
|
624
624
|
const handleAddNote = async () => {
|
|
625
625
|
await createComment2({
|
|
626
626
|
entity: "userClient",
|
|
627
|
-
userId:
|
|
627
|
+
userId: userInfo.id ?? 0,
|
|
628
628
|
comment,
|
|
629
629
|
id: patientId ?? 0
|
|
630
630
|
});
|
|
@@ -673,7 +673,7 @@ var PatientNotes = ({
|
|
|
673
673
|
!notes?.length && /* @__PURE__ */ jsx3(Text, { c: "dimmed", ta: "center", children: "No hay notas disponibles." })
|
|
674
674
|
] }),
|
|
675
675
|
/* @__PURE__ */ jsx3(Box, { p: "lg", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsxs2(Paper2, { withBorder: true, p: "md", bg: "brand-color.0", shadow: "none", children: [
|
|
676
|
-
/* @__PURE__ */ jsx3(Text, { c: "brand-color", children:
|
|
676
|
+
/* @__PURE__ */ jsx3(Text, { c: "brand-color", children: userInfo.name }),
|
|
677
677
|
/* @__PURE__ */ jsx3(
|
|
678
678
|
Textarea,
|
|
679
679
|
{
|
|
@@ -779,13 +779,13 @@ var PatientAdministrativeRisks = ({
|
|
|
779
779
|
isOpen,
|
|
780
780
|
onClose
|
|
781
781
|
}) => {
|
|
782
|
-
const {
|
|
782
|
+
const { userInfo } = useTTNSharedContext();
|
|
783
783
|
const [riskValue, setRiskValue] = useState2(null);
|
|
784
784
|
const [selectedRisks, setSelectedRisks] = useState2([]);
|
|
785
785
|
const { data: patientInfo } = usePatientDetail({
|
|
786
786
|
enabled: Boolean(patientId) && isOpen,
|
|
787
787
|
filters: {
|
|
788
|
-
eaccount:
|
|
788
|
+
eaccount: userInfo.accountId,
|
|
789
789
|
id: patientId
|
|
790
790
|
}
|
|
791
791
|
});
|
|
@@ -798,7 +798,7 @@ var PatientAdministrativeRisks = ({
|
|
|
798
798
|
const { mutateAsync: updateRisks2 } = useUpdateRisks();
|
|
799
799
|
const handleSaveRisks = async () => {
|
|
800
800
|
await updateRisks2({
|
|
801
|
-
eaccount:
|
|
801
|
+
eaccount: userInfo.accountId ?? 0,
|
|
802
802
|
idPatient: patientId ?? 0,
|
|
803
803
|
riskList: {
|
|
804
804
|
administrative: selectedRisks
|
|
@@ -932,13 +932,13 @@ var PatientAssistanceRisks = ({
|
|
|
932
932
|
isOpen,
|
|
933
933
|
onClose
|
|
934
934
|
}) => {
|
|
935
|
-
const {
|
|
935
|
+
const { userInfo } = useTTNSharedContext();
|
|
936
936
|
const [riskValue, setRiskValue] = useState3(null);
|
|
937
937
|
const [selectedRisks, setSelectedRisks] = useState3([]);
|
|
938
938
|
const { data: patientInfo } = usePatientDetail({
|
|
939
939
|
enabled: Boolean(patientId) && isOpen,
|
|
940
940
|
filters: {
|
|
941
|
-
eaccount:
|
|
941
|
+
eaccount: userInfo.accountId,
|
|
942
942
|
id: patientId
|
|
943
943
|
}
|
|
944
944
|
});
|
|
@@ -962,7 +962,7 @@ var PatientAssistanceRisks = ({
|
|
|
962
962
|
};
|
|
963
963
|
const handleSaveRisks = async () => {
|
|
964
964
|
await updateRisks2({
|
|
965
|
-
eaccount:
|
|
965
|
+
eaccount: userInfo.accountId ?? 0,
|
|
966
966
|
idPatient: patientId ?? 0,
|
|
967
967
|
riskList: {
|
|
968
968
|
assistance: selectedRisks.map((risk) => ({ id: risk.clinicalDiseaseId }))
|
|
@@ -1204,7 +1204,7 @@ function AppPagination(props) {
|
|
|
1204
1204
|
// src/components/PatientAppointmentHistory.tsx
|
|
1205
1205
|
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1206
1206
|
var PatientAppointmentHistory = ({ patientId }) => {
|
|
1207
|
-
const {
|
|
1207
|
+
const { userInfo } = useTTNSharedContext();
|
|
1208
1208
|
const [currentPage, setCurrentPage] = useState4(1);
|
|
1209
1209
|
const [selectedAppointment, setSelectedAppointment] = useState4();
|
|
1210
1210
|
const { data: appointments, rowTotal } = useAppointments({
|
|
@@ -1213,7 +1213,7 @@ var PatientAppointmentHistory = ({ patientId }) => {
|
|
|
1213
1213
|
idPatient: patientId,
|
|
1214
1214
|
page: currentPage,
|
|
1215
1215
|
perpage: 10,
|
|
1216
|
-
idAccount:
|
|
1216
|
+
idAccount: userInfo.accountId ?? 0
|
|
1217
1217
|
}
|
|
1218
1218
|
});
|
|
1219
1219
|
return /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
@@ -1460,11 +1460,16 @@ var PatientForm = ({
|
|
|
1460
1460
|
defaultMode,
|
|
1461
1461
|
patientId,
|
|
1462
1462
|
policyContent,
|
|
1463
|
+
disabledFields,
|
|
1463
1464
|
onSavePatient,
|
|
1464
1465
|
onSaveError,
|
|
1465
1466
|
onBack
|
|
1466
1467
|
}) => {
|
|
1467
|
-
const {
|
|
1468
|
+
const { userInfo } = useTTNSharedContext();
|
|
1469
|
+
const disabledFieldSet = useMemo4(() => new Set(disabledFields ?? []), [disabledFields]);
|
|
1470
|
+
const isFieldDisabled = (field) => disabledFieldSet.has(field);
|
|
1471
|
+
const isMandatoryInsuranceDisabled = isFieldDisabled("mandatoryInsurance");
|
|
1472
|
+
const isVoluntaryInsuranceDisabled = isFieldDisabled("voluntaryInsurance");
|
|
1468
1473
|
const [mode, setMode] = useState5(defaultMode);
|
|
1469
1474
|
const [openPatientNotes, setOpenPatientNotes] = useState5(false);
|
|
1470
1475
|
const [openPatientAssistanceRisks, setOpenPatientAssistanceRisks] = useState5(false);
|
|
@@ -1473,7 +1478,7 @@ var PatientForm = ({
|
|
|
1473
1478
|
const form = useForm({
|
|
1474
1479
|
mode: "controlled",
|
|
1475
1480
|
initialValues: {
|
|
1476
|
-
documentTypeId:
|
|
1481
|
+
documentTypeId: null,
|
|
1477
1482
|
documentNumber: "",
|
|
1478
1483
|
firstName: "",
|
|
1479
1484
|
middleName: "",
|
|
@@ -1482,30 +1487,30 @@ var PatientForm = ({
|
|
|
1482
1487
|
birthDate: "",
|
|
1483
1488
|
age: "",
|
|
1484
1489
|
whatsapp: "",
|
|
1485
|
-
gender:
|
|
1486
|
-
affiliationTypeId:
|
|
1487
|
-
bloodType:
|
|
1490
|
+
gender: null,
|
|
1491
|
+
affiliationTypeId: null,
|
|
1492
|
+
bloodType: null,
|
|
1488
1493
|
email: "",
|
|
1489
|
-
provinceId:
|
|
1490
|
-
cityId:
|
|
1494
|
+
provinceId: null,
|
|
1495
|
+
cityId: null,
|
|
1491
1496
|
homeAddress: "",
|
|
1492
1497
|
neighborhood: "",
|
|
1493
1498
|
cellphone: "",
|
|
1494
1499
|
homephone: "",
|
|
1495
1500
|
emergencyContact: "",
|
|
1496
|
-
maritalStatus:
|
|
1501
|
+
maritalStatus: null,
|
|
1497
1502
|
occupation: "",
|
|
1498
1503
|
use_glasses: "",
|
|
1499
1504
|
use_contact_lens: "",
|
|
1500
1505
|
isDataPolicyAccepted: false,
|
|
1501
|
-
stratumId:
|
|
1502
|
-
educationLevelId:
|
|
1503
|
-
ethnicGroupId:
|
|
1506
|
+
stratumId: null,
|
|
1507
|
+
educationLevelId: null,
|
|
1508
|
+
ethnicGroupId: null,
|
|
1504
1509
|
mandatoryInsurance: {
|
|
1505
|
-
companyId:
|
|
1506
|
-
plan:
|
|
1507
|
-
population:
|
|
1508
|
-
groupId:
|
|
1510
|
+
companyId: null,
|
|
1511
|
+
plan: null,
|
|
1512
|
+
population: null,
|
|
1513
|
+
groupId: null,
|
|
1509
1514
|
policyNumber: ""
|
|
1510
1515
|
},
|
|
1511
1516
|
voluntaryInsurance: []
|
|
@@ -1524,16 +1529,16 @@ var PatientForm = ({
|
|
|
1524
1529
|
const { data: patientInfo, refetch: refetchPatientInfo } = usePatientDetail({
|
|
1525
1530
|
enabled: Boolean(patientId) && mode !== "create",
|
|
1526
1531
|
filters: {
|
|
1527
|
-
eaccount:
|
|
1532
|
+
eaccount: userInfo.accountId,
|
|
1528
1533
|
id: patientId
|
|
1529
1534
|
}
|
|
1530
1535
|
});
|
|
1531
1536
|
const { data: documentTypes } = useDocumentTypes({});
|
|
1532
1537
|
const { data: affiliationTypes } = useAffiliationTypes({
|
|
1533
|
-
filters: { eaccount:
|
|
1538
|
+
filters: { eaccount: userInfo.accountId }
|
|
1534
1539
|
});
|
|
1535
1540
|
const { data: provinces } = useProvinces({
|
|
1536
|
-
filters: { eaccount:
|
|
1541
|
+
filters: { eaccount: userInfo.accountId }
|
|
1537
1542
|
});
|
|
1538
1543
|
const { data: cities } = useCities({
|
|
1539
1544
|
enabled: Boolean(form.values.provinceId),
|
|
@@ -1541,32 +1546,32 @@ var PatientForm = ({
|
|
|
1541
1546
|
});
|
|
1542
1547
|
const { data: stratums } = useStratums({});
|
|
1543
1548
|
const { data: ethnicGroups } = useEthnicGroups({
|
|
1544
|
-
filters: { eaccount:
|
|
1549
|
+
filters: { eaccount: userInfo.accountId }
|
|
1545
1550
|
});
|
|
1546
1551
|
const { data: educationLevels } = useEducationLevels({
|
|
1547
|
-
filters: { eaccount:
|
|
1552
|
+
filters: { eaccount: userInfo.accountId }
|
|
1548
1553
|
});
|
|
1549
1554
|
const { data: companyClients } = useCompanyClients({
|
|
1550
|
-
filters: { eaccount:
|
|
1555
|
+
filters: { eaccount: userInfo.accountId }
|
|
1551
1556
|
});
|
|
1552
1557
|
const { data: contracts } = useContracts({
|
|
1553
1558
|
enabled: Boolean(form.values.mandatoryInsurance.companyId),
|
|
1554
1559
|
filters: {
|
|
1555
|
-
eaccount:
|
|
1560
|
+
eaccount: userInfo.accountId,
|
|
1556
1561
|
client: Number(form.values.mandatoryInsurance.companyId) || void 0
|
|
1557
1562
|
}
|
|
1558
1563
|
});
|
|
1559
1564
|
const { data: contractPopulations } = useContractPopulations({
|
|
1560
1565
|
enabled: Boolean(form.values.mandatoryInsurance.plan),
|
|
1561
1566
|
filters: {
|
|
1562
|
-
eaccount:
|
|
1567
|
+
eaccount: userInfo.accountId,
|
|
1563
1568
|
contract: Number(form.values.mandatoryInsurance.plan) || void 0
|
|
1564
1569
|
}
|
|
1565
1570
|
});
|
|
1566
1571
|
const { data: incomeGroups } = useIncomeGroups({
|
|
1567
1572
|
enabled: Boolean(form.values.mandatoryInsurance.companyId),
|
|
1568
1573
|
filters: {
|
|
1569
|
-
eaccount:
|
|
1574
|
+
eaccount: userInfo.accountId,
|
|
1570
1575
|
corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0
|
|
1571
1576
|
}
|
|
1572
1577
|
});
|
|
@@ -1604,10 +1609,6 @@ var PatientForm = ({
|
|
|
1604
1609
|
value: values.affiliationTypeId,
|
|
1605
1610
|
message: "El campo Tipo de afiliado es obligatorio."
|
|
1606
1611
|
},
|
|
1607
|
-
{
|
|
1608
|
-
value: values.maritalStatus,
|
|
1609
|
-
message: "El campo Estado civil es obligatorio."
|
|
1610
|
-
},
|
|
1611
1612
|
{
|
|
1612
1613
|
value: values.provinceId,
|
|
1613
1614
|
message: "El campo Departamento es obligatorio."
|
|
@@ -1705,16 +1706,17 @@ var PatientForm = ({
|
|
|
1705
1706
|
onBack?.();
|
|
1706
1707
|
};
|
|
1707
1708
|
const handleAddVoluntaryInsurance = () => {
|
|
1708
|
-
|
|
1709
|
+
const newInsurance = {
|
|
1709
1710
|
companyTypeTag: "",
|
|
1710
1711
|
id: Date.now().toString(),
|
|
1711
1712
|
companyType: "",
|
|
1712
|
-
companyId:
|
|
1713
|
-
plan:
|
|
1714
|
-
population:
|
|
1715
|
-
groupId:
|
|
1713
|
+
companyId: null,
|
|
1714
|
+
plan: null,
|
|
1715
|
+
population: null,
|
|
1716
|
+
groupId: null,
|
|
1716
1717
|
policyNumber: ""
|
|
1717
|
-
}
|
|
1718
|
+
};
|
|
1719
|
+
form.insertListItem("voluntaryInsurance", newInsurance);
|
|
1718
1720
|
};
|
|
1719
1721
|
useEffect3(() => {
|
|
1720
1722
|
if (!patientInfo || mode === "create") return;
|
|
@@ -1847,7 +1849,7 @@ var PatientForm = ({
|
|
|
1847
1849
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1848
1850
|
Select4,
|
|
1849
1851
|
{
|
|
1850
|
-
readOnly: mode === "view",
|
|
1852
|
+
readOnly: mode === "view" || isFieldDisabled("documentTypeId"),
|
|
1851
1853
|
withAsterisk: mode !== "view",
|
|
1852
1854
|
label: "Tipo de Documento",
|
|
1853
1855
|
data: documentTypeOptions,
|
|
@@ -1858,7 +1860,7 @@ var PatientForm = ({
|
|
|
1858
1860
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1859
1861
|
TextInput3,
|
|
1860
1862
|
{
|
|
1861
|
-
readOnly: mode === "view",
|
|
1863
|
+
readOnly: mode === "view" || isFieldDisabled("documentNumber"),
|
|
1862
1864
|
withAsterisk: mode !== "view",
|
|
1863
1865
|
label: "N\xFAmero de Documento",
|
|
1864
1866
|
...form.getInputProps("documentNumber"),
|
|
@@ -1868,7 +1870,7 @@ var PatientForm = ({
|
|
|
1868
1870
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1869
1871
|
TextInput3,
|
|
1870
1872
|
{
|
|
1871
|
-
readOnly: mode === "view",
|
|
1873
|
+
readOnly: mode === "view" || isFieldDisabled("firstName"),
|
|
1872
1874
|
withAsterisk: mode !== "view",
|
|
1873
1875
|
label: "Primer Nombre",
|
|
1874
1876
|
...form.getInputProps("firstName"),
|
|
@@ -1878,7 +1880,7 @@ var PatientForm = ({
|
|
|
1878
1880
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1879
1881
|
TextInput3,
|
|
1880
1882
|
{
|
|
1881
|
-
readOnly: mode === "view",
|
|
1883
|
+
readOnly: mode === "view" || isFieldDisabled("middleName"),
|
|
1882
1884
|
label: "Segundo Nombre",
|
|
1883
1885
|
...form.getInputProps("middleName"),
|
|
1884
1886
|
"data-testid": "patient-form-middle-name-input"
|
|
@@ -1887,7 +1889,7 @@ var PatientForm = ({
|
|
|
1887
1889
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1888
1890
|
TextInput3,
|
|
1889
1891
|
{
|
|
1890
|
-
readOnly: mode === "view",
|
|
1892
|
+
readOnly: mode === "view" || isFieldDisabled("surname"),
|
|
1891
1893
|
withAsterisk: mode !== "view",
|
|
1892
1894
|
label: "Primer Apellido",
|
|
1893
1895
|
...form.getInputProps("surname"),
|
|
@@ -1897,7 +1899,7 @@ var PatientForm = ({
|
|
|
1897
1899
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1898
1900
|
TextInput3,
|
|
1899
1901
|
{
|
|
1900
|
-
readOnly: mode === "view",
|
|
1902
|
+
readOnly: mode === "view" || isFieldDisabled("secondSurname"),
|
|
1901
1903
|
label: "Segundo Apellido",
|
|
1902
1904
|
...form.getInputProps("secondSurname"),
|
|
1903
1905
|
"data-testid": "patient-form-second-surname-input"
|
|
@@ -1906,7 +1908,7 @@ var PatientForm = ({
|
|
|
1906
1908
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1907
1909
|
TextInput3,
|
|
1908
1910
|
{
|
|
1909
|
-
readOnly: mode === "view",
|
|
1911
|
+
readOnly: mode === "view" || isFieldDisabled("birthDate"),
|
|
1910
1912
|
withAsterisk: mode !== "view",
|
|
1911
1913
|
label: "Fecha de Nacimiento",
|
|
1912
1914
|
type: "date",
|
|
@@ -1917,7 +1919,8 @@ var PatientForm = ({
|
|
|
1917
1919
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1918
1920
|
NumberInput,
|
|
1919
1921
|
{
|
|
1920
|
-
readOnly:
|
|
1922
|
+
readOnly: isFieldDisabled("age"),
|
|
1923
|
+
disabled: true,
|
|
1921
1924
|
label: "Edad",
|
|
1922
1925
|
suffix: !form.values.age ? "" : " a\xF1os",
|
|
1923
1926
|
...form.getInputProps("age"),
|
|
@@ -1927,7 +1930,7 @@ var PatientForm = ({
|
|
|
1927
1930
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1928
1931
|
NumberInput,
|
|
1929
1932
|
{
|
|
1930
|
-
readOnly: mode === "view",
|
|
1933
|
+
readOnly: mode === "view" || isFieldDisabled("whatsapp"),
|
|
1931
1934
|
withAsterisk: mode !== "view",
|
|
1932
1935
|
label: "WhatsApp",
|
|
1933
1936
|
allowNegative: false,
|
|
@@ -1939,7 +1942,7 @@ var PatientForm = ({
|
|
|
1939
1942
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1940
1943
|
Select4,
|
|
1941
1944
|
{
|
|
1942
|
-
readOnly: mode === "view",
|
|
1945
|
+
readOnly: mode === "view" || isFieldDisabled("gender"),
|
|
1943
1946
|
withAsterisk: mode !== "view",
|
|
1944
1947
|
label: "G\xE9nero",
|
|
1945
1948
|
data: genderOptions,
|
|
@@ -1950,7 +1953,7 @@ var PatientForm = ({
|
|
|
1950
1953
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1951
1954
|
Select4,
|
|
1952
1955
|
{
|
|
1953
|
-
readOnly: mode === "view",
|
|
1956
|
+
readOnly: mode === "view" || isFieldDisabled("affiliationTypeId"),
|
|
1954
1957
|
withAsterisk: mode !== "view",
|
|
1955
1958
|
label: "Tipo de afiliaci\xF3n",
|
|
1956
1959
|
data: affiliationTypeOptions,
|
|
@@ -1961,7 +1964,7 @@ var PatientForm = ({
|
|
|
1961
1964
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1962
1965
|
TextInput3,
|
|
1963
1966
|
{
|
|
1964
|
-
readOnly: mode === "view",
|
|
1967
|
+
readOnly: mode === "view" || isFieldDisabled("email"),
|
|
1965
1968
|
label: "Correo electr\xF3nico",
|
|
1966
1969
|
...form.getInputProps("email"),
|
|
1967
1970
|
"data-testid": "patient-form-email-input"
|
|
@@ -1970,8 +1973,7 @@ var PatientForm = ({
|
|
|
1970
1973
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
1971
1974
|
Select4,
|
|
1972
1975
|
{
|
|
1973
|
-
readOnly: mode === "view",
|
|
1974
|
-
withAsterisk: mode !== "view",
|
|
1976
|
+
readOnly: mode === "view" || isFieldDisabled("maritalStatus"),
|
|
1975
1977
|
label: "Estado civil",
|
|
1976
1978
|
data: maritalStatusOptions,
|
|
1977
1979
|
...form.getInputProps("maritalStatus"),
|
|
@@ -1981,7 +1983,7 @@ var PatientForm = ({
|
|
|
1981
1983
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 12, mt: "sm", children: /* @__PURE__ */ jsx9(
|
|
1982
1984
|
Checkbox,
|
|
1983
1985
|
{
|
|
1984
|
-
|
|
1986
|
+
readOnly: mode === "view" || isFieldDisabled("isDataPolicyAccepted"),
|
|
1985
1987
|
label: /* @__PURE__ */ jsxs8(Text6, { fz: "sm", children: [
|
|
1986
1988
|
"Autorizo el tratamiento de mis datos personales conforme a la",
|
|
1987
1989
|
" ",
|
|
@@ -2010,14 +2012,14 @@ var PatientForm = ({
|
|
|
2010
2012
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2011
2013
|
Select4,
|
|
2012
2014
|
{
|
|
2013
|
-
readOnly: mode === "view",
|
|
2015
|
+
readOnly: mode === "view" || isFieldDisabled("provinceId"),
|
|
2014
2016
|
withAsterisk: mode !== "view",
|
|
2015
2017
|
label: "Departamento",
|
|
2016
2018
|
data: provinceOptions,
|
|
2017
2019
|
...form.getInputProps("provinceId"),
|
|
2018
2020
|
onChange: (value) => {
|
|
2019
|
-
form.setFieldValue("provinceId", value
|
|
2020
|
-
form.setFieldValue("cityId",
|
|
2021
|
+
form.setFieldValue("provinceId", value);
|
|
2022
|
+
form.setFieldValue("cityId", null);
|
|
2021
2023
|
},
|
|
2022
2024
|
"data-testid": "patient-form-province-select"
|
|
2023
2025
|
}
|
|
@@ -2025,7 +2027,7 @@ var PatientForm = ({
|
|
|
2025
2027
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2026
2028
|
Select4,
|
|
2027
2029
|
{
|
|
2028
|
-
readOnly: mode === "view",
|
|
2030
|
+
readOnly: mode === "view" || isFieldDisabled("cityId"),
|
|
2029
2031
|
withAsterisk: mode !== "view",
|
|
2030
2032
|
label: "Municipio",
|
|
2031
2033
|
data: cityOptions,
|
|
@@ -2036,7 +2038,7 @@ var PatientForm = ({
|
|
|
2036
2038
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2037
2039
|
TextInput3,
|
|
2038
2040
|
{
|
|
2039
|
-
readOnly: mode === "view",
|
|
2041
|
+
readOnly: mode === "view" || isFieldDisabled("homeAddress"),
|
|
2040
2042
|
label: "Direcci\xF3n",
|
|
2041
2043
|
...form.getInputProps("homeAddress"),
|
|
2042
2044
|
"data-testid": "patient-form-home-address-input"
|
|
@@ -2045,7 +2047,7 @@ var PatientForm = ({
|
|
|
2045
2047
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2046
2048
|
Select4,
|
|
2047
2049
|
{
|
|
2048
|
-
readOnly: mode === "view",
|
|
2050
|
+
readOnly: mode === "view" || isFieldDisabled("bloodType"),
|
|
2049
2051
|
label: "Grupo sangu\xEDneo",
|
|
2050
2052
|
data: bloodTypeOptions,
|
|
2051
2053
|
...form.getInputProps("bloodType"),
|
|
@@ -2055,7 +2057,7 @@ var PatientForm = ({
|
|
|
2055
2057
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2056
2058
|
NumberInput,
|
|
2057
2059
|
{
|
|
2058
|
-
readOnly: mode === "view",
|
|
2060
|
+
readOnly: mode === "view" || isFieldDisabled("cellphone"),
|
|
2059
2061
|
withAsterisk: mode !== "view",
|
|
2060
2062
|
label: "Celular",
|
|
2061
2063
|
allowNegative: false,
|
|
@@ -2068,7 +2070,7 @@ var PatientForm = ({
|
|
|
2068
2070
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2069
2071
|
NumberInput,
|
|
2070
2072
|
{
|
|
2071
|
-
readOnly: mode === "view",
|
|
2073
|
+
readOnly: mode === "view" || isFieldDisabled("homephone"),
|
|
2072
2074
|
label: "Tel\xE9fono fijo",
|
|
2073
2075
|
allowNegative: false,
|
|
2074
2076
|
allowDecimal: false,
|
|
@@ -2080,7 +2082,7 @@ var PatientForm = ({
|
|
|
2080
2082
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2081
2083
|
Select4,
|
|
2082
2084
|
{
|
|
2083
|
-
readOnly: mode === "view",
|
|
2085
|
+
readOnly: mode === "view" || isFieldDisabled("stratumId"),
|
|
2084
2086
|
withAsterisk: mode !== "view",
|
|
2085
2087
|
label: "Estrato",
|
|
2086
2088
|
data: stratumOptions,
|
|
@@ -2091,7 +2093,7 @@ var PatientForm = ({
|
|
|
2091
2093
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2092
2094
|
Select4,
|
|
2093
2095
|
{
|
|
2094
|
-
readOnly: mode === "view",
|
|
2096
|
+
readOnly: mode === "view" || isFieldDisabled("ethnicGroupId"),
|
|
2095
2097
|
withAsterisk: mode !== "view",
|
|
2096
2098
|
label: "Pertenencia \xE9tnica",
|
|
2097
2099
|
data: ethnicGroupOptions,
|
|
@@ -2102,7 +2104,7 @@ var PatientForm = ({
|
|
|
2102
2104
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2103
2105
|
Select4,
|
|
2104
2106
|
{
|
|
2105
|
-
readOnly: mode === "view",
|
|
2107
|
+
readOnly: mode === "view" || isFieldDisabled("educationLevelId"),
|
|
2106
2108
|
withAsterisk: mode !== "view",
|
|
2107
2109
|
label: "Nivel educativo",
|
|
2108
2110
|
data: educationLevelOptions,
|
|
@@ -2117,15 +2119,16 @@ var PatientForm = ({
|
|
|
2117
2119
|
Select4,
|
|
2118
2120
|
{
|
|
2119
2121
|
readOnly: mode === "view",
|
|
2122
|
+
disabled: isMandatoryInsuranceDisabled,
|
|
2120
2123
|
withAsterisk: mode !== "view",
|
|
2121
2124
|
label: "Seguro",
|
|
2122
2125
|
data: companyClientOptions,
|
|
2123
2126
|
...form.getInputProps("mandatoryInsurance.companyId"),
|
|
2124
2127
|
onChange: (value) => {
|
|
2125
|
-
form.setFieldValue("mandatoryInsurance.companyId", value
|
|
2126
|
-
form.setFieldValue("mandatoryInsurance.plan",
|
|
2127
|
-
form.setFieldValue("mandatoryInsurance.population",
|
|
2128
|
-
form.setFieldValue("mandatoryInsurance.groupId",
|
|
2128
|
+
form.setFieldValue("mandatoryInsurance.companyId", value);
|
|
2129
|
+
form.setFieldValue("mandatoryInsurance.plan", null);
|
|
2130
|
+
form.setFieldValue("mandatoryInsurance.population", null);
|
|
2131
|
+
form.setFieldValue("mandatoryInsurance.groupId", null);
|
|
2129
2132
|
form.setFieldValue("mandatoryInsurance.policyNumber", "");
|
|
2130
2133
|
},
|
|
2131
2134
|
"data-testid": "patient-form-mandatory-insurance-company-select"
|
|
@@ -2135,14 +2138,15 @@ var PatientForm = ({
|
|
|
2135
2138
|
Select4,
|
|
2136
2139
|
{
|
|
2137
2140
|
readOnly: mode === "view",
|
|
2141
|
+
disabled: isMandatoryInsuranceDisabled,
|
|
2138
2142
|
withAsterisk: mode !== "view",
|
|
2139
2143
|
label: "Plan",
|
|
2140
2144
|
data: contractOptions,
|
|
2141
2145
|
...form.getInputProps("mandatoryInsurance.plan"),
|
|
2142
2146
|
onChange: (value) => {
|
|
2143
|
-
form.setFieldValue("mandatoryInsurance.plan", value
|
|
2144
|
-
form.setFieldValue("mandatoryInsurance.population",
|
|
2145
|
-
form.setFieldValue("mandatoryInsurance.groupId",
|
|
2147
|
+
form.setFieldValue("mandatoryInsurance.plan", value);
|
|
2148
|
+
form.setFieldValue("mandatoryInsurance.population", null);
|
|
2149
|
+
form.setFieldValue("mandatoryInsurance.groupId", null);
|
|
2146
2150
|
form.setFieldValue("mandatoryInsurance.policyNumber", "");
|
|
2147
2151
|
},
|
|
2148
2152
|
"data-testid": "patient-form-mandatory-insurance-plan-select"
|
|
@@ -2152,6 +2156,7 @@ var PatientForm = ({
|
|
|
2152
2156
|
Select4,
|
|
2153
2157
|
{
|
|
2154
2158
|
readOnly: mode === "view",
|
|
2159
|
+
disabled: isMandatoryInsuranceDisabled,
|
|
2155
2160
|
withAsterisk: mode !== "view",
|
|
2156
2161
|
label: "Poblaci\xF3n",
|
|
2157
2162
|
data: contractPopulationOptions,
|
|
@@ -2163,6 +2168,7 @@ var PatientForm = ({
|
|
|
2163
2168
|
Select4,
|
|
2164
2169
|
{
|
|
2165
2170
|
readOnly: mode === "view",
|
|
2171
|
+
disabled: isMandatoryInsuranceDisabled,
|
|
2166
2172
|
withAsterisk: mode !== "view",
|
|
2167
2173
|
label: "Grupo de ingreso",
|
|
2168
2174
|
data: incomeGroupOptions,
|
|
@@ -2173,7 +2179,8 @@ var PatientForm = ({
|
|
|
2173
2179
|
/* @__PURE__ */ jsx9(Grid3.Col, { span: 6, children: /* @__PURE__ */ jsx9(
|
|
2174
2180
|
TextInput3,
|
|
2175
2181
|
{
|
|
2176
|
-
readOnly: mode === "view",
|
|
2182
|
+
readOnly: mode === "view" || isMandatoryInsuranceDisabled,
|
|
2183
|
+
disabled: isMandatoryInsuranceDisabled,
|
|
2177
2184
|
label: "N\xFAmero de p\xF3liza",
|
|
2178
2185
|
...form.getInputProps("mandatoryInsurance.policyNumber"),
|
|
2179
2186
|
"data-testid": "patient-form-mandatory-insurance-policy-number-input"
|
|
@@ -2186,7 +2193,7 @@ var PatientForm = ({
|
|
|
2186
2193
|
PatientVoluntaryInsuranceForm,
|
|
2187
2194
|
{
|
|
2188
2195
|
index,
|
|
2189
|
-
mode,
|
|
2196
|
+
mode: isVoluntaryInsuranceDisabled ? "view" : mode,
|
|
2190
2197
|
form
|
|
2191
2198
|
},
|
|
2192
2199
|
insurance.id ?? index
|
|
@@ -2197,6 +2204,7 @@ var PatientForm = ({
|
|
|
2197
2204
|
variant: "outline",
|
|
2198
2205
|
color: "secondary",
|
|
2199
2206
|
size: "xs",
|
|
2207
|
+
disabled: isVoluntaryInsuranceDisabled,
|
|
2200
2208
|
onClick: handleAddVoluntaryInsurance,
|
|
2201
2209
|
leftSection: /* @__PURE__ */ jsx9(IconPlus, { style: { width: 16, height: 16 } }),
|
|
2202
2210
|
"data-testid": "patient-form-add-voluntary-insurance-button",
|
|
@@ -2280,14 +2288,14 @@ var createPatientPayload = (values) => {
|
|
|
2280
2288
|
birthDate: values.birthDate,
|
|
2281
2289
|
age: values.age,
|
|
2282
2290
|
whatsapp: String(values.whatsapp),
|
|
2283
|
-
gender: values.gender,
|
|
2291
|
+
gender: values.gender ?? "",
|
|
2284
2292
|
affiliationType: Number(values.affiliationTypeId),
|
|
2285
2293
|
email: values.email,
|
|
2286
|
-
maritalStatus: values.maritalStatus,
|
|
2294
|
+
maritalStatus: values.maritalStatus ?? "",
|
|
2287
2295
|
provinceId: Number(values.provinceId),
|
|
2288
2296
|
cityId: Number(values.cityId),
|
|
2289
2297
|
homeAddress: values.homeAddress,
|
|
2290
|
-
bloodType: values.bloodType,
|
|
2298
|
+
bloodType: values.bloodType ?? "",
|
|
2291
2299
|
cellphone: String(values.cellphone),
|
|
2292
2300
|
homephone: String(values.homephone),
|
|
2293
2301
|
emergencyContact: values.emergencyContact,
|
|
@@ -2353,12 +2361,354 @@ var createPatientForm = (info) => {
|
|
|
2353
2361
|
}))
|
|
2354
2362
|
};
|
|
2355
2363
|
};
|
|
2364
|
+
|
|
2365
|
+
// src/components/header/Header.tsx
|
|
2366
|
+
import * as MC3 from "@mantine/core";
|
|
2367
|
+
import * as TI4 from "@tabler/icons-react";
|
|
2368
|
+
import { useMemo as useMemo5, useState as useState6 } from "react";
|
|
2369
|
+
|
|
2370
|
+
// src/components/header/HelpModal.tsx
|
|
2371
|
+
import * as MC from "@mantine/core";
|
|
2372
|
+
import * as TI2 from "@tabler/icons-react";
|
|
2373
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2374
|
+
var HelpModal = ({ opened, onClose, enterpriseLogo }) => {
|
|
2375
|
+
return /* @__PURE__ */ jsxs9(MC.Modal, { title: "Ayuda", opened, onClose, "data-testid": "header-help-modal", children: [
|
|
2376
|
+
/* @__PURE__ */ jsxs9(MC.Stack, { mb: "lg", align: "center", children: [
|
|
2377
|
+
enterpriseLogo,
|
|
2378
|
+
/* @__PURE__ */ jsx10(MC.Text, { fz: "lg", fw: "bold", children: "Informaci\xF3n de contacto" }),
|
|
2379
|
+
/* @__PURE__ */ jsxs9(MC.Stack, { children: [
|
|
2380
|
+
/* @__PURE__ */ jsxs9(MC.Group, { children: [
|
|
2381
|
+
/* @__PURE__ */ jsx10(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ jsx10(TI2.IconPhone, { style: { width: 24, height: 24 } }) }),
|
|
2382
|
+
/* @__PURE__ */ jsx10(MC.Text, { fz: "xs", children: "+57 300 658 32 65" })
|
|
2383
|
+
] }),
|
|
2384
|
+
/* @__PURE__ */ jsxs9(MC.Group, { children: [
|
|
2385
|
+
/* @__PURE__ */ jsx10(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ jsx10(TI2.IconMail, { style: { width: 24, height: 24 } }) }),
|
|
2386
|
+
/* @__PURE__ */ jsx10(MC.Text, { fz: "xs", children: "analistadesoporte@ttncompany.com" })
|
|
2387
|
+
] }),
|
|
2388
|
+
/* @__PURE__ */ jsxs9(MC.Group, { children: [
|
|
2389
|
+
/* @__PURE__ */ jsx10(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ jsx10(TI2.IconMapPin, { style: { width: 24, height: 24 } }) }),
|
|
2390
|
+
/* @__PURE__ */ jsx10(MC.Text, { fz: "xs", children: "Carrera 51b # 87 - 50 Piso 3 Local 337" })
|
|
2391
|
+
] })
|
|
2392
|
+
] })
|
|
2393
|
+
] }),
|
|
2394
|
+
/* @__PURE__ */ jsx10(MC.Group, { justify: "end", mt: "xl", children: /* @__PURE__ */ jsx10(
|
|
2395
|
+
MC.Button,
|
|
2396
|
+
{
|
|
2397
|
+
onClick: onClose,
|
|
2398
|
+
size: "sm",
|
|
2399
|
+
px: "xl",
|
|
2400
|
+
color: "brand-color",
|
|
2401
|
+
"data-testid": "header-help-accept-button",
|
|
2402
|
+
children: "Aceptar"
|
|
2403
|
+
}
|
|
2404
|
+
) })
|
|
2405
|
+
] });
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
// src/components/header/ChangeAccountModal.tsx
|
|
2409
|
+
import * as MC2 from "@mantine/core";
|
|
2410
|
+
import * as TI3 from "@tabler/icons-react";
|
|
2411
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2412
|
+
var ChangeAccountModal = ({
|
|
2413
|
+
opened,
|
|
2414
|
+
onClose,
|
|
2415
|
+
accounts,
|
|
2416
|
+
onChangeAccount
|
|
2417
|
+
}) => {
|
|
2418
|
+
return /* @__PURE__ */ jsx11(MC2.Modal, { opened, onClose, size: 1200, title: "Cambiar cuenta", children: /* @__PURE__ */ jsx11(MC2.Grid, { px: "lg", children: accounts.map((account, accountIndex) => /* @__PURE__ */ jsx11(MC2.Grid.Col, { span: 6, children: /* @__PURE__ */ jsxs10(MC2.Menu, { position: "right", width: 210, children: [
|
|
2419
|
+
/* @__PURE__ */ jsx11(MC2.Menu.Target, { "data-testid": `change-account-account-option-${accountIndex}`, children: /* @__PURE__ */ jsxs10(
|
|
2420
|
+
MC2.Group,
|
|
2421
|
+
{
|
|
2422
|
+
w: 216,
|
|
2423
|
+
h: 100,
|
|
2424
|
+
justify: "space-between",
|
|
2425
|
+
align: "center",
|
|
2426
|
+
style: (theme) => ({
|
|
2427
|
+
border: `1px solid ${theme.colors.gray[3]}`,
|
|
2428
|
+
borderRadius: theme.radius.md,
|
|
2429
|
+
padding: "8px",
|
|
2430
|
+
cursor: "pointer"
|
|
2431
|
+
}),
|
|
2432
|
+
children: [
|
|
2433
|
+
/* @__PURE__ */ jsx11("div", {}),
|
|
2434
|
+
/* @__PURE__ */ jsx11(MC2.Text, { fw: "bold", tt: "uppercase", children: account.name }),
|
|
2435
|
+
/* @__PURE__ */ jsx11(MC2.ThemeIcon, { variant: "transparent", c: "dimmed", children: /* @__PURE__ */ jsx11(TI3.IconChevronRight, { style: { width: 32, height: 32 } }) })
|
|
2436
|
+
]
|
|
2437
|
+
}
|
|
2438
|
+
) }),
|
|
2439
|
+
/* @__PURE__ */ jsx11(MC2.Menu.Dropdown, { p: 0, children: account.profiles.map((profile, profileIndex) => /* @__PURE__ */ jsx11(
|
|
2440
|
+
MC2.Menu.Item,
|
|
2441
|
+
{
|
|
2442
|
+
ta: "center",
|
|
2443
|
+
tt: "uppercase",
|
|
2444
|
+
py: "xs",
|
|
2445
|
+
onClick: () => {
|
|
2446
|
+
onChangeAccount(account, profile);
|
|
2447
|
+
onClose();
|
|
2448
|
+
},
|
|
2449
|
+
style: (theme) => ({
|
|
2450
|
+
borderRadius: 0,
|
|
2451
|
+
borderBottom: profileIndex !== account.profiles.length - 1 ? `1px solid ${theme.colors.gray[3]}` : void 0
|
|
2452
|
+
}),
|
|
2453
|
+
"data-testid": `change-account-profile-option-${accountIndex}-${profileIndex}`,
|
|
2454
|
+
children: profile.name
|
|
2455
|
+
},
|
|
2456
|
+
profile.id
|
|
2457
|
+
)) })
|
|
2458
|
+
] }) }, account.id)) }) });
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2461
|
+
// src/components/header/Header.tsx
|
|
2462
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2463
|
+
var Header = ({
|
|
2464
|
+
moduleName,
|
|
2465
|
+
logo,
|
|
2466
|
+
enterpriseLogo,
|
|
2467
|
+
accounts,
|
|
2468
|
+
currentSite,
|
|
2469
|
+
onBackHome,
|
|
2470
|
+
onChangeAccount,
|
|
2471
|
+
onClickMyPayroll,
|
|
2472
|
+
onClickSettings,
|
|
2473
|
+
onLogout
|
|
2474
|
+
}) => {
|
|
2475
|
+
const { userInfo } = useTTNSharedContext();
|
|
2476
|
+
const [changeAccountModalOpened, setChangeAccountModalOpened] = useState6(false);
|
|
2477
|
+
const [helpModalOpened, setHelpModalOpened] = useState6(false);
|
|
2478
|
+
const { currentAccount, currentProfile } = useMemo5(() => {
|
|
2479
|
+
if (!userInfo.accountId || !userInfo.profileId) {
|
|
2480
|
+
return { currentAccount: void 0, currentProfile: void 0 };
|
|
2481
|
+
}
|
|
2482
|
+
const currentAccount2 = accounts.find((account) => account.id === userInfo.accountId);
|
|
2483
|
+
const currentProfile2 = currentAccount2?.profiles.find(
|
|
2484
|
+
(profile) => profile.id === userInfo.profileId
|
|
2485
|
+
);
|
|
2486
|
+
return { currentAccount: currentAccount2, currentProfile: currentProfile2 };
|
|
2487
|
+
}, [accounts, userInfo]);
|
|
2488
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
2489
|
+
/* @__PURE__ */ jsxs11(MC3.Flex, { w: "100%", px: 16, py: 6, justify: "space-between", align: "center", children: [
|
|
2490
|
+
/* @__PURE__ */ jsxs11(MC3.Group, { children: [
|
|
2491
|
+
/* @__PURE__ */ jsx12(MC3.UnstyledButton, { onClick: onBackHome, "data-testid": "header-logo-button", children: logo }),
|
|
2492
|
+
/* @__PURE__ */ jsxs11(MC3.Title, { order: 3, c: "gray.4", fw: "inherit", children: [
|
|
2493
|
+
"\u2022 ",
|
|
2494
|
+
moduleName
|
|
2495
|
+
] })
|
|
2496
|
+
] }),
|
|
2497
|
+
/* @__PURE__ */ jsxs11(MC3.Flex, { gap: "sm", children: [
|
|
2498
|
+
Boolean(currentSite) && /* @__PURE__ */ jsxs11(MC3.Flex, { align: "center", children: [
|
|
2499
|
+
/* @__PURE__ */ jsx12(MC3.ThemeIcon, { variant: "transparent", c: "dimmed", children: /* @__PURE__ */ jsx12(TI4.IconMapPinFilled, { style: { width: 24, height: 24 } }) }),
|
|
2500
|
+
/* @__PURE__ */ jsx12(MC3.Text, { c: "gray.6", fz: "sm", children: currentSite?.name })
|
|
2501
|
+
] }),
|
|
2502
|
+
/* @__PURE__ */ jsxs11(MC3.Menu, { width: 216, position: "bottom-end", children: [
|
|
2503
|
+
/* @__PURE__ */ jsx12(MC3.Menu.Target, { "data-testid": "header-account-menu-button", children: /* @__PURE__ */ jsxs11(
|
|
2504
|
+
MC3.Box,
|
|
2505
|
+
{
|
|
2506
|
+
w: 216,
|
|
2507
|
+
style: (theme) => ({
|
|
2508
|
+
display: "flex",
|
|
2509
|
+
alignItems: "center",
|
|
2510
|
+
border: `1px solid ${theme.colors.gray[3]}`,
|
|
2511
|
+
borderRadius: theme.radius.sm,
|
|
2512
|
+
padding: "4px 8px",
|
|
2513
|
+
cursor: "pointer"
|
|
2514
|
+
}),
|
|
2515
|
+
children: [
|
|
2516
|
+
Boolean(currentAccount) && /* @__PURE__ */ jsx12(MC3.ThemeIcon, { variant: "transparent", c: "primary-color", size: "lg", children: /* @__PURE__ */ jsx12(TI4.IconBuilding, { style: { width: 24, height: 24 } }) }),
|
|
2517
|
+
/* @__PURE__ */ jsx12(MC3.Text, { ml: 6, flex: 1, children: currentAccount?.name }),
|
|
2518
|
+
/* @__PURE__ */ jsx12(MC3.Avatar, { src: userInfo?.imageUrl })
|
|
2519
|
+
]
|
|
2520
|
+
}
|
|
2521
|
+
) }),
|
|
2522
|
+
/* @__PURE__ */ jsxs11(MC3.Menu.Dropdown, { children: [
|
|
2523
|
+
/* @__PURE__ */ jsxs11(MC3.Stack, { px: "md", py: "sm", gap: "xs", align: "center", children: [
|
|
2524
|
+
/* @__PURE__ */ jsx12(MC3.Avatar, { src: userInfo?.imageUrl, size: "lg" }),
|
|
2525
|
+
/* @__PURE__ */ jsx12(MC3.Text, { fw: "bold", children: userInfo?.name }),
|
|
2526
|
+
/* @__PURE__ */ jsxs11(MC3.Text, { fw: "bold", ta: "center", c: "gray.4", children: [
|
|
2527
|
+
currentAccount?.name,
|
|
2528
|
+
" - ",
|
|
2529
|
+
currentProfile?.name
|
|
2530
|
+
] })
|
|
2531
|
+
] }),
|
|
2532
|
+
Boolean(currentAccount) && /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
2533
|
+
/* @__PURE__ */ jsx12(
|
|
2534
|
+
MC3.Menu.Item,
|
|
2535
|
+
{
|
|
2536
|
+
onClick: () => setChangeAccountModalOpened(true),
|
|
2537
|
+
"data-testid": "header-change-account-menu-item",
|
|
2538
|
+
children: "Cambiar rol y cuenta"
|
|
2539
|
+
}
|
|
2540
|
+
),
|
|
2541
|
+
/* @__PURE__ */ jsx12(
|
|
2542
|
+
MC3.Menu.Item,
|
|
2543
|
+
{
|
|
2544
|
+
onClick: onClickMyPayroll,
|
|
2545
|
+
"data-testid": "header-my-payroll-menu-item",
|
|
2546
|
+
children: "Mi n\xF3mina"
|
|
2547
|
+
}
|
|
2548
|
+
),
|
|
2549
|
+
/* @__PURE__ */ jsx12(MC3.Menu.Item, { onClick: onClickSettings, "data-testid": "header-settings-menu-item", children: "Configuraci\xF3n" })
|
|
2550
|
+
] }),
|
|
2551
|
+
/* @__PURE__ */ jsx12(
|
|
2552
|
+
MC3.Menu.Item,
|
|
2553
|
+
{
|
|
2554
|
+
onClick: () => setHelpModalOpened(true),
|
|
2555
|
+
"data-testid": "header-help-menu-item",
|
|
2556
|
+
children: "Ayuda"
|
|
2557
|
+
}
|
|
2558
|
+
),
|
|
2559
|
+
/* @__PURE__ */ jsx12(MC3.Menu.Divider, {}),
|
|
2560
|
+
/* @__PURE__ */ jsx12(MC3.Menu.Item, { onClick: onLogout, "data-testid": "header-logout-menu-item", children: "Cerrar sesi\xF3n" })
|
|
2561
|
+
] })
|
|
2562
|
+
] })
|
|
2563
|
+
] })
|
|
2564
|
+
] }),
|
|
2565
|
+
/* @__PURE__ */ jsx12(
|
|
2566
|
+
ChangeAccountModal,
|
|
2567
|
+
{
|
|
2568
|
+
opened: changeAccountModalOpened,
|
|
2569
|
+
onClose: () => setChangeAccountModalOpened(false),
|
|
2570
|
+
accounts,
|
|
2571
|
+
onChangeAccount
|
|
2572
|
+
}
|
|
2573
|
+
),
|
|
2574
|
+
/* @__PURE__ */ jsx12(
|
|
2575
|
+
HelpModal,
|
|
2576
|
+
{
|
|
2577
|
+
opened: helpModalOpened,
|
|
2578
|
+
onClose: () => setHelpModalOpened(false),
|
|
2579
|
+
enterpriseLogo
|
|
2580
|
+
}
|
|
2581
|
+
)
|
|
2582
|
+
] });
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2585
|
+
// src/components/sidebar/Sidebar.tsx
|
|
2586
|
+
import { useState as useState7 } from "react";
|
|
2587
|
+
import * as MC5 from "@mantine/core";
|
|
2588
|
+
import * as TI5 from "@tabler/icons-react";
|
|
2589
|
+
|
|
2590
|
+
// src/components/sidebar/SidebarMenu.tsx
|
|
2591
|
+
import * as MC4 from "@mantine/core";
|
|
2592
|
+
import { Fragment as Fragment4 } from "react/jsx-runtime";
|
|
2593
|
+
import { NavLink } from "react-router";
|
|
2594
|
+
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2595
|
+
var SidebarMenu = ({
|
|
2596
|
+
id,
|
|
2597
|
+
label,
|
|
2598
|
+
icon,
|
|
2599
|
+
active,
|
|
2600
|
+
screens,
|
|
2601
|
+
onClickMenu,
|
|
2602
|
+
onCloseSidebar,
|
|
2603
|
+
onClickExternalScreen
|
|
2604
|
+
}) => {
|
|
2605
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2606
|
+
/* @__PURE__ */ jsx13(
|
|
2607
|
+
MC4.UnstyledButton,
|
|
2608
|
+
{
|
|
2609
|
+
onClick: () => onClickMenu(id),
|
|
2610
|
+
className: "ttn-sidebar-menu",
|
|
2611
|
+
"data-testid": `sidebar-menu-${label}`,
|
|
2612
|
+
children: /* @__PURE__ */ jsxs12(MC4.Flex, { align: "center", children: [
|
|
2613
|
+
/* @__PURE__ */ jsx13(MC4.Center, { w: 40, h: 40, me: 10, children: /* @__PURE__ */ jsx13(
|
|
2614
|
+
MC4.Box,
|
|
2615
|
+
{
|
|
2616
|
+
className: "ttn-sidebar-menu-icon",
|
|
2617
|
+
style: { maskImage: `url(${icon})`, WebkitMaskImage: `url(${icon})` }
|
|
2618
|
+
}
|
|
2619
|
+
) }),
|
|
2620
|
+
/* @__PURE__ */ jsx13(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: label })
|
|
2621
|
+
] })
|
|
2622
|
+
}
|
|
2623
|
+
),
|
|
2624
|
+
Boolean(screens?.length) && /* @__PURE__ */ jsx13(MC4.Collapse, { in: active ?? false, children: screens?.map((screen) => /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2625
|
+
screen.external && /* @__PURE__ */ jsx13(MC4.Box, { onClick: () => onClickExternalScreen(screen), children: /* @__PURE__ */ jsx13(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: screen.label }) }),
|
|
2626
|
+
!screen.external && /* @__PURE__ */ jsx13(
|
|
2627
|
+
NavLink,
|
|
2628
|
+
{
|
|
2629
|
+
to: screen.url || "#",
|
|
2630
|
+
onClick: onCloseSidebar,
|
|
2631
|
+
className: ({ isActive }) => isActive ? "ttn-sidebar-menu-item active" : "ttn-sidebar-menu-item",
|
|
2632
|
+
children: /* @__PURE__ */ jsx13(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: screen.label })
|
|
2633
|
+
}
|
|
2634
|
+
)
|
|
2635
|
+
] }, screen.id)) })
|
|
2636
|
+
] });
|
|
2637
|
+
};
|
|
2638
|
+
|
|
2639
|
+
// src/components/sidebar/Sidebar.tsx
|
|
2640
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2641
|
+
var Sidebar = ({ modules, onClickExternalScreen }) => {
|
|
2642
|
+
const [opened, setOpened] = useState7(false);
|
|
2643
|
+
const [activeModuleId, setActiveModuleId] = useState7(null);
|
|
2644
|
+
const handleClickMenu = (id) => {
|
|
2645
|
+
setActiveModuleId(id === activeModuleId ? null : id);
|
|
2646
|
+
if (!opened) {
|
|
2647
|
+
setOpened(true);
|
|
2648
|
+
}
|
|
2649
|
+
};
|
|
2650
|
+
const handleCloseSidebar = () => {
|
|
2651
|
+
setActiveModuleId(null);
|
|
2652
|
+
setOpened(false);
|
|
2653
|
+
};
|
|
2654
|
+
const handleClickExternalScreen = (item) => {
|
|
2655
|
+
setActiveModuleId(null);
|
|
2656
|
+
setOpened(false);
|
|
2657
|
+
onClickExternalScreen(item);
|
|
2658
|
+
};
|
|
2659
|
+
return /* @__PURE__ */ jsxs13("aside", { className: opened ? "ttn-sidebar" : "ttn-sidebar closed", children: [
|
|
2660
|
+
/* @__PURE__ */ jsxs13(MC5.Flex, { direction: "column", justify: "center", h: 56, children: [
|
|
2661
|
+
opened && /* @__PURE__ */ jsx14(
|
|
2662
|
+
MC5.ActionIcon,
|
|
2663
|
+
{
|
|
2664
|
+
variant: "white",
|
|
2665
|
+
c: "gray.6",
|
|
2666
|
+
onClick: handleCloseSidebar,
|
|
2667
|
+
style: { alignSelf: "flex-end" },
|
|
2668
|
+
"data-testid": "sidebar-close-button",
|
|
2669
|
+
children: /* @__PURE__ */ jsx14(TI5.IconX, { style: { width: 20, height: 20 } })
|
|
2670
|
+
}
|
|
2671
|
+
),
|
|
2672
|
+
!opened && /* @__PURE__ */ jsx14(MC5.Center, { w: 80, children: /* @__PURE__ */ jsx14(
|
|
2673
|
+
MC5.ActionIcon,
|
|
2674
|
+
{
|
|
2675
|
+
w: 32,
|
|
2676
|
+
h: 32,
|
|
2677
|
+
variant: "outline",
|
|
2678
|
+
radius: "xs",
|
|
2679
|
+
onClick: () => setOpened(true),
|
|
2680
|
+
style: { alignSelf: "flex-end", borderWidth: 2 },
|
|
2681
|
+
"data-testid": "sidebar-open-button",
|
|
2682
|
+
children: /* @__PURE__ */ jsx14(TI5.IconMenu2, { style: { width: 20, height: 20, strokeWidth: 2 } })
|
|
2683
|
+
}
|
|
2684
|
+
) })
|
|
2685
|
+
] }),
|
|
2686
|
+
modules.map((module) => /* @__PURE__ */ jsx14(
|
|
2687
|
+
SidebarMenu,
|
|
2688
|
+
{
|
|
2689
|
+
id: module.id,
|
|
2690
|
+
label: module.label,
|
|
2691
|
+
icon: module.icon,
|
|
2692
|
+
active: activeModuleId === module.id,
|
|
2693
|
+
screens: module.screens,
|
|
2694
|
+
onClickMenu: handleClickMenu,
|
|
2695
|
+
onCloseSidebar: handleCloseSidebar,
|
|
2696
|
+
onClickExternalScreen: handleClickExternalScreen
|
|
2697
|
+
},
|
|
2698
|
+
module.id
|
|
2699
|
+
))
|
|
2700
|
+
] });
|
|
2701
|
+
};
|
|
2356
2702
|
export {
|
|
2703
|
+
ChangeAccountModal,
|
|
2704
|
+
Header,
|
|
2705
|
+
HelpModal,
|
|
2357
2706
|
PatientAdministrativeRisks,
|
|
2358
2707
|
PatientAppointmentHistory,
|
|
2359
2708
|
PatientAssistanceRisks,
|
|
2360
2709
|
PatientForm,
|
|
2361
2710
|
PatientNotes,
|
|
2711
|
+
Sidebar,
|
|
2362
2712
|
TTNSharedProvider,
|
|
2363
2713
|
useTTNSharedContext
|
|
2364
2714
|
};
|