fix: misc batch issues

This commit is contained in:
Jannat Patel
2025-05-13 11:46:00 +05:30
parent e6945ac076
commit 403e56b4ef
15 changed files with 110 additions and 672 deletions

View File

@@ -357,7 +357,7 @@ watch(tabIndex, () => {
const canMakeAnnouncement = () => {
if (readOnlyMode) return false
return user.data?.is_moderator || user.data?.is_evaluator
if (batch.data) return user.data?.is_moderator || user.data?.is_evaluator
}
usePageMeta(() => {

View File

@@ -6,67 +6,45 @@
<Breadcrumbs :items="breadcrumbs" />
</header>
<div class="m-5 pb-10">
<div>
<div class="text-3xl font-semibold text-ink-gray-9">
{{ batch.data.title }}
</div>
<div class="my-3 leading-6 text-ink-gray-7">
{{ batch.data.description }}
</div>
<div
class="flex flex-col gap-2 lg:gap-0 lg:flex-row lg:items-center space-x-0 md:space-x-5 lg:w-1/2"
>
<div
v-if="batch.data?.courses?.length"
class="flex items-center text-ink-gray-7"
>
<BookOpen class="h-4 w-4 mr-2 stroke-1.5" />
<span> {{ batch.data?.courses?.length }} {{ __('Courses') }} </span>
<div class="flex justify-between w-full">
<div class="md:w-2/3">
<div class="text-3xl font-semibold text-ink-gray-9">
{{ batch.data.title }}
</div>
<span v-if="batch.data?.courses?.length" class="hidden lg:block"
>&middot;</span
>
<DateRange
:startDate="batch.data.start_date"
:endDate="batch.data.end_date"
/>
<span class="hidden lg:block" v-if="batch.data.start_date"
>&middot;</span
>
<div class="flex items-center text-ink-gray-7">
<Clock class="h-4 w-4 mr-2 stroke-1.5" />
<span>
{{ formatTime(batch.data.start_time) }} -
{{ formatTime(batch.data.end_time) }}
</span>
<div class="my-3 leading-6 text-ink-gray-7">
{{ batch.data.description }}
</div>
</div>
<div class="flex avatar-group overlap mt-3">
<div
class="h-6 mr-1"
:class="{
'avatar-group overlap': batch.data.instructors.length > 1,
}"
>
<UserAvatar
v-for="instructor in batch.data.instructors"
:user="instructor"
/>
<div class="flex avatar-group overlap">
<div
class="h-6 mr-1"
:class="{
'avatar-group overlap': batch.data.instructors.length > 1,
}"
>
<UserAvatar
v-for="instructor in batch.data.instructors"
:user="instructor"
/>
</div>
<CourseInstructors :instructors="batch.data.instructors" />
</div>
<CourseInstructors :instructors="batch.data.instructors" />
</div>
</div>
<div class="grid lg:grid-cols-[60%,20%] gap-4 lg:gap-20 mt-10">
<div class="order-2 lg:order-none">
<div
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-outline-gray-2 prose-th:border-outline-gray-2 prose-td:relative prose-th:relative prose-th:bg-surface-gray-2 prose-sm max-w-none !whitespace-normal mt-6"
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-outline-gray-2 prose-th:border-outline-gray-2 prose-td:relative prose-th:relative prose-th:bg-surface-gray-2 prose-sm max-w-none !whitespace-normal mt-10"
v-html="batch.data.batch_details"
></div>
</div>
<div class="hidden md:block">
<BatchOverlay :batch="batch" />
</div>
</div>
<!-- <div class="grid lg:grid-cols-[60%,20%] gap-4 lg:gap-20 mt-10">
<div class="order-2 lg:order-none">
</div>
<div class="order-1 lg:order-none">
<BatchOverlay :batch="batch" />
</div>
</div>
</div> -->
<div v-if="batch.data.courses.length">
<div class="flex items-center mt-10">
<div class="text-2xl font-semibold">

View File

@@ -21,16 +21,6 @@
:required="true"
class="w-full"
/>
<FormControl
v-model="batch.description"
:label="__('Short Description')"
type="textarea"
:rows="8"
:placeholder="__('Short description of the batch')"
:required="true"
/>
</div>
<div class="space-y-5">
<MultiSelect
v-model="instructors"
doctype="User"
@@ -39,20 +29,15 @@
:onCreate="(close) => openSettings('Members', close)"
:filters="{ ignore_user_type: 1 }"
/>
<div>
<label class="block text-sm text-ink-gray-5 mb-1">
{{ __('Batch Details') }}
<span class="text-ink-red-3">*</span>
</label>
<TextEditor
:content="batch.batch_details"
@change="(val) => (batch.batch_details = val)"
:editable="true"
:fixedMenu="true"
editorClass="prose-sm max-w-none border-b border-x bg-surface-gray-2 rounded-b-md py-1 px-2 min-h-[7rem] mb-4"
/>
</div>
</div>
<FormControl
v-model="batch.description"
:label="__('Short Description')"
type="textarea"
:rows="8"
:placeholder="__('Short description of the batch')"
:required="true"
/>
</div>
</div>
@@ -135,6 +120,22 @@
</div>
</div>
<div class="px-20 pb-5 space-y-5 border-b mb-5">
<div>
<label class="block text-sm text-ink-gray-5 mb-1">
{{ __('Batch Details') }}
<span class="text-ink-red-3">*</span>
</label>
<TextEditor
:content="batch.batch_details"
@change="(val) => (batch.batch_details = val)"
:editable="true"
:fixedMenu="true"
editorClass="prose-sm max-w-none border-b border-x bg-surface-gray-2 rounded-b-md py-1 px-2 min-h-[7rem] max-h-[20rem] overflow-y-scroll mb-4"
/>
</div>
</div>
<div class="px-20 pb-5 space-y-5 border-b mb-5">
<div class="text-lg text-ink-gray-9 font-semibold mb-4">
{{ __('Configurations') }}
@@ -236,7 +237,7 @@
<div class="px-20 pb-5 space-y-5">
<div class="text-lg text-ink-gray-9 font-semibold">
{{ __('Payment') }}
{{ __('Pricing') }}
</div>
<FormControl
v-model="batch.paid_batch"

View File

@@ -270,6 +270,7 @@ import {
FormControl,
FileUploader,
usePageMeta,
toast,
} from 'frappe-ui'
import {
inject,
@@ -282,7 +283,7 @@ import {
getCurrentInstance,
} from 'vue'
import { showToast } from '@/utils'
import { Image, Trash2, X } from 'lucide-vue-next'
import { Check, Image, Trash2, X } from 'lucide-vue-next'
import { useRouter } from 'vue-router'
import { capture } from '@/telemetry'
import { useOnboarding } from 'frappe-ui/frappe'
@@ -449,7 +450,28 @@ const submitCourse = () => {
},
{
onSuccess() {
showToast('Success', 'Course updated successfully', 'check')
console.log('Course updated successfully')
/* showToast('Success', 'Course updated successfully', 'check') */
/* First arg of toast.promise is a promiseToResolve and second is the options obj, how to write this */
toast.promise(
new Promise((resolve) => {
resolve()
}),
{
open: true,
type: 'success',
message: __('Course updated successfully'),
icon: Check,
duration: 500,
}
)
/* toast.promise({
open: true,
type: 'success',
message: __('Course updated successfully'),
icon: Check,
duration: 5
}) */
},
onError(err) {
showToast('Error', err.messages?.[0] || err, 'x')

View File

@@ -168,6 +168,7 @@
ignore_user_type: 1,
}"
:label="__('Program Member')"
:onCreate="(value, close) => openSettings('Members', close)"
/>
</template>
</Dialog>
@@ -192,7 +193,8 @@ import { computed, ref } from 'vue'
import { Plus, Trash2 } from 'lucide-vue-next'
import { showToast } from '@/utils/'
import { useRouter } from 'vue-router'
import { sessionStore } from '../stores/session'
import { sessionStore } from '@/stores/session'
import { useSettings } from '@/stores/settings'
import Draggable from 'vuedraggable'
import Link from '@/components/Controls/Link.vue'
@@ -202,6 +204,7 @@ const currentForm = ref(null)
const course = ref(null)
const member = ref(null)
const router = useRouter()
const settingsStore = useSettings()
const props = defineProps({
programName: {
@@ -356,6 +359,12 @@ const memberColumns = computed(() => {
]
})
const openSettings = (category, close) => {
close()
settingsStore.activeTab = category
settingsStore.isSettingsOpen = true
}
const breadbrumbs = computed(() => {
return [
{