diff --git a/package-lock.json b/package-lock.json index 068a8fa..26a38b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,9 @@ "@testing-library/jest-dom": "^6.8.0", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^13.5.0", + "@tiptap/extension-placeholder": "^3.7.1", + "@tiptap/react": "^3.7.1", + "@tiptap/starter-kit": "^3.7.1", "apexcharts": "^5.3.4", "bootstrap": "^5.3.8", "bootstrap-icons": "^1.13.1", @@ -16184,6 +16187,31 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@floating-ui/core": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz", + "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", + "optional": true, + "dependencies": { + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "optional": true, + "dependencies": { + "@floating-ui/core": "^1.7.3", + "@floating-ui/utils": "^0.2.10" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz", + "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==", + "optional": true + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -17174,6 +17202,11 @@ "url": "https://opencollective.com/immer" } }, + "node_modules/@remirror/core-constants": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@remirror/core-constants/-/core-constants-3.0.0.tgz", + "integrity": "sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==" + }, "node_modules/@restart/hooks": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.16.tgz", @@ -17747,6 +17780,424 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@tiptap/core": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.7.1.tgz", + "integrity": "sha512-jB6R8EGI34QUmV7EhtE+JVpjbZ6Wa0dcf0LNS36X9V7FtDQcnxl7ekRs/ftELt/6qOjubRdyhaID0wNdJVmFtw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-blockquote": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-blockquote/-/extension-blockquote-3.7.1.tgz", + "integrity": "sha512-UPIne4kD8hwhadPtapn0WfJCNiF+b3ftNYiC1BpNfti5NmM0sXuqOOC0WnVgGgsNuJp4hd+4PMp42InlD6/1aw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-bold": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bold/-/extension-bold-3.7.1.tgz", + "integrity": "sha512-XZRt1blYGpqVlcBo+PKH1mlbsqdc5KsWi/ZsPBV3Ajg/Vx5d6SAY4wK6CW1SpotE1wWucUhfAmXddhBFvYzaUA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-bubble-menu": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-3.7.1.tgz", + "integrity": "sha512-7qLK49GC7pW6FbAE6vOGphcyjq7CqiBEwr9i9/5UgnadjLtREDzBl28D+95+8TkyF7sM3hP6s6RU+nh87v5fqw==", + "optional": true, + "dependencies": { + "@floating-ui/dom": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-bullet-list": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bullet-list/-/extension-bullet-list-3.7.1.tgz", + "integrity": "sha512-AO7EVAftvzSw7Sftp36P+HNedxjygMpobYNTBQzHfGljRZh8VDhIUzwyP1OsmlrcCbBxsrjMZLrmk/ozsALq0g==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-code": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-code/-/extension-code-3.7.1.tgz", + "integrity": "sha512-ZRarYvgQ16ZrzKox/iW3bVr5IVNBsD0yjU5S7GVmlRgRQ8lhsTloLk9Gu05uuZ6dOoL3qApLA8+W7w8sxZJ35w==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-code-block": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-code-block/-/extension-code-block-3.7.1.tgz", + "integrity": "sha512-/Ov81QXEn6AOiiSUFlM57a+YSye/Lkhvgy303+CEGtDuFVU/SJ0tDsgmSYzkP5q6DIVQLAXp5WkxEo02GnYHgQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-document": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-document/-/extension-document-3.7.1.tgz", + "integrity": "sha512-b7NHWseJSvhhbsiSWjQgiJcs6FUJiEJocfhazDiWAOk5ELQ6+oiIe7ecEgDqBmafk9oziV9r7u9OAgyeyP3JBA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-dropcursor": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-dropcursor/-/extension-dropcursor-3.7.1.tgz", + "integrity": "sha512-wZT3bPeNJAasOvNr6tUZAwXFeKlQEToSnVAjFiBzJwLDonuK8ZaAiBCDQgqEQSlP3HsEE4/qkERBNrdyAT26CQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extensions": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-floating-menu": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-3.7.1.tgz", + "integrity": "sha512-epfA87IIBy5IREMjmlRskp8T/9/avjfM8RtcqDnKQxVVXn8yl5i0Pca0jXD4w7rIAS7G95N9sYRxsou6Y6fTQg==", + "optional": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@floating-ui/dom": "^1.0.0", + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-gapcursor": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-gapcursor/-/extension-gapcursor-3.7.1.tgz", + "integrity": "sha512-1UrZEaqruWPLdgYsAm4au7BAyTDjaNRP0E7UIoEoGsq+MAS2MM3g4suXMzu+l3ZIayrSy98N3T8DIUG+U6+mww==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extensions": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-hard-break": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-hard-break/-/extension-hard-break-3.7.1.tgz", + "integrity": "sha512-pEvRjWexMNxXH5FOy3EhzyMFDFHrRTWOgZbWAxliKDg2dFEJ50e9KcCMDs87e7++V753lEKnFTmz/9WaH7cwcQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-heading": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-heading/-/extension-heading-3.7.1.tgz", + "integrity": "sha512-rOUou6b0+5E+DAmEMTC/mlKTLiOr4D0LKzBfqBLQ3zUyZPZabOKzN0L+4MaLNR2CkXy/Ae4du5ucHGrGOWzVrQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-horizontal-rule": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-3.7.1.tgz", + "integrity": "sha512-f4lXW/LHuJBF11PIrWdNAzTmlapV4fVujJ5eCsLAkpzhx3izVrDW/WlKRrkGUCy/qQT4v7BbHNa5JYlKDzDo0Q==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-italic": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-3.7.1.tgz", + "integrity": "sha512-Bm6eOtcafc5kjE357GlvIY2hNTRRAkb8D5SRm8zYlVB0fiLto+r15Ht+DTOmLiQKEGtEArQ/C8Rh2j09UdH2vA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-link": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-link/-/extension-link-3.7.1.tgz", + "integrity": "sha512-6+0/mo+EKDiA1d1pDZSsf/51ZOwdFnN35yF/4celxdr/JL4aupvtttIjGAtWd37h50cadYSL4F1uacKs7yyh8Q==", + "dependencies": { + "linkifyjs": "^4.3.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-list": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.7.1.tgz", + "integrity": "sha512-E93oXkV2vsZThsix0OA7RiHNLIMGi+w9ASKZ+8TGB69oy32yujnnZz6YVhTVVDPOw8rCP5CnOPhJbgdcqByr0A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-list-item": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-list-item/-/extension-list-item-3.7.1.tgz", + "integrity": "sha512-qkXfWRBusJCId9VhRo9vihcrmxvJ83fkzYWI0LiefJCT1LKfMaeInFNxIsFeUU4q9nR0mhZo7ES3E2+Tk0U3Mw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-list-keymap": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-list-keymap/-/extension-list-keymap-3.7.1.tgz", + "integrity": "sha512-3WyzWge/g6FoxMTkoAARtMJyIYQbpclNX48HyAqdwjJXuLmz3qckEnJEXo47CvJlRsNAlcDJniRS9j5SVJupRw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-ordered-list": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-ordered-list/-/extension-ordered-list-3.7.1.tgz", + "integrity": "sha512-iX3DhTwFp84fiCNSF7+kl/sq6orXq2QFcV2AH+CvL+d0WW1STYmmVmE26gHEjyY82QfpvLZYUCEG6RSYpxFIZw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-paragraph": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-paragraph/-/extension-paragraph-3.7.1.tgz", + "integrity": "sha512-L5dsppKKo46MN3Go5vzqqzjPX89pz1lIkIUN3IhU+KmAHg1TklfR7FQkiIFIIV2rb2ZLuLpD/JcNsZAUmJTW5Q==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-placeholder": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-placeholder/-/extension-placeholder-3.7.1.tgz", + "integrity": "sha512-35VZ578c9oho62Cpupzo9rZCxhPNtuLHNnpKy7bXYaR0Quy3/axtnly1x09nS/KZ4oqw8rvYtkS6GAXwMKKtLg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extensions": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-strike": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-3.7.1.tgz", + "integrity": "sha512-Ctqk/SfmGd3hFCDr4/OH0Dnja19UWUrUEY62pwM7JCkbY/Y9QwPLSO32L6KyamwUDek9SL/ATjRPz6GLp0P7hg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-text": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-3.7.1.tgz", + "integrity": "sha512-m+8FJrFAllJYuzLbEXJ9AztobxmWBTjWorkHcMHBLAbY2ytmAhIM1u3ExtOn9DjvnIT6MffCaq0i/KjhSBYJlA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extension-underline": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extension-underline/-/extension-underline-3.7.1.tgz", + "integrity": "sha512-tyx7ZM2ll8DclKe9Ea/vPyqaZBgnJfIbKBOpecpzawDaJ5ocjwywmYNduevOhw327X2/i8LIQBsPuIOJselcUQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1" + } + }, + "node_modules/@tiptap/extensions": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.7.1.tgz", + "integrity": "sha512-O7eq3frqh7kn/J2P+lpx8blBQrIQxt21J3NvlQJhW5nXIECdo2ox8SQcEfli0EqMSwZCZTdVufdFBkWfIRXhRg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1" + } + }, + "node_modules/@tiptap/pm": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.7.1.tgz", + "integrity": "sha512-t3n054kplRtRYn8pDnzF/prDUccF7QX7jPYLsYBpLn3+d59J5KKkBmOpPExUGE8kZkNoLfwffAFj6NBfqOu+Xg==", + "dependencies": { + "prosemirror-changeset": "^2.3.0", + "prosemirror-collab": "^1.3.1", + "prosemirror-commands": "^1.6.2", + "prosemirror-dropcursor": "^1.8.1", + "prosemirror-gapcursor": "^1.3.2", + "prosemirror-history": "^1.4.1", + "prosemirror-inputrules": "^1.4.0", + "prosemirror-keymap": "^1.2.2", + "prosemirror-markdown": "^1.13.1", + "prosemirror-menu": "^1.2.4", + "prosemirror-model": "^1.24.1", + "prosemirror-schema-basic": "^1.2.3", + "prosemirror-schema-list": "^1.5.0", + "prosemirror-state": "^1.4.3", + "prosemirror-tables": "^1.6.4", + "prosemirror-trailing-node": "^3.0.0", + "prosemirror-transform": "^1.10.2", + "prosemirror-view": "^1.38.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + } + }, + "node_modules/@tiptap/react": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/react/-/react-3.7.1.tgz", + "integrity": "sha512-0tDih8ACrVhKCpNjHcQhxV5DBsyY4xpAjr8nfb2RK+J2l1lGtNuj3PDRHlDLroQiK8svwARz4hsBs8MYWKSkfg==", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "fast-deep-equal": "^3.1.3", + "use-sync-external-store": "^1.4.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "optionalDependencies": { + "@tiptap/extension-bubble-menu": "^3.7.1", + "@tiptap/extension-floating-menu": "^3.7.1" + }, + "peerDependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/pm": "^3.7.1", + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tiptap/starter-kit": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-3.7.1.tgz", + "integrity": "sha512-ZYgA3BkASQmHyoDlUYKFPEpCzIcn/FP/Sb+Ic2L7gt2gOC7zvWAVc/2yIbiFuq+48s+5U/KJqDiXn2hiLwXxpA==", + "dependencies": { + "@tiptap/core": "^3.7.1", + "@tiptap/extension-blockquote": "^3.7.1", + "@tiptap/extension-bold": "^3.7.1", + "@tiptap/extension-bullet-list": "^3.7.1", + "@tiptap/extension-code": "^3.7.1", + "@tiptap/extension-code-block": "^3.7.1", + "@tiptap/extension-document": "^3.7.1", + "@tiptap/extension-dropcursor": "^3.7.1", + "@tiptap/extension-gapcursor": "^3.7.1", + "@tiptap/extension-hard-break": "^3.7.1", + "@tiptap/extension-heading": "^3.7.1", + "@tiptap/extension-horizontal-rule": "^3.7.1", + "@tiptap/extension-italic": "^3.7.1", + "@tiptap/extension-link": "^3.7.1", + "@tiptap/extension-list": "^3.7.1", + "@tiptap/extension-list-item": "^3.7.1", + "@tiptap/extension-list-keymap": "^3.7.1", + "@tiptap/extension-ordered-list": "^3.7.1", + "@tiptap/extension-paragraph": "^3.7.1", + "@tiptap/extension-strike": "^3.7.1", + "@tiptap/extension-text": "^3.7.1", + "@tiptap/extension-underline": "^3.7.1", + "@tiptap/extensions": "^3.7.1", + "@tiptap/pm": "^3.7.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -18078,6 +18529,20 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "license": "MIT" }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, "node_modules/@types/mdast": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", @@ -18088,6 +18553,11 @@ "@types/unist": "*" } }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==" + }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", @@ -18184,14 +18654,22 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "19.1.12", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.12.tgz", - "integrity": "sha512-cMoR+FoAf/Jyq6+Df2/Z41jISvGZZ2eTlnsaJRptmZ76Caldwy1odD4xTr/gNV9VLj0AWgg/nmkevIyUfIIq5w==", - "license": "MIT", + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", + "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", "dependencies": { "csstype": "^3.0.2" } }, + "node_modules/@types/react-dom": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.2.tgz", + "integrity": "sha512-9KQPoO6mZCi7jcIStSnlOWn2nEF3mNmyr3rIAsGnAbQKYbRLyqmeSc39EVgtxXVia+LMT8j3knZLAZAh+xLmrw==", + "peer": true, + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, "node_modules/@types/react-transition-group": { "version": "4.4.12", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz", @@ -21060,6 +21538,11 @@ "node": ">=10" } }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -26850,6 +27333,19 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "license": "MIT" }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/linkifyjs": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.3.2.tgz", + "integrity": "sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA==" + }, "node_modules/loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", @@ -27041,6 +27537,38 @@ "tmpl": "1.0.5" } }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/markdown-table": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", @@ -27329,6 +27857,11 @@ "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==", "license": "CC0-1.0" }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -28526,6 +29059,11 @@ "node": ">= 0.8.0" } }, + "node_modules/orderedmap": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz", + "integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==" + }, "node_modules/own-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", @@ -30322,6 +30860,183 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/prosemirror-changeset": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.3.1.tgz", + "integrity": "sha512-j0kORIBm8ayJNl3zQvD1TTPHJX3g042et6y/KQhZhnPrruO8exkTgG8X+NRpj7kIyMMEx74Xb3DyMIBtO0IKkQ==", + "dependencies": { + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-collab": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/prosemirror-collab/-/prosemirror-collab-1.3.1.tgz", + "integrity": "sha512-4SnynYR9TTYaQVXd/ieUvsVV4PDMBzrq2xPUWutHivDuOshZXqQ5rGbZM84HEaXKbLdItse7weMGOUdDVcLKEQ==", + "dependencies": { + "prosemirror-state": "^1.0.0" + } + }, + "node_modules/prosemirror-commands": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.1.tgz", + "integrity": "sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.10.2" + } + }, + "node_modules/prosemirror-dropcursor": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.2.tgz", + "integrity": "sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0", + "prosemirror-view": "^1.1.0" + } + }, + "node_modules/prosemirror-gapcursor": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.0.tgz", + "integrity": "sha512-z00qvurSdCEWUIulij/isHaqu4uLS8r/Fi61IbjdIPJEonQgggbJsLnstW7Lgdk4zQ68/yr6B6bf7sJXowIgdQ==", + "dependencies": { + "prosemirror-keymap": "^1.0.0", + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-view": "^1.0.0" + } + }, + "node_modules/prosemirror-history": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.4.1.tgz", + "integrity": "sha512-2JZD8z2JviJrboD9cPuX/Sv/1ChFng+xh2tChQ2X4bB2HeK+rra/bmJ3xGntCcjhOqIzSDG6Id7e8RJ9QPXLEQ==", + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.31.0", + "rope-sequence": "^1.3.0" + } + }, + "node_modules/prosemirror-inputrules": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.5.1.tgz", + "integrity": "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-keymap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz", + "integrity": "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==", + "dependencies": { + "prosemirror-state": "^1.0.0", + "w3c-keyname": "^2.2.0" + } + }, + "node_modules/prosemirror-markdown": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/prosemirror-markdown/-/prosemirror-markdown-1.13.2.tgz", + "integrity": "sha512-FPD9rHPdA9fqzNmIIDhhnYQ6WgNoSWX9StUZ8LEKapaXU9i6XgykaHKhp6XMyXlOWetmaFgGDS/nu/w9/vUc5g==", + "dependencies": { + "@types/markdown-it": "^14.0.0", + "markdown-it": "^14.0.0", + "prosemirror-model": "^1.25.0" + } + }, + "node_modules/prosemirror-menu": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/prosemirror-menu/-/prosemirror-menu-1.2.5.tgz", + "integrity": "sha512-qwXzynnpBIeg1D7BAtjOusR+81xCp53j7iWu/IargiRZqRjGIlQuu1f3jFi+ehrHhWMLoyOQTSRx/IWZJqOYtQ==", + "dependencies": { + "crelt": "^1.0.0", + "prosemirror-commands": "^1.0.0", + "prosemirror-history": "^1.0.0", + "prosemirror-state": "^1.0.0" + } + }, + "node_modules/prosemirror-model": { + "version": "1.25.3", + "resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.3.tgz", + "integrity": "sha512-dY2HdaNXlARknJbrManZ1WyUtos+AP97AmvqdOQtWtrrC5g4mohVX5DTi9rXNFSk09eczLq9GuNTtq3EfMeMGA==", + "dependencies": { + "orderedmap": "^2.0.0" + } + }, + "node_modules/prosemirror-schema-basic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/prosemirror-schema-basic/-/prosemirror-schema-basic-1.2.4.tgz", + "integrity": "sha512-ELxP4TlX3yr2v5rM7Sb70SqStq5NvI15c0j9j/gjsrO5vaw+fnnpovCLEGIcpeGfifkuqJwl4fon6b+KdrODYQ==", + "dependencies": { + "prosemirror-model": "^1.25.0" + } + }, + "node_modules/prosemirror-schema-list": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz", + "integrity": "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.7.3" + } + }, + "node_modules/prosemirror-state": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.3.tgz", + "integrity": "sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.27.0" + } + }, + "node_modules/prosemirror-tables": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.8.1.tgz", + "integrity": "sha512-DAgDoUYHCcc6tOGpLVPSU1k84kCUWTWnfWX3UDy2Delv4ryH0KqTD6RBI6k4yi9j9I8gl3j8MkPpRD/vWPZbug==", + "dependencies": { + "prosemirror-keymap": "^1.2.2", + "prosemirror-model": "^1.25.0", + "prosemirror-state": "^1.4.3", + "prosemirror-transform": "^1.10.3", + "prosemirror-view": "^1.39.1" + } + }, + "node_modules/prosemirror-trailing-node": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prosemirror-trailing-node/-/prosemirror-trailing-node-3.0.0.tgz", + "integrity": "sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ==", + "dependencies": { + "@remirror/core-constants": "3.0.0", + "escape-string-regexp": "^4.0.0" + }, + "peerDependencies": { + "prosemirror-model": "^1.22.1", + "prosemirror-state": "^1.4.2", + "prosemirror-view": "^1.33.8" + } + }, + "node_modules/prosemirror-transform": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.10.4.tgz", + "integrity": "sha512-pwDy22nAnGqNR1feOQKHxoFkkUtepoFAd3r2hbEDsnf4wp57kKA36hXsB3njA9FtONBEwSDnDeCiJe+ItD+ykw==", + "dependencies": { + "prosemirror-model": "^1.21.0" + } + }, + "node_modules/prosemirror-view": { + "version": "1.41.3", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.41.3.tgz", + "integrity": "sha512-SqMiYMUQNNBP9kfPhLO8WXEk/fon47vc52FQsUiJzTBuyjKgEcoAwMyF04eQ4WZ2ArMn7+ReypYL60aKngbACQ==", + "dependencies": { + "prosemirror-model": "^1.20.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -30365,6 +31080,14 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "engines": { + "node": ">=6" + } + }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -31707,6 +32430,11 @@ "randombytes": "^2.1.0" } }, + "node_modules/rope-sequence": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", + "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==" + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -33802,6 +34530,11 @@ "node": ">=4.2.0" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -34250,6 +34983,11 @@ "browser-process-hrtime": "^1.0.0" } }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" + }, "node_modules/w3c-xmlserializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", diff --git a/package.json b/package.json index 8f30168..728f80b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,9 @@ "@testing-library/jest-dom": "^6.8.0", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^13.5.0", + "@tiptap/extension-placeholder": "^3.7.1", + "@tiptap/react": "^3.7.1", + "@tiptap/starter-kit": "^3.7.1", "apexcharts": "^5.3.4", "bootstrap": "^5.3.8", "bootstrap-icons": "^1.13.1", diff --git a/src/App.js b/src/App.js index 1352f0e..0335710 100644 --- a/src/App.js +++ b/src/App.js @@ -9,6 +9,9 @@ import LandingPage from './pages/LandingPage'; import PerfilFinanceiro from "./perfis/perfil_financeiro/PerfilFinanceiro"; import Perfiladm from "./perfis/Perfil_adm/Perfiladm"; import PerfilMedico from "./perfis/Perfil_medico/PerfilMedico"; + +// COMBINADO: Importações de ambas as versões +import PerfilPaciente from "./perfis/Perfil_paciente/Perfilpaciente" import ProfilePage from "./pages/ProfilePage"; import Header from "./components/Header/Header"; @@ -33,11 +36,15 @@ function App() { } /> } /> } /> + + {/* COMBINADO: Rotas de ambas as versões */} + } /> } /> + Página não encontrada} /> ); } -export default App; +export default App; \ No newline at end of file diff --git a/src/PagesMedico/DoctorRelatorioManager.jsx b/src/PagesMedico/DoctorRelatorioManager.jsx index ce24602..22a79b2 100644 --- a/src/PagesMedico/DoctorRelatorioManager.jsx +++ b/src/PagesMedico/DoctorRelatorioManager.jsx @@ -5,6 +5,8 @@ import { useAuth } from '../components/utils/AuthProvider'; import { GetPatientByID } from '../components/utils/Functions-Endpoints/Patient'; import { useNavigate } from 'react-router-dom'; import html2pdf from 'html2pdf.js'; +import TiptapViewer from './TiptapViewer'; + const DoctorRelatorioManager = () => { const navigate = useNavigate() const {getAuthorizationHeader} = useAuth(); @@ -13,7 +15,7 @@ const DoctorRelatorioManager = () => { const [PacientesComRelatorios, setPacientesComRelatorios] = useState([]) const [showModal, setShowModal] = useState(false) const [index, setIndex] = useState() - + // 1º useEffect: Busca os dados dos pacientes após carregar os relatórios useEffect( () => { let pacientesDosRelatorios = [] @@ -26,34 +28,32 @@ const DoctorRelatorioManager = () => { if (paciente.length > 0) { pacientesDosRelatorios.push(paciente[0]); } - } setPacientesComRelatorios(pacientesDosRelatorios); - } - ListarPacientes() - console.log(PacientesComRelatorios, 'aqui') - - }, [RelatoriosFiltrados]); - + + }, [RelatoriosFiltrados, authHeader]); + // NOVO: useEffect para logar PacientesComRelatorios após a atualização + useEffect(() => { + console.log(PacientesComRelatorios, 'aqui') + }, [PacientesComRelatorios]) + + // 2º useEffect: Busca a lista de relatórios useEffect(() => { var myHeaders = new Headers(); myHeaders.append("apikey", API_KEY); myHeaders.append("Authorization", authHeader); - var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; - fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&status", requestOptions) .then(response => response.json()) .then(data => { setRelatorios(data); console.log(data) }) .catch(error => console.log('error', error)); - }, []) - + }, [authHeader]) const BaixarPDFdoRelatorio = (nome_paciente) => { const elemento = document.getElementById("folhaA4"); // tua div do relatório const opt = { @@ -62,10 +62,8 @@ fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&statu html2canvas: { scale: 2 }, jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, }; - html2pdf().set(opt).from(elemento).save(); } - return (
{showModal && ( @@ -82,36 +80,36 @@ fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&statu
-

Clinica Rise up

Dr - CRM/SP 123456

Avenida - (79) 9 4444-4444

-

Paciente: {PacientesComRelatorios[index]?.full_name}

Data de nascimento: {PacientesComRelatorios[index]?.birth_date}

-

Data do exame: {}

-

Exame: {RelatoriosFiltrados[index]?.exam}

- -

Diagnostico: {RelatoriosFiltrados[index]?.diagnosis}

-

Conclusão: {RelatoriosFiltrados[index]?.conclusion}

+ {/* INÍCIO DA MUDANÇA (da resposta anterior) */} +

Conteúdo do Relatório:

+ + {/* FIM DA MUDANÇA */}
-

Dr {RelatoriosFiltrados[index]?.required_by}

Emitido em: 0

-
- -
)} - -

Lista de Relatórios

@@ -143,14 +139,12 @@ fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&statu -
{" "} Filtros
-
-
@@ -178,7 +171,6 @@ fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&statu - @@ -210,7 +202,6 @@ fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/reports?patient_id&statu Ver Detalhes - + ) } diff --git a/src/PagesMedico/TiptapEditor.jsx b/src/PagesMedico/TiptapEditor.jsx new file mode 100644 index 0000000..7194562 --- /dev/null +++ b/src/PagesMedico/TiptapEditor.jsx @@ -0,0 +1,74 @@ +import React from 'react'; +import { useEditor, EditorContent } from '@tiptap/react'; +import StarterKit from '@tiptap/starter-kit'; +import Link from '@tiptap/extension-link'; +// Componente da barra de menu (Menu Bar) +const MenuBar = ({ editor }) => { + if (!editor) { + return null; + } + // Estilos simples para os botões. Você pode e deve estilizar melhor com CSS/Bootstrap. + const buttonStyle = { + marginRight: '4px', + padding: '4px 8px', + cursor: 'pointer', + border: '1px solid #ccc', + borderRadius: '4px', + backgroundColor: editor.isActive('bold') || editor.isActive('italic') ? '#ddd' : 'white', + }; + return ( +
+ + + + + {/* Adicione mais botões conforme a necessidade (link, código, etc.) */} +
+ ); +}; +// Componente principal do Editor +const TiptapEditor = ({ content, onChange }) => { + const editor = useEditor({ + extensions: [ + StarterKit.configure({ + // Desativa 'hardBreak' e 'blockquote' se não forem necessários para simplificar + hardBreak: false, + }), + Link, // Adiciona suporte para links + ], + content: content || '

Inicie o relatório aqui...

', + onUpdate: ({ editor }) => { + // Quando o conteúdo muda, chama a função onChange com o HTML + onChange(editor.getHTML()); + }, + }); + return ( +
+ + +
+ ); +}; +export default TiptapEditor; \ No newline at end of file diff --git a/src/PagesMedico/TiptapViewer.jsx b/src/PagesMedico/TiptapViewer.jsx new file mode 100644 index 0000000..cf21c49 --- /dev/null +++ b/src/PagesMedico/TiptapViewer.jsx @@ -0,0 +1,15 @@ +import React from 'react'; + +// Componente para renderizar o HTML salvo (conteúdo do editor) +const TiptapViewer = ({ htmlContent }) => { + return ( + // 'dangerouslySetInnerHTML' é necessário para renderizar HTML +
+ ); +}; + +export default TiptapViewer; \ No newline at end of file diff --git a/src/components/AgendarConsulta/CardConsulta.jsx b/src/components/AgendarConsulta/CardConsulta.jsx index 250a534..acd627c 100644 --- a/src/components/AgendarConsulta/CardConsulta.jsx +++ b/src/components/AgendarConsulta/CardConsulta.jsx @@ -1,23 +1,86 @@ -import React from 'react' +import React, { useState, useEffect } from 'react';import { GetDoctorByID } from '../utils/Functions-Endpoints/Doctor'; +import { GetPatientByID } from '../utils/Functions-Endpoints/Patient'; +import { useAuth } from '../utils/AuthProvider'; +import { useNavigate } from 'react-router-dom'; +import { useMemo } from 'react'; -const CardConsulta = ( {DadosConsulta, TabelaAgendamento} ) => { +const CardConsulta = ( {DadosConsulta, TabelaAgendamento, setShowDeleteModal} ) => { + const navigate = useNavigate(); + const {getAuthorizationHeader} = useAuth() + const authHeader = getAuthorizationHeader() + const [Paciente, setPaciente] = useState() + const [Medico, setMedico] = useState() - // Status (agendado, confirmado, realizado, cancelado) + const ids = useMemo(() => { + return { + doctor_id: DadosConsulta?.doctor_id, + patient_id: DadosConsulta?.patient_id, + status: DadosConsulta?.status + }; + }, [DadosConsulta]); + + + useEffect(() => { + const BuscarMedicoEPaciente = async () => { + if (!ids.doctor_id || !ids.patient_id || ids.status === 'nada') return; + + try { + const [Doctor, Patient] = await Promise.all([ + GetDoctorByID(ids.doctor_id, authHeader), + GetPatientByID(ids.patient_id, authHeader) + ]); + + setMedico(Doctor?.[0] || null); + setPaciente(Patient?.[0] || null); + } catch (error) { + console.error('Erro ao buscar médico/paciente:', error); + } + }; + + BuscarMedicoEPaciente(); + }, [ids, authHeader]); return (
- {DadosConsulta.status !== 'vazio'? + {DadosConsulta.id? +
-
-

{DadosConsulta.horario}|GEAP| {DadosConsulta.medico}

-
-
-

{DadosConsulta.paciente} - {DadosConsulta.motivo} - 23 anos

-
+
+
+

{DadosConsulta.horario} {Medico?.full_name}

+
+ +
+

{Paciente?.full_name} - {DadosConsulta.exam}

+
+
+ +
+ + + + + +
+
: null diff --git a/src/components/AgendarConsulta/FormDisponibilidade.jsx b/src/components/AgendarConsulta/FormDisponibilidade.jsx new file mode 100644 index 0000000..86ba6ce --- /dev/null +++ b/src/components/AgendarConsulta/FormDisponibilidade.jsx @@ -0,0 +1,177 @@ +import InputMask from "react-input-mask"; +import "./style/formagendamentos.css"; +import { useState, useEffect } from "react"; + +const FormNovaDisponibilidade = ({ onCancel, doctorID }) => { + + const [dadosAtendimento, setDadosAtendimento] = useState({ + profissional: '', + tipoAtendimento: '', + dataAtendimento: '', + inicio: '', + termino: '', + motivo: '' + }); + + const handleAtendimentoChange = (e) => { + const { value, name } = e.target; + setDadosAtendimento(prev => ({ + ...prev, + [name]: value + })); + }; + + const handleSubmitExcecao = async (e) => { + e.preventDefault(); + console.log("Modo Emergência Ativado: Tentando criar Exceção com novo endpoint."); + + const { profissional, dataAtendimento, tipoAtendimento, inicio, termino, motivo } = dadosAtendimento; + + if (!profissional || !dataAtendimento || !tipoAtendimento) { + alert("Por favor, preencha o Profissional, Data, e Tipo da exceção."); + return; + } + + const payload = { + doctor_id: profissional, + date: dataAtendimento, + start_time: inicio + ":00" || null, // Adiciona ":00" se o input type="time" retornar apenas HH:MM + end_time: termino + ":00" || null, // Adiciona ":00" + kind: tipoAtendimento, + reason: motivo, + }; + + var myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + + var requestOptions = { + method: 'POST', + headers: myHeaders, + body: JSON.stringify(payload), + redirect: 'follow' + }; + + try { + const response = await fetch("https://mock.apidog.com/m1/1053378-0-default/rest/v1/doctor_exceptions", requestOptions); + const result = await response.json(); + + if (response.ok || response.status === 201) { + console.log("Exceção de emergência criada com sucesso:", result); + alert(`Consulta de emergência agendada como exceção! Detalhes: ${JSON.stringify(result)}`); + } else { + console.error("Erro ao criar exceção de emergência:", result); + alert(`Erro ao agendar exceção. Status: ${response.status}. Detalhes: ${result.message || JSON.stringify(result)}`); + } + } catch (error) { + console.error("Erro na requisição para criar exceção:", error); + alert("Erro de comunicação com o servidor ou formato de resposta inválido."); + } + }; + + return ( +
+
+

Informações do médico

+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+ +
+ + +
+
+
+ +
+ + +
+ +
+ ); +}; + +export default FormNovaDisponibilidade; \ No newline at end of file diff --git a/src/components/AgendarConsulta/FormNovaConsulta.jsx b/src/components/AgendarConsulta/FormNovaConsulta.jsx index 435bc8e..bdae91d 100644 --- a/src/components/AgendarConsulta/FormNovaConsulta.jsx +++ b/src/components/AgendarConsulta/FormNovaConsulta.jsx @@ -1,57 +1,21 @@ import InputMask from "react-input-mask"; import "./style/formagendamentos.css"; import { useState, useEffect } from "react"; +import { GetPatientByCPF } from "../utils/Functions-Endpoints/Patient"; +import { GetDoctorByName } from "../utils/Functions-Endpoints/Doctor"; +import { useAuth } from "../utils/AuthProvider"; +const FormNovaConsulta = ({ onCancel, onSave, setAgendamento, agendamento }) => { + const {getAuthorizationHeader} = useAuth() -const FormNovaConsulta = ({ onCancel, patientID }) => { - const [selectedFile, setSelectedFile] = useState(null); const [anexos, setAnexos] = useState([]); const [loadingAnexos, setLoadingAnexos] = useState(false); - const [paciente, setPaciente] = useState({}) + + const [acessibilidade, setAcessibilidade] = useState({cadeirante:false,idoso:false,gravida:false,bebe:false, autista:false }) - useEffect(() => { - if (!patientID) return; - - const fetchAnexos = async () => { - setLoadingAnexos(true); - try { - const res = await fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${patientID}/anexos`); - const data = await res.json(); - setAnexos(data.data || []); - } catch (err) { - console.error("Erro ao buscar anexos:", err); - } finally { - setLoadingAnexos(false); - } - }; - - fetchAnexos(); - }, [patientID]); - - const handleUpload = async () => { - if (!selectedFile) return; - - const formData = new FormData(); - formData.append("file", selectedFile); - - try { - const res = await fetch(`https://mock.apidog.com/m1/1053378-0-default/pacientes/${patientID}/anexos`, { - method: "POST", - body: formData - }); - if (res.ok) { - const novoAnexo = await res.json(); - setAnexos(prev => [...prev, novoAnexo]); - setSelectedFile(null); - } else { - console.error("Erro ao enviar anexo"); - } - } catch (err) { - console.error("Erro ao enviar anexo:", err); - } - }; + let authHeader = getAuthorizationHeader() const handleclickAcessibilidade = (id) => { @@ -62,112 +26,65 @@ const FormNovaConsulta = ({ onCancel, patientID }) => { else if(resultado === true){ setAcessibilidade({...acessibilidade, [id]:false})} console.log(id) } - - const FormatCPF = (valor) => { - console.log(valor) + const FormatCPF = (valor) => { const digits = String(valor).replace(/\D/g, '').slice(0, 11); - BuscarPacienteExistentePeloCPF(valor) - return digits .replace(/(\d{3})(\d)/, '$1.$2') .replace(/(\d{3})(\d)/, '$1.$2') .replace(/(\d{3})(\d{1,2})$/, '$1-$2'); } - - const FormatTelefones = (valor) => { - const digits = String(valor).replace(/\D/g, '').slice(0, 11); - return digits - .replace(/(\d)/, '($1') - .replace(/(\d{2})(\d)/, '$1) $2' ) - .replace(/(\d)(\d{4})/, '$1 $2') - .replace(/(\d{4})(\d{4})/, '$1-$2') - } - - - const BuscarCPFnoBancodeDados = async (cpf) => { - - var myHeaders = new Headers(); - myHeaders.append("Authorization", "Bearer "); - myHeaders.append("Content-Type", "application/json"); - - var raw = JSON.stringify({ - "cpf": cpf - }); - - var requestOptions = { - method: 'POST', - headers: myHeaders, - body: raw, - redirect: 'follow' - }; - - const response = await fetch("https://mock.apidog.com/m1/1053378-0-default/pacientes/validar-cpf", requestOptions); - const result = await response.json(); - return result - - - } - - const BuscarPacienteExistentePeloCPF = async (value) => { - - if(isNaN(value[13]) === false && value.length === 14)try { - const result = await BuscarCPFnoBancodeDados(value); - console.log("Resultado:", result); - - if (result.data.existe === true){ - - var myHeaders = new Headers(); - myHeaders.append("Authorization", "Bearer "); - - var requestOptions = { - method: 'GET', - headers: myHeaders, - redirect: 'follow' - }; - - fetch("https://mock.apidog.com/m1/1053378-0-default/pacientes/", requestOptions) - .then(response => response.json()) - .then(result => setPaciente(result.data)) - .catch(error => console.log('error', error)); - } - - - - } catch (error) { - console.log("error", error); - } - //BuscarCPFnoBancodeDados(value) - } + const handleChange = (e) => { const {value, name} = e.target; - - console.log(value, name) - if(name === 'email'){ - setPaciente({...paciente, contato:{ - ...paciente.contato, + setAgendamento({...agendamento, contato:{ + ...agendamento.contato, email:value }}) - } else if(name === 'telefone'){ - setPaciente({...paciente, contato:{ - ...paciente.contato, - telefone1:FormatTelefones(value) - }}) + }else if(name === 'cpf'){ + + let cpfFormatted = FormatCPF(value) + const fetchPatient = async () => { + let patientData = await GetPatientByCPF(cpfFormatted, authHeader); + if (patientData) { + setAgendamento((prev) => ({ + ...prev, + nome: patientData.full_name, + patient_id: patientData.id + })); + }} + setAgendamento(prev => ({ ...prev, cpf: cpfFormatted })) + fetchPatient() + }else if(name==='convenio'){ + setAgendamento({...agendamento,insurance_provider:value}) + }else if(name ==='profissional'){ + + + const fetchDoctor = async () => { + let DoctorData = await GetDoctorByName(value, authHeader) + if(DoctorData){ + setAgendamento((prev) => ({ + ...prev, + doctor_id:DoctorData.id + })) + }} + fetchDoctor() } else{ - setPaciente({...paciente,[name]:value}) + setAgendamento({...agendamento,[name]:value}) } } const handleSubmit = (e) => { e.preventDefault(); alert("Agendamento salvo!"); + onSave(agendamento) }; return ( @@ -180,57 +97,33 @@ const FormNovaConsulta = ({ onCancel, patientID }) => {
- +
- e.target.value = FormatCPF(e.target.value)} /> +
-
- - -
+
-
-
- - -
- -
- - -
- -
- - -
-
+
- + + +
-
- - -
- -
- - -
+

Informações adicionais

@@ -243,7 +136,7 @@ const FormNovaConsulta = ({ onCancel, patientID }) => { onChange={(e) => setSelectedFile(e.target.files[0])} /> {selectedFile && ( - )} @@ -291,7 +184,7 @@ const FormNovaConsulta = ({ onCancel, patientID }) => {
- +
diff --git a/src/components/AgendarConsulta/TabelaAgendamentoDia.jsx b/src/components/AgendarConsulta/TabelaAgendamentoDia.jsx index da73a5a..a248f23 100644 --- a/src/components/AgendarConsulta/TabelaAgendamentoDia.jsx +++ b/src/components/AgendarConsulta/TabelaAgendamentoDia.jsx @@ -1,14 +1,34 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import CardConsulta from './CardConsulta'; import "./style/styleTabelas/tabeladia.css"; - -const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos }) => { +const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos, setShowDeleteModal }) => { + const [indiceAcesso, setIndiceAcesso] = useState(0) + const [Dia, setDia] = useState() const agendamentosDoDia = agendamentos?.semana1?.segunda || []; const nomeMedico = agendamentosDoDia.find(item => item.medico)?.medico || 'Profissional'; + let ListaDiasComAgendamentos = Object.keys(agendamentos) + + + + console.log(Dia, "hshdhshhsdhs") + + useEffect(() => { + setDia(ListaDiasComAgendamentos[indiceAcesso]) + }, [indiceAcesso]) + + + return (
+
+
+ +

{Dia}

+ +
+
Paciente CPFExame
@@ -18,12 +38,12 @@ const TabelaAgendamentoDia = ({ handleClickAgendamento, agendamentos }) => { - {agendamentosDoDia.map((agendamento, index) => ( + {agendamentos[Dia]?.map((agendamento, index) => ( diff --git a/src/components/AgendarConsulta/TabelaAgendamentoMes.jsx b/src/components/AgendarConsulta/TabelaAgendamentoMes.jsx index 7e40408..26dcb31 100644 --- a/src/components/AgendarConsulta/TabelaAgendamentoMes.jsx +++ b/src/components/AgendarConsulta/TabelaAgendamentoMes.jsx @@ -3,7 +3,8 @@ import React from 'react'; import dayjs from "dayjs"; import CardConsulta from './CardConsulta'; import "./style/styleTabelas/tabelames.css"; - +import { useEffect, useState } from 'react'; +import { useMemo } from 'react'; const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos }) => { @@ -12,19 +13,179 @@ const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos }) => { const mes = dataHoje.month() + 1; let ListaDiasDatas = ListarDiasdoMes(AnoAtual, mes); + const [AgendamentosSemanaisOrganizados, setAgendamentosSemanaisOrganizados] = useState({}) + const [indice, setIndice] = useState("10") - let segundas = ListaDiasDatas[0]; - let tercas = ListaDiasDatas[1]; - let quartas = ListaDiasDatas[2]; - let quintas = ListaDiasDatas[3]; - let sextas = ListaDiasDatas[4]; + const [AgendamentosMensaisOrganizados, setAgendamentosMensaisOrganizados] = useState({ + "01": { "nomeDoMes": "janeiro" }, + "02": { "nomeDoMes": "fevereiro" }, + "03": { "nomeDoMes": "março" }, + "04": { "nomeDoMes": "abril" }, + "05": { "nomeDoMes": "maio" }, + "06": { "nomeDoMes": "junho" }, + "07": { "nomeDoMes": "julho" }, + "08": { "nomeDoMes": "agosto" }, + "09": { "nomeDoMes": "setembro" }, + "10": { "nomeDoMes": "outubro" }, + "11": { "nomeDoMes": "novembro" }, + "12": { "nomeDoMes": "dezembro" } +}) + + + + + const OrganizarAgendamentosSemanais = useMemo(() => { + if (!agendamentos || Object.keys(agendamentos).length === 0) return {}; + + const DiasComAtendimentos = Object.keys(agendamentos) + const semanas = {} + + + for (let i = 0; i < DiasComAtendimentos.length; i++) { + const DiaComAtendimento = DiasComAtendimentos[i] + const [_, MesDoAgendamento, DiaDoAgendamento] = DiaComAtendimento.split("-") + + const data = dayjs(`${AnoAtual}-${MesDoAgendamento}-${DiaDoAgendamento}`) + const diaSemana = data.format('dddd') + const semanaKey = `semana${data.week()}` + + if (!semanas[semanaKey]) { + semanas[semanaKey] = { + segunda: [], terça: [], quarta: [], quinta: [], sexta: [] + } + } + + switch (diaSemana) { + case 'Monday': + semanas[semanaKey].segunda.push(...agendamentos[DiaComAtendimento]) + break + case 'Tuesday': + semanas[semanaKey].terça.push(...agendamentos[DiaComAtendimento]) + break + case 'Wednesday': + semanas[semanaKey].quarta.push(...agendamentos[DiaComAtendimento]) + break + case 'Thursday': + semanas[semanaKey].quinta.push(...agendamentos[DiaComAtendimento]) + break + case 'Friday': + semanas[semanaKey].sexta.push(...agendamentos[DiaComAtendimento]) + break + default: + break + } + } + + return semanas + }, [agendamentos, AnoAtual]) + + useEffect(() => { + setAgendamentosSemanaisOrganizados(OrganizarAgendamentosSemanais); + + + // NOTA: Ao carregar, o Indice é 0, que é a primeira semana. + }, [OrganizarAgendamentosSemanais]) + + useEffect(() => { + console.log(OrganizarAgendamentosMensais) + + + }, []) + + useEffect(() => { + console.log(AgendamentosMensaisOrganizados, 'aqui os agendamentos mensais') + }, [AgendamentosMensaisOrganizados]) + + const OrganizarAgendamentosMensais = useMemo(() => { + if (!AgendamentosSemanaisOrganizados || Object.keys(AgendamentosSemanaisOrganizados).length === 0) + return; + + // Cria uma cópia local do estado atual + const novoEstado = { ...AgendamentosMensaisOrganizados }; + + const indices = Object.keys(AgendamentosSemanaisOrganizados); + + for (let i = 0; i < indices.length; i++) { + const DictSemanais = AgendamentosSemanaisOrganizados[indices[i]]; + const indicesDictSemanais = Object.keys(DictSemanais); + + for (let d = 0; d < indicesDictSemanais.length; d++) { + const lista = DictSemanais[indicesDictSemanais[d]]; + + if (lista.length > 0) { + const [_, mesDaConsulta] = lista[0].scheduled_at.split("-"); + + // Cria o mês se ainda não existir + if (!novoEstado[mesDaConsulta]) { + novoEstado[mesDaConsulta] = { + nomeDoMes: AgendamentosMensaisOrganizados[mesDaConsulta]?.nomeDoMes || "", + }; + } + + // Garante que a semana existe + novoEstado[mesDaConsulta][indices[i]] = { + ...novoEstado[mesDaConsulta][indices[i]], + ...DictSemanais, + }; + } + } + } + + // Faz o set de uma vez só + setAgendamentosMensaisOrganizados(novoEstado); +}, [AgendamentosSemanaisOrganizados]); + + const AvançarMes = () => { + let Indice = parseInt(indice) + Indice += 1 + + console.log(Indice) + if(Indice < 10){ + Indice = "0" + Indice.toString() + console.log(Indice) + } + if(Indice === 13){ + return + }else{ + setIndice(Indice) + } + } + + const VoltarMes = () => { + let Indice = parseInt(indice) + + Indice -= 1 + + console.log(Indice) + if(Indice < 10){ + Indice = "0" + Indice.toString() + console.log(Indice) + } + if(Indice === "00"){ + return + }else{ + + setIndice(Indice) + } + + + } + return (
+
+
+ +

{AgendamentosMensaisOrganizados[indice].nomeDoMes}

+ + +
+

{agendamento.horario}

handleClickAgendamento(agendamento)}> - +
- + @@ -32,105 +193,33 @@ const TabelaAgendamentoMes = ({ ListarDiasdoMes, agendamentos }) => { - {agendamentos && Object.entries(agendamentos).map(([semana, dias], index) => ( - - {/* Coluna de Segunda-feira */} - + {Object.keys(AgendamentosMensaisOrganizados[indice]).map((semanaKey) => { + const semana = AgendamentosMensaisOrganizados[indice][semanaKey] + console.log(AgendamentosMensaisOrganizados[indice][semanaKey], 'ajdsahchbaohdfoduh') - {/* Coluna de Terça-feira */} - - {/* Coluna de Quarta-feira */} - + return( + + + { + semana && typeof semana === "object" && Object.keys(semana).map((dia) => ( + + ): null } + + )) + } + - {/* Coluna de Sexta-feira */} - - - ))} - + )})} +
SegSeg Ter Qua Qui
-
-

{segundas[index]}

-
- {(dias.segunda || []).slice(0, 3).map((consulta, idx) => ( - - ))} -
- {(dias.segunda || []).length > 3 ? -

+ {(dias.segunda || []).length - 3}

- : null} -
-
-
-

{tercas[index]}

-
- {(dias.terca || []).slice(0, 3).map((consulta, idx) => ( - - ))} -
- {(dias.terca || []).length > 3 ? -

+ {(dias.terca || []).length - 3}

- : null} -
-
-
-

{quartas[index]}

-
- {(dias.quarta || []).slice(0, 3).map((consulta, idx) => ( - - ))} -
- {(dias.quarta || []).length > 3 ? -

+ {(dias.quarta || []).length - 3}

- : null} -
-
+ + + + {semana[dia].length > 3 ? ( +
+

{` +${semana[dia].length - 2}`}

+
- {/* Coluna de Quinta-feira */} -
-
-

{quintas[index]}

-
- {(dias.quinta || []).slice(0, 3).map((consulta, idx) => ( - - ))} -
- {(dias.quinta || []).length > 3 ? -

+ {(dias.quinta || []).length - 3}

- : null} -
-
-
-

{sextas[index]}

-
- {(dias.sexta || []).slice(0, 3).map((consulta, idx) => ( - - ))} -
- {(dias.sexta || []).length > 3 ? -

+ {(dias.sexta || []).length - 3}

- : null} -
-
) diff --git a/src/components/AgendarConsulta/TabelaAgendamentoSemana.jsx b/src/components/AgendarConsulta/TabelaAgendamentoSemana.jsx index 3f3c2b6..95a3238 100644 --- a/src/components/AgendarConsulta/TabelaAgendamentoSemana.jsx +++ b/src/components/AgendarConsulta/TabelaAgendamentoSemana.jsx @@ -1,31 +1,150 @@ import React from 'react'; import CardConsulta from './CardConsulta'; import "./style/styleTabelas/tabelasemana.css"; +import dayjs from 'dayjs'; +import { useEffect, useState, useMemo } from 'react'; +import weekOfYear from 'dayjs/plugin/weekOfYear' +dayjs.extend(weekOfYear) +const TabelaAgendamentoSemana = ({ agendamentos, ListarDiasdoMes }) => { -const TabelaAgendamentoSemana = ({ agendamentos }) => { + // Armazena o objeto COMPLETO das semanas organizadas + const [semanasOrganizadas, setSemanasOrganizadas] = useState({}); + // Controla qual semana está sendo exibida (o índice da chave no objeto) + const [Indice, setIndice] = useState(0); + const dataHoje = dayjs(); + const AnoAtual = dataHoje.year(); + const mes = dataHoje.month() + 1; + + let DiasdoMes = ListarDiasdoMes(AnoAtual, mes) + + // Array de chaves (ex: ['semana40', 'semana41', ...]) + const chavesDasSemanas = Object.keys(semanasOrganizadas); + + // Armazena o total de semanas que foram organizadas (para definir os limites de navegação) + const totalSemanas = chavesDasSemanas.length; + + // --- LÓGICA DE ORGANIZAÇÃO (useMemo mantido para otimização) --- + + const OrganizarAgendamentosSemanais = useMemo(() => { + if (!agendamentos || Object.keys(agendamentos).length === 0) return {}; + + const DiasComAtendimentos = Object.keys(agendamentos) + const semanas = {} + + for (let i = 0; i < DiasComAtendimentos.length; i++) { + const DiaComAtendimento = DiasComAtendimentos[i] + const [_, MesDoAgendamento, DiaDoAgendamento] = DiaComAtendimento.split("-") + + const data = dayjs(`${AnoAtual}-${MesDoAgendamento}-${DiaDoAgendamento}`) + const diaSemana = data.format('dddd') + const semanaKey = `semana${data.week()}` + + if (!semanas[semanaKey]) { + semanas[semanaKey] = { + segunda: [], terça: [], quarta: [], quinta: [], sexta: [] + } + } + + switch (diaSemana) { + case 'Monday': + semanas[semanaKey].segunda.push(...agendamentos[DiaComAtendimento]) + break + case 'Tuesday': + semanas[semanaKey].terça.push(...agendamentos[DiaComAtendimento]) + break + case 'Wednesday': + semanas[semanaKey].quarta.push(...agendamentos[DiaComAtendimento]) + break + case 'Thursday': + semanas[semanaKey].quinta.push(...agendamentos[DiaComAtendimento]) + break + case 'Friday': + semanas[semanaKey].sexta.push(...agendamentos[DiaComAtendimento]) + break + default: + break + } + } + + return semanas + }, [agendamentos, AnoAtual]) // Adicionei AnoAtual como dependência por segurança + + // --- EFEITO PARA POPULAR O ESTADO --- + + useEffect(() => { + setSemanasOrganizadas(OrganizarAgendamentosSemanais); + // NOTA: Ao carregar, o Indice é 0, que é a primeira semana. + }, [OrganizarAgendamentosSemanais]) + + // --- NOVAS FUNÇÕES DE NAVEGAÇÃO --- + + const avancarSemana = () => { + // Avança se o índice atual não for o último (totalSemanas - 1) + if (Indice < totalSemanas - 1) { + setIndice(Indice + 1); + } + }; + + const voltarSemana = () => { + // Volta se o índice atual não for o primeiro (0) + if (Indice > 0) { + setIndice(Indice - 1); + } + }; - const agendamentoSemana = agendamentos?.semana1 || {}; - - const agendamentosDeSegunda = agendamentoSemana.segunda || []; - const agendamentosDeTerca = agendamentoSemana.terca || []; - const agendamentosDeQuarta = agendamentoSemana.quarta || []; - const agendamentosDeQuinta = agendamentoSemana.quinta || []; - const agendamentosDeSexta = agendamentoSemana.sexta || []; + // --- PREPARAÇÃO DOS DADOS PARA RENDERIZAÇÃO --- - + // Pega a chave da semana que deve ser exibida (usa o estado Indice) + const chaveDaSemanaAtual = chavesDasSemanas[Indice]; + + // Extrai os agendamentos da semana atual (ou um objeto vazio se não existir) + const semanaParaRenderizar = semanasOrganizadas[chaveDaSemanaAtual] || { + segunda: [], terça: [], quarta: [], quinta: [], sexta: [] + }; + + // Determina o número máximo de linhas/consultas const numLinhas = Math.max( - agendamentosDeSegunda.length, - agendamentosDeTerca.length, - agendamentosDeQuarta.length, - agendamentosDeQuinta.length, - agendamentosDeSexta.length + semanaParaRenderizar.segunda.length, + semanaParaRenderizar.terça.length, + semanaParaRenderizar.quarta.length, + semanaParaRenderizar.quinta.length, + semanaParaRenderizar.sexta.length ); + // Array de índices para iterar sobre as LINHAS da tabela + const indicesDeLinha = Array.from({ length: numLinhas }, (_, i) => i); + + // Título da semana (para mostrar ao usuário) + const tituloSemana = chaveDaSemanaAtual + ? `Semana ${chaveDaSemanaAtual.replace('semana', '')} / ${AnoAtual}` + : 'Nenhuma semana encontrada'; + + // --- RENDERIZAÇÃO --- return (
+ {/* Container de Navegação */} +
+ + +

{tituloSemana}

+ +
+ + {/* Tabela de Agendamentos */} @@ -38,28 +157,44 @@ const TabelaAgendamentoSemana = ({ agendamentos }) => { - {Array.from({ length: numLinhas }).map((_, index) => { - - const consultaSeg = agendamentosDeSegunda[index]; - const consultaTer = agendamentosDeTerca[index]; - const consultaQua = agendamentosDeQuarta[index]; - const consultaQui = agendamentosDeQuinta[index]; - const consultaSex = agendamentosDeSexta[index]; + {indicesDeLinha.map((indiceLinha) => ( + + {/* Célula para Horário (Pode ser ajustado para mostrar o horário real) */} + - - const horarioDaLinha = consultaSeg?.horario || consultaTer?.horario || consultaQua?.horario || consultaQui?.horario || consultaSex?.horario; - - return ( - - - - - - - - - ); - })} + {/* Mapeamento de COLUNAS (dias) */} + + + + + + + ))}
{horarioDaLinha}{consultaSeg && }{consultaTer && }{consultaQua && }{consultaQui && }{consultaSex && }
+ {semanaParaRenderizar.segunda[indiceLinha] + ? + : null + } + + {semanaParaRenderizar.terça[indiceLinha] + ? + : null + } + + {semanaParaRenderizar.quarta[indiceLinha] + ? + : null + } + + {semanaParaRenderizar.quinta[indiceLinha] + ? + : null + } + + {semanaParaRenderizar.sexta[indiceLinha] + ? + : null + } +
diff --git a/src/components/AgendarConsulta/style/styleTabelas/tabeladia.css b/src/components/AgendarConsulta/style/styleTabelas/tabeladia.css index 6228433..0e94023 100644 --- a/src/components/AgendarConsulta/style/styleTabelas/tabeladia.css +++ b/src/components/AgendarConsulta/style/styleTabelas/tabeladia.css @@ -114,4 +114,9 @@ html[data-bs-theme="dark"] .mostrar-horario th { border: 1px solid #333; color: #e0e0e0; background-color: #232323; -} \ No newline at end of file +} +/* +.container-botons{ + margin-left: 10rem; + background-color: pink; +}*/ \ No newline at end of file diff --git a/src/components/AgendarConsulta/style/styleTabelas/tabelames.css b/src/components/AgendarConsulta/style/styleTabelas/tabelames.css index 5fbe05c..2197260 100644 --- a/src/components/AgendarConsulta/style/styleTabelas/tabelames.css +++ b/src/components/AgendarConsulta/style/styleTabelas/tabelames.css @@ -219,4 +219,14 @@ html[data-bs-theme="dark"] .usuario-default { html[data-bs-theme="dark"] .cards-que-faltam { color: #90caf9; +} + +.cabecalho-tabela{ + color: white; + background-color: #005a9e; +} + +.container-botons{ + margin-left: 5rem; + } \ No newline at end of file diff --git a/src/components/TrocardePerfis.jsx b/src/components/TrocardePerfis.jsx index d340b7f..87b2482 100644 --- a/src/components/TrocardePerfis.jsx +++ b/src/components/TrocardePerfis.jsx @@ -33,6 +33,7 @@ const TrocardePerfis = () => { { key: "medico", label: "Médico", route: "/medico" }, { key: "financeiro", label: "Financeiro", route: "/financeiro" }, { key: "admin", label: "Administração", route: "/admin" }, + { key: "paciente", label: "Paciente", route: "/paciente" }, ].filter( (opt) => showProfiles?.includes(opt.key) || showProfiles?.includes("admin") diff --git a/src/components/utils/Functions-Endpoints/Doctor.js b/src/components/utils/Functions-Endpoints/Doctor.js index 2d6046f..d3c0e28 100644 --- a/src/components/utils/Functions-Endpoints/Doctor.js +++ b/src/components/utils/Functions-Endpoints/Doctor.js @@ -4,8 +4,6 @@ import API_KEY from "../apiKeys"; const GetDoctorByID = async (ID,authHeader) => { - console.log(authHeader, 'mostrando autorização dentro da função') - var myHeaders = new Headers(); myHeaders.append('apikey', API_KEY) myHeaders.append('Authorization', authHeader) @@ -23,4 +21,36 @@ return DictMedico } -export {GetDoctorByID} \ No newline at end of file +const GetAllDoctors = async (authHeader) => { + var myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + + var requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + const result = await fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions) + const DictMedicos = await result.json() + return DictMedicos + } + + +const GetDoctorByName = async (nome, authHeader) => { + const Medicos = await GetAllDoctors(authHeader) + + for (let i = 0; i < Medicos.length; i++) { + + if (Medicos[i].full_name === nome) { + console.log('Medico encontrado:', Medicos[i]); + return Medicos[i]; + } + else{console.log("nada encontrado")} + } + + +} + +export {GetDoctorByID, GetDoctorByName} \ No newline at end of file diff --git a/src/components/utils/Functions-Endpoints/Patient.js b/src/components/utils/Functions-Endpoints/Patient.js index ad84854..14cbfd6 100644 --- a/src/components/utils/Functions-Endpoints/Patient.js +++ b/src/components/utils/Functions-Endpoints/Patient.js @@ -4,8 +4,6 @@ import API_KEY from "../apiKeys"; const GetPatientByID = async (ID,authHeader) => { - console.log(authHeader, 'mostrando autorização dentro da função') - var myHeaders = new Headers(); myHeaders.append('apikey', API_KEY) myHeaders.append('Authorization', authHeader) diff --git a/src/data/sidebar-items-paciente.json b/src/data/sidebar-items-paciente.json new file mode 100644 index 0000000..bb15caf --- /dev/null +++ b/src/data/sidebar-items-paciente.json @@ -0,0 +1,13 @@ +[ +{ + "name": "Minhas consulta", + "icon": "calendar-plus-fill", + "url": "/paciente/agendamento" + }, + + { + "name": "Meus laudos", + "icon": "table", + "url": "/paciente/laudo" + } +] diff --git a/src/pages/Agendamento.jsx b/src/pages/Agendamento.jsx index d693cfe..27febb3 100644 --- a/src/pages/Agendamento.jsx +++ b/src/pages/Agendamento.jsx @@ -1,23 +1,80 @@ -import React, { useState, useMemo } from 'react'; - +import React, { useState, useMemo, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; +import API_KEY from '../components/utils/apiKeys.js'; +import AgendamentoCadastroManager from './AgendamentoCadastroManager.jsx'; import TabelaAgendamentoDia from '../components/AgendarConsulta/TabelaAgendamentoDia'; import TabelaAgendamentoSemana from '../components/AgendarConsulta/TabelaAgendamentoSemana'; import TabelaAgendamentoMes from '../components/AgendarConsulta/TabelaAgendamentoMes'; import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta'; - +import { useAuth } from '../components/utils/AuthProvider.js'; // ✨ NOVO: Caminho de importação corrigido com base na sua estrutura de pastas import AgendamentosMes from '../components/AgendarConsulta/DadosConsultasMock.js'; + import dayjs from 'dayjs'; import "./style/Agendamento.css"; import './style/FilaEspera.css'; const Agendamento = () => { + const navigate = useNavigate(); - const [FiladeEspera, setFiladeEspera] = useState(false); + const [FiladeEspera, setFiladeEspera] = useState(false); const [tabela, setTabela] = useState('diario'); const [PageNovaConsulta, setPageConsulta] = useState(false); const [searchTerm, setSearchTerm] = useState(''); + const [agendamentos, setAgendamentos] = useState() + const {getAuthorizationHeader} = useAuth() + const [DictAgendamentosOrganizados, setAgendamentosOrganizados ] = useState({}) + + const [showDeleteModal, setShowDeleteModal] = useState(false) + const [AgendamentoFiltrado, setAgendamentoFiltrado] = useState() + + + let authHeader = getAuthorizationHeader() + + const FiltrarAgendamentos = (listaTodosAgendamentos) => { + let DictAgendamentosOrganizados = {}; + + for (let i = 0; i < listaTodosAgendamentos.length; i++) { + const agendamento = listaTodosAgendamentos[i]; + const DiaAgendamento = agendamento.scheduled_at.split("T")[0]; + + console.log(DictAgendamentosOrganizados) + + if (DiaAgendamento in DictAgendamentosOrganizados) { + // já existe a data → adiciona na lista + DictAgendamentosOrganizados[DiaAgendamento].push(agendamento); + } else { + // não existe → cria nova key com uma lista + DictAgendamentosOrganizados[DiaAgendamento] = [agendamento]; + } + } + + // faz o set de uma vez só ✅ + setAgendamentosOrganizados(DictAgendamentosOrganizados); + + } + + // Requisição inicial para mostrar os agendamentos do banco de dados + useEffect(() => { + + var myHeaders = new Headers(); + myHeaders.append("Authorization", authHeader); + myHeaders.append("apikey", API_KEY) + + var requestOptions = { + method: 'GET', + headers: myHeaders, + redirect: 'follow' + }; + + fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?select&doctor_id&patient_id&status&scheduled_at&order&limit&offset", requestOptions) + .then(response => response.json()) + .then(result => {FiltrarAgendamentos(result); console.log(result, "aqui")}) + .catch(error => console.log('error', error)); + }, []) + + // Dados da fila de espera (sem alteração) const filaEsperaData = [ @@ -76,7 +133,7 @@ const Agendamento = () => { default: break } } - let ListaDiasDatas = [segundas, tercas, quartas, quintas, sextas] + let ListaDiasDatas = {segundas:segundas,tercas:tercas,quartas: quartas,quintas: quintas,sextas: sextas} return ListaDiasDatas } @@ -91,6 +148,10 @@ const Agendamento = () => {

Agendar nova consulta

+ + {!PageNovaConsulta ? (
@@ -169,9 +230,9 @@ const Agendamento = () => {
- {tabela === "diario" && } - {tabela === 'semanal' && } - {tabela === 'mensal' && } + {tabela === "diario" && } + {tabela === 'semanal' && } + {tabela === 'mensal' && }
) @@ -216,8 +277,65 @@ const Agendamento = () => {
) : ( - + )} + + {showDeleteModal && ( +
+ e.target.classList.contains("modal") && setShowDeleteModal(false) + } + > +
+
+ +
+
+ Confirmação de Exclusão +
+ +
+ +
+

+ Tem certeza que deseja excluir este paciente? +

+
+ +
+ + + + + +
+
+
+
)} + + ) } diff --git a/src/pages/AgendamentoCadastroManager.jsx b/src/pages/AgendamentoCadastroManager.jsx new file mode 100644 index 0000000..7c97640 --- /dev/null +++ b/src/pages/AgendamentoCadastroManager.jsx @@ -0,0 +1,58 @@ +import React from 'react' +import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta' +import API_KEY from '../components/utils/apiKeys' +import { useAuth } from '../components/utils/AuthProvider' +import { useState } from 'react' +import dayjs from 'dayjs' + +const AgendamentoCadastroManager = () => { + + const {getAuthorizationHeader} = useAuth() + const [agendamento, setAgendamento] = useState({}) + + + let authHeader = getAuthorizationHeader() + + const handleSave = (Dict) => { + let DataAtual = dayjs() + var myHeaders = new Headers(); + myHeaders.append("apikey", API_KEY); + myHeaders.append("Authorization", authHeader); + myHeaders.append("Content-Type", "application/json"); + + var raw = JSON.stringify({ + "patient_id": Dict.patient_id, + "doctor_id": Dict.doctor_id, + "scheduled_at": DataAtual, + "duration_minutes": 30, + "appointment_type": "presencial", + "chief_complaint": "Dor de cabeça há 3 ", + "patient_notes": "Prefiro horário pela manhã", + "insurance_provider": "Unimed", + "created_by": "87f2662c-9da7-45c0-9e05-521d9d92d105" + }); + + var requestOptions = { + method: 'POST', + headers: myHeaders, + body: raw, + redirect: 'follow' + }; + + fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments", requestOptions) + .then(response => response.text()) + .then(result => console.log(result)) + .catch(error => console.log('error', error)); + + } + + return ( +
+ + + +
+ ) +} + +export default AgendamentoCadastroManager \ No newline at end of file diff --git a/src/pages/AgendamentoEditPage.jsx b/src/pages/AgendamentoEditPage.jsx new file mode 100644 index 0000000..46f3711 --- /dev/null +++ b/src/pages/AgendamentoEditPage.jsx @@ -0,0 +1,70 @@ +import React from 'react' +import FormNovaConsulta from '../components/AgendarConsulta/FormNovaConsulta' +import { useState } from 'react' +import { useParams } from 'react-router-dom' +import API_KEY from '../components/utils/apiKeys' +import { useAuth } from '../components/utils/AuthProvider' +import dayjs from 'dayjs' + + +const AgendamentoEditPage = () => { + + let DataAtual = dayjs() + const {getAuthorizationHeader} = useAuth() + const params = useParams() + const [PatientToPatch, setPatientToPatch] = useState({}) + + let id = params.id + + console.log(id) + + let authHeader = getAuthorizationHeader() + + const handleSave = (DictParaPatch) => { + var myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + myHeaders.append('apikey', API_KEY) + myHeaders.append("authorization", authHeader) + + console.log(DictParaPatch) + + var raw = JSON.stringify({"patient_id": DictParaPatch.patient_id, + "doctor_id": DictParaPatch.doctor_id, + "scheduled_at": DataAtual, + "duration_minutes": 30, + "appointment_type": "presencial", + "chief_complaint": "Dor de cabeça há 3 ", + "patient_notes": "Prefiro horário pela manhã", + "insurance_provider": "Unimed", + "created_by": "87f2662c-9da7-45c0-9e05-521d9d92d105" + + + }); + + console.log(DictParaPatch) + console.log(id) + + var requestOptions = { + method: 'PATCH', + headers: myHeaders, + body: raw, + redirect: 'follow' + }; + + fetch(`https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/appointments?id=eq.${id}`, requestOptions) + .then(response => response.text()) + .then(result => console.log(result)) + .catch(error => console.log('error', error)); + } + + + return ( +
+ + + +
+ ) +} + +export default AgendamentoEditPage diff --git a/src/pages/DoctorTable.jsx b/src/pages/DoctorTable.jsx index 3c67b7d..21dfa84 100644 --- a/src/pages/DoctorTable.jsx +++ b/src/pages/DoctorTable.jsx @@ -77,6 +77,7 @@ function TableDoctor() { return idade; }; +<<<<<<< HEAD // Função para limpar todos os filtros const limparFiltros = () => { setSearch(""); @@ -91,6 +92,13 @@ function TableDoctor() { setDataInicial(""); setDataFinal(""); }; +======= + fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/doctors", requestOptions) + .then(response => response.json()) + .then(result => {setMedicos(result); console.log(result)}) + .catch(error => console.log('error', error)); + }, []); +>>>>>>> main // Buscar médicos da API useEffect(() => { diff --git a/src/pages/PatientCadastroManager.jsx b/src/pages/PatientCadastroManager.jsx index 1504b5b..ccc427c 100644 --- a/src/pages/PatientCadastroManager.jsx +++ b/src/pages/PatientCadastroManager.jsx @@ -155,7 +155,11 @@ function PatientCadastroManager({ setCurrentPage }) { message: 'O cadastro do paciente foi realizado com sucesso.' }); setShowModal(true); +<<<<<<< HEAD +======= + +>>>>>>> main setTimeout(() => { setShowModal(false); navigate('/secretaria/pacientes'); diff --git a/src/pages/ProfilePage.jsx b/src/pages/ProfilePage.jsx index ef09ef1..6d4f10b 100644 --- a/src/pages/ProfilePage.jsx +++ b/src/pages/ProfilePage.jsx @@ -1,206 +1,107 @@ // src/pages/ProfilePage.jsx -import React, { useState } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; -// import { useAuth } from '../components/utils/AuthProvider'; // <-- NOVO: Se você puder importar isso. +import React, { useState } from "react"; +import { useLocation, useNavigate } from "react-router-dom"; +import "./style/ProfilePage.css"; -// --- SIMULAÇÃO DE DADOS DE USUÁRIO --- -// COMO NÃO PODEMOS IMPORTAR O useAuth SEM MEXER EM OUTROS ARQUIVOS, VAMOS USAR ESTA SIMULAÇÃO: const simulatedUserData = { - // ESTA SIMULAÇÃO DEVERIA SER SUBTITUÍDA PELO SEU CONTEXTO DE AUTENTICAÇÃO REAL. - // O EMAIL REALMENTE LOGADO VEM DO CONTEXTO DE AUTENTICAÇÃO (useAuth) - email: 'admin@squad23.com', - role: 'Administrador' // Vamos forçar um valor para fins de visualização + email: "admin@squad23.com", + role: "Administrador", }; const ProfilePage = () => { const location = useLocation(); const navigate = useNavigate(); - // const { user } = useAuth(); // Descomente esta linha e comente o bloco simulatedUserData se puder usar o useAuth! - // --- Lógica de Cargo (AGORA CORRIGIDA PARA PEGAR DA URL SE O CONTEXTO FALHAR) --- const getRoleFromPath = () => { const path = location.pathname; - if (path.includes('/admin')) return 'Administrador'; - if (path.includes('/secretaria')) return 'Secretária'; - if (path.includes('/medico')) return 'Médico'; - if (path.includes('/financeiro')) return 'Financeiro'; - return 'Usuário Padrão'; + if (path.includes("/admin")) return "Administrador"; + if (path.includes("/secretaria")) return "Secretária"; + if (path.includes("/medico")) return "Médico"; + if (path.includes("/financeiro")) return "Financeiro"; + return "Usuário Padrão"; }; - - // Use a simulação ou o dado real: - const userRole = simulatedUserData.role || getRoleFromPath(); - const userEmail = simulatedUserData.email || 'email.nao.encontrado@mediconnect.com'; - - // --- Estados do Componente --- - // Se o nome do usuário vier do contexto de autenticação, use-o aqui - const [userName, setUserName] = useState('Admin Padrão'); + const userRole = simulatedUserData.role || getRoleFromPath(); + const userEmail = simulatedUserData.email || "email.nao.encontrado@example.com"; + + const [userName, setUserName] = useState("Admin Padrão"); const [isEditingName, setIsEditingName] = useState(false); - // --- Funções de Interação --- - - const handleNameChange = (e) => { - if (e.key === 'Enter') { - setIsEditingName(false); - } + const handleNameKeyDown = (e) => { + if (e.key === "Enter") setIsEditingName(false); }; - const handleClose = () => { - navigate(-1); // Volta para a página anterior - }; + const handleClose = () => navigate(-1); return ( -
-
- - {/* Botão de Fechar (X) */} - - {/* 1. Área da Foto de Perfil (Quadrada) */} -
-
-
- -
- - {/* 2. Nome do Usuário com Edição */} -
- {isEditingName ? ( - setUserName(e.target.value)} - onBlur={() => setIsEditingName(false)} - onKeyPress={handleNameChange} - autoFocus - style={styles.nameInput} - /> - ) : ( -

{userName}

- )} - - +
+
+
+
+ +
- {/* 3. Email (AGORA EXIBE O VALOR SIMULADO/CORRIGIDO) */} -

Email: {userEmail}

+
+
+ {isEditingName ? ( + setUserName(e.target.value)} + onBlur={() => setIsEditingName(false)} + onKeyDown={handleNameKeyDown} + autoFocus + /> + ) : ( +

{userName}

+ )} - {/* 4. Cargo (AGORA EXIBE O VALOR SIMULADO/CORRIGIDO) */} -

Cargo: {userRole}

+ +
+ +

+ Email: {userEmail} +

+ +

+ Cargo: {userRole} +

+ +
+ +
+
); }; -// Estilos Atualizados para Aumentar o Tamanho do Modal -const styles = { - overlay: { - position: 'fixed', - top: 0, - left: 0, - right: 0, - bottom: 0, - backgroundColor: 'rgba(0, 0, 0, 0.5)', - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - zIndex: 1100, - }, - modalContainer: { - position: 'relative', - padding: '50px 70px', // Aumentado o padding - backgroundColor: 'white', - borderRadius: '15px', - boxShadow: '0 8px 30px rgba(0, 0, 0, 0.3)', - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - minWidth: '400px', - width: '60%', // Aumentando a largura para cobrir mais a tela - maxWidth: '500px', // Limite máximo para não ficar gigante em telas grandes - height: 'auto', - }, - closeButton: { - position: 'absolute', - top: '15px', - right: '20px', - background: 'none', - border: 'none', - fontSize: '30px', - cursor: 'pointer', - color: '#666', - lineHeight: '1', - }, - // ... (Os estilos de profilePictureContainer, infoContainer, etc., permanecem iguais) - profilePictureContainer: { - width: '120px', - height: '120px', - borderRadius: '15px', - overflow: 'hidden', - boxShadow: '0 4px 10px rgba(0, 0, 0, 0.15)', - marginBottom: '20px', - }, - profilePicturePlaceholder: { - width: '100%', - height: '100%', - backgroundColor: '#A9A9A9', - backgroundImage: 'url(\'data:image/svg+xml;utf8,\')', - backgroundSize: '80%', - backgroundRepeat: 'no-repeat', - backgroundPosition: 'center', - }, - infoContainer: { - textAlign: 'center', - maxWidth: '400px', - width: '100%', - }, - nameSection: { - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - marginBottom: '10px', - }, - userName: { - margin: '0 5px 0 0', - fontSize: '1.8rem', - color: '#333', - }, - nameInput: { - fontSize: '1.8rem', - padding: '5px', - border: '1px solid #ccc', - borderRadius: '5px', - textAlign: 'center', - marginRight: '5px', - }, - editButton: { - background: 'none', - border: 'none', - cursor: 'pointer', - fontSize: '1.2rem', - marginLeft: '5px', - }, - emailText: { - fontSize: '1rem', - color: '#666', - margin: '5px 0', - }, - roleText: { - fontSize: '1.1rem', - color: '#333', - marginTop: '15px', - paddingTop: '10px', - borderTop: '1px solid #eee', - } -}; - -export default ProfilePage; \ No newline at end of file +export default ProfilePage; diff --git a/src/pages/TablePaciente.jsx b/src/pages/TablePaciente.jsx index 94caeab..1006a25 100644 --- a/src/pages/TablePaciente.jsx +++ b/src/pages/TablePaciente.jsx @@ -108,7 +108,11 @@ function TablePaciente({ setCurrentPage, setPatientID }) { const authHeader = getAuthorizationHeader() +<<<<<<< HEAD console.log(authHeader, 'aqui autorização') +======= + console.log(authHeader) +>>>>>>> main var myHeaders = new Headers(); myHeaders.append("apikey", API_KEY); @@ -119,10 +123,17 @@ function TablePaciente({ setCurrentPage, setPatientID }) { redirect: 'follow' }; +<<<<<<< HEAD fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients", requestOptions) .then(response => response.json()) .then(result => setPacientes(result)) .catch(error => console.log('error', error)); +======= + fetch("https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/patients", requestOptions) + .then(response => response.json()) + .then(result => {setPacientes(result); console.log(result)}) + .catch(error => console.log('error', error)); +>>>>>>> main }, [isAuthenticated, getAuthorizationHeader]); // Função para verificar se hoje é aniversário do paciente diff --git a/src/pages/style/Agendamento.css b/src/pages/style/Agendamento.css index 8df2e11..8d1e7eb 100644 --- a/src/pages/style/Agendamento.css +++ b/src/pages/style/Agendamento.css @@ -118,7 +118,7 @@ border-radius: 10px; } -#status-card-consulta-confirmado, .legenda-item-confirmado { +#status-card-consulta-confirmado, .legenda-item-confirmed { background-color: #eef8fb; border:3px solid #d8dfe7; padding: 5px; @@ -288,4 +288,73 @@ html[data-bs-theme="dark"] { color: #fff; background-color: #005a9e; } -} \ No newline at end of file +} + +/* Estilo para o botão de Editar */ +.btn-edit-custom { + background-color: #FFF3CD; + color: #856404; +} + +/* Estilo para o botão de Excluir (Deletar) */ +.btn-delete-custom { + background-color: #F8D7DA; + color: #721C24; + padding: 10px; +} + +.cardconsulta{ + display:flex; + align-items: center; + flex-direction: row; +} + +.container-botons{ + display: flex; + flex-direction: row; +} + +#tabela-seletor-container { + display: flex; + align-items: center; + justify-content: center; + gap: 12px; + + background-color: #fff; + border-radius: 8px; + padding: 6px 12px; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); + + font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto; + width: fit-content; + margin: 0 auto; +} + +#tabela-seletor-container p { + margin: 0; + font-size: 23px; + font-weight: 500; + color: #4085f6; + text-align: center; + white-space: nowrap; +} + +#tabela-seletor-container button { + background: transparent; + border: none; + color: #555; + font-size: 20px; + cursor: pointer; + padding: 4px 6px; + border-radius: 6px; + transition: all 0.2s ease-in-out; +} + +#tabela-seletor-container button:hover { + background-color: rgba(0, 0, 0, 0.05); + color: #000; +} + +#tabela-seletor-container i { + pointer-events: none; +} diff --git a/src/pages/style/ProfilePage.css b/src/pages/style/ProfilePage.css index e69de29..c9215aa 100644 --- a/src/pages/style/ProfilePage.css +++ b/src/pages/style/ProfilePage.css @@ -0,0 +1,178 @@ +/* src/pages/ProfilePage.css */ + +/* Overlay que cobre toda a tela */ +.profile-overlay { + position: fixed; + inset: 0; + background-color: rgba(0, 0, 0, 0.65); + display: flex; + align-items: center; + justify-content: center; + z-index: 20000; /* acima de header, vlibras, botões de acessibilidade */ + padding: 20px; + box-sizing: border-box; +} + +/* Card central (estilo modal amplo parecido com a 4ª foto) */ +.profile-modal { + background: #ffffff; + border-radius: 10px; + padding: 18px; + width: min(1100px, 96%); + max-width: 1100px; + box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5); + position: relative; + box-sizing: border-box; + overflow: visible; +} + +/* Botão fechar (X) no canto do card */ +.profile-close { + position: absolute; + top: 14px; + right: 14px; + background: none; + border: none; + font-size: 26px; + color: #666; + cursor: pointer; + line-height: 1; +} + +/* Conteúdo dividido em 2 colunas: esquerda avatar / direita infos */ +.profile-content { + display: flex; + gap: 28px; + align-items: flex-start; + padding: 22px 18px; +} + +/* Coluna esquerda - avatar */ +.profile-left { + width: 220px; + display: flex; + justify-content: center; +} + +/* Avatar quadrado com sombra (estilo da foto 4) */ +.avatar-wrapper { + position: relative; + width: 180px; + height: 180px; +} + +.avatar-square { + width: 100%; + height: 100%; + border-radius: 8px; + background-color: #d0d0d0; + background-image: url("data:image/svg+xml;utf8,"); + background-position: center; + background-repeat: no-repeat; + background-size: 55%; + box-shadow: 0 8px 24px rgba(0,0,0,0.25); +} + +/* Botão editar sobre o avatar — círculo pequeno */ +.avatar-edit-btn { + position: absolute; + right: -8px; + bottom: -8px; + transform: translate(0, 0); + border: none; + background: #ffffff; + padding: 8px 9px; + border-radius: 50%; + box-shadow: 0 6px 14px rgba(0,0,0,0.18); + cursor: pointer; + font-size: 0.95rem; + line-height: 1; +} + +/* Coluna direita - informações */ +.profile-right { + flex: 1; + min-width: 280px; + display: flex; + flex-direction: column; + justify-content: center; +} + +/* Nome e botão de editar inline */ +.profile-name-row { + display: flex; + align-items: center; + gap: 10px; + margin-bottom: 10px; +} + +.profile-username { + margin: 0; + font-size: 1.9rem; + color: #222; +} + +.profile-edit-inline { + background: none; + border: none; + cursor: pointer; + font-size: 1.05rem; + color: #444; +} + +/* input de edição do nome */ +.profile-name-input { + font-size: 1.6rem; + padding: 6px 8px; + border: 1px solid #e0e0e0; + border-radius: 6px; +} + +/* email/role */ +.profile-email, +.profile-role { + margin: 6px 0; + color: #555; + font-size: 1rem; +} + +.profile-role { + margin-top: 14px; + padding-top: 12px; + border-top: 1px solid #f1f1f1; + color: #333; +} + +/* ações (apenas fechar aqui) */ +.profile-actions-row { + display: flex; + gap: 12px; + margin-top: 18px; +} + +/* botões */ +.btn { + padding: 8px 14px; + border-radius: 8px; + border: 1px solid transparent; + cursor: pointer; + font-size: 0.95rem; +} + +.btn-close { + background: #f0f0f0; + color: #222; + border: 1px solid #e6e6e6; +} + +/* responsividade */ +@media (max-width: 880px) { + .profile-content { + flex-direction: column; + gap: 14px; + align-items: center; + } + .profile-left { width: 100%; } + .avatar-wrapper { width: 140px; height: 140px; } + .profile-right { width: 100%; text-align: center; } +} diff --git a/src/perfis/Perfil_paciente/Perfilpaciente.jsx b/src/perfis/Perfil_paciente/Perfilpaciente.jsx new file mode 100644 index 0000000..d7a64d7 --- /dev/null +++ b/src/perfis/Perfil_paciente/Perfilpaciente.jsx @@ -0,0 +1,23 @@ +import { Routes, Route } from "react-router-dom"; +import Sidebar from "../../components/Sidebar"; +import PacienteItems from "../../data/sidebar-items-paciente.json"; +import Agendamento from "../../pages/Agendamento"; +import LaudoManager from "../../pages/LaudoManager"; +function PerfilPaciente({ onLogout }) { + return ( +
+ + +
+ + } /> + } /> + } /> + Página não encontrada} /> + +
+
+ ); +} + +export default PerfilPaciente; \ No newline at end of file diff --git a/src/perfis/perfil_secretaria/PerfilSecretaria.jsx b/src/perfis/perfil_secretaria/PerfilSecretaria.jsx index baa72a6..1dc5146 100644 --- a/src/perfis/perfil_secretaria/PerfilSecretaria.jsx +++ b/src/perfis/perfil_secretaria/PerfilSecretaria.jsx @@ -15,6 +15,8 @@ import Details from "../../pages/Details"; import EditPage from "../../pages/EditPage"; import DoctorDetails from "../../pages/DoctorDetails"; import DoctorEditPage from "../../pages/DoctorEditPage"; +import FormDisponibilidade from "../../components/AgendarConsulta/FormDisponibilidade"; +import AgendamentoEditPage from "../../pages/AgendamentoEditPage"; function PerfilSecretaria({ onLogout }) { return ( @@ -33,8 +35,10 @@ function PerfilSecretaria({ onLogout }) { } /> } /> } /> - } /> + } /> + } /> Página não encontrada} /> + } />