initial commit

This commit is contained in:
Inshal
2024-10-25 19:58:19 +05:00
commit 2046156f90
1558 changed files with 210706 additions and 0 deletions

View File

@@ -0,0 +1,384 @@
<script setup>
import { passwordValidator } from '@/@core/utils/validators';
import { PerfectScrollbar } from 'vue3-perfect-scrollbar';
import { VForm } from 'vuetify/components/VForm';
import { useStore } from 'vuex';
const store = useStore()
const props = defineProps({
isDrawerOpen: {
type: Boolean,
required: true,
},
})
const states = ref([
{ name: 'Alabama', abbreviation: 'AL' },
{ name: 'Alaska', abbreviation: 'AK' },
{ name: 'Arizona', abbreviation: 'AZ' },
{ name: 'Arkansas', abbreviation: 'AR' },
{ name: 'Howland Island', abbreviation: 'UM-84' },
{ name: 'Delaware', abbreviation: 'DE' },
{ name: 'Maryland', abbreviation: 'MD' },
{ name: 'Baker Island', abbreviation: 'UM-81' },
{ name: 'Kingman Reef', abbreviation: 'UM-89' },
{ name: 'New Hampshire', abbreviation: 'NH' },
{ name: 'Wake Island', abbreviation: 'UM-79' },
{ name: 'Kansas', abbreviation: 'KS' },
{ name: 'Texas', abbreviation: 'TX' },
{ name: 'Nebraska', abbreviation: 'NE' },
{ name: 'Vermont', abbreviation: 'VT' },
{ name: 'Jarvis Island', abbreviation: 'UM-86' },
{ name: 'Hawaii', abbreviation: 'HI' },
{ name: 'Guam', abbreviation: 'GU' },
{ name: 'United States Virgin Islands', abbreviation: 'VI' },
{ name: 'Utah', abbreviation: 'UT' },
{ name: 'Oregon', abbreviation: 'OR' },
{ name: 'California', abbreviation: 'CA' },
{ name: 'New Jersey', abbreviation: 'NJ' },
{ name: 'North Dakota', abbreviation: 'ND' },
{ name: 'Kentucky', abbreviation: 'KY' },
{ name: 'Minnesota', abbreviation: 'MN' },
{ name: 'Oklahoma', abbreviation: 'OK' },
{ name: 'Pennsylvania', abbreviation: 'PA' },
{ name: 'New Mexico', abbreviation: 'NM' },
{ name: 'American Samoa', abbreviation: 'AS' },
{ name: 'Illinois', abbreviation: 'IL' },
{ name: 'Michigan', abbreviation: 'MI' },
{ name: 'Virginia', abbreviation: 'VA' },
{ name: 'Johnston Atoll', abbreviation: 'UM-67' },
{ name: 'West Virginia', abbreviation: 'WV' },
{ name: 'Mississippi', abbreviation: 'MS' },
{ name: 'Northern Mariana Islands', abbreviation: 'MP' },
{ name: 'United States Minor Outlying Islands', abbreviation: 'UM' },
{ name: 'Massachusetts', abbreviation: 'MA' },
{ name: 'Connecticut', abbreviation: 'CT' },
{ name: 'Florida', abbreviation: 'FL' },
{ name: 'District of Columbia', abbreviation: 'DC' },
{ name: 'Midway Atoll', abbreviation: 'UM-71' },
{ name: 'Navassa Island', abbreviation: 'UM-76' },
{ name: 'Indiana', abbreviation: 'IN' },
{ name: 'Wisconsin', abbreviation: 'WI' },
{ name: 'Wyoming', abbreviation: 'WY' },
{ name: 'South Carolina', abbreviation: 'SC' },
{ name: 'South Dakota', abbreviation: 'SD' },
{ name: 'Montana', abbreviation: 'MT' },
{ name: 'North Carolina', abbreviation: 'NC' },
{ name: 'Palmyra Atoll', abbreviation: 'UM-95' },
{ name: 'Puerto Rico', abbreviation: 'PR' },
{ name: 'Colorado', abbreviation: 'CO' },
{ name: 'Missouri', abbreviation: 'MO' },
{ name: 'New York', abbreviation: 'NY' },
{ name: 'Maine', abbreviation: 'ME' },
{ name: 'Tennessee', abbreviation: 'TN' },
{ name: 'Georgia', abbreviation: 'GA' },
{ name: 'Louisiana', abbreviation: 'LA' },
{ name: 'Nevada', abbreviation: 'NV' },
{ name: 'Iowa', abbreviation: 'IA' },
{ name: 'Idaho', abbreviation: 'ID' },
{ name: 'Rhode Island', abbreviation: 'RI' },
{ name: 'Washington', abbreviation: 'WA' },
{ name: 'Ohio', abbreviation: 'OH' },
// ... (add the rest of the states)
]);
const sortedStates = computed(() => {
return states.value.slice().sort((a, b) => {
return a.name.localeCompare(b.name);
});
});
const isPasswordVisible = ref(false)
const emit = defineEmits(['update:isDrawerOpen','patientAdded'])
const formatPhoneNumber = () => {
// Remove non-numeric characters from the input
const numericValue = phone_no.value.replace(/\D/g, '');
// Apply formatting logic
if (numericValue.length <= 10) {
phone_no.value = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
} else {
// Limit the input to a maximum of 14 characters
const truncatedValue = numericValue.slice(0, 10);
phone_no.value= truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
}
};
const handleDrawerModelValueUpdate = val => {
emit('update:isDrawerOpen', val)
}
const genders = ref([
{ name: 'Male', abbreviation: 'Male' },
{ name: 'Female', abbreviation: 'Female' },
{ name: 'Other', abbreviation: 'Other' },
]);
const refVForm = ref()
const first_name = ref()
const last_name = ref()
const email = ref()
const addressLine1 = ref()
const city = ref()
const state = ref()
const zip_code = ref()
const country = ref()
const phone_no = ref()
const dob = ref()
const gender = ref()
const password = ref()
const isBillingAddress = ref(false)
const getCurrentDate = () => {
const today = new Date();
console.log("today", today);
const year = today.getFullYear();
let month = today.getMonth() + 1;
let day = today.getDate();
// Format the date to match the input type="date" format
month = month < 10 ? `0${month}` : month;
day = day < 10 ? `0${day}` : day;
return `${month}-${day}-${year}`;
};
const calculateAge = (dateOfBirth) => {
const today = new Date();
const birthDate = new Date(dateOfBirth);
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (
monthDiff < 0 ||
(monthDiff === 0 && today.getDate() < birthDate.getDate())
) {
age--;
}
return age;
};
const onSubmit = async () => {
const { valid } = await refVForm.value.validate()
if (valid) {
if (calculateAge(dob.value) >= 18) {
await store.dispatch('patientAdd', {
first_name: first_name.value,
last_name: last_name.value,
email: email.value,
password: password.value,
phone_no: phone_no.value,
dob: dob.value,
address: addressLine1.value,
city: city.value,
state: state.value,
zip_code:zip_code.value,
country: country.value,
gender: gender.value
})
} else {
store.dispatch('updateErrorMessage', 'Patient must be 18+')
}
if (!store.getters.getErrorMsg) {
emit('patientAdded', 'success')
first_name.value = null
last_name.value = null
email.value = null
password.value = null
phone_no.value = null
dob.value = null
addressLine1.value = null
city.value = null
state.value = null
country.value = null
zip_code.value = null
emit('update:isDrawerOpen', false)
}
}
}
const resetForm = () => {
refVForm.value?.reset()
emit('update:isDrawerOpen', false)
}
</script>
<template>
<VNavigationDrawer
:model-value="props.isDrawerOpen"
temporary
location="end"
width="800"
@update:model-value="handleDrawerModelValueUpdate"
>
<!-- 👉 Header -->
<AppDrawerHeaderSection
title="Add Patient"
@cancel="$emit('update:isDrawerOpen', false)"
/>
<VDivider />
<VCard flat>
<PerfectScrollbar
:options="{ wheelPropagation: false }"
class="h-100"
>
<VCardText style="block-size: calc(100vh - 5rem);">
<VForm
ref="refVForm"
@submit.prevent=""
>
<VRow>
<VCol cols="12" md="12">
<div class="text-body-1 font-weight-medium text-high-emphasis">
Basic Information
</div>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="first_name"
label="First Name"
:rules="[requiredValidator]"
placeholder="First Name"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="last_name"
label="Last Name"
:rules="[requiredValidator]"
placeholder="Last Name"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="email"
label="Email Address"
:rules="[requiredValidator, emailValidator]"
placeholder="johndoe@email.com"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="password"
label="Password"
placeholder="············"
:type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon="isPasswordVisible ? 'ri-eye-off-line' : 'ri-eye-line'"
@click:append-inner="isPasswordVisible = !isPasswordVisible"
:rules="[requiredValidator, passwordValidator]"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField v-model="phone_no" label="Phone Number" pattern="^\(\d{3}\) \d{3}-\d{4}$"
:rules="[requiredPhone, validUSAPhone]" placeholder="i.e. (000) 000-0000"
@input="formatPhoneNumber" max="14" density="comfortable" />
</VCol>
<VCol cols="12" md="6">
<v-select v-model="gender" label="Gender" :items="genders" item-title="name" item-value="abbreviation"
:rules="[requiredValidator]" density="comfortable">
</v-select>
</VCol>
<VCol cols="12" md="6">
<AppDateTimePicker
v-model="dob"
label="Date Of Birth"
placeholder="Date Of Birth"
format="MM-dd-yyyy"
:config="{ dateFormat: 'Y-m-d' }"
:max="getCurrentDate()"
:rules="[requiredValidator]"
/>
</VCol>
<VCol cols="12">
<div class="text-body-1 font-weight-medium text-high-emphasis">
Shipping Information
</div>
</VCol>
<VCol cols="12">
<VTextField
v-model="addressLine1"
label="Address Line 1*"
:rules="[requiredValidator]"
placeholder="45, Rocker Terrace"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="city"
label="City*"
:rules="[requiredValidator]"
placeholder="New York"
/>
</VCol>
<VCol cols="12" md="6">
<VAutocomplete
v-model="state"
label="States"
:items="sortedStates"
item-title="name" item-value="abbreviation"
placeholder="Select State"
:rules="[requiredState]"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="zip_code"
label="Zip Code*"
type="number"
:rules="[requiredValidator]"
placeholder="982347"
/>
</VCol>
<VCol cols="12" md="6">
<VSelect
v-model="country"
placeholder="United States"
:rules="[requiredValidator]"
label="Country"
:items="['United States']"
/>
</VCol>
<VCol cols="12">
<div class="d-flex justify-start">
<VBtn
type="submit"
color="primary"
class="me-4"
@click="onSubmit"
>
Save
</VBtn>
<VBtn
color="error"
variant="outlined"
@click="resetForm"
>
Discard
</VBtn>
</div>
</VCol>
</VRow>
</VForm>
</VCardText>
</PerfectScrollbar>
</VCard>
</VNavigationDrawer>
</template>
<style lang="scss">
.v-navigation-drawer__content {
overflow-y: hidden !important;
}
</style>

View File

@@ -0,0 +1,328 @@
<script setup>
const props = defineProps({
userData: {
type: Object,
required: true,
},
})
import moment from 'moment';
import { onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const editDialog = ref(false);
const deleteDialog = ref(false);
const search = ref('');
const appointmentId = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
});
const editedItem = ref({ ...defaultItem.value });
const editedIndex = ref(-1);
const patientMeetingList = ref([]);
const isLoading = ref(false);
// Status options
const selectedOptions = [
{ text: 'Active', value: 1 },
{ text: 'InActive', value: 2 },
];
const refVForm = ref(null);
// Headers
const headers = [
{ title: 'Order ID', key: 'order_id' },
{ title: 'Provider Name', key: 'provider_name' },
// { key: 'appointment_date', sortable: false, title: 'Date' },
{ key: 'start_time', title: 'Start Time' },
// { key: 'end_time', title: 'End Time' },
{ key: 'duration', title: 'Duration' },
// { title: 'ACTIONS', key: 'actions' },
];
function totalCallDuration(start_time, end_time) {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = String(duration.hours()).padStart(2, '0');
const minutes = String(duration.minutes()).padStart(2, '0');
const seconds = String(duration.seconds()).padStart(2, '0');
if (hours === '00' && minutes === '00') {
return `00:00:${seconds}`;
} else if (hours === '00') {
return `00:${minutes}`;
} else {
return `${hours}:${minutes}`;
}
}
const formatDate = (date) => {
const messageDate = new Date(date);
const options = {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric', // Change from '2-digit' to 'numeric'
minute: '2-digit',
hour12: true, // Add hour12: true to get 12-hour format with AM/PM
};
const formattedDate = messageDate.toLocaleString('en-US', options).replace(/\//g, '-');
return `${formattedDate} `;
};
const convertUtcTime = (time, date, timezone) => {
const timezones = {
"EST": "America/New_York",
"CST": "America/Chicago",
"MST": "America/Denver",
"PST": "America/Los_Angeles",
"PST": "Asia/Karachi"
// Add more mappings as needed
};
// Get the IANA timezone identifier from the abbreviation
let ianaTimeZone = timezones[timezone];
if (!ianaTimeZone) {
// throw new Error(`Unknown timezone abbreviation: ${timezone}`);
timezone='PST'
ianaTimeZone = timezones[timezone];
}
// Combine date and time into a single string
const dateTimeString = `${date}T${time}Z`; // Assuming the input date and time are in UTC
// Create a Date object from the combined string
const dateObj = new Date(dateTimeString);
// Options for the formatter
const options = {
timeZone: ianaTimeZone,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
};
// Create the formatter
const formatter = new Intl.DateTimeFormat('en-US', options);
// Format the date
const convertedDateTime = formatter.format(dateObj);
return convertedDateTime;
};
const getConvertedTime = (inputDate) => {
// Split the input date string into date and time components
const [datePart, timePart] = inputDate.split(', ');
// Split the time component into hours, minutes, and seconds
let [hours, minutes, seconds] = timePart.split(':');
// Convert the hours to an integer
hours = parseInt(hours);
const period = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12 || 12; // Convert 0 and 12 to 12, and other hours to 1-11
// Format the time as desired
const formattedTime = `${hours.toString().padStart(2, '0')}:${minutes} ${period}`;
return formattedTime;
}
const getConvertedDate = (inputDate) => {
// Split the input date string into date and time components
const [datePart, timePart] = inputDate.split(', ');
// Split the date component into month, day, and year
const [month, day, year] = datePart.split('/');
// Create a new Date object from the parsed components
const dateObject = new Date(`${year}-${month}-${day}T${timePart}`);
// Define an array of month names
const monthNames = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
// Format the date as desired
const formattedDate = `${monthNames[dateObject.getMonth()]} ${day}, ${year}`;
return formattedDate;
};
const changeDateTime = (dateT, timezone) => {
const [date, time] = dateT.split(' ');
let formatedate =changeFormat(date)
let fortmtetime = getConvertedTime(convertUtcTime(time, date, timezone))
console.log(fortmtetime,formatedate)
return formatedate +' '+fortmtetime
}
// Fetch and process the patient meeting list
const getPatientMeetingList = async () => {
//store.dispatch('updateIsLoading', true);
//await store.dispatch('patientMeetingList', { id: route.params.id });
// store.dispatch('updateIsLoading', false);
let list = props.userData.completed_meetings;
patientMeetingList.value = list.map(history => ({
...history,
//appointment_date: formatDate(history.appointment_date),
appointment_time: getConvertedTime(convertUtcTime(history.appointment_time, history.appointment_date, history.timezone)),
appointment_date: changeFormat(history.appointment_date),
start_time: history.start_time,
end_time: history.end_time,
duration: totalCallDuration(history.start_time, history.end_time),
}));
patientMeetingList.value.sort((a, b) => {
return b.order_id - a.order_id;
});
console.log(list);
};
function changeFormat(dateFormat) {
const dateParts = dateFormat.split('-'); // Assuming date is in yyyy-mm-dd format
const year = parseInt(dateParts[0]);
const month = String(dateParts[1]).padStart(2, '0'); // Pad single-digit months with leading zero
const day = String(dateParts[2]).padStart(2, '0'); // Pad single-digit days with leading zero
// 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();
return formattedDate;
}
// Lifecycle hooks
onBeforeMount(() => {});
onMounted(async () => {
await getPatientMeetingList();
});
onUnmounted(() => {});
const historyDetail = (item, value) => {
console.log('item',item.id ,value)
if(value == 'notes')
router.push('/admin/patient/meeting/notes/' + route.params.id + '/' + item.id);
if(value == 'prescription')
router.push('/admin/patient/meeting/prescription/' + route.params.id + '/' + item.id);
}
const menusVariant = [
'primary'
];
const options = [
{
title: 'Notes',
key: 'notes',
},
{
title: 'Prescription',
key: 'prescription',
},
]
</script>
<template>
<v-row>
<v-col cols="12" md="12">
<v-card title="Meetings">
<v-card-text>
<v-row>
<v-col cols="12" offset-md="8" md="4">
<v-text-field
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</v-col>
</v-row>
</v-card-text>
<v-data-table
:headers="headers"
:items="patientMeetingList"
:search="search"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.id="{ item }">{{ item.id }}</template>
<template #item.order_id="{ item }">
<RouterLink :to="{ name: 'admin-order-detail', params: { id: item.order_id } }">
<span class=""> #{{ item.order_id }} &nbsp;</span>
</RouterLink>
</template>
<template #item.provider_name="{ item }">
<div class="d-flex flex-column ms-3">
<router-link
:to="{ name: 'admin-provider-profile', params: { id: item.provider_id } }"
class="highlighted"
>
<span class="d-block font-weight-medium text-truncate">{{ item.provider_name }}</span>
</router-link>
</div>
</template>
<template #item.start_time="{ item }">{{ changeDateTime(item.start_time,item.timezone) }}</template>
<template #item.end_time="{ item }">{{ changeDateTime(item.end_time,item.timezone) }}</template>
<template #item.duration="{ item }">{{ item.duration }}</template>
<!-- Actions -->
<template #item.actions="{ item }">
<div class="demo-space-x">
<VMenu
v-for="menu in menusVariant"
:key="menu"
>
<template #activator="{ props }">
<i class="ri-more-2-line cursor-pointer" style="font-size: 32px;" v-bind="props"></i>
</template>
<v-list>
<v-list-item
v-for="opt in options"
:key="opt.value"
@click="historyDetail(item, opt.key)"
>
{{ opt.title }}
</v-list-item>
</v-list>
</VMenu>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>
</div> -->
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</template>

View File

@@ -0,0 +1,408 @@
<script setup>
import { PerfectScrollbar } from 'vue3-perfect-scrollbar';
import { VForm } from 'vuetify/components/VForm';
import { useStore } from 'vuex';
const store = useStore()
const props = defineProps({
isDrawerOpen: {
type: Boolean,
required: true,
},
userData: {
type: Object,
required: true,
}
})
const states = ref([
{ name: 'Alabama', abbreviation: 'AL' },
{ name: 'Alaska', abbreviation: 'AK' },
{ name: 'Arizona', abbreviation: 'AZ' },
{ name: 'Arkansas', abbreviation: 'AR' },
{ name: 'Howland Island', abbreviation: 'UM-84' },
{ name: 'Delaware', abbreviation: 'DE' },
{ name: 'Maryland', abbreviation: 'MD' },
{ name: 'Baker Island', abbreviation: 'UM-81' },
{ name: 'Kingman Reef', abbreviation: 'UM-89' },
{ name: 'New Hampshire', abbreviation: 'NH' },
{ name: 'Wake Island', abbreviation: 'UM-79' },
{ name: 'Kansas', abbreviation: 'KS' },
{ name: 'Texas', abbreviation: 'TX' },
{ name: 'Nebraska', abbreviation: 'NE' },
{ name: 'Vermont', abbreviation: 'VT' },
{ name: 'Jarvis Island', abbreviation: 'UM-86' },
{ name: 'Hawaii', abbreviation: 'HI' },
{ name: 'Guam', abbreviation: 'GU' },
{ name: 'United States Virgin Islands', abbreviation: 'VI' },
{ name: 'Utah', abbreviation: 'UT' },
{ name: 'Oregon', abbreviation: 'OR' },
{ name: 'California', abbreviation: 'CA' },
{ name: 'New Jersey', abbreviation: 'NJ' },
{ name: 'North Dakota', abbreviation: 'ND' },
{ name: 'Kentucky', abbreviation: 'KY' },
{ name: 'Minnesota', abbreviation: 'MN' },
{ name: 'Oklahoma', abbreviation: 'OK' },
{ name: 'Pennsylvania', abbreviation: 'PA' },
{ name: 'New Mexico', abbreviation: 'NM' },
{ name: 'American Samoa', abbreviation: 'AS' },
{ name: 'Illinois', abbreviation: 'IL' },
{ name: 'Michigan', abbreviation: 'MI' },
{ name: 'Virginia', abbreviation: 'VA' },
{ name: 'Johnston Atoll', abbreviation: 'UM-67' },
{ name: 'West Virginia', abbreviation: 'WV' },
{ name: 'Mississippi', abbreviation: 'MS' },
{ name: 'Northern Mariana Islands', abbreviation: 'MP' },
{ name: 'United States Minor Outlying Islands', abbreviation: 'UM' },
{ name: 'Massachusetts', abbreviation: 'MA' },
{ name: 'Connecticut', abbreviation: 'CT' },
{ name: 'Florida', abbreviation: 'FL' },
{ name: 'District of Columbia', abbreviation: 'DC' },
{ name: 'Midway Atoll', abbreviation: 'UM-71' },
{ name: 'Navassa Island', abbreviation: 'UM-76' },
{ name: 'Indiana', abbreviation: 'IN' },
{ name: 'Wisconsin', abbreviation: 'WI' },
{ name: 'Wyoming', abbreviation: 'WY' },
{ name: 'South Carolina', abbreviation: 'SC' },
{ name: 'South Dakota', abbreviation: 'SD' },
{ name: 'Montana', abbreviation: 'MT' },
{ name: 'North Carolina', abbreviation: 'NC' },
{ name: 'Palmyra Atoll', abbreviation: 'UM-95' },
{ name: 'Puerto Rico', abbreviation: 'PR' },
{ name: 'Colorado', abbreviation: 'CO' },
{ name: 'Missouri', abbreviation: 'MO' },
{ name: 'New York', abbreviation: 'NY' },
{ name: 'Maine', abbreviation: 'ME' },
{ name: 'Tennessee', abbreviation: 'TN' },
{ name: 'Georgia', abbreviation: 'GA' },
{ name: 'Louisiana', abbreviation: 'LA' },
{ name: 'Nevada', abbreviation: 'NV' },
{ name: 'Iowa', abbreviation: 'IA' },
{ name: 'Idaho', abbreviation: 'ID' },
{ name: 'Rhode Island', abbreviation: 'RI' },
{ name: 'Washington', abbreviation: 'WA' },
{ name: 'Ohio', abbreviation: 'OH' },
// ... (add the rest of the states)
]);
const sortedStates = computed(() => {
return states.value.slice().sort((a, b) => {
return a.name.localeCompare(b.name);
});
});
const isPasswordVisible = ref(false)
const emit = defineEmits(['update:isDrawerOpen','patientAdded'])
const formatPhoneNumber = () => {
// Remove non-numeric characters from the input
const numericValue = phone_no.value.replace(/\D/g, '');
// Apply formatting logic
if (numericValue.length <= 10) {
phone_no.value = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
} else {
// Limit the input to a maximum of 14 characters
const truncatedValue = numericValue.slice(0, 10);
phone_no.value= truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
}
};
const handleDrawerModelValueUpdate = val => {
emit('update:isDrawerOpen', val)
}
const genders = ref([
{ name: 'Male', abbreviation: 'Male' },
{ name: 'Female', abbreviation: 'Female' },
{ name: 'Other', abbreviation: 'Other' },
]);
const refVForm = ref()
const first_name = ref()
const last_name = ref()
const email = ref()
const addressLine1 = ref()
const city = ref()
const state = ref()
const zip_code = ref()
const country = ref()
const phone_no = ref()
const dob = ref()
const gender = ref()
const password = ref()
const itemId = ref()
const isBillingAddress = ref(false)
const getCurrentDate = () => {
const today = new Date();
console.log("today", today);
const year = today.getFullYear();
let month = today.getMonth() + 1;
let day = today.getDate();
// Format the date to match the input type="date" format
month = month < 10 ? `0${month}` : month;
day = day < 10 ? `0${day}` : day;
return `${month}-${day}-${year}`;
};
const calculateAge = (dateOfBirth) => {
const today = new Date();
const birthDate = new Date(dateOfBirth);
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (
monthDiff < 0 ||
(monthDiff === 0 && today.getDate() < birthDate.getDate())
) {
age--;
}
return age;
};
const onSubmit = async () => {
const { valid } = await refVForm.value.validate()
if (valid) {
if (calculateAge(dob.value) >= 18) {
await store.dispatch('patientUpdate', {
id:itemId.value,
first_name: first_name.value,
last_name: last_name.value,
email: email.value,
password: password.value,
phone_no: phone_no.value,
dob: dob.value,
address: addressLine1.value,
city: city.value,
state: state.value,
zip_code:zip_code.value,
country: country.value,
gender: gender.value
})
} else {
store.dispatch('updateErrorMessage', 'Patient must be 18+')
}
if (!store.getters.getErrorMsg) {
emit('patientAdded', 'success')
first_name.value = null
last_name.value = null
email.value = null
password.value = null
phone_no.value = null
dob.value = null
addressLine1.value = null
city.value = null
state.value = null
country.value = null
zip_code.value=null
}
emit('update:isDrawerOpen', false)
}
}
const getPatientList = computed(async () => {
if (props.userData) {
itemId.value=props.userData.id
first_name.value = props.userData.first_name
last_name.value = props.userData.last_name
email.value = props.userData.email
password.value = props.userData.password
phone_no.value = props.userData.phone_no
dob.value = props.userData.dob
addressLine1.value = props.userData.shipping_address
city.value = props.userData.shipping_city
state.value = props.userData.shipping_state
country.value = props.userData.shipping_country
zip_code.value = props.userData.shipping_zipcode
gender.value= props.userData.gender
}
});
const resetForm = () => {
refVForm.value?.reset()
emit('update:isDrawerOpen', false)
}
</script>
<template>
<VNavigationDrawer
:model-value="props.isDrawerOpen"
temporary
location="end"
width="800"
@update:model-value="handleDrawerModelValueUpdate"
>
<!-- 👉 Header -->
<AppDrawerHeaderSection
title="Edit Patient"
@cancel="$emit('update:isDrawerOpen', false)"
/>
<VDivider />
<VCard flat>
<PerfectScrollbar
:options="{ wheelPropagation: false }"
class="h-100"
>
<VCardText style="block-size: calc(100vh - 5rem);" v-if="getPatientList">
<VForm
ref="refVForm"
@submit.prevent=""
>
<VRow>
<VCol cols="12" md="12">
<div class="text-body-1 font-weight-medium text-high-emphasis">
Basic Information
</div>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="first_name"
label="First Name"
:rules="[requiredValidator]"
placeholder="First Name"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="last_name"
label="Last Name"
:rules="[requiredValidator]"
placeholder="Last Name"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="email"
label="Email Address"
:rules="[requiredValidator, emailValidator]"
placeholder="johndoe@email.com"
readonly
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="password"
label="Password"
placeholder="············"
:type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon="isPasswordVisible ? 'ri-eye-off-line' : 'ri-eye-line'"
@click:append-inner="isPasswordVisible = !isPasswordVisible"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField v-model="phone_no" label="Phone Number" pattern="^\(\d{3}\) \d{3}-\d{4}$"
:rules="[requiredPhone, validUSAPhone]" placeholder="i.e. (000) 000-0000"
@input="formatPhoneNumber" max="14" density="comfortable" />
</VCol>
<VCol cols="12" md="6">
<v-select v-model="gender" label="Gender" :items="genders" item-title="name" item-value="abbreviation"
:rules="[requiredValidator]" density="comfortable">
</v-select>
</VCol>
<VCol cols="12" md="6">
<AppDateTimePicker
v-model="dob"
label="Date Of Birth"
placeholder="Date Of Birth"
format="MM-dd-yyyy"
:config="{ dateFormat: 'Y-m-d' }"
:max="getCurrentDate()"
:rules="[requiredValidator]"
/>
</VCol>
<VCol cols="12">
<div class="text-body-1 font-weight-medium text-high-emphasis">
Shipping Information
</div>
</VCol>
<VCol cols="12">
<VTextField
v-model="addressLine1"
label="Address Line 1*"
:rules="[requiredValidator]"
placeholder="45, Rocker Terrace"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="city"
label="City*"
:rules="[requiredValidator]"
placeholder="New York"
/>
</VCol>
<VCol cols="12" md="6">
<VAutocomplete
v-model="state"
label="States"
:items="sortedStates"
item-title="name" item-value="abbreviation"
placeholder="Select State"
:rules="[requiredState]"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="zip_code"
label="Zip Code*"
type="number"
:rules="[requiredValidator]"
placeholder="982347"
/>
</VCol>
<VCol cols="12" md="6">
<VSelect
v-model="country"
placeholder="United States"
:rules="[requiredValidator]"
label="Country"
:items="['United States']"
/>
</VCol>
<VCol cols="12">
<div class="d-flex justify-start">
<VBtn
type="submit"
color="primary"
class="me-4"
@click="onSubmit"
>
Save
</VBtn>
<VBtn
color="error"
variant="outlined"
@click="resetForm"
>
Discard
</VBtn>
</div>
</VCol>
</VRow>
</VForm>
</VCardText>
</PerfectScrollbar>
</VCard>
</VNavigationDrawer>
</template>
<style lang="scss">
.v-navigation-drawer__content {
overflow-y: hidden !important;
}
</style>

View File

@@ -0,0 +1,140 @@
<script setup>
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const patientId = route.params.patient_id;
const appointmentId = route.params.id;
const notes = ref([]);
const props = defineProps({
notesData: {
type: Object,
required: true,
},
})
onMounted(async () => {
notes.value = props.notesData.patientNotes
notes.value.sort((a, b) => {
return b.order_id - a.order_id;
});
console.log(" notes.value", notes.value);
});
const formatDateDate = (date) => {
const messageDate = new Date(date);
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
};
return messageDate.toLocaleDateString('en-US', options).replace(/\//g, '-');
};
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);
}
};
</script>
<template>
<VCard title="Notes">
<VCardText>
<VTimeline
side="end"
align="start"
line-inset="8"
truncate-line="both"
density="compact"
>
<!-- SECTION Timeline Item: Flight -->
<template v-for="(p_note, index) in notes" :key="index" v-if="notes.length>0">
<VTimelineItem
dot-color="primary"
size="x-small"
>
<!-- 👉 Header -->
<div class="d-flex justify-space-between align-center gap-2 flex-wrap">
<span class="app-timeline-title" v-if="p_note.note_type=='Notes'">
{{p_note.note}}
</span>
<span class="app-timeline-title" v-if="p_note.note_type == 'file'">
<VIcon>ri-attachment-2</VIcon> <button @click="downloadFile(p_note.note,'noteFile.png')">Download Image</button>
</span>
<span class="app-timeline-meta">
Add By:
<span class="">{{ p_note.created_by }}</span><br/>
{{ formatDateDate(p_note.created_at) }}</span>
<!-- <span></span> -->
</div>
<!-- 👉 Content -->
<div class="app-timeline-text mb-1">
Order ID : <RouterLink :to="{ name: 'admin-order-detail', params: { id: p_note.order_id } }">
<span class=""> {{ p_note.order_id }} &nbsp;</span>
</RouterLink>
<VIcon
size="20"
icon="tabler-arrow-right"
class="mx-2 flip-in-rtl"
/>
<!-- <span>Heathrow Airport, London</span> -->
</div>
<!-- <p class="app-timeline-meta mb-2">
6:30 AM
</p> -->
<!-- <div class="app-timeline-text d-flex align-center gap-2">
<div>
<VImg
:src="pdf"
:width="22"
/>
</div>
<span>booking-card.pdf</span>
</div> -->
</VTimelineItem>
</template>
<!-- !SECTION -->
<!-- !SECTION -->
</VTimeline>
</VCardText>
</VCard>
</template>

View File

@@ -0,0 +1,307 @@
<script setup>
const props = defineProps({
userData: {
type: Object,
required: true,
},
})
import CompletedMeetingTab from '@/pages/patients/CompletedMeetingTab.vue';
import moment from 'moment';
import { onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const editDialog = ref(false);
const deleteDialog = ref(false);
const search = ref('');
const appointmentId = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
});
const editedItem = ref({ ...defaultItem.value });
const editedIndex = ref(-1);
const patientMeetingList = ref([]);
const isLoading = ref(false);
// Status options
const selectedOptions = [
{ text: 'Active', value: 1 },
{ text: 'InActive', value: 2 },
];
const refVForm = ref(null);
// Headers
const headers = [
{ title: 'Order ID', key: 'order_id' },
{ key: 'appointment_date', sortable: false, title: 'Date' },
//{ key: 'start_time', title: 'Start Time' },
// { key: 'end_time', title: 'End Time' },
//{ key: 'duration', title: 'Duration' },
//{ title: 'ACTIONS', key: 'actions' },
];
function totalCallDuration(start_time, end_time) {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = String(duration.hours()).padStart(2, '0');
const minutes = String(duration.minutes()).padStart(2, '0');
const seconds = String(duration.seconds()).padStart(2, '0');
if (hours === '00' && minutes === '00') {
return `00:00:${seconds}`;
} else if (hours === '00') {
return `00:${minutes}`;
} else {
return `${hours}:${minutes}`;
}
}
const formatDate = (date) => {
const messageDate = new Date(date);
const options = {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric', // Change from '2-digit' to 'numeric'
minute: '2-digit',
hour12: true, // Add hour12: true to get 12-hour format with AM/PM
};
const formattedDate = messageDate.toLocaleString('en-US', options).replace(/\//g, '-');
return `${formattedDate} `;
};
function changeFormat(dateFormat) {
const dateParts = dateFormat.split('-'); // Assuming date is in yyyy-mm-dd format
const year = parseInt(dateParts[0]);
const month = String(dateParts[1]).padStart(2, '0'); // Pad single-digit months with leading zero
const day = String(dateParts[2]).padStart(2, '0'); // Pad single-digit days with leading zero
// 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();
return formattedDate;
}
// Fetch and process the patient meeting list
const getPatientMeetingList = async () => {
//store.dispatch('updateIsLoading', true);
//await store.dispatch('patientMeetingList', { id: route.params.id });
// store.dispatch('updateIsLoading', false);
let list = props.userData.upcomingMeetings;
patientMeetingList.value = list.map(history => ({
...history,
//appointment_date: getConvertedDate(convertUtcTime(history.appointment_time, history.appointment_date, history.timezone)),
appointment_time: getConvertedTime(convertUtcTime(history.appointment_time, history.appointment_date, history.timezone)),
appointment_date: changeFormat(history.appointment_date),
start_time: formatDate(history.start_time),
end_time: formatDate(history.end_time),
duration: totalCallDuration(history.start_time, history.end_time),
}));
patientMeetingList.value.sort((a, b) => {
return b.order_id - a.order_id;
});
console.log(list);
};
const convertUtcTime = (time, date, timezone) => {
const timezones = {
"EST": "America/New_York",
"CST": "America/Chicago",
"MST": "America/Denver",
"PST": "America/Los_Angeles",
"PST": "Asia/Karachi"
// Add more mappings as needed
};
// Get the IANA timezone identifier from the abbreviation
let ianaTimeZone = timezones[timezone];
if (!ianaTimeZone) {
// throw new Error(`Unknown timezone abbreviation: ${timezone}`);
timezone='PST'
ianaTimeZone = timezones[timezone];
}
// Combine date and time into a single string
const dateTimeString = `${date}T${time}Z`; // Assuming the input date and time are in UTC
// Create a Date object from the combined string
const dateObj = new Date(dateTimeString);
// Options for the formatter
const options = {
timeZone: ianaTimeZone,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
};
// Create the formatter
const formatter = new Intl.DateTimeFormat('en-US', options);
// Format the date
const convertedDateTime = formatter.format(dateObj);
return convertedDateTime;
};
const getConvertedTime = (inputDate) => {
// Split the input date string into date and time components
const [datePart, timePart] = inputDate.split(', ');
// Split the time component into hours, minutes, and seconds
let [hours, minutes, seconds] = timePart.split(':');
// Convert the hours to an integer
hours = parseInt(hours);
// Determine the period (AM/PM) and adjust the hours if necessary
const period = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12 || 12; // Convert 0 and 12 to 12, and other hours to 1-11
// Format the time as desired
const formattedTime = `${hours.toString().padStart(2, '0')}:${minutes}${period}`;
return formattedTime;
}
const getConvertedDate = (inputDate) => {
// Split the input date string into date and time components
const [datePart, timePart] = inputDate.split(', ');
// Split the date component into month, day, and year
const [month, day, year] = datePart.split('/');
// Create a new Date object from the parsed components
const dateObject = new Date(`${year}-${month}-${day}T${timePart}`);
// Define an array of month names
const monthNames = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
// Format the date as desired
const formattedDate = `${monthNames[dateObject.getMonth()]} ${day}, ${year}`;
return formattedDate;
};
// Lifecycle hooks
onBeforeMount(() => {});
onMounted(async () => {
await getPatientMeetingList();
});
onUnmounted(() => {});
const historyDetail = (item, value) => {
console.log('item',item.id ,value)
if(value == 'notes')
router.push('/admin/patient/meeting/notes/' + route.params.id + '/' + item.id);
if(value == 'prescription')
router.push('/admin/patient/meeting/prescription/' + route.params.id + '/' + item.id);
}
const menusVariant = [
'primary'
];
const options = [
{
title: 'Notes',
key: 'notes',
},
{
title: 'Prescription',
key: 'prescription',
},
]
</script>
<template>
<v-row>
<v-col cols="12" md="12">
<v-card title="Upcoming Meetings">
<v-card-text>
<v-row>
<v-col cols="12" offset-md="8" md="4">
<v-text-field
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</v-col>
</v-row>
</v-card-text>
<v-data-table
:headers="headers"
:items="patientMeetingList"
:search="search"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.order_id="{ item }">
<RouterLink :to="{ name: 'admin-order-detail', params: { id: item.order_id } }">
<span class=""> #{{ item.order_id }} &nbsp;</span>
</RouterLink>
</template>
<template #item.duration="{ item }">{{ item.duration }}</template>
<template #item.appointment_date="{ item }">{{ item.appointment_date +' ' +item.appointment_time }}</template>
<!-- Actions -->
<template #item.actions="{ item }">
<div class="demo-space-x">
<VMenu
v-for="menu in menusVariant"
:key="menu"
>
<template #activator="{ props }">
<i class="ri-more-2-line cursor-pointer" style="font-size: 32px;" v-bind="props"></i>
</template>
<v-list>
<v-list-item
v-for="opt in options"
:key="opt.value"
@click="historyDetail(item, opt.key)"
>
{{ opt.title }}
</v-list-item>
</v-list>
</VMenu>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>
</div> -->
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
<CompletedMeetingTab :user-data="props.userData"/>
</template>

View File

@@ -0,0 +1,325 @@
<script setup>
const profile = ref(0)
const color = ref(null)
const props = defineProps({
userData: {
type: Object,
required: true,
},
})
const standardPlan = {
plan: 'Standard',
price: 99,
benefits: [
'10 Users',
'Up to 10GB storage',
'Basic Support',
],
}
const isUserInfoEditDialogVisible = ref(false)
const isUpgradePlanDialogVisible = ref(false)
const resolveUserStatusVariant = stat => {
if (stat === 'pending')
return 'warning'
if (stat === 'active')
return 'success'
if (stat === 'inactive')
return 'secondary'
return 'primary'
}
const resolveUserRoleVariant = role => {
if (role === 'subscriber')
return {
color: 'primary',
icon: 'ri-user-line',
}
if (role === 'author')
return {
color: 'warning',
icon: 'ri-settings-2-line',
}
if (role === 'maintainer')
return {
color: 'success',
icon: 'ri-database-2-line',
}
if (role === 'editor')
return {
color: 'info',
icon: 'ri-pencil-line',
}
if (role === 'admin')
return {
color: 'error',
icon: 'ri-server-line',
}
return {
color: 'primary',
icon: 'ri-user-line',
}
}
const firstThreeLines = computed(() => {
const lines = props.userData.plans.list_two_title.split(',')
return lines.slice(0, 3)
})
onMounted(async () => {
profile.value = props.userData.patient.profile_completion_Percentage
if (profile.value <= 50) {
color.value="rgb(var(--v-theme-error))"
}
if (profile.value >= 80) {
color.value="rgb(var(--v-theme-success))"
}
if (profile.value > 50 && profile.value < 80) {
color.value="rgb(var(--v-theme-warning))"
}
});
</script>
<template>
<VRow>
<!-- SECTION User Details -->
<VCol cols="12">
<VCard v-if="props.userData">
<VCardText class="text-center pt-12 pb-6">
<!-- 👉 Avatar -->
<VAvatar
rounded
:size="120"
:color="!props.userData.patient.avatar ? 'primary' : undefined"
:variant="!props.userData.patient.avatar ? 'tonal' : undefined"
>
<VImg
v-if="props.userData.patient.avatar"
:src="props.userData.patient.avatar"
/>
<span
v-else
class="text-5xl font-weight-medium"
>
{{ avatarText(props.userData.patient.first_name) }}
</span>
</VAvatar>
<!-- 👉 User fullName -->
<h5 class="text-h5 mt-4">
{{ props.userData.patient.first_name }}
</h5>
<!-- 👉 Role chip -->
<div class="mt-3">
<span class="font-weight-medium" style="float: left;">
Profile Status:
</span>
<VProgressLinear
v-model="profile"
:color="color"
height="14"
striped
>
<template #default="{ value }">
<span>{{ Math.ceil(value) }}%</span>
</template>
</VProgressLinear>
</div>
</VCardText>
<!-- 👉 Details -->
<VCardText class="pb-6">
<h5 class="text-h5">
Details
</h5>
<VDivider class="my-4" />
<!-- 👉 User Details list -->
<VList class="card-list">
<VListItem>
<VListItemTitle class="text-sm">
<span class="font-weight-medium">
Email:
</span>
<span class="text-body-1">{{ props.userData.patient.email }}</span>
</VListItemTitle>
</VListItem>
<VListItem>
<VListItemTitle class="text-sm">
<span class="font-weight-medium">
Address:
</span>
<span class="text-body-1 text-wrap">{{ props.userData.patient.address }} ,{{ props.userData.patient.city }},{{ props.userData.patient.state }} {{ props.userData.patient.zip_code }}</span>
</VListItemTitle>
</VListItem>
<VListItem>
<VListItemTitle class="text-sm">
<span class="font-weight-medium">
Contact:
</span>
<span class="text-body-1">{{ props.userData.patient.phone_no }}</span>
</VListItemTitle>
</VListItem>
</VList>
</VCardText>
<!-- 👉 Edit and Suspend button -->
<VCardText class="d-flex justify-center" >
<VBtn
variant="elevated"
class="me-4"
@click="isUserInfoEditDialogVisible = true"
style="display: none;"
>
Edit
</VBtn>
<VBtn
variant="outlined"
color="error"
style="display: none;"
>
Suspend
</VBtn>
</VCardText>
</VCard>
</VCol>
<!-- !SECTION -->
<!-- SECTION Current Plan -->
<VCol cols="12" v-if="props.userData.plans" style="display: none;">
<VCard
flat
class="current-plan"
>
<VCardText class="d-flex">
<!-- 👉 Standard Chip -->
<VChip
color="primary"
size="small"
>
{{ props.userData.plans.title }}
</VChip>
<VSpacer />
<!-- 👉 Current Price -->
<div class="d-flex align-center">
<sup class="text-primary text-lg font-weight-medium"> {{ props.userData.plans.currency }}</sup>
<h1 class="text-h1 text-primary">
{{ props.userData.plans.price }}
</h1>
<sub class="mt-3"><h6 class="text-h6 font-weight-regular">month</h6></sub>
</div>
</VCardText>
<VCardText>
<!-- 👉 Price Benefits -->
<VList class="card-list">
<VListItem
>
<div class="d-flex align-center">
<VIcon
size="10"
color="medium-emphasis"
class="me-2"
icon="ri-circle-fill"
/>
<div class="text-medium-emphasis">
{{ props.userData.plans.list_one_title }}
</div>
</div>
</VListItem>
<VListItem
>
<div class="d-flex align-center">
<VIcon
size="10"
color="medium-emphasis"
class="me-2"
icon="ri-circle-fill"
/>
<div class="text-medium-emphasis">
{{ props.userData.plans.list_sub_title }}
</div>
</div>
</VListItem>
<VListItem
>
<div class="d-flex align-center">
<VIcon
size="10"
color="medium-emphasis"
class="me-2"
icon="ri-circle-fill"
/>
<div class="text-medium-emphasis">
<span v-for="(line, index) in firstThreeLines" :key="index">
{{ line }}
<br v-if="index !== firstThreeLines.length - 1" />
</span>
</div>
</div>
</VListItem>
</VList>
<!-- 👉 Days -->
<!-- 👉 Upgrade Plan -->
<VBtn
block
@click="isUpgradePlanDialogVisible = true"
>
Upgrade Plan
</VBtn>
</VCardText>
</VCard>
</VCol>
<!-- !SECTION -->
</VRow>
<!-- 👉 Edit user info dialog -->
<UserInfoEditDialog
v-model:isDialogVisible="isUserInfoEditDialogVisible"
:user-data="props.userData"
/>
<!-- 👉 Upgrade plan dialog -->
<UserUpgradePlanDialog v-model:isDialogVisible="isUpgradePlanDialogVisible" />
</template>
<style lang="scss" scoped>
.card-list {
--v-card-list-gap: .5rem;
}
.current-plan {
border: 2px solid rgb(var(--v-theme-primary));
}
.text-capitalize {
text-transform: capitalize !important;
}
</style>

View File

@@ -0,0 +1,209 @@
<script setup>
const props = defineProps({
userData: {
type: Object,
required: true,
},
})
import { onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const editDialog = ref(false);
const deleteDialog = ref(false);
const search = ref('');
const appointmentId = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
});
const editedItem = ref({ ...defaultItem.value });
const editedIndex = ref(-1);
const patientLabList = ref([]);
const isLoading = ref(false);
// Status options
const selectedOptions = [
{ text: 'Active', value: 1 },
{ text: 'InActive', value: 2 },
];
const refVForm = ref(null);
// Headers
const headers = [
// { title: 'Appointment Id', key: 'id' },
{ title: 'Product Name', key: 'product_name' },
{ title: 'Lab Kit Name', key: 'lab_kit_name' },
// { key: 'appointment_date', sortable: false, title: 'Date' },
{ key: 'status', title: 'Status' },
// { title: 'ACTIONS', key: 'actions' },
];
const formatDate = (date) => {
const messageDate = new Date(date);
const options = {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric', // Change from '2-digit' to 'numeric'
minute: '2-digit',
hour12: true, // Add hour12: true to get 12-hour format with AM/PM
};
const formattedDate = messageDate.toLocaleString('en-US', options).replace(/\//g, '-');
return `${formattedDate} `;
};
// Fetch and process the patient meeting list
const getPatientLabList = async () => {
//store.dispatch('updateIsLoading', true);
//await store.dispatch('patientMeetingList', { id: route.params.id });
// store.dispatch('updateIsLoading', false);
let list = props.userData.labkit;
patientLabList.value = list
console.log(list);
};
// Lifecycle hooks
onBeforeMount(() => {});
onMounted(async () => {
await getPatientLabList();
});
onUnmounted(() => {});
const historyDetail = (item, value) => {
console.log('item',item.id ,value)
if(value == 'notes')
router.push('/admin/patient/meeting/notes/' + route.params.id + '/' + item.id);
if(value == 'prescription')
router.push('/admin/patient/meeting/prescription/' + route.params.id + '/' + item.id);
}
const menusVariant = [
'primary'
];
const options = [
{
title: 'Notes',
key: 'notes',
},
{
title: 'Prescription',
key: 'prescription',
},
]
const getStatusColor = (status) => {
switch (status) {
case 'pending':
return 'warning'; // Use Vuetify's warning color (typically yellow)
case 'shipped':
return '#45B8AC'; // Use Vuetify's primary color (typically blue)
case 'delivered':
return 'success';
case 'returned':
return 'red';
case 'results':
return 'blue';
default:
return 'grey'; // Use Vuetify's grey color for any other status
}
};
</script>
<template>
<v-row>
<v-col cols="12" md="12" >
<v-card title="Lab Kits">
<v-card-text>
<v-row>
<v-col cols="12" offset-md="8" md="4">
<v-text-field
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</v-col>
</v-row>
</v-card-text>
<v-data-table
:headers="headers"
:items="patientLabList"
:search="search"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.id="{ item }">{{ item.id }}</template>
<template #item.provider_name="{ item }">
<div class="d-flex flex-column ms-3">
<router-link
:to="{ name: 'admin-provider-profile', params: { id: item.provider_id } }"
class="highlighted"
>
<span class="d-block font-weight-medium text-truncate">{{ item.provider_name }}</span>
</router-link>
</div>
</template>
<template #item.status="{ item }">
<VChip
:color="getStatusColor(item.status)"
density="comfortable"
>
{{ item.status}}
</VChip>
</template>
<template #item.address="{ item }">{{ item.shipping_address1 }} <br/>{{ item.shipping_city }} {{ item.shipping_state }} {{ item.shipping_zipcode }}</template>
<!-- Actions -->
<template #item.actions="{ item }">
<div class="demo-space-x">
<VMenu
v-for="menu in menusVariant"
:key="menu"
>
<template #activator="{ props }">
<i class="ri-more-2-line cursor-pointer" style="font-size: 32px;" v-bind="props"></i>
</template>
<v-list>
<v-list-item
v-for="opt in options"
:key="opt.value"
@click="historyDetail(item, opt.key)"
>
{{ opt.title }}
</v-list-item>
</v-list>
</VMenu>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>
</div> -->
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</template>

View File

@@ -0,0 +1,525 @@
<script setup>
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
import QuestionProgressBar from '../patients/QuestionProgressBar.vue';
import questionsJson from '../patients/questions_parse.json';
const router = useRouter()
const route = useRoute();
const store = useStore()
const questionsJsonData = ref(questionsJson)
const answers = ref(null)
const QuestionsAnswers = ref([]);
const username = ref(null);
const email = ref(null);
const phone = ref(null);
const address1 = ref(null);
const dob = ref(null);
const agePatient = ref(null);
const isMobile = ref(window.innerWidth <= 768);
const patientId = route.params.id
onMounted(async () => {
// console.log('patient id',props.patient_id)
const navbar = document.querySelector('.layout-navbar');
const callDiv = document.querySelector('.layout-page-content');
if (navbar) {
navbar.style.display = 'block';
}
if (callDiv)
callDiv.style.padding = '1.5rem';
store.dispatch('updateIsLoading', true)
await store.dispatch('patientDetial',{id:patientId})
await store.dispatch('getAgentQuestionsAnswers',{patient_id:patientId})
username.value = store.getters.getPatientDetail.patient.first_name + ' ' + store.getters.getPatientDetail.patient.last_name;
email.value = store.getters.getPatientDetail.patient.email
phone.value = store.getters.getPatientDetail.patient.phone_no
dob.value = changeFormat(store.getters.getPatientDetail.patient.dob)
agePatient.value = calculateAge(store.getters.getPatientDetail.patient.dob) + " Year"
address1.value = store.getters.getPatientDetail.patient.address + ' ' +
store.getters.getPatientDetail.patient.city + ' ' +
store.getters.getPatientDetail.patient.state + ' ' +
store.getters.getPatientDetail.patient.country;
// address.value = patient_address;
answers.value = store.getters.getPatientAnswers
// console.log('questionsJsonData', questionsJsonData.value)
// console.log('API Answers', answers.value)
createFinalArray();
store.dispatch('updateIsLoading', false)
window.addEventListener('resize', checkMobile);
});
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();
return formattedDate;
}
// function changeFormat(dateFormat) {
// const dateParts = dateFormat.split('-'); // Assuming date is in yyyy-mm-dd format
// const year = parseInt(dateParts[0]);
// const month = String(dateParts[1]).padStart(2, '0'); // Pad single-digit months with leading zero
// const day = String(dateParts[2]).padStart(2, '0'); // Pad single-digit days with leading zero
// // 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();
// return formattedDate;
// }
const createFinalArray = () => {
questionsJsonData.value.forEach(question => {
const { label, key, type } = question;
if (answers.value.hasOwnProperty(key)) {
QuestionsAnswers.value.push({
label,
key,
type,
value: answers.value[key]
});
}
});
// console.log('------finalArray ', QuestionsAnswers.value)
};
const checkMobile = () => {
isMobile.value = window.innerWidth <= 768;
};
const calculateAge = (dateOfBirth) => {
const today = new Date();
const birthDate = new Date(dateOfBirth);
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (
monthDiff < 0 ||
(monthDiff === 0 && today.getDate() < birthDate.getDate())
) {
age--;
}
return age;
}
</script>
<template>
<v-row class='mb-2'>
<!-- <VCol cols="12" md="12" class="mb-4 " v-if="username || phone" style="font-size: 16px;">
<VCard>
<VCardText>
<h3 class="mb-2"> {{ username }}</h3>
<div class="mb-1">
<VTooltip location="left" activator="parent" transition="scroll-x-transition">
Email
</VTooltip>
<VIcon icon="ri-mail-line" size="20" class="me-2" />{{ email }}
</div>
<div class="mb-2">
<VTooltip location="left" activator="parent" transition="scroll-x-transition">
Age
</VTooltip>
<VIcon icon="ri-calendar-event-line" title="Age" size="20" class="me-2" />{{ agePatient }}
</div>
<div class="mb-2">
<VTooltip location="left" activator="parent" transition="scroll-x-transition">
Date of Birth
</VTooltip>
<VIcon icon="ri-calendar-line" size="20" class="me-2" />{{ dob }}
</div>
<div class="mb-2">
<VTooltip location="left" activator="parent" transition="scroll-x-transition">
Address
</VTooltip>
<VIcon icon="ri-map-pin-line" size="20" class="me-2" />{{ address1 }}
</div>
<div>
<VTooltip location="left" activator="parent" transition="scroll-x-transition">
Contact Number
</VTooltip>
<VIcon icon="ri-phone-line" size="20" class="me-2" />{{ phone }}
</div>
</VCardText>
</VCard>
</VCol> -->
<v-col cols="12" md="12">
<VList class="">
<VListItem class="">
<VListItemTitle class="d-flex align-center justify-space-between bg-dark mt-1"
style="padding: 5px;">
<div :class="isMobile ? '' : 'w-40'">
<p class="mb-0" :class="isMobile ? 'heading-text-m' : 'heading-text-d'"><b>SYMPTOM
CHECKLIST</b></p>
</div>
<div class="d-flex align-center" :class="isMobile ? 'heading-text-m' : 'heading-text-d'">
<p class="mb-0"><b>MILD</b>
</p>
</div>
<div class="d-flex align-center" :class="isMobile ? 'heading-text-m' : 'heading-text-d'">
<p class="mb-0"><b>MODERATE</b>
</p>
</div>
<div class="d-flex align-center" :class="isMobile ? 'heading-text-m' : 'heading-text-d'">
<p class="mb-0"><b>SEVERE</b>
</p>
</div>
</VListItemTitle>
</VListItem>
<!-- Move the second list item inside the loop -->
<VListItem class="pt-0 pb-0 ht-li" v-for="(item, index) of QuestionsAnswers" :key="index">
<VListItemTitle class="d-flex align-center justify-space-between">
<div class="border-right"
:class="{ 'bg-silver': (index + 1) % 2 === 0, 'w-custom-m': isMobile, 'w-40': !isMobile }"
style="padding-left: 5px;">
<p class="text-wrap mb-0" :class="isMobile ? 'heading-text-m' : 'heading-text-d'">{{
item.label
}}</p>
</div>
<div class="d-flex align-center" :class="isMobile ? 'w-custom-d' : 'w-60'">
<QuestionProgressBar :type="item.type" :value="item.value"></QuestionProgressBar>
</div>
</VListItemTitle>
</VListItem>
</VList>
<!-- <v-table density="compact" fixed-header>
<thead>
<tr class="text-right">
<th class="bg-dark">
<b>SYMPTOM CHECKLIST</b>
</th>
<th class="text-right bg-dark">
<b>MILD</b>
<VIcon icon="mdi-menu-down"></VIcon>
</th>
<th class="text-right bg-dark">
<b>MODERATE</b>
<VIcon icon="mdi-menu-down"></VIcon>
</th>
<th class="text-right bg-dark">
<b>SEVERE</b>
<VIcon icon="mdi-menu-down"></VIcon>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) of QuestionsAnswers" :key="index">
<td class="border-right" v-if="!isMobile">{{ item.label }}</td>
<td :colspan="isMobile ? '4' : '3'">
<p v-if="isMobile" class="mb-0">{{ item.label }}</p>
<QuestionProgressBar :type="item.type" :value="item.value"></QuestionProgressBar>
</td>
</tr>
</tbody>
</v-table> -->
</v-col>
</v-row>
</template>
<style lang="scss" scoped>
.mdi-email {
margin-bottom: 5px;
}
.ht-li {
min-height: 20px !important;
}
.bg-silver {
background-color: silver;
}
.text-wrap {
text-wrap: balance;
}
.w-40 {
width: 40%;
}
.w-custom-m {
width: 36%;
}
.w-60 {
width: 60%;
}
.w-custom-d {
width: 65%;
}
.v-list-item--density-default.v-list-item--one-line {
min-height: 40px;
}
.heading-text-m {
font-size: 9px;
}
.heading-text-d {
font-size: 12px;
}
.bg-dark {
background-color: #808080b3 !important;
}
.text-right {
text-align: right !important;
width: 23%;
}
.border-right {
border-right: 1.5px solid black;
}
.hidden-component {
display: none
}
.meta-key {
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
border-radius: 6px;
block-size: 1.5625rem;
line-height: 1.3125rem;
padding-block: 0.125rem;
padding-inline: 0.25rem;
}
::v-deep .custom-menu {
position: relative;
}
::v-deep .custom-menu::before {
content: "" !important;
position: absolute !important;
transform: translateY(-50%);
top: 50% !important;
left: -8px !important;
border-left: 8px solid transparent !important;
border-right: 8px solid transparent !important;
border-bottom: 8px solid #fff !important;
}
// Styles for the VList component
.more .v-list-item-title {
color: rgb(106 109 255);
}
.more .menu-item:hover {
cursor: pointer;
}
.slide-enter-active,
.slide-leave-active {
transition: transform 0.3s ease;
}
.slide-enter,
.slide-leave-to {
transform: translateX(-100%);
}
.start-call-btn {
opacity: 0;
display: none;
transition: opacity 0.3s ease;
}
.button_margin {
margin: 2px;
}
.dialog_padding {
padding: 5px;
}
.custom-menu .v-menu__content {
background-color: #333;
color: #fff;
border-radius: 4px;
padding: 8px 0;
}
.user-info {
display: flex;
flex-direction: column;
transition: opacity 0.3s ease;
}
.list-item-hover {
transition: background-color 0.3s ease;
&:hover {
background-color: rgba(var(--v-theme-primary), 0.1);
.start-call-btn {
opacity: 1;
display: block;
position: relative;
left: -35px;
}
.user-info {
opacity: 0;
display: none;
}
}
}
.pop_card {
overflow: hidden !important;
padding: 10px;
}
.v-overlay__content {
max-height: 706.4px;
max-width: 941.6px;
min-width: 24px;
--v-overlay-anchor-origin: bottom left;
transform-origin: left top;
top: 154.4px !important;
left: 204px !important;
}
.button_margin {
margin-top: 10px;
font-size: 10px;
}
/* Responsive Styles */
@media screen and (max-width: 768px) {
.pop_card {
max-width: 100%;
margin: 0 auto;
}
}
.container_img {
display: flex;
flex-direction: column;
width: 100%;
align-items: center;
}
.image {
order: 2;
/* Change the order to 2 in mobile view */
}
.text {
order: 1;
/* Change the order to 1 in mobile view */
}
/* Media query for mobile view */
@media (max-width: 768px) {
.container_img {
flex-direction: row;
margin-top: 10px;
}
.button_margin_mobile {
width: 100%;
}
.image {
width: 20%;
padding: 0 10px;
}
.text {
width: 80%;
/* Each takes 50% width */
padding: 0 10px;
/* Optional padding */
}
}
::-webkit-scrollbar {
width: 10px;
/* Width of the scrollbar */
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
/* Color of the track */
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888;
/* Color of the handle */
border-radius: 5px;
/* Roundness of the handle */
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
/* Color of the handle on hover */
}
/* Container for the content */
.scroll-container {
max-height: 191px;
/* Maximum height of the scrollable content */
overflow-y: scroll;
/* Enable vertical scrolling */
}
/* Content within the scroll container */
.scroll-content {
padding: 20px;
}
/* Example of additional styling for content */
.scroll-content p {
margin-bottom: 20px;
}
.cross button {
padding: 0px;
margin: 0px;
/* font-size: 10px; */
background: none;
border: none;
box-shadow: none;
height: 23px;
}
.v-data-table-header {
display: table-header-group;
}
</style>

View File

@@ -0,0 +1,517 @@
<script setup>
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter()
const route = useRoute()
const itemsPrescriptions = ref([]);
const patientId = route.params.patient_id;
const props = defineProps({
prescriptionData: {
type: Object,
required: true,
},
})
const prescriptionList = computed(async () => {
console.log('computed=====')
return await getprescriptionList()
});
const doctorName = ref('');
const currentPage = ref(1);
const itemsPerPage = ref(2);
const paginatedItems = computed(() => {
const start = (currentPage.value - 1) * itemsPerPage.value;
const end = start + itemsPerPage.value;
let prescriptions = props.prescriptionData.prescriptionData;
prescriptions.sort((a, b) => {
return b.order_id - a.order_id;
});
console.log('props.orderData', props.prescriptionData.prescriptionData)
itemsPrescriptions.value = prescriptions
return itemsPrescriptions.value.slice(start, end);
});
const totalPages = computed(() => {
return Math.ceil(itemsPrescriptions.value.length / itemsPerPage.value);
});
const changePage = (page) => {
currentPage.value = page;
}
const getprescriptionList = async () => {
let prescriptions = props.prescriptionData.prescriptionData
console.log("BeforeOverviewItem", prescriptions);
// itemsPrescriptions.value = store.getters.getPrescriptionList
for (let data of prescriptions) {
let dataObject = {}
dataObject.name = data.name
dataObject.brand = data.brand
dataObject.from = data.from
dataObject.direction_quantity = data.direction_quantity
dataObject.dosage = data.dosage
dataObject.quantity = data.quantity
dataObject.refill_quantity = data.refill_quantity
dataObject.actions = ''
dataObject.id = data.id
dataObject.comments = data.comments
dataObject.direction_one = data.direction_one
dataObject.direction_two= data.direction_two
dataObject.status = data.status
dataObject.provider_name = data.provider_name
dataObject.order_id = data.order_id
dataObject.created_by=data.created_by
dataObject.date = formatDateDate(data.created_at)
dataObject.prescription_date=data.created_at
itemsPrescriptions.value.push(dataObject)
}
console.log(itemsPrescriptions.value)
itemsPrescriptions.value.sort((a, b) => {
return b.order_id - a.order_id;
});
return itemsPrescriptions.value
console.log("OverviewItem", itemsPrescriptions.value);
};
const formatDateDate = (date) => {
const messageDate = new Date(date);
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
};
return messageDate.toLocaleDateString('en-US', options).replace(/\//g, '-');
};
const getStatusColor = (status) => {
switch (status) {
case 'pending':
return 'warning'; // Use Vuetify's warning color (typically yellow)
case 'shipped':
return '#45B8AC'; // Use Vuetify's primary color (typically blue)
case 'delivered':
return 'success';
case 'returned':
return 'red';
case 'results':
return 'blue';
default:
return 'grey'; // Use Vuetify's grey color for any other status
}
};
const resolveStatusVariant = status => {
if (status === 1)
return {
color: 'primary',
text: 'Current',
}
else if (status === 2)
return {
color: 'success',
text: 'Professional',
}
else if (status === 3)
return {
color: 'error',
text: 'Rejected',
}
else if (status === 4)
return {
color: 'warning',
text: 'Resigned',
}
else
return {
color: 'info',
text: 'Applied',
}
}
const headers = [
{
title: 'Order ID',
key: 'order_id',
},
{
title: 'Provider Name',
key: 'provider_name',
},
{
title: 'Name',
key: 'name',
},
{
title: 'Date',
key: 'date',
},
{
title: 'Status',
key: 'status',
},
]
const prescriptionIndex = ref([]);
const prescriptionItem = ref(-1)
const prescriptionDialog = ref(false)
const selectedItem = ref(null);
const showDetail = item => {
// console.log("id",item);
prescriptionIndex.value = item
selectedItem.value = item;
// console.log("index",prescriptionIndex.value);
// prescriptionItem.value = { ...item }
prescriptionDialog.value = true
}
const close = () => {
prescriptionDialog.value = false
prescriptionIndex.value = -1
prescriptionItem.value = { ...defaultItem.value }
}
const formatDate = (dateString) => {
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
const formatTime = (dateString) => {
return new Date(dateString).toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric'
})
}
onMounted(async () => {
let prescriptions = props.prescriptionData.prescriptionData;
prescriptions.sort((a, b) => {
return b.order_id - a.order_id;
});
console.log('props.orderData', props.prescriptionData.prescriptionData)
itemsPrescriptions.value = prescriptions
});
</script>
<template>
<template v-if="itemsPrescriptions.length > 0">
<v-row>
<v-col v-for="prescription in paginatedItems" :key="prescription.id" cols="12" md="6">
<v-card class="mx-auto mb-4" elevation="4" hover>
<v-img height="200" src="https://cdn.pixabay.com/photo/2016/11/23/15/03/medication-1853400_1280.jpg"
class="white--text align-end" gradient="to bottom, rgba(0,0,0,.1), rgba(0,0,0,.5)">
<v-card-title class="text-h5" style="color: #fff;">{{ prescription.prescription_name
}}</v-card-title>
</v-img>
<v-card-text>
<v-chip :color="getStatusColor(prescription.status)" text-color="white" small class="mr-2">
{{ prescription.status }}
</v-chip>
Order ID : <RouterLink :to="{ name: 'admin-order-detail', params: { id: prescription.order_id } }">
<span class=""> #{{ prescription.order_id }} &nbsp;</span>
</RouterLink>
</v-card-text>
<v-divider class="mx-4"></v-divider>
<v-card-text>
<v-row dense>
<v-col cols="6">
<v-icon small color="primary">ri-capsule-line</v-icon>
<span class="ml-1">Dosage:{{ prescription.dosage }}</span>
</v-col>
<v-col cols="6">
<v-icon small color="primary">ri-medicine-bottle-line</v-icon>
<span class="ml-1">Quantity:{{ prescription.quantity }}</span>
</v-col>
<v-col cols="6">
<v-icon small color="primary">ri-calendar-line</v-icon>
<span class="ml-1">{{ formatDate(prescription.created_at) }}</span>
</v-col>
<v-col cols="6">
<v-icon small color="primary">ri-time-line</v-icon>
<span class="ml-1">{{ formatTime(prescription.created_at) }}</span>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-btn color="primary" text>
More Details
</v-btn>
<v-spacer></v-spacer>
<v-btn @click="prescription.show = !prescription.show">
{{ prescription.show ? '' : '' }}
<v-icon right color="primary">
{{ prescription.show ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line' }}
</v-icon>
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="prescription.show">
<v-divider></v-divider>
<v-card-text>
<v-row dense>
<v-col cols="12">
<strong>Add By:</strong> {{ prescription.created_by}}
</v-col>
<v-col cols="12">
<strong>Brand:</strong> {{ prescription.brand }}
</v-col>
<v-col cols="12">
<strong>From:</strong> {{ prescription.from }}
</v-col>
<v-col cols="12">
<strong>Direction One:</strong> {{ prescription.direction_one }}
</v-col>
<v-col cols="12">
<strong>Direction Two:</strong> {{ prescription.direction_two }}
</v-col>
<v-col cols="12">
<strong>Refill Quantity:</strong> {{ prescription.refill_quantity }}
</v-col>
<v-col cols="12">
<strong>Direction Quantity:</strong> {{ prescription.direction_quantity }}
</v-col>
<v-col cols="12" v-if="prescription.comments">
<strong>Comments:</strong> {{ prescription.comments }}
</v-col>
</v-row>
</v-card-text>
</div>
</v-expand-transition>
</v-card>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="auto">
<v-pagination v-model="currentPage" :length="totalPages" @input="changePage"></v-pagination>
</v-col>
</v-row>
</template>
<!-- <v-row style="display: none;">
<v-col cols="12" md="12" v-if="itemsPrescriptions">
<v-card title="Prescriptions" v-if="prescriptionList">
<VCardText >
</VCardText>
<VDataTable
:headers="headers"
:items="itemsPrescriptions"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.provider_name="{ item }">
<span class="">{{ item.provider_name }}</span>
</template>
<template #item.order_id="{ item }">
<RouterLink :to="{ name: 'admin-order-detail', params: { id: item.order_id } }">
<span class=""> #{{ item.order_id }} &nbsp;</span>
</RouterLink>
</template>
<template #item.status="{ item }">
<VChip
:color="getStatusColor(item.status)"
density="comfortable"
>
{{ item.status}}
</VChip>
</template>
<template #item.name="{ item }">
<router-link
:to="{ name: 'admin-patient-profile', params: { id: item.id } }"
class="text-high-emphasis "
@click.prevent=showDetail(item)
>
{{ item.name }}
</router-link>
</template>
</VDataTable>
</v-card>
</v-col>
</v-row> -->
<VDialog
v-model="prescriptionDialog"
max-width="600px"
>
<VCard :title=prescriptionIndex.name>
<DialogCloseBtn
variant="text"
size="default"
@click="[prescriptionDialog = false,selectedItem = '']"
/>
<VCardText>
<v-row class='mt-0'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Brand:</b></p>
</v-col>
<v-col cols="12" md="4" sm="6">
<p>{{ prescriptionIndex.brand }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>From:</b></p>
</v-col>
<v-col cols="12" md="4" sm="6">
<p>{{ prescriptionIndex.from }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Dosage:</b></p>
</v-col>
<v-col cols="12" md="4" sm="6">
<p>{{ prescriptionIndex.dosage }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Quantity:</b></p>
</v-col>
<v-col cols="12" md="4" sm="6">
<p>{{ prescriptionIndex.quantity }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Direction Quantity:</b></p>
</v-col>
<v-col cols="12" md="8" sm="6">
<p>{{ prescriptionIndex.direction_quantity }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Direction One:</b></p>
</v-col>
<v-col cols="12" md="8" sm="6">
<p>{{ prescriptionIndex.direction_one }} </p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Direction Two:</b></p>
</v-col>
<v-col cols="12" md="8" sm="6">
<p>{{ prescriptionIndex.direction_two }} </p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Refill Quantity:</b></p>
</v-col>
<v-col cols="12" md="8" sm="6">
<p>{{ prescriptionIndex.refill_quantity }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Status:</b></p>
</v-col>
<v-col cols="12" md="8" sm="6">
<p v-if="prescriptionIndex.status == null" class="text-warning">Pending</p>
<p v-else>{{ prescriptionIndex.status }}</p>
</v-col>
</v-row>
<VDivider></VDivider>
<v-row class='mt-1 pb-0'>
<v-col cols="12" md="4" sm="6">
<p class='heading mb-0 text-right'><b>Comments:</b></p>
</v-col>
<v-col cols="12" md="8" sm="8">
<p>{{ prescriptionIndex.comments }} </p>
</v-col>
</v-row>
</VCardText>
</VCard>
</VDialog>
</template>
<style lang="scss">
button.v-expansion-panel-title {
background-color: #003152 !important;
color: #fff;
}
button.v-expansion-panel-title.bg-secondary {
background-color: #003152 !important;
color: #fff;
}
button.v-expansion-panel-title {
background-color: #003152 !important;
color: #fff;
}
span.v-expansion-panel-title__icon {
color: #fff
}
// button.v-expansion-panel-title.bg-secondary {
// background-color: rgba(var(--v-theme-primary), var(--v-activated-opacity)) !important;
// }
// button.v-expansion-panel-title {
// background-color: rgba(var(--v-theme-primary), var(--v-activated-opacity)) !important;
// }
// button.v-expansion-panel-title.v-expansion-panel-title--active {
// background-color: rgba(var(--v-theme-primary), var(--v-activated-opacity)) !important;
// }
.v-expansion-panel {
overflow: hidden;
border-radius: 16px;
background-color: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 10%);
margin-block-end: 10px;
transition: box-shadow 0.3s ease;
}
.details {
position: relative;
box-sizing: content-box;
border: 2px solid #fff;
border-radius: 1em;
background-color: #696cff;
block-size: 0.85em;
box-shadow: 0 0 3px rgba(67, 89, 113, 80%);
color: #fff;
content: "+";
font-family: "Courier New", Courier, monospace;
font-weight: 500;
inline-size: 0.85em;
inset-block-start: 50%;
inset-block-start: 0.7em;
inset-inline-start: 50%;
line-height: 0.9em;
text-align: center;
transform: translate(-50%, -50%);
}
</style>

View File

@@ -0,0 +1,66 @@
<script setup>
import { computed, defineProps, onBeforeMount, ref } from 'vue';
import typeJson from '../patients/type_parse.json';
const allTypes = ref(typeJson);
const props = defineProps({
type: {
type: String,
required: true,
},
value: {
type: String,
required: false,
},
})
const bgColor = ref(null)
const operator = {
c(obj, value) {
let keys = Object.keys(obj.values)
let prev = 0;
for (let key of keys) {
if (key > prev && key <= value) {
prev = key
}
}
return obj.values[prev]
},
e(obj, value) {
return obj.values[value]
},
}
const progressValue = ref(0); // Initialize progress value with 0
const finalValue = computed(() => {
const singleObject = allTypes.value[props.type];
// console.log('singleObject', singleObject)
if (operator[singleObject.type](singleObject, props.value) > 0 && operator[singleObject.type](singleObject, props.value) <= 33) {
bgColor.value = 'success'
}
if (operator[singleObject.type](singleObject, props.value) > 33 && operator[singleObject.type](singleObject, props.value) <= 50) {
bgColor.value = 'yellow'
}
if (operator[singleObject.type](singleObject, props.value) > 50 && operator[singleObject.type](singleObject, props.value) <= 80) {
bgColor.value = 'warning'
}
if (operator[singleObject.type](singleObject, props.value) > 80 && operator[singleObject.type](singleObject, props.value) <= 100) {
bgColor.value = 'error'
}
return operator[singleObject.type](singleObject, props.value)
})
onBeforeMount(async () => {
await new Promise(resolve => {
setTimeout(() => {
progressValue.value = finalValue.value;
resolve();
}, 500); // Simulating some delay, you can replace this with your actual async logic
});
});
</script>
<template>
<v-progress-linear :model-value="progressValue" :height="22" :color="bgColor"></v-progress-linear>
</template>

View File

@@ -0,0 +1,79 @@
<script setup>
import Notes from '@/pages/pages/patient-meetings/notes.vue';
import Prescription from '@/pages/pages/patient-meetings/prescription.vue';
import moment from 'moment';
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const patientId = route.params.patient_id;
const appointmentId = route.params.id;
const currentTab = ref(0);
const appointmentID = ref();
const doctorName = ref();
const startTime = ref();
const endTime = ref();
const duration = ref();
const appointmentData = ref(null);
onMounted(async () => {
store.dispatch('updateIsLoading', true);
await store.dispatch('getAppointmentByIdAgent', {
patient_id: patientId,
appointment_id: appointmentId,
});
appointmentData.value = store.getters.getSinglePatientAppointment;
appointmentID.value = appointmentId;
doctorName.value = appointmentData.value.agent_name;
startTime.value = appointmentData.value.start_time;
endTime.value = appointmentData.value.end_time;
duration.value = totalCallDuration(startTime.value, endTime.value);
localStorage.setItem('meetingPatientAppointmentId', appointmentID.value);
store.dispatch('updateIsLoading', false);
});
const totalCallDuration = (start_time, end_time) => {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = duration.hours();
const minutes = duration.minutes();
const seconds = duration.seconds();
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
};
</script>
<template>
<VCard>
<VCardText>
<h3 v-if="appointmentID"> #{{ appointmentID }} By {{ doctorName }} </h3>
<span> Meeting duration: <b>{{ duration }}</b></span>
</VCardText>
<div class="d-flex">
<div>
<VTabs v-model="currentTab" direction="vertical">
<VTab>
<VIcon start icon="tabler-edit" />
Notes
</VTab>
<VTab>
<VIcon start icon="tabler-lock" />
Prescriptions
</VTab>
</VTabs>
</div>
<VCardText>
<VWindow v-model="currentTab" class="ms-3">
<VWindowItem>
<Notes />
</VWindowItem>
<VWindowItem>
<Prescription />
</VWindowItem>
</VWindow>
</VCardText>
</div>
</VCard>
</template>

View File

@@ -0,0 +1,206 @@
<script setup>
import moment from 'moment';
import { onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
const router = useRouter();
const route = useRoute();
const editDialog = ref(false);
const deleteDialog = ref(false);
const search = ref('');
const appointmentId = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
});
const editedItem = ref({ ...defaultItem.value });
const editedIndex = ref(-1);
const patientMeetingList = ref([]);
const isLoading = ref(false);
// Status options
const selectedOptions = [
{ text: 'Active', value: 1 },
{ text: 'InActive', value: 2 },
];
const refVForm = ref(null);
// Headers
const headers = [
// { title: 'Appointment Id', key: 'id' },
{ title: 'Patient', key: 'patient_name' },
// { key: 'appointment_date', sortable: false, title: 'Date' },
{ key: 'start_time', title: 'Start Time' },
{ key: 'end_time', title: 'End Time' },
{ key: 'duration', title: 'Duration' },
{ title: 'ACTIONS', key: 'actions' },
];
// Utility functions
function changeDateFormat(dateFormat) {
if (dateFormat) {
const [datePart, timePart] = dateFormat.split(' ');
const [year, month, day] = datePart.split('-');
// const formattedDate = `${parseInt(month)}-${parseInt(day)}-${year}`;
return `${formattedDate} ${timePart}`;
}
return dateFormat;
}
function changeFormat(dateFormat) {
const [year, month, day] = dateFormat.split('-');
return `${parseInt(month)}-${parseInt(day)}-${year}`;
}
function totalCallDuration(start_time, end_time) {
const startMoment = moment(start_time);
const endMoment = moment(end_time);
const duration = moment.duration(endMoment.diff(startMoment));
const hours = String(duration.hours()).padStart(2, '0');
const minutes = String(duration.minutes()).padStart(2, '0');
const seconds = String(duration.seconds()).padStart(2, '0');
if (hours === '00' && minutes === '00') {
return `00:00:${seconds}`;
} else if (hours === '00') {
return `00:${minutes}:${seconds}`;
} else {
return `${hours}:${minutes}:${seconds}`;
}
}
// Fetch and process the patient meeting list
const getPatientMeetingList = async () => {
store.dispatch('updateIsLoading', true);
await store.dispatch('patientMeetingList', { id: route.params.id });
store.dispatch('updateIsLoading', false);
let list = store.getters.getPatientMeetingList;
patientMeetingList.value = list.map(history => ({
...history,
appointment_date: changeFormat(history.appointment_date),
start_time: changeDateFormat(history.start_time),
end_time: changeDateFormat(history.end_time),
duration: totalCallDuration(history.start_time, history.end_time),
}));
console.log(list);
};
// Lifecycle hooks
onBeforeMount(() => {});
onMounted(async () => {
await getPatientMeetingList();
});
onUnmounted(() => {});
const historyDetail = (item, value) => {
console.log('item',item.id ,value)
if(value == 'notes')
router.push('/admin/patient/meeting/notes/' + route.params.id + '/' + item.id);
if(value == 'prescription')
router.push('/admin/patient/meeting/prescription/' + route.params.id + '/' + item.id);
}
const menusVariant = [
'primary'
];
const options = [
{
title: 'Notes',
key: 'notes',
},
{
title: 'Prescription',
key: 'prescription',
},
]
const breadcrums = [
{
title: 'Patient',
disabled: false,
to: '/admin/patients',
},
{
title: 'Meetings',
disabled: false,
}
];
</script>
<template>
<v-breadcrumbs :items="breadcrums" class="text-primary pt-0 pb-0 mb-5">
<template v-slot:divider style="padding-top:0px; padding-bottom:0px">
>
</template>
</v-breadcrumbs>
<v-row>
<v-col cols="12" md="12">
<v-card title="Meetings">
<v-card-text>
<v-row>
<v-col cols="12" offset-md="8" md="4">
<v-text-field
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</v-col>
</v-row>
</v-card-text>
<v-data-table
:headers="headers"
:items="patientMeetingList"
:search="search"
:items-per-page="5"
class="text-no-wrap"
>
<template #item.id="{ item }">{{ item.id }}</template>
<template #item.duration="{ item }">{{ item.duration }}</template>
<!-- Actions -->
<template #item.actions="{ item }">
<div class="demo-space-x">
<VMenu
v-for="menu in menusVariant"
:key="menu"
>
<template #activator="{ props }">
<i class="ri-more-2-line cursor-pointer" style="font-size: 32px;" v-bind="props"></i>
</template>
<v-list>
<v-list-item
v-for="opt in options"
:key="opt.value"
@click="historyDetail(item, opt.key)"
>
{{ opt.title }}
</v-list-item>
</v-list>
</VMenu>
</div>
<!-- <div class="d-flex gap-1">
<VBtn class="text-capitalize text-white" @click="historyDetail(item)"> Detail
</VBtn>
</div> -->
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</template>

View File

@@ -0,0 +1,136 @@
<script setup>
import NotesPanel from '@/pages/patients/NotesPanel.vue'
import PatienTabOverview from '@/pages/patients/PatienTabOverview.vue'
import PatientBioPanel from '@/pages/patients/PatientBioPanel.vue'
import PatientLabTest from '@/pages/patients/PatientLabTest.vue'
import PatientQuestionProfile from '@/pages/patients/PatientQuestionProfile.vue'
import PrescriptionPanel from '@/pages/patients/PrescriptionPanel.vue'
import { useStore } from 'vuex'
const patientDtail = ref(null);
const store = useStore();
const route = useRoute('apps-user-view-id')
const userTab = ref(null)
const tabs = [
{
icon: 'ri-group-line',
title: 'Overview',
action: 'read',
subject: "Patient Overview Tab",
},
{
icon: 'ri-lock-2-line',
title: 'Notes',
action: 'read',
subject: "Patient Notes Tab",
},
{
icon: 'ri-bookmark-line',
title: 'Prescriptions',
action: 'read',
subject: "Patient Prescription Tab",
},
{
icon: 'ri-flask-line',
title: 'Lab Test',
action: 'read',
subject: "Patient Lab Test Tab",
},
{
icon: 'ri-survey-line',
title: 'Profile',
action: 'read',
subject: "Patient Profile Tab",
},
// {
// icon: 'ri-link-m',
// title: 'Connections',
// },
]
const getPatientDeatail = async () => {
store.dispatch('updateIsLoading', true);
await store.dispatch('patientDetial', { id: route.params.id });
store.dispatch('updateIsLoading', false);
let list = store.getters.getPatientDetail;
patientDtail.value=list
console.log(list.patient);
};
onMounted(async () => {
await getPatientDeatail();
});
//const { data: userData } = await useApi(`/apps/users/${ route.params.id }`)
</script>
<template>
<VRow v-if="patientDtail">
<VCol
cols="12"
md="5"
lg="4"
>
<PatientBioPanel :user-data="patientDtail" />
</VCol>
<VCol
cols="12"
md="7"
lg="8"
>
<VTabs
v-model="userTab"
class="v-tabs-pill"
>
<VTab
v-for="tab in tabs"
:key="tab.icon"
>
<VIcon
start
:icon="tab.icon"
v-if="$can(tab.action, tab.subject)"
/>
<span v-if="$can(tab.action, tab.subject)">{{ tab.title }}</span>
</VTab>
</VTabs>
<VWindow
v-model="userTab"
class="mt-6 disable-tab-transition"
:touch="false"
>
<VWindowItem>
<PatienTabOverview :user-data="patientDtail" v-if="$can('read', 'Patient Overview Tab')"/>
</VWindowItem>
<VWindowItem>
<NotesPanel :notes-data="patientDtail" v-if="$can('read', 'Patient Notes Tab')"/>
</VWindowItem>
<VWindowItem>
<PrescriptionPanel :prescription-data="patientDtail" v-if="$can('read', 'Patient Prescription Tab')"/>
</VWindowItem>
<VWindowItem>
<PatientLabTest :user-data="patientDtail" v-if="$can('read', 'Patient Lab Test Tab')"/>
</VWindowItem>
<VWindowItem v-if="$can('read', 'Patient Profile Tab')">
<PatientQuestionProfile />
</VWindowItem>
</VWindow>
</VCol>
</VRow>
<VCard v-else>
<VCardTitle class="text-center">
No User Found
</VCardTitle>
</VCard>
</template>

View File

@@ -0,0 +1,893 @@
<script setup>
import API from '@/api';
import { PATIENT_FILTER_LIST_API } from '@/constants';
import debounce from 'lodash.debounce';
import { onBeforeMount, onMounted, onUnmounted } from 'vue';
import AddPatient from '@/pages/patients/AddPatient.vue';
import EditPatient from '@/pages/patients/EditPatient.vue';
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
// DataTable.use(DataTablesCore);
const store = useStore()
// const route = useRoute()
const isAddCustomerDrawerOpen = ref(false)
const isEditCustomerDrawerOpen = ref(false)
const router = useRouter()
const editDialog = ref(false)
const deleteDialog = ref(false)
// const search = ref('')
const patientRexord = ref([]);
const patientTotalRexord = ref([]);
const search = ref('');
const serverItems = ref([]);
const loading = ref(true);
const totalItems = ref(0);
const first_name1 = ref('');
const defaultItem = ref({
id: -1,
avatar: '',
name: '',
email: '',
dob: '',
phone_no: '',
address: '',
city: '',
state: '',
country: '',
})
const editedItem = ref(defaultItem.value)
const editedIndex = ref(-1)
const patientList = ref([])
const subcriptionLists = ref(['All'])
const isLoading = ref(false)
const filter = ref({
gender: 'All',
state: 'all',
plan: 'all',
})
// const gender =ref();
// const city =ref();
// const plan =ref();
// status options
const selectedOptions = [
{
text: 'Active',
value: 1,
},
{
text: 'InActive',
value: 2,
},
]
const refVForm = ref(null)
onBeforeMount(async () => { });
onMounted(async () => {
store.dispatch('updateIsLoading', true)
await store.dispatch('getSubcriptions')
// await store.dispatch('patientListDataTable')
await store.dispatch('patientList')
// console.log('getPatientDataTable',store.getters.getPatientDataTable);
// patientRexord.value = store.getters.getPatientDataTable.data;
// patientTotalRexord.value = store.getters.getPatientDataTable.recordsTotal;
// console.log("patientRexord",patientRexord.value,patientTotalRexord.value );
// patientList.value = store.getters.getPatientList
store.dispatch('updateIsLoading', false)
// loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
// document.addEventListener('click', (event) => {
// if (event.target.matches('.edit-btn')) {
// const id = event.target.getAttribute('data-id');
// const item = patientList.value.find(patient => patient.id === parseInt(id));
// editItem(item);
// } else if (event.target.matches('.delete-btn')) {
// const id = event.target.getAttribute('data-id');
// const item = patientList.value.find(patient => patient.id === parseInt(id));
// deleteItem(item);
// }
// });
});
const handlePatientAdded = async (msg) => {
if (msg == 'success') {
store.dispatch('updateIsLoading', true)
loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
store.dispatch('updateIsLoading', false)
}
// You can also trigger a toast or snackbar here to show the message
// For example, if using Vuetify:
// showSnackbar(msg)
}
// const getPatientFilter = async () => {
// console.log("filter", filter.value.plan, filter.value.gender, filter.value.state);
// await store.dispatch('PatientFilter', {
// plan: filter.value.plan,
// gender: filter.value.gender.toLowerCase(),
// state: filter.value.state,
// })
// store.dispatch('updateIsLoading', false)
// }
const getPatientList = computed(async () => {
subcriptionLists.value = [];
patientList.value = [];
subcriptionLists.value = store.getters.getSubcriptions;
const allIndex = subcriptionLists.value.findIndex(sub => sub.title.toLowerCase() === 'all');
// If "All" exists, move it to the beginning
if (allIndex !== -1) {
const all = subcriptionLists.value.splice(allIndex, 1)[0];
subcriptionLists.value.unshift(all);
} else {
// If "All" doesn't exist, create it and prepend it
subcriptionLists.value.unshift({ title: 'All', slug: 'all' });
}
console.log("subcriptin", subcriptionLists.value);
patientList.value = store.getters.getPatientList.map(history => ({
...history,
dob: changeFormat(history.dob),
}));
patientList.value.sort((a, b) => {
return b.id - a.id;
});
console.log("patientList",patientList.value);
return patientList.value
});
onUnmounted(async () => { });
const formatPhoneNumber = () => {
console.log(editedItem.value)
// Remove non-numeric characters from the input
const numericValue = editedItem.value.phone_no.replace(/\D/g, '');
// Apply formatting logic
if (numericValue.length <= 10) {
editedItem.value.phone_no = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
} else {
// Limit the input to a maximum of 14 characters
const truncatedValue = numericValue.slice(0, 10);
editedItem.value.phone_no = truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
}
};
const resolveStatusVariant = status => {
if (status === 1)
return {
color: 'primary',
text: 'Current',
}
else if (status === 2)
return {
color: 'success',
text: 'Professional',
}
else if (status === 3)
return {
color: 'error',
text: 'Rejected',
}
else if (status === 4)
return {
color: 'warning',
text: 'Resigned',
}
else
return {
color: 'info',
text: 'Applied',
}
}
const editItem = async (item) => {
isEditCustomerDrawerOpen.value = true
await store.dispatch('patientGETBYID', {
id: item.id,
})
editedItem.value = store.getters.getSinglePatient
console.log(store.getters.getSinglePatient)
//editDialog.value = true
}
const deleteItem = item => {
console.log('del', item)
editedIndex.value = patientList.value.indexOf(item)
editedItem.value = { ...item }
deleteDialog.value = true
}
const close = () => {
editDialog.value = false
editedIndex.value = -1
editedItem.value = { ...defaultItem.value }
}
const closeDelete = () => {
deleteDialog.value = false
editedIndex.value = -1
editedItem.value = { ...defaultItem.value }
loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
}
const getMettings = (Item) => {
router.push('/admin/patient/meetings/' + Item.id);
}
const save = async () => {
const { valid } = await refVForm.value.validate()
console.log(valid)
if (valid) {
console.log('editedItem.value', editedItem.value);
// if (editedIndex.value > -1) {
await store.dispatch('patientUpdate', {
id: editedItem.value.id,
first_name: editedItem.value.first_name,
last_name: editedItem.value.last_name,
email: editedItem.value.email,
phone_no: editedItem.value.phone_no,
dob: editedItem.value.dob,
})
loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
close();
// Object.assign(patientList.value[editedIndex.value], editedItem.value)
// } else {
// patientList.value.push(editedItem.value)
// }
}
}
const states = ref([
{ name: 'Alabama', abbreviation: 'AL' },
{ name: 'Alaska', abbreviation: 'AK' },
{ name: 'Arizona', abbreviation: 'AZ' },
{ name: 'Arkansas', abbreviation: 'AR' },
{ name: 'Howland Island', abbreviation: 'UM-84' },
{ name: 'Delaware', abbreviation: 'DE' },
{ name: 'Maryland', abbreviation: 'MD' },
{ name: 'Baker Island', abbreviation: 'UM-81' },
{ name: 'Kingman Reef', abbreviation: 'UM-89' },
{ name: 'New Hampshire', abbreviation: 'NH' },
{ name: 'Wake Island', abbreviation: 'UM-79' },
{ name: 'Kansas', abbreviation: 'KS' },
{ name: 'Texas', abbreviation: 'TX' },
{ name: 'Nebraska', abbreviation: 'NE' },
{ name: 'Vermont', abbreviation: 'VT' },
{ name: 'Jarvis Island', abbreviation: 'UM-86' },
{ name: 'Hawaii', abbreviation: 'HI' },
{ name: 'Guam', abbreviation: 'GU' },
{ name: 'United States Virgin Islands', abbreviation: 'VI' },
{ name: 'Utah', abbreviation: 'UT' },
{ name: 'Oregon', abbreviation: 'OR' },
{ name: 'California', abbreviation: 'CA' },
{ name: 'New Jersey', abbreviation: 'NJ' },
{ name: 'North Dakota', abbreviation: 'ND' },
{ name: 'Kentucky', abbreviation: 'KY' },
{ name: 'Minnesota', abbreviation: 'MN' },
{ name: 'Oklahoma', abbreviation: 'OK' },
{ name: 'Pennsylvania', abbreviation: 'PA' },
{ name: 'New Mexico', abbreviation: 'NM' },
{ name: 'American Samoa', abbreviation: 'AS' },
{ name: 'Illinois', abbreviation: 'IL' },
{ name: 'Michigan', abbreviation: 'MI' },
{ name: 'Virginia', abbreviation: 'VA' },
{ name: 'Johnston Atoll', abbreviation: 'UM-67' },
{ name: 'West Virginia', abbreviation: 'WV' },
{ name: 'Mississippi', abbreviation: 'MS' },
{ name: 'Northern Mariana Islands', abbreviation: 'MP' },
{ name: 'United States Minor Outlying Islands', abbreviation: 'UM' },
{ name: 'Massachusetts', abbreviation: 'MA' },
{ name: 'Connecticut', abbreviation: 'CT' },
{ name: 'Florida', abbreviation: 'FL' },
{ name: 'District of Columbia', abbreviation: 'DC' },
{ name: 'Midway Atoll', abbreviation: 'UM-71' },
{ name: 'Navassa Island', abbreviation: 'UM-76' },
{ name: 'Indiana', abbreviation: 'IN' },
{ name: 'Wisconsin', abbreviation: 'WI' },
{ name: 'Wyoming', abbreviation: 'WY' },
{ name: 'South Carolina', abbreviation: 'SC' },
{ name: 'Arkansas', abbreviation: 'AR' },
{ name: 'South Dakota', abbreviation: 'SD' },
{ name: 'Montana', abbreviation: 'MT' },
{ name: 'North Carolina', abbreviation: 'NC' },
{ name: 'Palmyra Atoll', abbreviation: 'UM-95' },
{ name: 'Puerto Rico', abbreviation: 'PR' },
{ name: 'Colorado', abbreviation: 'CO' },
{ name: 'Missouri', abbreviation: 'MO' },
{ name: 'New York', abbreviation: 'NY' },
{ name: 'Maine', abbreviation: 'ME' },
{ name: 'Tennessee', abbreviation: 'TN' },
{ name: 'Georgia', abbreviation: 'GA' },
{ name: 'Louisiana', abbreviation: 'LA' },
{ name: 'Nevada', abbreviation: 'NV' },
{ name: 'Iowa', abbreviation: 'IA' },
{ name: 'Idaho', abbreviation: 'ID' },
{ name: 'Rhode Island', abbreviation: 'RI' },
{ name: 'Washington', abbreviation: 'WA' },
{ name: 'Ohio', abbreviation: 'OH' },
{ name: 'All', abbreviation: 'all' },
// ... (add the rest of the states)
]);
const sortedStates = computed(() => {
const sorted = states.value.slice().sort((a, b) => {
// Move "All" to the beginning
if (a.name === 'All') return -1;
if (b.name === 'all') return 1;
// Sort other states alphabetically
return a.name.localeCompare(b.name);
});
return sorted;
});
const deleteItemConfirm = async () => {
console.log('editedIndex.value', editedIndex.value, editedItem.value.id)
await store.dispatch('patientDelete', {
id: editedItem.value.id
})
closeDelete()
}
const LabKit = (item) => {
router.push('/admin/patients/labkit/' + item.id);
}
const onSubcriptionChange = async (newvalue) => {
filter.value.plan = newvalue;
console.log("Plan", filter.value.plan);
loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
}
const onGenderChange = async (newvalue) => {
filter.value.gender = newvalue;
console.log("gender", filter.value.gender);
loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
}
// const tableKey = ref(0);
// const dataTableRef = ref(null);
// watch(
// () => filter.value.gender,
// (newGender) => {
// console.log('Gender changed:', newGender);
// if (dataTableRef.value) {
// tableKey.value += 1;
// console.log('dataTableRef:', dataTableRef.value);
// } else {
// console.warn('dataTableRef.value is null');
// }
// }
// );
// watch(
// () => filter.value.plan,
// (newPlan) => {
// console.log('Plan changed:', newPlan);
// if (dataTableRef.value) {
// tableKey.value += 1;
// console.log('dataTableRef:', dataTableRef.value);
// } else {
// console.warn('dataTableRef.value is null');
// }
// }
// );
// const onStateChange = async(newvalue)=> {
// filter.value.state = newvalue;
// console.log("state",filter.value.state);
// loadItems({ page: 1, itemsPerPage: itemsPerPage.value, sortBy: [] });
// }
const itemsPerPage = ref(30);
const headers = [
{ title: 'ID', key: 'id' },
{ title: 'NAME', key: 'first_name' },
{ title: 'Gender', key: 'gender', align: 'end' },
{ title: 'EMAIL', key: 'email', align: 'start' },
{ title: 'Date Of Birth', key: 'dob', align: 'start' },
{ title: 'Last Order', key: 'last_order_date', searchable:false },
{ title: 'Register Date', key: 'created_at', align: 'start' },
{ title: 'Total Orders', key: 'total_orders', align: 'start' ,searchable:false},
{ title: 'Total Subcriptions', key: 'total_subscriptions', align: 'start',searchable:false },
{
title: 'Action',
key: 'actions',
searchable:false
},
];
const loadItems = debounce( async ( { page, itemsPerPage, sortBy }) => {
const formattedSortBy = sortBy.map(sort => ({
key: sort.key,
order: 'desc' // Force descending order
}));
const payload = {
page,
itemsPerPage,
sortBy:formattedSortBy,
filters:{
gender:filter.value.gender.toLowerCase(),
plan:filter.value.plan,
state: 'all'
},
search:search.value,
}
console.log("records",page, itemsPerPage, sortBy , PATIENT_FILTER_LIST_API);
loading.value = true;
const data = await API.getDataTableRecord(PATIENT_FILTER_LIST_API, payload, headers);
console.log('patientData',data);
serverItems.value = data.items;
totalItems.value = data.total;
loading.value = false;
},500);
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();
return formattedDate;
}
function formatDate(dateTime) {
if (!dateTime) return '';
// Split date and time parts
const [datePart, timePart] = dateTime.split(' ');
// Split date into parts
const [year, month, day] = datePart.split('-').map(Number);
// Split time into parts
const [hour, minute, second] = timePart.split(':').map(Number);
// Format the date and time
return `${month}-${day}-${year}`;
}
function ConvertDateFormate(dateTime) {
if (!dateTime) return '';
// Create a Date object from the ISO date string
const date = new Date(dateTime);
// Extract day, month, year, hours, and minutes
const day = String(date.getUTCDate()).padStart(2, '0');
const month = String(date.getUTCMonth() + 1).padStart(2, '0'); // Months are zero-based
const year = date.getUTCFullYear();
const hours = String(date.getUTCHours()).padStart(2, '0');
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
// Format the date and time
return `${month}-${day}-${year}`;
}
function changeDateFormat(dateFormat) {
if (!dateFormat) {
throw new Error('Invalid date format input');
}
const dateParts = dateFormat.split('-'); // Assuming date is in yyyy-mm-dd format
if (dateParts.length !== 3) {
throw new Error('Invalid date format');
}
const year = parseInt(dateParts[0], 10);
const month = parseInt(dateParts[1], 10); // No need for padding
const day = parseInt(dateParts[2], 10); // 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 < 10 ? '0' : '') + month + '-' +
(day < 10 ? '0' : '') + day + '-' +
date.getFullYear();
return formattedDate;
}
</script>
<style scoped>
/* Add your styles here */
</style>
<template>
<v-row>
<v-col cols="12" md="12" v-if="getPatientList">
<v-card title="Patients">
<VCardText>
<VRow>
<VCol cols="12" md="3">
<VAutocomplete v-model="filter.plan" label="Subcription" placeholder="Subcription" density="compact"
:items="subcriptionLists" item-title="title" item-value="slug"
@update:model-value="onSubcriptionChange" />
</VCol>
<VCol cols="12" md="3">
<VAutocomplete v-model="filter.gender" label="Gender" placeholder="Gender" density="compact"
:items="['All', 'Male', 'Female']" @update:model-value="onGenderChange" />
</VCol>
<!--<VCol
cols="12"
md="3"
>
<VAutocomplete
v-model="filter.state"
label="State"
density="compact"
:items="sortedStates"
item-title="name"
item-value="abbreviation"
@update:model-value="onStateChange"
/>
</VCol>-->
<VCol
cols="12"
md="3"
>
<!-- <VTextField
v-model="search"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
density="compact"
hide-details
dense
outlined
/> -->
<VTextField
v-model="search"
density="compact"
label="Search"
placeholder="Search ..."
append-inner-icon="ri-search-line"
single-line
hide-details
dense
outlined
/>
</VCol>
<VCol cols="12" md="3" v-if="$can('read', 'Patient Add')">
<VBtn prepend-icon="ri-add-line" @click="isAddCustomerDrawerOpen = !isAddCustomerDrawerOpen">
Add Patient
</VBtn>
</VCol>
</VRow>
</VCardText>
<v-data-table-server
v-model:items-per-page="itemsPerPage"
:headers="headers"
:items="serverItems"
:items-length="totalItems"
:loading="loading"
:search="search"
:item-value="first_name"
@update:options="loadItems">
<template #item.id="{ item }">
{{ item.id }}
</template>
<template #item.first_name="{ item }">
<div class="d-flex align-center">
<VAvatar
size="32"
:color="item.avatar ? '' : 'primary'"
:class="item.avatar ? '' : 'v-avatar-light-bg primary--text'"
:variant="!item.avatar ? 'tonal' : undefined"
>
<VImg
v-if="item.avatar"
:src="item.avatar"
/>
<span
v-else
class="text-sm"
>{{ avatarText(item.first_name) }}</span>
</VAvatar>
<div class="d-flex flex-column ms-3">
<router-link
:to="{ name: 'admin-patient-profile', params: { id: item.id } }"
class="highlighted"
>
<span class="d-block font-weight-medium text-truncate">{{ item.first_name }} {{ item.last_name }}</span>
</router-link>
<small>{{ item.post }}</small>
</div>
</div>
</template>
<template #item.status="{ item }">
<VChip
:color="resolveStatusVariant(item.status).color"
density="comfortable"
>
{{ resolveStatusVariant(item.status).text }}
</VChip>
</template>
<template #item.dob="{ item }">
<span class="d-flex align-center" style="width: 100px;"> {{ changeFormat (item.dob) }}</span>
</template>
<template #item.last_order_date="{ item }">
<span class="d-flex align-center" style="width: 100px;"> {{ formatDate(item.last_order_date) }}</span>
</template>
<template #item.created_at="{ item }">
<span class="d-flex align-center" style="width: 100px;"> {{ ConvertDateFormate(item.created_at) }}</span>
</template>
<template #item.labkit="{ item }">
<div class="text-primary cursor-pointer" @click="LabKit(item)"> LabKits</div>
</template>
<template #item.actions="{ item }">
<div class="d-flex gap-1">
<IconBtn
size="small"
@click="editItem(item)"
v-if="$can('read', 'Patient Edit')"
>
<VIcon icon="ri-pencil-line" />
</IconBtn>
<IconBtn
size="small"
@click="deleteItem(item)"
v-if="$can('read', 'Patient Delete')"
>
<VIcon icon="ri-delete-bin-line" />
</IconBtn>
<IconBtn
size="small"
@click="getMettings(item)"
style="display: none;"
>
<VIcon icon="ri-time-line" />
</IconBtn>
</div>
</template>
</v-data-table-server>
</v-card>
</v-col>
</v-row>
<AddPatient v-model:is-drawer-open="isAddCustomerDrawerOpen" @patientAdded="handlePatientAdded" />
<EditPatient v-model:is-drawer-open="isEditCustomerDrawerOpen" :user-data="store.getters.getSinglePatient"
@patientAdded="handlePatientAdded" />
<!-- 👉 Edit Dialog -->
<VDialog v-model="editDialog" max-width="600px">
<VForm ref="refVForm">
<VCard>
<VCardTitle>
<span class="headline">Edit Patient</span>
</VCardTitle>
<VCardText>
<VContainer>
<VRow>
<!-- fullName -->
<VCol cols="12" md="6">
<VTextField v-model="editedItem.first_name" label="First Name" :rules="[requiredFirstName]" />
</VCol>
<VCol cols="12" md="6">
<VTextField v-model="editedItem.last_name" label="Last Name" :rules="[requiredLastName]" />
</VCol>
<!-- email -->
<VCol cols="12" sm="6" md="12">
<VTextField v-model="editedItem.email" label="Email" :rules="[requiredEmail, emailValidator]" />
</VCol>
<VCol cols="12" sm="6" md="12">
<VTextField v-model="editedItem.dob" type="date" label="Date Of Birth" />
</VCol>
<VCol cols="12" sm="6" md="12">
<VTextField v-model="editedItem.phone_no" label="Phone Number" pattern="^\(\d{3}\) \d{3}-\d{4}$"
:rules="[requiredPhone, validUSAPhone]" placeholder="i.e. (000) 000-0000" @input="formatPhoneNumber"
max="14" density="comfortable" />
</VCol>
<!-- status -->
<VCol cols="12" md="12">
<VSelect v-model="editedItem.status" :items="selectedOptions" item-title="text" item-value="value"
label="Status" variant="outlined" />
</VCol>
</VRow>
</VContainer>
</VCardText>
<VCardActions>
<VSpacer />
<VBtn color="error" variant="outlined" @click="close">
Cancel
</VBtn>
<VBtn color="success" variant="elevated" @click="save">
Save
</VBtn>
</VCardActions>
</VCard>
</VForm>
</VDialog>
<!-- 👉 Delete Dialog -->
<VDialog v-model="deleteDialog" max-width="500px">
<VCard>
<VCardTitle>
Are you sure you want to delete this item?
</VCardTitle>
<VCardActions>
<VSpacer />
<VBtn color="error" variant="outlined" @click="closeDelete">
Cancel
</VBtn>
<VBtn color="success" variant="elevated" @click="deleteItemConfirm">
OK
</VBtn>
<VSpacer />
</VCardActions>
</VCard>
</VDialog>
</template>
<style>
table>thead>tr>th {
height: 56px;
font-weight: 500;
-webkit-user-select: none;
user-select: none;
text-align: center;
padding: 0 20px;
transition-duration: .28s;
transition-property: height;
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
border-bottom: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
/* background: rgb(var(--v-table-header-color)) !important; */
border-block-end: none !important;
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity)) !important;
font-size: .8125rem;
letter-spacing: .2px;
line-height: 24px;
text-transform: uppercase;
}
table>tbody>tr>td {
text-align: center;
height: 50px;
border-bottom: 1px solid #e2dfdf;
}
.dt-layout-row {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 10px;
}
.dt-layout-table {
display: block !important;
width: 100%;
}
.dt-layout-cell {
display: flex;
align-items: center;
}
.dt-input {
border: 1px solid silver;
border-radius: 5px;
padding: 7px;
text-align: center;
margin-left: 5px;
background: rgb(var(--v-table-header-color)) !important;
}
.dt-length,
.dt-search {
display: flex;
align-items: center;
}
.dt-length label,
.dt-search label {
margin-left: 5px;
}
.dt-layout-start {
flex: 1;
}
.dt-layout-end {
flex: 1;
display: flex;
justify-content: flex-end;
}
.dt-paging-button {
cursor: pointer;
border: 1px solid silver;
border-radius: 22px;
padding: 9px 15px 6px 15px;
margin-left: 3px;
}
.first,
.previous,
.next,
.last {
cursor: pointer;
border: 0px solid silver;
border-radius: 22px;
padding: 9px 5px 6px 5px;
margin-left: 3px;
}
.current {
background: #8c57ff;
color: white;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,578 @@
<script setup>
import { VNodeRenderer } from '@layouts/components/VNodeRenderer';
import { themeConfig } from '@themeConfig';
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
const router = useRouter()
const store = useStore()
definePage({ meta: { layout: 'blank' } })
const states = ref([
{ name: 'Alabama', abbreviation: 'AL' },
{ name: 'Alaska', abbreviation: 'AK' },
{ name: 'Arizona', abbreviation: 'AZ' },
{ name: 'Arkansas', abbreviation: 'AR' },
{ name: 'Howland Island', abbreviation: 'UM-84' },
{ name: 'Delaware', abbreviation: 'DE' },
{ name: 'Maryland', abbreviation: 'MD' },
{ name: 'Baker Island', abbreviation: 'UM-81' },
{ name: 'Kingman Reef', abbreviation: 'UM-89' },
{ name: 'New Hampshire', abbreviation: 'NH' },
{ name: 'Wake Island', abbreviation: 'UM-79' },
{ name: 'Kansas', abbreviation: 'KS' },
{ name: 'Texas', abbreviation: 'TX' },
{ name: 'Nebraska', abbreviation: 'NE' },
{ name: 'Vermont', abbreviation: 'VT' },
{ name: 'Jarvis Island', abbreviation: 'UM-86' },
{ name: 'Hawaii', abbreviation: 'HI' },
{ name: 'Guam', abbreviation: 'GU' },
{ name: 'United States Virgin Islands', abbreviation: 'VI' },
{ name: 'Utah', abbreviation: 'UT' },
{ name: 'Oregon', abbreviation: 'OR' },
{ name: 'California', abbreviation: 'CA' },
{ name: 'New Jersey', abbreviation: 'NJ' },
{ name: 'North Dakota', abbreviation: 'ND' },
{ name: 'Kentucky', abbreviation: 'KY' },
{ name: 'Minnesota', abbreviation: 'MN' },
{ name: 'Oklahoma', abbreviation: 'OK' },
{ name: 'Pennsylvania', abbreviation: 'PA' },
{ name: 'New Mexico', abbreviation: 'NM' },
{ name: 'American Samoa', abbreviation: 'AS' },
{ name: 'Illinois', abbreviation: 'IL' },
{ name: 'Michigan', abbreviation: 'MI' },
{ name: 'Virginia', abbreviation: 'VA' },
{ name: 'Johnston Atoll', abbreviation: 'UM-67' },
{ name: 'West Virginia', abbreviation: 'WV' },
{ name: 'Mississippi', abbreviation: 'MS' },
{ name: 'Northern Mariana Islands', abbreviation: 'MP' },
{ name: 'United States Minor Outlying Islands', abbreviation: 'UM' },
{ name: 'Massachusetts', abbreviation: 'MA' },
{ name: 'Connecticut', abbreviation: 'CT' },
{ name: 'Florida', abbreviation: 'FL' },
{ name: 'District of Columbia', abbreviation: 'DC' },
{ name: 'Midway Atoll', abbreviation: 'UM-71' },
{ name: 'Navassa Island', abbreviation: 'UM-76' },
{ name: 'Indiana', abbreviation: 'IN' },
{ name: 'Wisconsin', abbreviation: 'WI' },
{ name: 'Wyoming', abbreviation: 'WY' },
{ name: 'South Carolina', abbreviation: 'SC' },
{ name: 'South Dakota', abbreviation: 'SD' },
{ name: 'Montana', abbreviation: 'MT' },
{ name: 'North Carolina', abbreviation: 'NC' },
{ name: 'Palmyra Atoll', abbreviation: 'UM-95' },
{ name: 'Puerto Rico', abbreviation: 'PR' },
{ name: 'Colorado', abbreviation: 'CO' },
{ name: 'Missouri', abbreviation: 'MO' },
{ name: 'New York', abbreviation: 'NY' },
{ name: 'Maine', abbreviation: 'ME' },
{ name: 'Tennessee', abbreviation: 'TN' },
{ name: 'Georgia', abbreviation: 'GA' },
{ name: 'Louisiana', abbreviation: 'LA' },
{ name: 'Nevada', abbreviation: 'NV' },
{ name: 'Iowa', abbreviation: 'IA' },
{ name: 'Idaho', abbreviation: 'ID' },
{ name: 'Rhode Island', abbreviation: 'RI' },
{ name: 'Washington', abbreviation: 'WA' },
{ name: 'Ohio', abbreviation: 'OH' },
// ... (add the rest of the states)
]);
const sortedStates = computed(() => {
return states.value.slice().sort((a, b) => {
return a.name.localeCompare(b.name);
});
});
const selectedStateName = (abbreviation) => {
const selectedState = states.value.find(
(s) => s.abbreviation === abbreviation
);
return selectedState ? selectedState.name : abbreviation;
};
const currentStep = ref(0)
const isPasswordVisible = ref(false)
const isConfirmPasswordVisible = ref(false)
const formSave = ref(null)
const formatPhoneNumber = () => {
// Remove non-numeric characters from the input
const numericValue = form.value.phone_no.replace(/\D/g, '');
// Apply formatting logic
if (numericValue.length <= 10) {
form.value.phone_no = numericValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
} else {
// Limit the input to a maximum of 14 characters
const truncatedValue = numericValue.slice(0, 10);
form.value.phone_no= truncatedValue.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
}
};
const getCurrentDate = () => {
const today = new Date();
console.log("today", today);
const year = today.getFullYear();
let month = today.getMonth() + 1;
let day = today.getDate();
// Format the date to match the input type="date" format
month = month < 10 ? `0${month}` : month;
day = day < 10 ? `0${day}` : day;
return `${month}-${day}-${year}`;
};
const radioContent = [
{
title: 'Starter',
desc: 'A simple start for everyone.',
value: '0',
},
{
title: 'Standard',
desc: 'For small to medium businesses.',
value: '99',
},
{
title: 'Enterprise',
desc: 'Solution for big organizations.',
value: '499',
},
]
const items = [
{
title: 'Account',
subtitle: 'Account Details',
},
{
title: 'Shipping Information',
subtitle: 'Enter Information',
}
]
const form = ref({
first_name: '',
last_name: '',
email: '',
password: '',
mobile: '',
pincode: '',
address: '',
landmark: '',
city: '',
dob: '',
phone_no:'',
state: null,
selectedPlan: '0',
cardNumber: '',
cardName: '',
expiryDate: '',
cvv: '',
zip_code: '',
country: 'United States',
gender:''
})
const genders = ref([
{ name: 'Male', abbreviation: 'Male' },
{ name: 'Female', abbreviation: 'Female' },
{ name: 'Other', abbreviation: 'Other' },
]);
const validateStep = async () => {
const { valid } = await formSave.value.validate()
console.log(formSave.value)
return valid
}
const handleNext = async () => {
if (await validateStep()) {
if (currentStep.value < items.length - 1) {
console.log('Age', calculateAge(form.value.dob))
if (calculateAge(form.value.dob) >= 18) {
currentStep.value++
} else {
store.dispatch('updateErrorMessage', 'Patient must be 18+')
}
}
}
}
const handlePrevious = () => {
if (currentStep.value > 0) {
currentStep.value--
}
}
const calculateAge = (dateOfBirth) => {
const today = new Date();
const birthDate = new Date(dateOfBirth);
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
if (
monthDiff < 0 ||
(monthDiff === 0 && today.getDate() < birthDate.getDate())
) {
age--;
}
return age;
};
const onSubmit = async () => {
const { valid } = await formSave.value.validate()
if (valid) {
await store.dispatch('patientAdd',{
first_name: form.value.first_name,
last_name: form.value.last_name,
email: form.value.email,
password: form.value.password,
phone_no: form.value.phone_no,
dob: form.value.dob,
address: form.value.address,
city: form.value.city,
state: form.value.state,
country: form.value.country,
gender: form.value.gender,
zip_code:form.value.zip_code
})
if (!store.getters.getErrorMsg) {
router.push('/admin/patients');
form.value.first_name = null
form.value.last_name = null
form.value.email = null
form.value.password = null
form.value.phone_no = null
form.value.dob = null
form.value.address = null
form.value.city = null
form.value.state = null
form.value.country = null
form.value.zip_code=null
}
}
}
</script>
<template>
<RouterLink to="/">
<div class="auth-logo d-flex align-center gap-x-3">
<VNodeRenderer :nodes="themeConfig.app.logo" />
<h1 class="auth-title">
{{ themeConfig.app.title }}
</h1>
</div>
</RouterLink>
<VRow
no-gutters
class="auth-wrapper"
>
<VCol
cols="12"
md="12"
class="auth-card-v2 d-flex align-center justify-center pa-10"
style="background-color: rgb(var(--v-theme-surface));"
>
<VCard
flat
class="mt-12 mt-sm-0"
>
<AppStepper
v-model:current-step="currentStep"
:items="items"
:direction="$vuetify.display.smAndUp ? 'horizontal' : 'vertical'"
class="mb-12"
/>
<VWindow
v-model="currentStep"
class="disable-tab-transition"
style="max-inline-size: 650px;"
>
<VForm ref="formSave">
<VWindowItem >
<h4 class="text-h4">
Basic Information
</h4>
<p class="mb-5">
Enter Your Account Details
</p>
<VRow>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.first_name"
label="First Name"
placeholder="Johndoe"
:rules="[requiredValidator]"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.last_name"
label="Last Name"
placeholder="Johndoe"
:rules="[requiredValidator]"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.email"
label="Email"
placeholder="johndoe@email.com"
:rules="[requiredValidator, emailValidator]"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.password"
label="Password"
placeholder="············"
:type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon="isPasswordVisible ? 'ri-eye-off-line' : 'ri-eye-line'"
@click:append-inner="isPasswordVisible = !isPasswordVisible"
:rules="[requiredValidator, passwordValidator]"
/>
</VCol>
<VCol cols="12" md="6">
<VTextField v-model="form.phone_no" label="Phone Number" pattern="^\(\d{3}\) \d{3}-\d{4}$"
:rules="[requiredPhone, validUSAPhone]" placeholder="i.e. (000) 000-0000"
@input="formatPhoneNumber" max="14" density="comfortable" />
</VCol>
<VCol cols="12" md="6">
<v-select v-model="form.gender" label="Gender" :items="genders" item-title="name" item-value="abbreviation"
:rules="[requiredValidator]" density="comfortable">
</v-select>
</VCol>
<VCol cols="12" md="6">
<AppDateTimePicker
v-model="form.dob"
label="Date Of Birth"
placeholder="Date Of Birth"
format="MM-dd-yyyy"
:config="{ dateFormat: 'Y-m-d' }"
:max="getCurrentDate()"
:rules="[requiredValidator]"
/>
</VCol>
</VRow>
</VWindowItem>
<VWindowItem >
<h4 class="text-h4">
Shipping Information
</h4>
<p class="mb-5">
Enter Your Shipping Information
</p>
<VRow>
<VCol cols="12">
<VTextField
v-model="form.address"
label="Address"
placeholder="1234 Main St, New York, NY 10001, USA"
:rules="[requiredValidator]"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="form.zip_code"
label="Zip Code*"
type="number"
:rules="[requiredValidator]"
placeholder="982347"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.city"
label="City"
placeholder="New York"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VAutocomplete
v-model="form.state"
label="States"
:items="sortedStates"
item-title="name" item-value="abbreviation"
placeholder="Select State"
:rules="[requiredState]"
/>
</VCol>
</VRow>
</VWindowItem>
<VWindowItem>
<h4 class="text-h4">
Select Plan
</h4>
<p class="mb-5">
Select plan as per your requirement
</p>
<CustomRadiosWithIcon
v-model:selected-radio="form.selectedPlan"
:radio-content="radioContent"
:grid-column="{ sm: '4', cols: '12' }"
>
<template #default="{ item }">
<div class="text-center">
<h6 class="text-h6 mb-2">
{{ item.title }}
</h6>
<p class="clamp-text text-body-2 mb-2">
{{ item.desc }}
</p>
<div class="d-flex align-center justify-center">
<div class="text-primary mb-2">
$
</div>
<h4 class="text-h4 text-primary">
{{ item.value }}
</h4>
<div class="text-body-2 text-disabled mt-2">
/month
</div>
</div>
</div>
</template>
</CustomRadiosWithIcon>
<h4 class="text-h4 mt-12">
Payment Information
</h4>
<p class="mb-5">
Enter your card information
</p>
<VRow>
<VCol cols="12">
<VTextField
v-model="form.cardNumber"
type="number"
label="Card Number"
placeholder="1234 1234 1234 1234"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="form.cardName"
label="Name on Card"
placeholder="John Doe"
/>
</VCol>
<VCol
cols="6"
md="3"
>
<VTextField
v-model="form.expiryDate"
label="Expiry"
placeholder="MM/YY"
/>
</VCol>
<VCol
cols="6"
md="3"
>
<VTextField
v-model="form.cvv"
type="number"
label="CVV"
placeholder="123"
/>
</VCol>
</VRow>
</VWindowItem>
</VForm>
</VWindow>
<div class="d-flex flex-wrap justify-space-between gap-x-4 gap-y-2 mt-5">
<VBtn
color="secondary"
variant="outlined"
:disabled="currentStep === 0"
@click="currentStep--"
>
<VIcon
icon="ri-arrow-left-line"
start
class="flip-in-rtl"
@click="handlePrevious"
/>
Previous
</VBtn>
<VBtn
v-if="items.length - 1 === currentStep"
color="success"
append-icon="ri-check-line"
@click="onSubmit"
>
submit
</VBtn>
<VBtn
v-else
@click="handleNext(currentStep)"
>
Next
<VIcon
icon="ri-arrow-right-line"
end
class="flip-in-rtl"
/>
</VBtn>
</div>
</VCard>
</VCol>
</VRow>
</template>
<style lang="scss">
@use "@core-scss/template/pages/page-auth.scss";
</style>

View File

@@ -0,0 +1,43 @@
{
"bp_match": {
"type": "c",
"values": {
"0": 100,
"60": 80,
"70": 60
}
},
"exact_match": {
"type": "e",
"values": {
"yes": 100,
"no": 2,
"high": 2,
"never": 2,
"almost_never": 30,
"occasionally": 66,
"almost_always": 75,
"always": 100,
"very_much": 66,
"a_lot": 100,
"a_little": 30,
"not_at_all": 2,
"not_applicable": 2,
"rarely": 30,
"sometimes": 66,
"often": 75,
"unsure": 2,
"less_than_6_hrs": 100,
"six_to_eight_hrs": 66,
"more_than_eight": 33,
"before_penetrate": 100,
"ejaculate_early": 66,
"no_issue_with_ejaculation": 2,
"no_issue": 2,
"usually_difficult": 100,
"low": 100,
"medium": 66,
"none_of_above_them": 2
}
}
}