diff --git a/frontend/src/pages/JobApplications.vue b/frontend/src/pages/JobApplications.vue index acd34eb3..1ba7d0db 100644 --- a/frontend/src/pages/JobApplications.vue +++ b/frontend/src/pages/JobApplications.vue @@ -15,12 +15,21 @@ ]" /> -
-
-

- {{ applicationCount }} - {{ applicationCount === 1 ? __('Application') : __('Applications') }} -

+
+
+
+ {{ totalApplications.data }} + {{ + totalApplications.data === 1 + ? __('Application') + : __('Applications') + }} +
+ + +
@@ -32,9 +41,10 @@ showTooltip: false, selectable: false, }" + class="h-[79vh] border-b" > {{ item }}
-
+
+
+
+ {{ applications.data?.length }} {{ __('of') }} + {{ totalApplications.data }} +
@@ -172,8 +181,7 @@ import { usePageMeta, toast, } from 'frappe-ui' -import { RefreshCw } from 'lucide-vue-next' -import { computed, inject, onMounted, ref, reactive } from 'vue' +import { computed, inject, ref, reactive, watch } from 'vue' import { sessionStore } from '../stores/session' import EmptyState from '@/components/EmptyState.vue' @@ -181,7 +189,7 @@ const dayjs = inject('$dayjs') const { brand } = sessionStore() const showEmailModal = ref(false) const selectedApplicant = ref(null) -const applicationCount = ref(0) +const search = ref('') const emailForm = reactive({ subject: '', message: '', @@ -195,19 +203,6 @@ const props = defineProps({ }, }) -onMounted(() => { - getApplicationCount() -}) - -const getApplicationCount = () => { - call('frappe.client.get_count', { - doctype: 'LMS Job Application', - filters: { job: props.job }, - }).then((count) => { - applicationCount.value = count - }) -} - const applications = createListResource({ doctype: 'LMS Job Application', fields: [ @@ -225,6 +220,37 @@ const applications = createListResource({ auto: true, }) +const totalApplications = createResource({ + url: 'frappe.client.get_count', + params: { + doctype: 'LMS Job Application', + filters: { + job: props.job, + }, + }, + auto: true, + cache: ['totalApplications', props.job], + onError(err) { + toast.error(err.messages?.[0] || err) + console.error('Error fetching total applications:', err) + }, +}) + +watch(search, () => { + let filters = { + job: props.job, + user: ['like', `%${search.value}%`], + } + applications.update({ + filters: filters, + }) + applications.reload() + totalApplications.update({ + filters: filters, + }) + totalApplications.reload() +}) + const emailResource = createResource({ url: 'frappe.core.doctype.communication.email.make', makeParams(values) { @@ -298,25 +324,26 @@ const applicationColumns = computed(() => { { label: __('Full Name'), key: 'full_name', - width: 2, + width: 3, icon: 'user', }, { label: __('Email'), key: 'email', - width: 2, + width: 3, icon: 'at-sign', }, { label: __('Applied On'), key: 'applied_on', - width: 1, + width: 2, icon: 'calendar', }, { label: '', key: 'actions', width: 1, + align: 'right', }, ] }) @@ -326,7 +353,7 @@ const applicantRows = computed(() => { return applications.data.map((application) => ({ ...application, full_name: application.full_name, - applied_on: dayjs(application.creation).fromNow(), + applied_on: dayjs(application.creation).format('DD MMM YYYY'), })) }) diff --git a/frontend/src/pages/Quizzes.vue b/frontend/src/pages/Quizzes.vue index 47cc4231..2935120b 100644 --- a/frontend/src/pages/Quizzes.vue +++ b/frontend/src/pages/Quizzes.vue @@ -184,6 +184,7 @@ watch(search, () => { totalQuizzes.update({ filters: quizFilters.value, }) + totalQuizzes.reload() }) const quizzes = createListResource({