From 05ca36f24e010c5109da4483a14335646d66c474 Mon Sep 17 00:00:00 2001 From: Muhammad Shahzad Date: Tue, 4 Jun 2024 04:35:53 +0500 Subject: [PATCH] fixes --- .../pages/patient-meetings/prescription.vue | 2 +- resources/js/pages/patients/patients.vue | 47 +++++++++++++------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/resources/js/pages/pages/patient-meetings/prescription.vue b/resources/js/pages/pages/patient-meetings/prescription.vue index 4644238..583e861 100644 --- a/resources/js/pages/pages/patient-meetings/prescription.vue +++ b/resources/js/pages/pages/patient-meetings/prescription.vue @@ -64,7 +64,7 @@ const getStatusColor = (status) => { case 'shipped': return '#45B8AC'; // Use Vuetify's primary color (typically blue) case 'delivered': - return 'green'; + return 'success'; case 'returned': return 'red'; case 'results': diff --git a/resources/js/pages/patients/patients.vue b/resources/js/pages/patients/patients.vue index 746dec4..4725474 100644 --- a/resources/js/pages/patients/patients.vue +++ b/resources/js/pages/patients/patients.vue @@ -38,7 +38,22 @@ const selectedOptions = [ const refVForm = ref(null) onBeforeMount(async () => {}); -onMounted(async () => {}); +onMounted(async () => { + store.dispatch('updateIsLoading', true) + await store.dispatch('patientList') + // console.log('patientList',store.getters.getPatientList) + patientList.value = store.getters.getPatientList + store.dispatch('updateIsLoading', false) + +}); +const getPatientList = computed(async () => { + return patientList.value.map(history => ({ + ...history, + dob: changeFormat(history.dob), + })); + // return patientList.value +}); + onUnmounted(async () => {}); const formatPhoneNumber = () => { console.log(editedItem.value) @@ -139,7 +154,6 @@ const closeDelete = () => { } const getMettings = (Item) => { - console.log("item", Item); router.push('/admin/patient/meetings/'+Item.id); } @@ -176,25 +190,29 @@ const deleteItemConfirm = async () => { patientList.value.splice(editedIndex.value, 1) closeDelete() } -const getPatientList = computed(async () => { - store.dispatch('updateIsLoading', true) - await store.dispatch('patientList') - console.log('patientList',store.getters.getPatientList) - let list = store.getters.getPatientList - store.dispatch('updateIsLoading', false) - patientList.value = list - return patientList.value -}); -onMounted(() => { - -}) +function changeFormat(dateFormat) { + const dateParts = dateFormat.split('-'); // Assuming date is in yyyy-mm-dd format + const year = parseInt(dateParts[0]); + const month = parseInt(dateParts[1]); // No need for padding + const day = parseInt(dateParts[2]); // No need for padding + + // Create a new Date object with the parsed values + const date = new Date(year, month - 1, day); // Month is zero-based in JavaScript Date object + + // Format the date as mm-dd-yyyy + const formattedDate = month + '-' + day + '-' + date.getFullYear(); + console.log("formattedDate",formattedDate) + return formattedDate; +} + +