@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 CHANGED
@@ -30,11 +30,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ ChangeAccountModal: () => ChangeAccountModal,
34
+ Header: () => Header,
35
+ HelpModal: () => HelpModal,
33
36
  PatientAdministrativeRisks: () => PatientAdministrativeRisks,
34
37
  PatientAppointmentHistory: () => PatientAppointmentHistory,
35
38
  PatientAssistanceRisks: () => PatientAssistanceRisks,
36
39
  PatientForm: () => PatientForm,
37
40
  PatientNotes: () => PatientNotes,
41
+ Sidebar: () => Sidebar,
38
42
  TTNSharedProvider: () => TTNSharedProvider,
39
43
  useTTNSharedContext: () => useTTNSharedContext
40
44
  });
@@ -354,24 +358,24 @@ var PatientVoluntaryInsuranceForm = ({
354
358
  mode,
355
359
  form
356
360
  }) => {
357
- const { userAccountId } = useTTNSharedContext();
361
+ const { userInfo } = useTTNSharedContext();
358
362
  const insuranceInfo = form.values.voluntaryInsurance[index];
359
363
  const { data: companyTypes } = useCompanyTypes({
360
364
  filters: {
361
- eaccount: userAccountId,
365
+ eaccount: userInfo.accountId,
362
366
  status: "enabled"
363
367
  }
364
368
  });
365
369
  const { data: companyClients } = useCompanyClients({
366
370
  filters: {
367
- eaccount: userAccountId,
371
+ eaccount: userInfo.accountId,
368
372
  status: "enabled"
369
373
  }
370
374
  });
371
375
  const { data: contracts } = useContracts({
372
376
  enabled: Boolean(insuranceInfo.companyId),
373
377
  filters: {
374
- eaccount: userAccountId,
378
+ eaccount: userInfo.accountId,
375
379
  cType: "particular",
376
380
  client: Number(insuranceInfo.companyId) || void 0,
377
381
  status: "enabled"
@@ -380,7 +384,7 @@ var PatientVoluntaryInsuranceForm = ({
380
384
  const { data: contractPopulations } = useContractPopulations({
381
385
  enabled: Boolean(insuranceInfo.plan),
382
386
  filters: {
383
- eaccount: userAccountId,
387
+ eaccount: userInfo.accountId,
384
388
  contract: Number(insuranceInfo.plan) || void 0,
385
389
  status: "enabled"
386
390
  }
@@ -388,7 +392,7 @@ var PatientVoluntaryInsuranceForm = ({
388
392
  const { data: incomeGroups } = useIncomeGroups({
389
393
  enabled: Boolean(insuranceInfo.companyId),
390
394
  filters: {
391
- eaccount: userAccountId,
395
+ eaccount: userInfo.accountId,
392
396
  corpclientId: Number(insuranceInfo.companyId) || void 0
393
397
  }
394
398
  });
@@ -454,11 +458,11 @@ var PatientVoluntaryInsuranceForm = ({
454
458
  companyTypeTag || ""
455
459
  );
456
460
  }
457
- form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value || "");
458
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, "");
459
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
460
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
461
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
461
+ form.setFieldValue(`voluntaryInsurance.${index}.companyType`, value);
462
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, null);
463
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
464
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
465
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
462
466
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
463
467
  },
464
468
  "data-testid": `patient-form-voluntary-insurance-company-type-select-${index}`
@@ -473,10 +477,10 @@ var PatientVoluntaryInsuranceForm = ({
473
477
  data: companyClientOptions,
474
478
  ...form.getInputProps(`voluntaryInsurance.${index}.companyId`),
475
479
  onChange: (value) => {
476
- form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value || "");
477
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, "");
478
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
479
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
480
+ form.setFieldValue(`voluntaryInsurance.${index}.companyId`, value);
481
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, null);
482
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
483
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
480
484
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
481
485
  },
482
486
  "data-testid": `patient-form-voluntary-insurance-company-select-${index}`
@@ -491,9 +495,9 @@ var PatientVoluntaryInsuranceForm = ({
491
495
  data: contractOptions,
492
496
  ...form.getInputProps(`voluntaryInsurance.${index}.plan`),
493
497
  onChange: (value) => {
494
- form.setFieldValue(`voluntaryInsurance.${index}.plan`, value || "");
495
- form.setFieldValue(`voluntaryInsurance.${index}.population`, "");
496
- form.setFieldValue(`voluntaryInsurance.${index}.groupId`, "");
498
+ form.setFieldValue(`voluntaryInsurance.${index}.plan`, value);
499
+ form.setFieldValue(`voluntaryInsurance.${index}.population`, null);
500
+ form.setFieldValue(`voluntaryInsurance.${index}.groupId`, null);
497
501
  form.setFieldValue(`voluntaryInsurance.${index}.policyNumber`, "");
498
502
  },
499
503
  "data-testid": `patient-form-voluntary-insurance-plan-select-${index}`
@@ -625,7 +629,7 @@ var PatientNotes = ({
625
629
  closeOnSave = true,
626
630
  onAttemptRemoveNote
627
631
  }) => {
628
- const { userId, userName } = useTTNSharedContext();
632
+ const { userInfo } = useTTNSharedContext();
629
633
  const [comment, setComment] = (0, import_react3.useState)("");
630
634
  const { data: notes } = useComments({
631
635
  enabled: isOpen && Boolean(patientId),
@@ -636,7 +640,7 @@ var PatientNotes = ({
636
640
  const handleAddNote = async () => {
637
641
  await createComment2({
638
642
  entity: "userClient",
639
- userId: userId ?? 0,
643
+ userId: userInfo.id ?? 0,
640
644
  comment,
641
645
  id: patientId ?? 0
642
646
  });
@@ -685,7 +689,7 @@ var PatientNotes = ({
685
689
  !notes?.length && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Text, { c: "dimmed", ta: "center", children: "No hay notas disponibles." })
686
690
  ] }),
687
691
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Box, { p: "lg", style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core2.Paper, { withBorder: true, p: "md", bg: "brand-color.0", shadow: "none", children: [
688
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Text, { c: "brand-color", children: userName }),
692
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Text, { c: "brand-color", children: userInfo.name }),
689
693
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
690
694
  import_core2.Textarea,
691
695
  {
@@ -779,13 +783,13 @@ var PatientAdministrativeRisks = ({
779
783
  isOpen,
780
784
  onClose
781
785
  }) => {
782
- const { userAccountId } = useTTNSharedContext();
786
+ const { userInfo } = useTTNSharedContext();
783
787
  const [riskValue, setRiskValue] = (0, import_react4.useState)(null);
784
788
  const [selectedRisks, setSelectedRisks] = (0, import_react4.useState)([]);
785
789
  const { data: patientInfo } = usePatientDetail({
786
790
  enabled: Boolean(patientId) && isOpen,
787
791
  filters: {
788
- eaccount: userAccountId,
792
+ eaccount: userInfo.accountId,
789
793
  id: patientId
790
794
  }
791
795
  });
@@ -798,7 +802,7 @@ var PatientAdministrativeRisks = ({
798
802
  const { mutateAsync: updateRisks2 } = useUpdateRisks();
799
803
  const handleSaveRisks = async () => {
800
804
  await updateRisks2({
801
- eaccount: userAccountId ?? 0,
805
+ eaccount: userInfo.accountId ?? 0,
802
806
  idPatient: patientId ?? 0,
803
807
  riskList: {
804
808
  administrative: selectedRisks
@@ -921,13 +925,13 @@ var PatientAssistanceRisks = ({
921
925
  isOpen,
922
926
  onClose
923
927
  }) => {
924
- const { userAccountId } = useTTNSharedContext();
928
+ const { userInfo } = useTTNSharedContext();
925
929
  const [riskValue, setRiskValue] = (0, import_react5.useState)(null);
926
930
  const [selectedRisks, setSelectedRisks] = (0, import_react5.useState)([]);
927
931
  const { data: patientInfo } = usePatientDetail({
928
932
  enabled: Boolean(patientId) && isOpen,
929
933
  filters: {
930
- eaccount: userAccountId,
934
+ eaccount: userInfo.accountId,
931
935
  id: patientId
932
936
  }
933
937
  });
@@ -951,7 +955,7 @@ var PatientAssistanceRisks = ({
951
955
  };
952
956
  const handleSaveRisks = async () => {
953
957
  await updateRisks2({
954
- eaccount: userAccountId ?? 0,
958
+ eaccount: userInfo.accountId ?? 0,
955
959
  idPatient: patientId ?? 0,
956
960
  riskList: {
957
961
  assistance: selectedRisks.map((risk) => ({ id: risk.clinicalDiseaseId }))
@@ -1182,7 +1186,7 @@ function AppPagination(props) {
1182
1186
  // src/components/PatientAppointmentHistory.tsx
1183
1187
  var import_jsx_runtime7 = require("react/jsx-runtime");
1184
1188
  var PatientAppointmentHistory = ({ patientId }) => {
1185
- const { userAccountId } = useTTNSharedContext();
1189
+ const { userInfo } = useTTNSharedContext();
1186
1190
  const [currentPage, setCurrentPage] = (0, import_react6.useState)(1);
1187
1191
  const [selectedAppointment, setSelectedAppointment] = (0, import_react6.useState)();
1188
1192
  const { data: appointments, rowTotal } = useAppointments({
@@ -1191,7 +1195,7 @@ var PatientAppointmentHistory = ({ patientId }) => {
1191
1195
  idPatient: patientId,
1192
1196
  page: currentPage,
1193
1197
  perpage: 10,
1194
- idAccount: userAccountId ?? 0
1198
+ idAccount: userInfo.accountId ?? 0
1195
1199
  }
1196
1200
  });
1197
1201
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
@@ -1438,11 +1442,16 @@ var PatientForm = ({
1438
1442
  defaultMode,
1439
1443
  patientId,
1440
1444
  policyContent,
1445
+ disabledFields,
1441
1446
  onSavePatient,
1442
1447
  onSaveError,
1443
1448
  onBack
1444
1449
  }) => {
1445
- const { userAccountId } = useTTNSharedContext();
1450
+ const { userInfo } = useTTNSharedContext();
1451
+ const disabledFieldSet = (0, import_react7.useMemo)(() => new Set(disabledFields ?? []), [disabledFields]);
1452
+ const isFieldDisabled = (field) => disabledFieldSet.has(field);
1453
+ const isMandatoryInsuranceDisabled = isFieldDisabled("mandatoryInsurance");
1454
+ const isVoluntaryInsuranceDisabled = isFieldDisabled("voluntaryInsurance");
1446
1455
  const [mode, setMode] = (0, import_react7.useState)(defaultMode);
1447
1456
  const [openPatientNotes, setOpenPatientNotes] = (0, import_react7.useState)(false);
1448
1457
  const [openPatientAssistanceRisks, setOpenPatientAssistanceRisks] = (0, import_react7.useState)(false);
@@ -1451,7 +1460,7 @@ var PatientForm = ({
1451
1460
  const form = (0, import_form.useForm)({
1452
1461
  mode: "controlled",
1453
1462
  initialValues: {
1454
- documentTypeId: "",
1463
+ documentTypeId: null,
1455
1464
  documentNumber: "",
1456
1465
  firstName: "",
1457
1466
  middleName: "",
@@ -1460,30 +1469,30 @@ var PatientForm = ({
1460
1469
  birthDate: "",
1461
1470
  age: "",
1462
1471
  whatsapp: "",
1463
- gender: "",
1464
- affiliationTypeId: "",
1465
- bloodType: "",
1472
+ gender: null,
1473
+ affiliationTypeId: null,
1474
+ bloodType: null,
1466
1475
  email: "",
1467
- provinceId: "",
1468
- cityId: "",
1476
+ provinceId: null,
1477
+ cityId: null,
1469
1478
  homeAddress: "",
1470
1479
  neighborhood: "",
1471
1480
  cellphone: "",
1472
1481
  homephone: "",
1473
1482
  emergencyContact: "",
1474
- maritalStatus: "",
1483
+ maritalStatus: null,
1475
1484
  occupation: "",
1476
1485
  use_glasses: "",
1477
1486
  use_contact_lens: "",
1478
1487
  isDataPolicyAccepted: false,
1479
- stratumId: "",
1480
- educationLevelId: "",
1481
- ethnicGroupId: "",
1488
+ stratumId: null,
1489
+ educationLevelId: null,
1490
+ ethnicGroupId: null,
1482
1491
  mandatoryInsurance: {
1483
- companyId: "",
1484
- plan: "",
1485
- population: "",
1486
- groupId: "",
1492
+ companyId: null,
1493
+ plan: null,
1494
+ population: null,
1495
+ groupId: null,
1487
1496
  policyNumber: ""
1488
1497
  },
1489
1498
  voluntaryInsurance: []
@@ -1502,16 +1511,16 @@ var PatientForm = ({
1502
1511
  const { data: patientInfo, refetch: refetchPatientInfo } = usePatientDetail({
1503
1512
  enabled: Boolean(patientId) && mode !== "create",
1504
1513
  filters: {
1505
- eaccount: userAccountId,
1514
+ eaccount: userInfo.accountId,
1506
1515
  id: patientId
1507
1516
  }
1508
1517
  });
1509
1518
  const { data: documentTypes } = useDocumentTypes({});
1510
1519
  const { data: affiliationTypes } = useAffiliationTypes({
1511
- filters: { eaccount: userAccountId }
1520
+ filters: { eaccount: userInfo.accountId }
1512
1521
  });
1513
1522
  const { data: provinces } = useProvinces({
1514
- filters: { eaccount: userAccountId }
1523
+ filters: { eaccount: userInfo.accountId }
1515
1524
  });
1516
1525
  const { data: cities } = useCities({
1517
1526
  enabled: Boolean(form.values.provinceId),
@@ -1519,32 +1528,32 @@ var PatientForm = ({
1519
1528
  });
1520
1529
  const { data: stratums } = useStratums({});
1521
1530
  const { data: ethnicGroups } = useEthnicGroups({
1522
- filters: { eaccount: userAccountId }
1531
+ filters: { eaccount: userInfo.accountId }
1523
1532
  });
1524
1533
  const { data: educationLevels } = useEducationLevels({
1525
- filters: { eaccount: userAccountId }
1534
+ filters: { eaccount: userInfo.accountId }
1526
1535
  });
1527
1536
  const { data: companyClients } = useCompanyClients({
1528
- filters: { eaccount: userAccountId }
1537
+ filters: { eaccount: userInfo.accountId }
1529
1538
  });
1530
1539
  const { data: contracts } = useContracts({
1531
1540
  enabled: Boolean(form.values.mandatoryInsurance.companyId),
1532
1541
  filters: {
1533
- eaccount: userAccountId,
1542
+ eaccount: userInfo.accountId,
1534
1543
  client: Number(form.values.mandatoryInsurance.companyId) || void 0
1535
1544
  }
1536
1545
  });
1537
1546
  const { data: contractPopulations } = useContractPopulations({
1538
1547
  enabled: Boolean(form.values.mandatoryInsurance.plan),
1539
1548
  filters: {
1540
- eaccount: userAccountId,
1549
+ eaccount: userInfo.accountId,
1541
1550
  contract: Number(form.values.mandatoryInsurance.plan) || void 0
1542
1551
  }
1543
1552
  });
1544
1553
  const { data: incomeGroups } = useIncomeGroups({
1545
1554
  enabled: Boolean(form.values.mandatoryInsurance.companyId),
1546
1555
  filters: {
1547
- eaccount: userAccountId,
1556
+ eaccount: userInfo.accountId,
1548
1557
  corpclientId: Number(form.values.mandatoryInsurance.companyId) || void 0
1549
1558
  }
1550
1559
  });
@@ -1582,10 +1591,6 @@ var PatientForm = ({
1582
1591
  value: values.affiliationTypeId,
1583
1592
  message: "El campo Tipo de afiliado es obligatorio."
1584
1593
  },
1585
- {
1586
- value: values.maritalStatus,
1587
- message: "El campo Estado civil es obligatorio."
1588
- },
1589
1594
  {
1590
1595
  value: values.provinceId,
1591
1596
  message: "El campo Departamento es obligatorio."
@@ -1683,16 +1688,17 @@ var PatientForm = ({
1683
1688
  onBack?.();
1684
1689
  };
1685
1690
  const handleAddVoluntaryInsurance = () => {
1686
- form.insertListItem("voluntaryInsurance", {
1691
+ const newInsurance = {
1687
1692
  companyTypeTag: "",
1688
1693
  id: Date.now().toString(),
1689
1694
  companyType: "",
1690
- companyId: "",
1691
- plan: "",
1692
- population: "",
1693
- groupId: "",
1695
+ companyId: null,
1696
+ plan: null,
1697
+ population: null,
1698
+ groupId: null,
1694
1699
  policyNumber: ""
1695
- });
1700
+ };
1701
+ form.insertListItem("voluntaryInsurance", newInsurance);
1696
1702
  };
1697
1703
  (0, import_react7.useEffect)(() => {
1698
1704
  if (!patientInfo || mode === "create") return;
@@ -1825,7 +1831,7 @@ var PatientForm = ({
1825
1831
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1826
1832
  import_core8.Select,
1827
1833
  {
1828
- readOnly: mode === "view",
1834
+ readOnly: mode === "view" || isFieldDisabled("documentTypeId"),
1829
1835
  withAsterisk: mode !== "view",
1830
1836
  label: "Tipo de Documento",
1831
1837
  data: documentTypeOptions,
@@ -1836,7 +1842,7 @@ var PatientForm = ({
1836
1842
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1837
1843
  import_core8.TextInput,
1838
1844
  {
1839
- readOnly: mode === "view",
1845
+ readOnly: mode === "view" || isFieldDisabled("documentNumber"),
1840
1846
  withAsterisk: mode !== "view",
1841
1847
  label: "N\xFAmero de Documento",
1842
1848
  ...form.getInputProps("documentNumber"),
@@ -1846,7 +1852,7 @@ var PatientForm = ({
1846
1852
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1847
1853
  import_core8.TextInput,
1848
1854
  {
1849
- readOnly: mode === "view",
1855
+ readOnly: mode === "view" || isFieldDisabled("firstName"),
1850
1856
  withAsterisk: mode !== "view",
1851
1857
  label: "Primer Nombre",
1852
1858
  ...form.getInputProps("firstName"),
@@ -1856,7 +1862,7 @@ var PatientForm = ({
1856
1862
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1857
1863
  import_core8.TextInput,
1858
1864
  {
1859
- readOnly: mode === "view",
1865
+ readOnly: mode === "view" || isFieldDisabled("middleName"),
1860
1866
  label: "Segundo Nombre",
1861
1867
  ...form.getInputProps("middleName"),
1862
1868
  "data-testid": "patient-form-middle-name-input"
@@ -1865,7 +1871,7 @@ var PatientForm = ({
1865
1871
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1866
1872
  import_core8.TextInput,
1867
1873
  {
1868
- readOnly: mode === "view",
1874
+ readOnly: mode === "view" || isFieldDisabled("surname"),
1869
1875
  withAsterisk: mode !== "view",
1870
1876
  label: "Primer Apellido",
1871
1877
  ...form.getInputProps("surname"),
@@ -1875,7 +1881,7 @@ var PatientForm = ({
1875
1881
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1876
1882
  import_core8.TextInput,
1877
1883
  {
1878
- readOnly: mode === "view",
1884
+ readOnly: mode === "view" || isFieldDisabled("secondSurname"),
1879
1885
  label: "Segundo Apellido",
1880
1886
  ...form.getInputProps("secondSurname"),
1881
1887
  "data-testid": "patient-form-second-surname-input"
@@ -1884,7 +1890,7 @@ var PatientForm = ({
1884
1890
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1885
1891
  import_core8.TextInput,
1886
1892
  {
1887
- readOnly: mode === "view",
1893
+ readOnly: mode === "view" || isFieldDisabled("birthDate"),
1888
1894
  withAsterisk: mode !== "view",
1889
1895
  label: "Fecha de Nacimiento",
1890
1896
  type: "date",
@@ -1895,7 +1901,8 @@ var PatientForm = ({
1895
1901
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1896
1902
  import_core8.NumberInput,
1897
1903
  {
1898
- readOnly: true,
1904
+ readOnly: isFieldDisabled("age"),
1905
+ disabled: true,
1899
1906
  label: "Edad",
1900
1907
  suffix: !form.values.age ? "" : " a\xF1os",
1901
1908
  ...form.getInputProps("age"),
@@ -1905,7 +1912,7 @@ var PatientForm = ({
1905
1912
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1906
1913
  import_core8.NumberInput,
1907
1914
  {
1908
- readOnly: mode === "view",
1915
+ readOnly: mode === "view" || isFieldDisabled("whatsapp"),
1909
1916
  withAsterisk: mode !== "view",
1910
1917
  label: "WhatsApp",
1911
1918
  allowNegative: false,
@@ -1917,7 +1924,7 @@ var PatientForm = ({
1917
1924
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1918
1925
  import_core8.Select,
1919
1926
  {
1920
- readOnly: mode === "view",
1927
+ readOnly: mode === "view" || isFieldDisabled("gender"),
1921
1928
  withAsterisk: mode !== "view",
1922
1929
  label: "G\xE9nero",
1923
1930
  data: genderOptions,
@@ -1928,7 +1935,7 @@ var PatientForm = ({
1928
1935
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1929
1936
  import_core8.Select,
1930
1937
  {
1931
- readOnly: mode === "view",
1938
+ readOnly: mode === "view" || isFieldDisabled("affiliationTypeId"),
1932
1939
  withAsterisk: mode !== "view",
1933
1940
  label: "Tipo de afiliaci\xF3n",
1934
1941
  data: affiliationTypeOptions,
@@ -1939,7 +1946,7 @@ var PatientForm = ({
1939
1946
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1940
1947
  import_core8.TextInput,
1941
1948
  {
1942
- readOnly: mode === "view",
1949
+ readOnly: mode === "view" || isFieldDisabled("email"),
1943
1950
  label: "Correo electr\xF3nico",
1944
1951
  ...form.getInputProps("email"),
1945
1952
  "data-testid": "patient-form-email-input"
@@ -1948,8 +1955,7 @@ var PatientForm = ({
1948
1955
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1949
1956
  import_core8.Select,
1950
1957
  {
1951
- readOnly: mode === "view",
1952
- withAsterisk: mode !== "view",
1958
+ readOnly: mode === "view" || isFieldDisabled("maritalStatus"),
1953
1959
  label: "Estado civil",
1954
1960
  data: maritalStatusOptions,
1955
1961
  ...form.getInputProps("maritalStatus"),
@@ -1959,7 +1965,7 @@ var PatientForm = ({
1959
1965
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 12, mt: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1960
1966
  import_core8.Checkbox,
1961
1967
  {
1962
- disabled: mode === "view",
1968
+ readOnly: mode === "view" || isFieldDisabled("isDataPolicyAccepted"),
1963
1969
  label: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core8.Text, { fz: "sm", children: [
1964
1970
  "Autorizo el tratamiento de mis datos personales conforme a la",
1965
1971
  " ",
@@ -1988,14 +1994,14 @@ var PatientForm = ({
1988
1994
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1989
1995
  import_core8.Select,
1990
1996
  {
1991
- readOnly: mode === "view",
1997
+ readOnly: mode === "view" || isFieldDisabled("provinceId"),
1992
1998
  withAsterisk: mode !== "view",
1993
1999
  label: "Departamento",
1994
2000
  data: provinceOptions,
1995
2001
  ...form.getInputProps("provinceId"),
1996
2002
  onChange: (value) => {
1997
- form.setFieldValue("provinceId", value || "");
1998
- form.setFieldValue("cityId", "");
2003
+ form.setFieldValue("provinceId", value);
2004
+ form.setFieldValue("cityId", null);
1999
2005
  },
2000
2006
  "data-testid": "patient-form-province-select"
2001
2007
  }
@@ -2003,7 +2009,7 @@ var PatientForm = ({
2003
2009
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2004
2010
  import_core8.Select,
2005
2011
  {
2006
- readOnly: mode === "view",
2012
+ readOnly: mode === "view" || isFieldDisabled("cityId"),
2007
2013
  withAsterisk: mode !== "view",
2008
2014
  label: "Municipio",
2009
2015
  data: cityOptions,
@@ -2014,7 +2020,7 @@ var PatientForm = ({
2014
2020
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2015
2021
  import_core8.TextInput,
2016
2022
  {
2017
- readOnly: mode === "view",
2023
+ readOnly: mode === "view" || isFieldDisabled("homeAddress"),
2018
2024
  label: "Direcci\xF3n",
2019
2025
  ...form.getInputProps("homeAddress"),
2020
2026
  "data-testid": "patient-form-home-address-input"
@@ -2023,7 +2029,7 @@ var PatientForm = ({
2023
2029
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2024
2030
  import_core8.Select,
2025
2031
  {
2026
- readOnly: mode === "view",
2032
+ readOnly: mode === "view" || isFieldDisabled("bloodType"),
2027
2033
  label: "Grupo sangu\xEDneo",
2028
2034
  data: bloodTypeOptions,
2029
2035
  ...form.getInputProps("bloodType"),
@@ -2033,7 +2039,7 @@ var PatientForm = ({
2033
2039
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2034
2040
  import_core8.NumberInput,
2035
2041
  {
2036
- readOnly: mode === "view",
2042
+ readOnly: mode === "view" || isFieldDisabled("cellphone"),
2037
2043
  withAsterisk: mode !== "view",
2038
2044
  label: "Celular",
2039
2045
  allowNegative: false,
@@ -2046,7 +2052,7 @@ var PatientForm = ({
2046
2052
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2047
2053
  import_core8.NumberInput,
2048
2054
  {
2049
- readOnly: mode === "view",
2055
+ readOnly: mode === "view" || isFieldDisabled("homephone"),
2050
2056
  label: "Tel\xE9fono fijo",
2051
2057
  allowNegative: false,
2052
2058
  allowDecimal: false,
@@ -2058,7 +2064,7 @@ var PatientForm = ({
2058
2064
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2059
2065
  import_core8.Select,
2060
2066
  {
2061
- readOnly: mode === "view",
2067
+ readOnly: mode === "view" || isFieldDisabled("stratumId"),
2062
2068
  withAsterisk: mode !== "view",
2063
2069
  label: "Estrato",
2064
2070
  data: stratumOptions,
@@ -2069,7 +2075,7 @@ var PatientForm = ({
2069
2075
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2070
2076
  import_core8.Select,
2071
2077
  {
2072
- readOnly: mode === "view",
2078
+ readOnly: mode === "view" || isFieldDisabled("ethnicGroupId"),
2073
2079
  withAsterisk: mode !== "view",
2074
2080
  label: "Pertenencia \xE9tnica",
2075
2081
  data: ethnicGroupOptions,
@@ -2080,7 +2086,7 @@ var PatientForm = ({
2080
2086
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2081
2087
  import_core8.Select,
2082
2088
  {
2083
- readOnly: mode === "view",
2089
+ readOnly: mode === "view" || isFieldDisabled("educationLevelId"),
2084
2090
  withAsterisk: mode !== "view",
2085
2091
  label: "Nivel educativo",
2086
2092
  data: educationLevelOptions,
@@ -2095,15 +2101,16 @@ var PatientForm = ({
2095
2101
  import_core8.Select,
2096
2102
  {
2097
2103
  readOnly: mode === "view",
2104
+ disabled: isMandatoryInsuranceDisabled,
2098
2105
  withAsterisk: mode !== "view",
2099
2106
  label: "Seguro",
2100
2107
  data: companyClientOptions,
2101
2108
  ...form.getInputProps("mandatoryInsurance.companyId"),
2102
2109
  onChange: (value) => {
2103
- form.setFieldValue("mandatoryInsurance.companyId", value || "");
2104
- form.setFieldValue("mandatoryInsurance.plan", "");
2105
- form.setFieldValue("mandatoryInsurance.population", "");
2106
- form.setFieldValue("mandatoryInsurance.groupId", "");
2110
+ form.setFieldValue("mandatoryInsurance.companyId", value);
2111
+ form.setFieldValue("mandatoryInsurance.plan", null);
2112
+ form.setFieldValue("mandatoryInsurance.population", null);
2113
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2107
2114
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2108
2115
  },
2109
2116
  "data-testid": "patient-form-mandatory-insurance-company-select"
@@ -2113,14 +2120,15 @@ var PatientForm = ({
2113
2120
  import_core8.Select,
2114
2121
  {
2115
2122
  readOnly: mode === "view",
2123
+ disabled: isMandatoryInsuranceDisabled,
2116
2124
  withAsterisk: mode !== "view",
2117
2125
  label: "Plan",
2118
2126
  data: contractOptions,
2119
2127
  ...form.getInputProps("mandatoryInsurance.plan"),
2120
2128
  onChange: (value) => {
2121
- form.setFieldValue("mandatoryInsurance.plan", value || "");
2122
- form.setFieldValue("mandatoryInsurance.population", "");
2123
- form.setFieldValue("mandatoryInsurance.groupId", "");
2129
+ form.setFieldValue("mandatoryInsurance.plan", value);
2130
+ form.setFieldValue("mandatoryInsurance.population", null);
2131
+ form.setFieldValue("mandatoryInsurance.groupId", null);
2124
2132
  form.setFieldValue("mandatoryInsurance.policyNumber", "");
2125
2133
  },
2126
2134
  "data-testid": "patient-form-mandatory-insurance-plan-select"
@@ -2130,6 +2138,7 @@ var PatientForm = ({
2130
2138
  import_core8.Select,
2131
2139
  {
2132
2140
  readOnly: mode === "view",
2141
+ disabled: isMandatoryInsuranceDisabled,
2133
2142
  withAsterisk: mode !== "view",
2134
2143
  label: "Poblaci\xF3n",
2135
2144
  data: contractPopulationOptions,
@@ -2141,6 +2150,7 @@ var PatientForm = ({
2141
2150
  import_core8.Select,
2142
2151
  {
2143
2152
  readOnly: mode === "view",
2153
+ disabled: isMandatoryInsuranceDisabled,
2144
2154
  withAsterisk: mode !== "view",
2145
2155
  label: "Grupo de ingreso",
2146
2156
  data: incomeGroupOptions,
@@ -2151,7 +2161,8 @@ var PatientForm = ({
2151
2161
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core8.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2152
2162
  import_core8.TextInput,
2153
2163
  {
2154
- readOnly: mode === "view",
2164
+ readOnly: mode === "view" || isMandatoryInsuranceDisabled,
2165
+ disabled: isMandatoryInsuranceDisabled,
2155
2166
  label: "N\xFAmero de p\xF3liza",
2156
2167
  ...form.getInputProps("mandatoryInsurance.policyNumber"),
2157
2168
  "data-testid": "patient-form-mandatory-insurance-policy-number-input"
@@ -2164,7 +2175,7 @@ var PatientForm = ({
2164
2175
  PatientVoluntaryInsuranceForm,
2165
2176
  {
2166
2177
  index,
2167
- mode,
2178
+ mode: isVoluntaryInsuranceDisabled ? "view" : mode,
2168
2179
  form
2169
2180
  },
2170
2181
  insurance.id ?? index
@@ -2175,6 +2186,7 @@ var PatientForm = ({
2175
2186
  variant: "outline",
2176
2187
  color: "secondary",
2177
2188
  size: "xs",
2189
+ disabled: isVoluntaryInsuranceDisabled,
2178
2190
  onClick: handleAddVoluntaryInsurance,
2179
2191
  leftSection: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons_react6.IconPlus, { style: { width: 16, height: 16 } }),
2180
2192
  "data-testid": "patient-form-add-voluntary-insurance-button",
@@ -2258,14 +2270,14 @@ var createPatientPayload = (values) => {
2258
2270
  birthDate: values.birthDate,
2259
2271
  age: values.age,
2260
2272
  whatsapp: String(values.whatsapp),
2261
- gender: values.gender,
2273
+ gender: values.gender ?? "",
2262
2274
  affiliationType: Number(values.affiliationTypeId),
2263
2275
  email: values.email,
2264
- maritalStatus: values.maritalStatus,
2276
+ maritalStatus: values.maritalStatus ?? "",
2265
2277
  provinceId: Number(values.provinceId),
2266
2278
  cityId: Number(values.cityId),
2267
2279
  homeAddress: values.homeAddress,
2268
- bloodType: values.bloodType,
2280
+ bloodType: values.bloodType ?? "",
2269
2281
  cellphone: String(values.cellphone),
2270
2282
  homephone: String(values.homephone),
2271
2283
  emergencyContact: values.emergencyContact,
@@ -2331,13 +2343,355 @@ var createPatientForm = (info) => {
2331
2343
  }))
2332
2344
  };
2333
2345
  };
2346
+
2347
+ // src/components/header/Header.tsx
2348
+ var MC3 = __toESM(require("@mantine/core"), 1);
2349
+ var TI4 = __toESM(require("@tabler/icons-react"), 1);
2350
+ var import_react8 = require("react");
2351
+
2352
+ // src/components/header/HelpModal.tsx
2353
+ var MC = __toESM(require("@mantine/core"), 1);
2354
+ var TI2 = __toESM(require("@tabler/icons-react"), 1);
2355
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2356
+ var HelpModal = ({ opened, onClose, enterpriseLogo }) => {
2357
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Modal, { title: "Ayuda", opened, onClose, "data-testid": "header-help-modal", children: [
2358
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Stack, { mb: "lg", align: "center", children: [
2359
+ enterpriseLogo,
2360
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.Text, { fz: "lg", fw: "bold", children: "Informaci\xF3n de contacto" }),
2361
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Stack, { children: [
2362
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Group, { children: [
2363
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TI2.IconPhone, { style: { width: 24, height: 24 } }) }),
2364
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.Text, { fz: "xs", children: "+57 300 658 32 65" })
2365
+ ] }),
2366
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Group, { children: [
2367
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TI2.IconMail, { style: { width: 24, height: 24 } }) }),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.Text, { fz: "xs", children: "analistadesoporte@ttncompany.com" })
2369
+ ] }),
2370
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(MC.Group, { children: [
2371
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.ThemeIcon, { variant: "transparent", c: "primary-color", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TI2.IconMapPin, { style: { width: 24, height: 24 } }) }),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.Text, { fz: "xs", children: "Carrera 51b # 87 - 50 Piso 3 Local 337" })
2373
+ ] })
2374
+ ] })
2375
+ ] }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MC.Group, { justify: "end", mt: "xl", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2377
+ MC.Button,
2378
+ {
2379
+ onClick: onClose,
2380
+ size: "sm",
2381
+ px: "xl",
2382
+ color: "brand-color",
2383
+ "data-testid": "header-help-accept-button",
2384
+ children: "Aceptar"
2385
+ }
2386
+ ) })
2387
+ ] });
2388
+ };
2389
+
2390
+ // src/components/header/ChangeAccountModal.tsx
2391
+ var MC2 = __toESM(require("@mantine/core"), 1);
2392
+ var TI3 = __toESM(require("@tabler/icons-react"), 1);
2393
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2394
+ var ChangeAccountModal = ({
2395
+ opened,
2396
+ onClose,
2397
+ accounts,
2398
+ onChangeAccount
2399
+ }) => {
2400
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Modal, { opened, onClose, size: 1200, title: "Cambiar cuenta", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Grid, { px: "lg", children: accounts.map((account, accountIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Grid.Col, { span: 6, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(MC2.Menu, { position: "right", width: 210, children: [
2401
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Menu.Target, { "data-testid": `change-account-account-option-${accountIndex}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2402
+ MC2.Group,
2403
+ {
2404
+ w: 216,
2405
+ h: 100,
2406
+ justify: "space-between",
2407
+ align: "center",
2408
+ style: (theme) => ({
2409
+ border: `1px solid ${theme.colors.gray[3]}`,
2410
+ borderRadius: theme.radius.md,
2411
+ padding: "8px",
2412
+ cursor: "pointer"
2413
+ }),
2414
+ children: [
2415
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {}),
2416
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Text, { fw: "bold", tt: "uppercase", children: account.name }),
2417
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.ThemeIcon, { variant: "transparent", c: "dimmed", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TI3.IconChevronRight, { style: { width: 32, height: 32 } }) })
2418
+ ]
2419
+ }
2420
+ ) }),
2421
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MC2.Menu.Dropdown, { p: 0, children: account.profiles.map((profile, profileIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2422
+ MC2.Menu.Item,
2423
+ {
2424
+ ta: "center",
2425
+ tt: "uppercase",
2426
+ py: "xs",
2427
+ onClick: () => {
2428
+ onChangeAccount(account, profile);
2429
+ onClose();
2430
+ },
2431
+ style: (theme) => ({
2432
+ borderRadius: 0,
2433
+ borderBottom: profileIndex !== account.profiles.length - 1 ? `1px solid ${theme.colors.gray[3]}` : void 0
2434
+ }),
2435
+ "data-testid": `change-account-profile-option-${accountIndex}-${profileIndex}`,
2436
+ children: profile.name
2437
+ },
2438
+ profile.id
2439
+ )) })
2440
+ ] }) }, account.id)) }) });
2441
+ };
2442
+
2443
+ // src/components/header/Header.tsx
2444
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2445
+ var Header = ({
2446
+ moduleName,
2447
+ logo,
2448
+ enterpriseLogo,
2449
+ accounts,
2450
+ currentSite,
2451
+ onBackHome,
2452
+ onChangeAccount,
2453
+ onClickMyPayroll,
2454
+ onClickSettings,
2455
+ onLogout
2456
+ }) => {
2457
+ const { userInfo } = useTTNSharedContext();
2458
+ const [changeAccountModalOpened, setChangeAccountModalOpened] = (0, import_react8.useState)(false);
2459
+ const [helpModalOpened, setHelpModalOpened] = (0, import_react8.useState)(false);
2460
+ const { currentAccount, currentProfile } = (0, import_react8.useMemo)(() => {
2461
+ if (!userInfo.accountId || !userInfo.profileId) {
2462
+ return { currentAccount: void 0, currentProfile: void 0 };
2463
+ }
2464
+ const currentAccount2 = accounts.find((account) => account.id === userInfo.accountId);
2465
+ const currentProfile2 = currentAccount2?.profiles.find(
2466
+ (profile) => profile.id === userInfo.profileId
2467
+ );
2468
+ return { currentAccount: currentAccount2, currentProfile: currentProfile2 };
2469
+ }, [accounts, userInfo]);
2470
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2471
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Flex, { w: "100%", px: 16, py: 6, justify: "space-between", align: "center", children: [
2472
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Group, { children: [
2473
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.UnstyledButton, { onClick: onBackHome, "data-testid": "header-logo-button", children: logo }),
2474
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Title, { order: 3, c: "gray.4", fw: "inherit", children: [
2475
+ "\u2022 ",
2476
+ moduleName
2477
+ ] })
2478
+ ] }),
2479
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Flex, { gap: "sm", children: [
2480
+ Boolean(currentSite) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Flex, { align: "center", children: [
2481
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.ThemeIcon, { variant: "transparent", c: "dimmed", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TI4.IconMapPinFilled, { style: { width: 24, height: 24 } }) }),
2482
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Text, { c: "gray.6", fz: "sm", children: currentSite?.name })
2483
+ ] }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Menu, { width: 216, position: "bottom-end", children: [
2485
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Menu.Target, { "data-testid": "header-account-menu-button", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2486
+ MC3.Box,
2487
+ {
2488
+ w: 216,
2489
+ style: (theme) => ({
2490
+ display: "flex",
2491
+ alignItems: "center",
2492
+ border: `1px solid ${theme.colors.gray[3]}`,
2493
+ borderRadius: theme.radius.sm,
2494
+ padding: "4px 8px",
2495
+ cursor: "pointer"
2496
+ }),
2497
+ children: [
2498
+ Boolean(currentAccount) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.ThemeIcon, { variant: "transparent", c: "primary-color", size: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TI4.IconBuilding, { style: { width: 24, height: 24 } }) }),
2499
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Text, { ml: 6, flex: 1, children: currentAccount?.name }),
2500
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Avatar, { src: userInfo?.imageUrl })
2501
+ ]
2502
+ }
2503
+ ) }),
2504
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Menu.Dropdown, { children: [
2505
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Stack, { px: "md", py: "sm", gap: "xs", align: "center", children: [
2506
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Avatar, { src: userInfo?.imageUrl, size: "lg" }),
2507
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Text, { fw: "bold", children: userInfo?.name }),
2508
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(MC3.Text, { fw: "bold", ta: "center", c: "gray.4", children: [
2509
+ currentAccount?.name,
2510
+ " - ",
2511
+ currentProfile?.name
2512
+ ] })
2513
+ ] }),
2514
+ Boolean(currentAccount) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2515
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2516
+ MC3.Menu.Item,
2517
+ {
2518
+ onClick: () => setChangeAccountModalOpened(true),
2519
+ "data-testid": "header-change-account-menu-item",
2520
+ children: "Cambiar rol y cuenta"
2521
+ }
2522
+ ),
2523
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2524
+ MC3.Menu.Item,
2525
+ {
2526
+ onClick: onClickMyPayroll,
2527
+ "data-testid": "header-my-payroll-menu-item",
2528
+ children: "Mi n\xF3mina"
2529
+ }
2530
+ ),
2531
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Menu.Item, { onClick: onClickSettings, "data-testid": "header-settings-menu-item", children: "Configuraci\xF3n" })
2532
+ ] }),
2533
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2534
+ MC3.Menu.Item,
2535
+ {
2536
+ onClick: () => setHelpModalOpened(true),
2537
+ "data-testid": "header-help-menu-item",
2538
+ children: "Ayuda"
2539
+ }
2540
+ ),
2541
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Menu.Divider, {}),
2542
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MC3.Menu.Item, { onClick: onLogout, "data-testid": "header-logout-menu-item", children: "Cerrar sesi\xF3n" })
2543
+ ] })
2544
+ ] })
2545
+ ] })
2546
+ ] }),
2547
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2548
+ ChangeAccountModal,
2549
+ {
2550
+ opened: changeAccountModalOpened,
2551
+ onClose: () => setChangeAccountModalOpened(false),
2552
+ accounts,
2553
+ onChangeAccount
2554
+ }
2555
+ ),
2556
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2557
+ HelpModal,
2558
+ {
2559
+ opened: helpModalOpened,
2560
+ onClose: () => setHelpModalOpened(false),
2561
+ enterpriseLogo
2562
+ }
2563
+ )
2564
+ ] });
2565
+ };
2566
+
2567
+ // src/components/sidebar/Sidebar.tsx
2568
+ var import_react9 = require("react");
2569
+ var MC5 = __toESM(require("@mantine/core"), 1);
2570
+ var TI5 = __toESM(require("@tabler/icons-react"), 1);
2571
+
2572
+ // src/components/sidebar/SidebarMenu.tsx
2573
+ var MC4 = __toESM(require("@mantine/core"), 1);
2574
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2575
+ var import_react_router = require("react-router");
2576
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2577
+ var SidebarMenu = ({
2578
+ id,
2579
+ label,
2580
+ icon,
2581
+ active,
2582
+ screens,
2583
+ onClickMenu,
2584
+ onCloseSidebar,
2585
+ onClickExternalScreen
2586
+ }) => {
2587
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2588
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2589
+ MC4.UnstyledButton,
2590
+ {
2591
+ onClick: () => onClickMenu(id),
2592
+ className: "ttn-sidebar-menu",
2593
+ "data-testid": `sidebar-menu-${label}`,
2594
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MC4.Flex, { align: "center", children: [
2595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Center, { w: 40, h: 40, me: 10, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2596
+ MC4.Box,
2597
+ {
2598
+ className: "ttn-sidebar-menu-icon",
2599
+ style: { maskImage: `url(${icon})`, WebkitMaskImage: `url(${icon})` }
2600
+ }
2601
+ ) }),
2602
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: label })
2603
+ ] })
2604
+ }
2605
+ ),
2606
+ Boolean(screens?.length) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Collapse, { in: active ?? false, children: screens?.map((screen) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime13.Fragment, { children: [
2607
+ screen.external && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Box, { onClick: () => onClickExternalScreen(screen), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: screen.label }) }),
2608
+ !screen.external && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2609
+ import_react_router.NavLink,
2610
+ {
2611
+ to: screen.url || "#",
2612
+ onClick: onCloseSidebar,
2613
+ className: ({ isActive }) => isActive ? "ttn-sidebar-menu-item active" : "ttn-sidebar-menu-item",
2614
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MC4.Text, { size: "sm", c: "gray.7", lineClamp: 1, children: screen.label })
2615
+ }
2616
+ )
2617
+ ] }, screen.id)) })
2618
+ ] });
2619
+ };
2620
+
2621
+ // src/components/sidebar/Sidebar.tsx
2622
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2623
+ var Sidebar = ({ modules, onClickExternalScreen }) => {
2624
+ const [opened, setOpened] = (0, import_react9.useState)(false);
2625
+ const [activeModuleId, setActiveModuleId] = (0, import_react9.useState)(null);
2626
+ const handleClickMenu = (id) => {
2627
+ setActiveModuleId(id === activeModuleId ? null : id);
2628
+ if (!opened) {
2629
+ setOpened(true);
2630
+ }
2631
+ };
2632
+ const handleCloseSidebar = () => {
2633
+ setActiveModuleId(null);
2634
+ setOpened(false);
2635
+ };
2636
+ const handleClickExternalScreen = (item) => {
2637
+ setActiveModuleId(null);
2638
+ setOpened(false);
2639
+ onClickExternalScreen(item);
2640
+ };
2641
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("aside", { className: opened ? "ttn-sidebar" : "ttn-sidebar closed", children: [
2642
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(MC5.Flex, { direction: "column", justify: "center", h: 56, children: [
2643
+ opened && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2644
+ MC5.ActionIcon,
2645
+ {
2646
+ variant: "white",
2647
+ c: "gray.6",
2648
+ onClick: handleCloseSidebar,
2649
+ style: { alignSelf: "flex-end" },
2650
+ "data-testid": "sidebar-close-button",
2651
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TI5.IconX, { style: { width: 20, height: 20 } })
2652
+ }
2653
+ ),
2654
+ !opened && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MC5.Center, { w: 80, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2655
+ MC5.ActionIcon,
2656
+ {
2657
+ w: 32,
2658
+ h: 32,
2659
+ variant: "outline",
2660
+ radius: "xs",
2661
+ onClick: () => setOpened(true),
2662
+ style: { alignSelf: "flex-end", borderWidth: 2 },
2663
+ "data-testid": "sidebar-open-button",
2664
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TI5.IconMenu2, { style: { width: 20, height: 20, strokeWidth: 2 } })
2665
+ }
2666
+ ) })
2667
+ ] }),
2668
+ modules.map((module2) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2669
+ SidebarMenu,
2670
+ {
2671
+ id: module2.id,
2672
+ label: module2.label,
2673
+ icon: module2.icon,
2674
+ active: activeModuleId === module2.id,
2675
+ screens: module2.screens,
2676
+ onClickMenu: handleClickMenu,
2677
+ onCloseSidebar: handleCloseSidebar,
2678
+ onClickExternalScreen: handleClickExternalScreen
2679
+ },
2680
+ module2.id
2681
+ ))
2682
+ ] });
2683
+ };
2334
2684
  // Annotate the CommonJS export names for ESM import in node:
2335
2685
  0 && (module.exports = {
2686
+ ChangeAccountModal,
2687
+ Header,
2688
+ HelpModal,
2336
2689
  PatientAdministrativeRisks,
2337
2690
  PatientAppointmentHistory,
2338
2691
  PatientAssistanceRisks,
2339
2692
  PatientForm,
2340
2693
  PatientNotes,
2694
+ Sidebar,
2341
2695
  TTNSharedProvider,
2342
2696
  useTTNSharedContext
2343
2697
  });