diff --git a/resources/js/pages/patients/NotesPanel.vue b/resources/js/pages/patients/NotesPanel.vue index 69021e6..69e30b2 100644 --- a/resources/js/pages/patients/NotesPanel.vue +++ b/resources/js/pages/patients/NotesPanel.vue @@ -16,7 +16,6 @@ const props = defineProps({ }) - const formatDateDate = (date) => { const messageDate = new Date(date); const options = { @@ -29,14 +28,25 @@ const formatDateDate = (date) => { return messageDate.toLocaleDateString('en-US', options).replace(/\//g, '-'); }; -const downloadFile = (fileUrl) => { - const link = document.createElement('a'); - link.href = fileUrl; - link.download = 'noteFile.png'; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); -}; +const downloadFile = async (fileUrl, fileName = 'downloadedFile.png') => { + try { + const response = await fetch(fileUrl); + if (!response.ok) throw new Error('Network response was not ok'); + const blob = await response.blob(); + const link = document.createElement('a'); + const url = window.URL.createObjectURL(blob); + link.href = url; + link.download = fileName; + document.body.appendChild(link); + link.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(link); + } catch (error) { + console.error('Download failed', error); + } + }; + + diff --git a/resources/js/pages/patients/patient-profile.vue b/resources/js/pages/patients/patient-profile.vue index fe30926..d23b923 100644 --- a/resources/js/pages/patients/patient-profile.vue +++ b/resources/js/pages/patients/patient-profile.vue @@ -2,11 +2,10 @@ import NotesPanel from '@/pages/patients/NotesPanel.vue' import PatienTabOverview from '@/pages/patients/PatienTabOverview.vue' import PatientBioPanel from '@/pages/patients/PatientBioPanel.vue' +import PatientProfile from '@/pages/patients/PatientProfile.vue' import PrescriptionPanel from '@/pages/patients/PrescriptionPanel.vue' -// import UserTabNotifications from '@/views/apps/user/view/UserTabNotifications.vue' import { useStore } from 'vuex' -import patientProfile from '../patients/patientprofile.vue' const patientDtail = ref(null); const store = useStore(); @@ -27,14 +26,10 @@ const tabs = [ title: 'Prescriptions', }, { - icon: 'ri-survey-line', + icon: 'ri-notification-4-line', title: 'Profile', }, // { - // icon: 'ri-notification-4-line', - // title: 'Notifications', - // }, - // { // icon: 'ri-link-m', // title: 'Connections', // }, @@ -103,12 +98,8 @@ onMounted(async () => { - - - + diff --git a/resources/js/pages/providers/NotesPanel.vue b/resources/js/pages/providers/NotesPanel.vue index eead594..0f8f940 100644 --- a/resources/js/pages/providers/NotesPanel.vue +++ b/resources/js/pages/providers/NotesPanel.vue @@ -37,6 +37,16 @@ const downloadFile = (fileUrl) => { link.click(); document.body.removeChild(link); }; + const downloadImage = async (imageUrl) => { + try { + const response = await fetch(imageUrl) + const blob = await response.blob() + const fileName = imageUrl.split('/').pop() + saveAs(blob, fileName) + } catch (error) { + console.error('Error downloading image:', error) } + } +