diff --git a/web/admin/src/components/VolunteerList.vue b/web/admin/src/components/VolunteerList.vue index 0b7ac58..315cf1f 100644 --- a/web/admin/src/components/VolunteerList.vue +++ b/web/admin/src/components/VolunteerList.vue @@ -83,7 +83,10 @@ const updateInactive = async id => { {{ v.email }} - + + + + {{ v.status }} diff --git a/web/admin/src/views/VolunteersPage.vue b/web/admin/src/views/VolunteersPage.vue index f8da9e6..71dee65 100644 --- a/web/admin/src/views/VolunteersPage.vue +++ b/web/admin/src/views/VolunteersPage.vue @@ -3,14 +3,25 @@ import { reactive, computed, ref, onBeforeMount } from "vue" import VolunteerList from "@/components/VolunteerList.vue" import { collection, getFirestore, query, where, getDocs, orderBy } from "firebase/firestore" -var volunteers = ref() +const volunteers = ref() const statusFilter = ref("in-review") const sortBy = ref("firstname") const sortAsc = ref(true) +const driverFilter = ref(false) +const approvedDriverFilter = ref(false) const refreshList = async () => { const db = getFirestore() - const q = query(collection(db, "volunteerprofilestate"), where("status", "==", statusFilter.value), orderBy(sortBy.value, sortAsc.value ? "asc" : "desc")) + const volunteerCollection = collection(db, "volunteerprofilestate") + let q = query(volunteerCollection, where("status", "==", statusFilter.value), orderBy(sortBy.value, sortAsc.value ? "asc" : "desc")) + + if (driverFilter.value) { + q = query(q, where('isDriver', '==', true)) + } + if (approvedDriverFilter.value) { + q = query(q, where('isApprovedDriver', '==', true)) + } + const pstates = await getDocs(q) volunteers.value = [] pstates.forEach(prof => { @@ -31,9 +42,23 @@ onBeforeMount(async () => {