Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge 'develop' into 'main' #1164

Merged
merged 28 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d8f8a8e
chore: update POT file
frappe-pr-bot Nov 29, 2024
060a280
chore: Turkish translations
pateljannat Nov 29, 2024
ddc3352
chore: Swedish translations
pateljannat Nov 30, 2024
7048b22
fix: check standard in patch when deleting web forms
pateljannat Dec 1, 2024
0057467
Merge pull request #1159 from pateljannat/issues-53
pateljannat Dec 2, 2024
4c21ce2
Merge pull request #1157 from frappe/pot_develop_2024-11-29
pateljannat Dec 2, 2024
8d17b35
Merge pull request #1158 from frappe/l10n_develop2
pateljannat Dec 2, 2024
115b72f
chore: French translations
pateljannat Dec 2, 2024
cd82463
chore: Spanish translations
pateljannat Dec 2, 2024
66121e6
chore: Arabic translations
pateljannat Dec 2, 2024
e56b892
chore: German translations
pateljannat Dec 2, 2024
cf710d7
chore: Hungarian translations
pateljannat Dec 2, 2024
d4641c9
chore: Polish translations
pateljannat Dec 2, 2024
2da9462
chore: Russian translations
pateljannat Dec 2, 2024
8a3c681
chore: Swedish translations
pateljannat Dec 2, 2024
ac24a35
chore: Turkish translations
pateljannat Dec 2, 2024
5e8ad81
chore: Chinese Simplified translations
pateljannat Dec 2, 2024
c636683
chore: Persian translations
pateljannat Dec 2, 2024
9db203d
chore: Bosnian translations
pateljannat Dec 2, 2024
e278e1e
chore: Esperanto translations
pateljannat Dec 2, 2024
9ac4efe
Merge pull request #1162 from frappe/l10n_develop2
pateljannat Dec 3, 2024
0b7ff1d
chore(release): Bumped to Version 2.15.0
frappe-bot Dec 4, 2024
6c3bb34
feat: generate bulk certificates for batch students
pateljannat Dec 4, 2024
3134ef6
Merge pull request #1165 from pateljannat/batch-bulk-certificate
pateljannat Dec 4, 2024
d811014
chore: Swedish translations
pateljannat Dec 4, 2024
2416777
refactor: scorm package render
pateljannat Dec 5, 2024
e0127d0
Merge pull request #1167 from pateljannat/scorm-cloud
pateljannat Dec 6, 2024
c1fdddb
Merge pull request #1166 from frappe/l10n_develop2
pateljannat Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
"codemirror-editor-vue3": "^2.8.0",
"dayjs": "^1.11.6",
"feather-icons": "^4.28.0",
"frappe-ui": "^0.1.72",
"frappe-ui": "^0.1.89",
"lucide-vue-next": "^0.383.0",
"markdown-it": "^14.0.0",
"pinia": "^2.0.33",
"socket.io-client": "^4.7.2",
"tailwindcss": "^3.3.3",
"typescript": "^5.7.2",
"vue": "^3.4.23",
"vue-chartjs": "^5.3.0",
"vue-draggable-next": "^2.2.1",
Expand Down
132 changes: 132 additions & 0 deletions frontend/src/components/Modals/BulkCertificates.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<template>
<Dialog
v-model="show"
:options="{
title: __('Generate Certificates'),
size: 'lg',
actions: [
{
label: 'Create',
variant: 'solid',
onClick: ({ close }) => {
generateCertificates(close)
},
},
],
}"
>
<template #body-content>
<div class="space-y-4">
<FormControl
type="select"
v-model="details.course"
:label="__('Course')"
:options="getCourses()"
/>
<Link
v-model="details.evaluator"
:label="__('Evaluator')"
doctype="Course Evaluator"
/>
<FormControl
type="date"
v-model="details.issue_date"
:label="__('Issue Date')"
/>
<FormControl
type="date"
v-model="details.expiry_date"
:label="__('Expiry Date')"
/>
<Link
v-model="details.template"
:label="__('Template')"
doctype="Print Format"
:filters="{
doc_type: 'LMS Certificate',
}"
/>
<Switch
size="sm"
:label="__('Published')"
:description="
__(
'Enabling this will publish the certificate on the certified participants page.'
)
"
v-model="details.published"
/>
</div>
</template>
</Dialog>
</template>
<script setup>
import { inject, reactive } from 'vue'
import { createResource, Dialog, FormControl, Switch } from 'frappe-ui'
import Link from '@/components/Controls/Link.vue'
import { showToast } from '@/utils'

const show = defineModel()
const dayjs = inject('$dayjs')
const details = reactive({
issue_date: dayjs().format('YYYY-MM-DD'),
expiry_date: null,
template: null,
evaluator: null,
published: true,
})

const props = defineProps({
batch: {
type: [Object, null],
required: true,
},
})

const createCertificate = createResource({
url: 'frappe.client.insert',
makeParams(values) {
return {
doc: {
doctype: 'LMS Certificate',
issue_date: details.issue_date,
expiry_date: details.expiry_date,
template: details.template,
published: details.published,
course: values.course,
batch: values.batch,
member: values.member,
evaluator: details.evaluator,
},
}
},
})

const generateCertificates = (close) => {
props.batch?.students.forEach((student) => {
createCertificate.submit(
{
course: details.course,
batch: props.batch.name,
member: student,
},
{
onError(err) {
showToast(__('Error'), err.messages?.[0] || err, 'x')
},
}
)
})
close()
showToast(__('Success'), __('Certificates generated successfully'), 'check')
}

const getCourses = () => {
return props.batch?.courses.map((course) => {
return {
label: course.course,
value: course.course,
}
})
}
</script>
2 changes: 1 addition & 1 deletion frontend/src/components/SettingDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const update = () => {
{},
{
onError(err) {
showToast('Error', err.messages?.[0] || err, 'x')
showToast(__('Error'), err.messages?.[0] || err, 'x')
},
}
)
Expand Down
29 changes: 20 additions & 9 deletions frontend/src/pages/Batch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@
class="sticky top-0 z-10 flex items-center justify-between border-b bg-white px-3 py-2.5 sm:px-5"
>
<Breadcrumbs class="h-7" :items="breadcrumbs" />
<Button v-if="user.data?.is_moderator" @click="openAnnouncementModal()">
<span>
{{ __('Make an Announcement') }}
</span>
<template #suffix>
<SendIcon class="h-4 stroke-1.5" />
</template>
</Button>
<div class="flex items-center space-x-2">
<Button
v-if="user.data?.is_moderator"
@click="openCertificateDialog = true"
>
{{ __('Generate Certificates') }}
</Button>
<Button v-if="user.data?.is_moderator" @click="openAnnouncementModal()">
<span>
{{ __('Make an Announcement') }}
</span>
<template #suffix>
<SendIcon class="h-4 stroke-1.5" />
</template>
</Button>
</div>
</header>
<div v-if="batch.data" class="grid grid-cols-[70%,30%] h-screen">
<div class="border-r-2">
<Tabs
v-model="tabIndex"
:tabs="tabs"
tablistClass="overflow-y-hidden sticky top-11 bg-white z-10"
tablistClass="overflow-y-hidden bg-white"
>
<template #tab="{ tab, selected }" class="overflow-x-hidden">
<div>
Expand Down Expand Up @@ -169,6 +177,7 @@
</div>
</div>
</div>
<BulkCertificates v-model="openCertificateDialog" :batch="batch.data" />
</template>
<script setup>
import { Breadcrumbs, Button, createResource, Tabs, Badge } from 'frappe-ui'
Expand Down Expand Up @@ -197,9 +206,11 @@ import Announcements from '@/components/Annoucements.vue'
import AnnouncementModal from '@/components/Modals/AnnouncementModal.vue'
import Discussions from '@/components/Discussions.vue'
import DateRange from '@/components/Common/DateRange.vue'
import BulkCertificates from '@/components/Modals/BulkCertificates.vue'

const user = inject('$user')
const showAnnouncementModal = ref(false)
const openCertificateDialog = ref(false)

const props = defineProps({
batchName: {
Expand Down
114 changes: 59 additions & 55 deletions frontend/src/pages/SCORMChapter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,28 @@ const props = defineProps({

onBeforeMount(() => {
sidebarStore.isSidebarCollapsed = true
window.API_1484_11 = {
Initialize: () => 'true',
Terminate: () => 'true',
GetValue: (key) => {
console.log(`GET: ${key}`)
return getDataFromLMS(key)
},
SetValue: (key, value) => {
console.log(`SET: ${key} to value: ${value}`)
setupSCORMAPI()
})

saveDataToLMS(key, value)
return 'true'
},
Commit: () => 'true',
GetLastError: () => '0',
GetErrorString: () => '',
GetDiagnostic: () => '',
}
window.API = {
LMSInitialize: () => 'true',
LMSFinish: () => 'true',
LMSGetValue: (key) => {
console.log(`GET: ${key}`)
return getDataFromLMS(key)
},
LMSSetValue: (key, value) => {
console.log(`SET: ${key} to value: ${value}`)
saveDataToLMS(key, value)
return 'true'
},
LMSCommit: () => 'true',
LMSGetLastError: () => '0',
LMSGetErrorString: () => '',
LMSGetDiagnostic: () => '',
}
const chapter = createDocumentResource({
doctype: 'Course Chapter',
name: props.chapterName,
auto: true,
cache: ['chapter', props.chapterName],
onSuccess(data) {
progress.submit()
},
})

const enrollment = createListResource({
doctype: 'LMS Enrollment',
fields: ['member', 'course'],
filters: {
course: props.courseName,
member: user.data?.name,
},
auto: true,
cache: ['enrollments', props.courseName, user.data?.name],
})

const getDataFromLMS = (key) => {
Expand All @@ -114,27 +101,6 @@ const saveDataToLMS = (key, value) => {
}
}

const enrollment = createListResource({
doctype: 'LMS Enrollment',
fields: ['member', 'course'],
filters: {
course: props.courseName,
member: user.data?.name,
},
auto: true,
cache: ['enrollments', props.courseName, user.data?.name],
})

const chapter = createDocumentResource({
doctype: 'Course Chapter',
name: props.chapterName,
auto: true,
cache: ['chapter', props.chapterName],
onSuccess(data) {
progress.submit()
},
})

const saveProgress = () => {
call('lms.lms.doctype.course_lesson.course_lesson.save_progress', {
lesson: chapter.doc.lessons[0].lesson,
Expand Down Expand Up @@ -175,6 +141,44 @@ const enrollStudent = () => {
)
}

const setupSCORMAPI = () => {
window.API_1484_11 = {
Initialize: () => 'true',
Terminate: () => 'true',
GetValue: (key) => {
console.log(`GET: ${key}`)
return getDataFromLMS(key)
},
SetValue: (key, value) => {
console.log(`SET: ${key} to value: ${value}`)

saveDataToLMS(key, value)
return 'true'
},
Commit: () => 'true',
GetLastError: () => '0',
GetErrorString: () => '',
GetDiagnostic: () => '',
}
window.API = {
LMSInitialize: () => 'true',
LMSFinish: () => 'true',
LMSGetValue: (key) => {
console.log(`GET: ${key}`)
return getDataFromLMS(key)
},
LMSSetValue: (key, value) => {
console.log(`SET: ${key} to value: ${value}`)
saveDataToLMS(key, value)
return 'true'
},
LMSCommit: () => 'true',
LMSGetLastError: () => '0',
LMSGetErrorString: () => '',
LMSGetDiagnostic: () => '',
}
}

const breadcrumbs = computed(() => {
return [
{
Expand Down
Loading
Loading