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 editedIndex = ref(-1)
const patientList = ref([])
const subcriptionLists = ref([])
const subcriptionLists = ref(['All'])
const isLoading=ref(false)
const filter = ref({
@@ -61,9 +61,10 @@ onMounted(async () => {
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,
gender: filter.value.gender.toLowerCase(),
state: filter.value.state,
})
store.dispatch('updateIsLoading', false)
@@ -71,6 +72,16 @@ const getPatientFilter = async() => {
const getPatientList = computed(async () => {
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,
@@ -282,13 +293,19 @@ const states = ref([
{ 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(() => {
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 sorted;
});
const deleteItemConfirm = async () => {
@@ -349,7 +366,7 @@ const onStateChange = async(newvalue)=> {
<VRow>
<VCol
cols="12"
md="3"
>
<VSelect
@@ -376,7 +393,7 @@ const onStateChange = async(newvalue)=> {
label="Gender"
placeholder="Gender"
density="comfortable"
:items="['Male', 'Female']"
:items="['All','Male', 'Female']"
@update:model-value="onGenderChange"
/>