This commit is contained in:
Muhammad Shahzad 2024-06-11 04:45:17 +05:00
parent 41857281af
commit 7247a33cdc
2 changed files with 297 additions and 7 deletions

View File

@ -21,7 +21,7 @@ const defaultItem = ref({
const editedItem = ref(defaultItem.value) const editedItem = ref(defaultItem.value)
const editedIndex = ref(-1) const editedIndex = ref(-1)
const patientList = ref([]) const patientList = ref([])
const subcriptionLists = ref([]) const subcriptionLists = ref(['All'])
const isLoading=ref(false) const isLoading=ref(false)
const filter = ref({ const filter = ref({
@ -61,9 +61,10 @@ onMounted(async () => {
const getPatientFilter = async() => { const getPatientFilter = async() => {
console.log("filter", filter.value.plan, filter.value.gender, filter.value.state); console.log("filter", filter.value.plan, filter.value.gender, filter.value.state);
await store.dispatch('PatientFilter', { await store.dispatch('PatientFilter', {
plan: filter.value.plan, plan: filter.value.plan,
gender: filter.value.gender, gender: filter.value.gender.toLowerCase(),
state: filter.value.state, state: filter.value.state,
}) })
store.dispatch('updateIsLoading', false) store.dispatch('updateIsLoading', false)
@ -71,6 +72,16 @@ const getPatientFilter = async() => {
const getPatientList = computed(async () => { const getPatientList = computed(async () => {
subcriptionLists.value = store.getters.getSubcriptions; 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); console.log("subcriptin",subcriptionLists.value);
patientList.value = store.getters.getPatientList.map(history => ({ patientList.value = store.getters.getPatientList.map(history => ({
...history, ...history,
@ -282,13 +293,19 @@ const states = ref([
{ name: 'Rhode Island', abbreviation: 'RI' }, { name: 'Rhode Island', abbreviation: 'RI' },
{ name: 'Washington', abbreviation: 'WA' }, { name: 'Washington', abbreviation: 'WA' },
{ name: 'Ohio', abbreviation: 'OH' }, { name: 'Ohio', abbreviation: 'OH' },
{ name: 'All', abbreviation: 'all' },
// ... (add the rest of the states) // ... (add the rest of the states)
]); ]);
const sortedStates = computed(() => { const sortedStates = computed(() => {
return states.value.slice().sort((a, b) => { 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 a.name.localeCompare(b.name);
}); });
return sorted;
}); });
const deleteItemConfirm = async () => { const deleteItemConfirm = async () => {
@ -349,7 +366,7 @@ const onStateChange = async(newvalue)=> {
<VRow> <VRow>
<VCol <VCol
cols="12" cols="12"
md="3" md="3"
> >
<VSelect <VSelect
@ -376,7 +393,7 @@ const onStateChange = async(newvalue)=> {
label="Gender" label="Gender"
placeholder="Gender" placeholder="Gender"
density="comfortable" density="comfortable"
:items="['Male', 'Female']" :items="['All','Male', 'Female']"
@update:model-value="onGenderChange" @update:model-value="onGenderChange"
/> />

View File

@ -152,6 +152,89 @@ const save = async () => {
} }
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 getMettings = (Item) => { const getMettings = (Item) => {
router.push('/admin/provider/meetings/'+Item.id); router.push('/admin/provider/meetings/'+Item.id);
} }
@ -173,10 +256,108 @@ const getprovidersList = computed(async () => {
return providersList.value return providersList.value
}); });
const getProviderFilter = 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,
// state: filter.value.state,
// })
// store.dispatch('updateIsLoading', false)
}
onMounted(() => { onMounted(() => {
}) })
const filter = ref({
practics_state:'',
gender: '',
state: '',
specialty:'',
availabilityFrom:'',
availabilityTo:''
// plan: '',
})
// const onSubcriptionChange = async(newvalue)=> {
// filter.value.plan = newvalue;
// console.log("Plan",filter.value.plan );
// await getPatientFilter();
// }
const onSpecialty = async(newvalue)=> {
if(newvalue.length > 3){
filter.value.specialty = newvalue;
console.log("onSpecialty",filter.value.specialty);
}
// await getPatientFilter();
}
const onGenderChange = async(newvalue)=> {
filter.value.gender = newvalue;
console.log("gender",filter.value.gender);
await getProviderFilter();
}
const onStateChange = async(newvalue)=> {
filter.value.state = newvalue;
console.log("state",filter.value.state);
await getProviderFilter();
}
const onAvailabilityFromChange = async(newvalue)=> {
filter.value.availabilityFrom = newvalue;
console.log("frmo",filter.value.availabilityFrom);
await getProviderFilter();
}
const onAvailabilityToChange = async(newvalue)=> {
filter.value.availabilityTo = newvalue;
console.log("to",filter.value.availabilityTo);
await getProviderFilter();
}
const onPracticsStateChange = async(newvalue)=> {
filter.value.practics_state = newvalue;
console.log("state",filter.value.practics_state);
await getProviderFilter();
}
const onDateRangeChange = async(newvalue)=> {
filter.value.date_range = newvalue;
console.log("Length", newvalue.length);
}
const timeOptions = computed(() => {
const options = ['All'];
for (let hour = 0; hour < 24; hour++) {
for (let minute = 0; minute < 60; minute += 30) {
let period = 'AM';
let displayHour = hour;
if (hour === 0) {
displayHour = 12; // Convert 0 to 12 for 12:00 AM
} else if (hour === 12) {
period = 'PM'; // 12:00 PM
} else if (hour > 12) {
displayHour = hour - 12; // Convert to 12-hour format
period = 'PM';
}
const timeString = `${displayHour.toString().padStart(2, '0')}:${minute
.toString()
.padStart(2, '0')} ${period}`;
options.push(timeString);
}
}
return options;
});
</script> </script>
<template> <template>
@ -185,10 +366,102 @@ onMounted(() => {
<VCard title="Providers"> <VCard title="Providers">
<VCardText > <VCardText >
<VRow> <VRow>
<!-- <VCol
cols="12"
md="3"
>
<VSelect
v-model="filter.plan"
label="Subcription"
placeholder="Subcription"
density="comfortable"
:items="subcriptionLists"
item-title="title"
item-value="slug"
@update:model-value="onSubcriptionChange"
/>
</VCol> -->
<!-- <VCol
cols="12"
md="2"
>
<VSelect
v-model="filter.practics_state"
label="Practics State"
density="comfortable"
:items="sortedStates"
item-title="name"
item-value="abbreviation"
@update:model-value="onPracticsStateChange"
/>
</VCol> -->
<VCol <VCol
cols="12" cols="12"
offset-md="8"
md="4" md="2"
>
<VSelect
v-model="filter.gender"
label="Gender"
placeholder="Gender"
density="comfortable"
:items="['All','Male', 'Female']"
@update:model-value="onGenderChange"
/>
</VCol>
<VCol
cols="12"
md="2"
>
<VSelect
v-model="filter.state"
label="State"
density="comfortable"
:items="sortedStates"
item-title="name"
item-value="abbreviation"
@update:model-value="onStateChange"
/>
</VCol>
<!-- <VCol
cols="12"
md="2"
>
<VTextField
v-model="filter.specialty"
label="Speciality"
append-inner-icon="ri-search-line"
@update:model-value="onSpecialty"
/>
</VCol> -->
<VCol
cols="12"
md="3"
>
<VSelect @update:model-value="onAvailabilityFromChange" v-model="filter.availabilityFrom" label="Availability From" :items="timeOptions" density="comfortable" />
</VCol>
<VCol
cols="12"
md="3"
>
<VSelect @update:model-value="onAvailabilityToChange" v-model="filter.availabilityTo" label="Availability To" :items="timeOptions" density="comfortable"
/>
</VCol>
<VCol
cols="12"
md="2"
> >
<VTextField <VTextField
v-model="search" v-model="search"