fix: misc issues

This commit is contained in:
Jannat Patel
2026-02-27 12:31:38 +05:30
parent 5c0faa39b7
commit 361d1c0fd6
4 changed files with 47 additions and 81 deletions

View File

@@ -53,9 +53,9 @@
</template>
<script setup>
import { Dialog, FormControl, createResource, toast } from 'frappe-ui'
import { Link } from 'frappe-ui/frappe'
import { computed, ref } from 'vue'
import { useRouter } from 'vue-router'
import Link from '@/components/Controls/Link.vue'
const show = defineModel()
const assessmentType = ref(null)

View File

@@ -109,16 +109,14 @@ const account = reactive({
client_secret: '',
})
const props = defineProps({
accountID: {
type: String,
default: 'new',
},
})
const props = defineProps<{
accountID: string | null
}>()
watch(
() => props.accountID,
(val) => {
console.log(props.accountID)
if (val === 'new') {
account.name = ''
account.enabled = false

View File

@@ -6,7 +6,7 @@
{{ label }}
</div>
<div class="text-ink-gray-6 leading-5">
{{ __(description) }}
{{ __(description || '') }}
</div>
</div>
<div class="flex items-center space-x-5">
@@ -90,6 +90,7 @@
</div>
</div>
<ZoomAccountModal
v-if="showForm"
v-model="showForm"
v-model:zoomAccounts="zoomAccounts"
:accountID="currentAccount"
@@ -100,7 +101,6 @@ import {
Avatar,
Button,
Badge,
call,
createListResource,
FeatherIcon,
ListView,
@@ -112,20 +112,18 @@ import {
ListSelectBanner,
toast,
} from 'frappe-ui'
import { computed, inject, onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { Plus, Trash2 } from 'lucide-vue-next'
import { cleanError } from '@/utils'
import { User } from '@/components/Settings/types'
import ZoomAccountModal from '@/components/Modals/ZoomAccountModal.vue'
const user = inject<User | null>('$user')
const showForm = ref(false)
const currentAccount = ref<string | null>(null)
const props = defineProps({
label: String,
description: String,
})
const props = defineProps<{
label: string
description?: string
}>()
const zoomAccounts = createListResource({
doctype: 'LMS Zoom Settings',
@@ -147,15 +145,6 @@ onMounted(() => {
})
const fetchZoomAccounts = () => {
if (!user?.data?.is_moderator && !user?.data?.is_evaluator) return
if (!user?.data?.is_moderator) {
zoomAccounts.update({
filters: {
member: user.data.name,
},
})
}
zoomAccounts.reload()
}
@@ -164,21 +153,20 @@ const openForm = (accountID: string) => {
showForm.value = true
}
const removeAccount = (selections, unselectAll) => {
call('lms.lms.api.delete_documents', {
doctype: 'LMS Zoom Settings',
documents: Array.from(selections),
const removeAccount = (selections: Set<string>, unselectAll: () => void) => {
Array.from(selections).forEach((accountID) => {
zoomAccounts.delete.submit(accountID, {
onSuccess() {
toast.success(__('Zoom account deleted successfully'))
fetchZoomAccounts()
unselectAll()
},
onError(err: any) {
toast.error(cleanError(err.messages[0] || err))
console.error(err)
},
})
})
.then(() => {
zoomAccounts.reload()
toast.success(__('Email Templates deleted successfully'))
unselectAll()
})
.catch((err) => {
toast.error(
cleanError(err.messages[0]) || __('Error deleting email templates')
)
})
}
const columns = computed(() => {

View File

@@ -41,47 +41,28 @@
<span class="font-semibold text-ink-gray-9 leading-5">
{{ evl.course_title }}
</span>
<Menu
<Dropdown
v-if="evl.date > dayjs().format()"
as="div"
class="relative inline-block text-left"
:options="[
{
label: __('Cancel'),
icon: Ban,
onClick() {
cancelEvaluation(evl)
},
},
]"
placement="left"
side="left"
>
<div>
<MenuButton class="inline-flex w-full justify-center">
<EllipsisVertical class="w-4 h-4 stroke-1.5" />
</MenuButton>
</div>
<transition
enter-active-class="transition duration-100 ease-out"
enter-from-class="transform scale-95 opacity-0"
enter-to-class="transform scale-100 opacity-100"
leave-active-class="transition duration-75 ease-in"
leave-from-class="transform scale-100 opacity-100"
leave-to-class="transform scale-95 opacity-0"
>
<MenuItems
class="absolute mt-2 w-32 rounded-md bg-surface-white border p-1.5"
>
<MenuItem v-slot="{ active }">
<Button
variant="ghost"
class="w-full"
@click="cancelEvaluation(evl)"
>
<template #prefix>
<Ban
:active="active"
class="size-4 stroke-1.5"
aria-hidden="true"
/>
</template>
{{ __('Cancel') }}
</Button>
</MenuItem>
</MenuItems>
</transition>
</Menu>
<template v-slot="{ open }">
<Button variant="ghost">
<template #icon>
<EllipsisVertical class="w-4 h-4 stroke-1.5" />
</template>
</Button>
</template>
</Dropdown>
</div>
<div class="flex items-center mb-3">
<Calendar class="w-4 h-4 stroke-1.5" />
@@ -139,9 +120,8 @@ import {
} from 'lucide-vue-next'
import { inject, ref, getCurrentInstance, computed } from 'vue'
import { formatTime } from '@/utils'
import { Button, createListResource, call, toast } from 'frappe-ui'
import { Button, createListResource, call, Dropdown, toast } from 'frappe-ui'
import EvaluationModal from '@/components/Modals/EvaluationModal.vue'
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'
const dayjs = inject('$dayjs')
const user = inject('$user')
@@ -221,7 +201,7 @@ const endDateHasPassed = computed(() => {
const cancelEvaluation = (evl) => {
$dialog({
title: __('Cancel this evaluation?'),
title: __('Confirm Cancellation?'),
message: __(
'Are you sure you want to cancel this evaluation? This action cannot be undone.'
),