feat: filter certification batches
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<Breadcrumbs class="h-7" :items="breadcrumbs" />
|
<Breadcrumbs class="h-7" :items="breadcrumbs" />
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<Button
|
<Button
|
||||||
v-if="user.data?.is_moderator"
|
v-if="user.data?.is_moderator && batch.data?.certification"
|
||||||
@click="openCertificateDialog = true"
|
@click="openCertificateDialog = true"
|
||||||
>
|
>
|
||||||
{{ __('Generate Certificates') }}
|
{{ __('Generate Certificates') }}
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
:label="__('Allow self enrollment')"
|
:label="__('Allow self enrollment')"
|
||||||
/>
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="batch.certification"
|
||||||
|
type="checkbox"
|
||||||
|
:label="__('Certification')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -293,6 +298,7 @@ const batch = reactive({
|
|||||||
medium: '',
|
medium: '',
|
||||||
category: '',
|
category: '',
|
||||||
allow_self_enrollment: false,
|
allow_self_enrollment: false,
|
||||||
|
certification: false,
|
||||||
image: null,
|
image: null,
|
||||||
paid_batch: false,
|
paid_batch: false,
|
||||||
currency: '',
|
currency: '',
|
||||||
@@ -362,7 +368,12 @@ const batchDetail = createResource({
|
|||||||
batch[key] = `${hours}:${minutes}`
|
batch[key] = `${hours}:${minutes}`
|
||||||
} else if (Object.hasOwn(batch, key)) batch[key] = data[key]
|
} else if (Object.hasOwn(batch, key)) batch[key] = data[key]
|
||||||
})
|
})
|
||||||
let checkboxes = ['published', 'paid_batch', 'allow_self_enrollment']
|
let checkboxes = [
|
||||||
|
'published',
|
||||||
|
'paid_batch',
|
||||||
|
'allow_self_enrollment',
|
||||||
|
'certification',
|
||||||
|
]
|
||||||
for (let idx in checkboxes) {
|
for (let idx in checkboxes) {
|
||||||
let key = checkboxes[idx]
|
let key = checkboxes[idx]
|
||||||
batch[key] = batch[key] ? true : false
|
batch[key] = batch[key] ? true : false
|
||||||
|
|||||||
@@ -26,13 +26,19 @@
|
|||||||
{{ __('All Batches') }}
|
{{ __('All Batches') }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col space-y-2 lg:space-y-0 lg:flex-row lg:items-center lg:space-x-2"
|
class="flex flex-col space-y-2 lg:space-y-0 lg:flex-row lg:items-center lg:space-x-4"
|
||||||
>
|
>
|
||||||
<TabButtons
|
<TabButtons
|
||||||
v-if="user.data"
|
v-if="user.data"
|
||||||
:buttons="batchTabs"
|
:buttons="batchTabs"
|
||||||
v-model="currentTab"
|
v-model="currentTab"
|
||||||
/>
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-model="certification"
|
||||||
|
:label="__('Certification')"
|
||||||
|
type="checkbox"
|
||||||
|
@change="updateBatches()"
|
||||||
|
/>
|
||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="grid grid-cols-2 gap-2">
|
||||||
<FormControl
|
<FormControl
|
||||||
v-model="title"
|
v-model="title"
|
||||||
@@ -111,6 +117,7 @@ const pageLength = ref(20)
|
|||||||
const categories = ref([])
|
const categories = ref([])
|
||||||
const currentCategory = ref(null)
|
const currentCategory = ref(null)
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
const certification = ref(false)
|
||||||
const filters = ref({})
|
const filters = ref({})
|
||||||
const currentTab = ref(user.data?.is_student ? 'All' : 'Upcoming')
|
const currentTab = ref(user.data?.is_student ? 'All' : 'Upcoming')
|
||||||
const orderBy = ref('start_date')
|
const orderBy = ref('start_date')
|
||||||
@@ -130,6 +137,7 @@ const setFiltersFromQuery = () => {
|
|||||||
let queries = new URLSearchParams(location.search)
|
let queries = new URLSearchParams(location.search)
|
||||||
title.value = queries.get('title') || ''
|
title.value = queries.get('title') || ''
|
||||||
currentCategory.value = queries.get('category') || null
|
currentCategory.value = queries.get('category') || null
|
||||||
|
certification.value = queries.get('certification') || false
|
||||||
}
|
}
|
||||||
|
|
||||||
const batches = createListResource({
|
const batches = createListResource({
|
||||||
@@ -161,6 +169,7 @@ const updateBatches = () => {
|
|||||||
const updateFilters = () => {
|
const updateFilters = () => {
|
||||||
updateCategoryFilter()
|
updateCategoryFilter()
|
||||||
updateTitleFilter()
|
updateTitleFilter()
|
||||||
|
updateCertificationFilter()
|
||||||
updateTabFilter()
|
updateTabFilter()
|
||||||
updateStudentFilter()
|
updateStudentFilter()
|
||||||
setQueryParams()
|
setQueryParams()
|
||||||
@@ -182,6 +191,14 @@ const updateTitleFilter = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateCertificationFilter = () => {
|
||||||
|
if (certification.value) {
|
||||||
|
filters.value['certification'] = 1
|
||||||
|
} else {
|
||||||
|
delete filters.value['certification']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const updateTabFilter = () => {
|
const updateTabFilter = () => {
|
||||||
orderBy.value = 'start_date'
|
orderBy.value = 'start_date'
|
||||||
if (!user.data) {
|
if (!user.data) {
|
||||||
@@ -222,6 +239,7 @@ const setQueryParams = () => {
|
|||||||
let filterKeys = {
|
let filterKeys = {
|
||||||
title: title.value,
|
title: title.value,
|
||||||
category: currentCategory.value,
|
category: currentCategory.value,
|
||||||
|
certification: certification.value,
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(filterKeys).forEach((key) => {
|
Object.keys(filterKeys).forEach((key) => {
|
||||||
|
|||||||
@@ -8,15 +8,20 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"published",
|
"section_break_earo",
|
||||||
"title",
|
"title",
|
||||||
"start_date",
|
"start_date",
|
||||||
"end_date",
|
"end_date",
|
||||||
"column_break_4",
|
"column_break_4",
|
||||||
"allow_self_enrollment",
|
|
||||||
"start_time",
|
"start_time",
|
||||||
"end_time",
|
"end_time",
|
||||||
"timezone",
|
"timezone",
|
||||||
|
"section_break_cssv",
|
||||||
|
"published",
|
||||||
|
"column_break_wfkz",
|
||||||
|
"allow_self_enrollment",
|
||||||
|
"column_break_vnrp",
|
||||||
|
"certification",
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
"description",
|
"description",
|
||||||
"column_break_hlqw",
|
"column_break_hlqw",
|
||||||
@@ -207,6 +212,7 @@
|
|||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "published",
|
"fieldname": "published",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
|
"in_standard_filter": 1,
|
||||||
"label": "Published"
|
"label": "Published"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -325,6 +331,29 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Confirmation Email Template",
|
"label": "Confirmation Email Template",
|
||||||
"options": "Email Template"
|
"options": "Email Template"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_wfkz",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_vnrp",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "certification",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"in_standard_filter": 1,
|
||||||
|
"label": "Certification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_earo",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_cssv",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
@@ -342,7 +371,7 @@
|
|||||||
"link_fieldname": "batch_name"
|
"link_fieldname": "batch_name"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2025-02-17 17:48:12.949392",
|
"modified": "2025-02-18 15:43:18.512504",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Batch",
|
"name": "LMS Batch",
|
||||||
|
|||||||
@@ -139,8 +139,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [
|
||||||
"modified": "2025-02-11 14:48:27.801895",
|
{
|
||||||
|
"link_doctype": "LMS Batch Enrollment",
|
||||||
|
"link_fieldname": "payment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"link_doctype": "LMS Enrollment",
|
||||||
|
"link_fieldname": "payment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"modified": "2025-02-18 15:54:25.383353",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Payment",
|
"name": "LMS Payment",
|
||||||
|
|||||||
@@ -1225,6 +1225,7 @@ def get_batch_details(batch):
|
|||||||
"paid_batch",
|
"paid_batch",
|
||||||
"evaluation_end_date",
|
"evaluation_end_date",
|
||||||
"allow_self_enrollment",
|
"allow_self_enrollment",
|
||||||
|
"certification",
|
||||||
"timezone",
|
"timezone",
|
||||||
"category",
|
"category",
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user