fix: misc issues

This commit is contained in:
Jannat Patel
2026-01-14 09:24:24 +05:30
parent 4c81eef80d
commit 8ff339b7ed
8 changed files with 126 additions and 32 deletions

View File

@@ -4,15 +4,30 @@
<div class="text-lg text-ink-gray-9 font-semibold">
{{ __('Upcoming Evaluations') }}
</div>
<Button
v-if="
upcoming_evals.data?.length != evaluationCourses.length && !forHome
"
@click="openEvalModal"
>
<Button v-if="canScheduleEvals" @click="openEvalModal">
{{ __('Schedule Evaluation') }}
</Button>
</div>
<div
v-if="endDate && !endDateHasPassed"
class="text-sm leading-5 bg-surface-amber-1 text-ink-amber-3 p-2 rounded-md mb-4"
>
{{ __('The last day to schedule your evaluations is ') }}
<span class="font-medium">
{{ dayjs(endDate).format('DD MMMM YYYY') }} </span
>.
{{ __('Please make sure to schedule your evaluation before this date.') }}
</div>
<div
v-else-if="endDateHasPassed"
class="text-sm leading-5 bg-surface-red-1 text-ink-red-3 p-2 rounded-md mb-4"
>
{{
__(
'The deadline to schedule evaluations has passed. Please contact the Instructor for assistance.'
)
}}
</div>
<div v-if="upcoming_evals.data?.length">
<div
class="grid gap-4"
@@ -99,7 +114,7 @@
</div>
</div>
</div>
<div v-else class="text-ink-gray-5">
<div v-else-if="!endDateHasPassed" class="text-ink-gray-5">
{{ __('Schedule an evaluation to get certified.') }}
</div>
</div>
@@ -125,6 +140,7 @@ import { formatTime } from '@/utils'
import { Button, createResource, call } from 'frappe-ui'
import EvaluationModal from '@/components/Modals/EvaluationModal.vue'
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'
import IsSameOrAfter from 'dayjs/esm/plugin/IsSameOrAfter'
const dayjs = inject('$dayjs')
const showEvalModal = ref(false)
@@ -173,6 +189,19 @@ const evaluationCourses = computed(() => {
})
})
const canScheduleEvals = computed(() => {
return (
upcoming_evals.data?.length != evaluationCourses.length &&
!props.forHome &&
!endDateHasPassed.value
)
})
const endDateHasPassed = computed(() => {
dayjs.extend(IsSameOrAfter)
return dayjs().isSameOrAfter(dayjs(props.endDate), 'day')
})
const cancelEvaluation = (evl) => {
$dialog({
title: __('Cancel this evaluation?'),

View File

@@ -144,20 +144,7 @@
</span>
</div>
</div>
<div
v-if="batch.data.evaluation_end_date && isStudent"
class="text-sm leading-5 bg-surface-amber-1 text-ink-amber-3 p-2 rounded-md mb-10"
>
{{ __('The last day to schedule your evaluations is ') }}
<span class="font-medium">
{{
dayjs(batch.data.evaluation_end_date).format('DD MMMM YYYY')
}} </span
>.
{{
__('Please make sure to schedule your evaluation before this date.')
}}
</div>
<div v-if="dayjs().isSameOrAfter(dayjs(batch.data.start_date))">
<div class="text-ink-gray-7 font-semibold mb-2">
{{ __('Feedback') }}