From 7247a33cdca8445ce3e5875b5ffc5e9fcb25a3b0 Mon Sep 17 00:00:00 2001 From: Muhammad Shahzad Date: Tue, 11 Jun 2024 04:45:17 +0500 Subject: [PATCH] fixes --- resources/js/pages/patients/patients.vue | 27 +- resources/js/pages/providers/providers.vue | 277 ++++++++++++++++++++- 2 files changed, 297 insertions(+), 7 deletions(-) diff --git a/resources/js/pages/patients/patients.vue b/resources/js/pages/patients/patients.vue index 1e89457..81dee5c 100644 --- a/resources/js/pages/patients/patients.vue +++ b/resources/js/pages/patients/patients.vue @@ -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)=> { { label="Gender" placeholder="Gender" density="comfortable" - :items="['Male', 'Female']" + :items="['All','Male', 'Female']" @update:model-value="onGenderChange" /> diff --git a/resources/js/pages/providers/providers.vue b/resources/js/pages/providers/providers.vue index abc7436..b3b136e 100644 --- a/resources/js/pages/providers/providers.vue +++ b/resources/js/pages/providers/providers.vue @@ -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) => { router.push('/admin/provider/meetings/'+Item.id); } @@ -173,10 +256,108 @@ const getprovidersList = computed(async () => { 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(() => { }) +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; +});