Merge pull request #1304 from pateljannat/issues-74
fix: misc batch flow changes
This commit is contained in:
@@ -281,7 +281,6 @@ watch(submissionResource, () => {
|
||||
if (submissionResource.doc.answer) {
|
||||
answer.value = submissionResource.doc.answer
|
||||
}
|
||||
|
||||
if (submissionResource.isDirty) {
|
||||
isDirty.value = true
|
||||
} else if (showUploader() && !submissionFile.value) {
|
||||
@@ -309,6 +308,7 @@ const submitAssignment = () => {
|
||||
submissionResource.setValue.submit(
|
||||
{
|
||||
...submissionResource.doc,
|
||||
assignment_attachment: submissionFile.value?.file_url,
|
||||
evaluator: evaluator,
|
||||
},
|
||||
{
|
||||
@@ -351,6 +351,7 @@ const addNewSubmission = () => {
|
||||
}
|
||||
|
||||
const saveSubmission = (file) => {
|
||||
isDirty.value = true
|
||||
submissionFile.value = file
|
||||
}
|
||||
|
||||
@@ -401,6 +402,7 @@ const validateFile = (file) => {
|
||||
}
|
||||
|
||||
const removeSubmission = () => {
|
||||
isDirty.value = true
|
||||
submissionFile.value = null
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{ __('Statistics') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-5 mb-8">
|
||||
<div class="grid grid-cols-4 gap-5 mb-8">
|
||||
<div
|
||||
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
||||
>
|
||||
@@ -22,6 +22,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
||||
>
|
||||
<div class="p-2 rounded-md bg-surface-gray-2 mr-3">
|
||||
<GraduationCap class="w-5 h-5 stroke-1.5" />
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="font-semibold">
|
||||
{{ certificationCount.data }}
|
||||
</span>
|
||||
<span class="">
|
||||
{{ __('Certified') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
||||
>
|
||||
@@ -210,7 +226,7 @@ import {
|
||||
} from 'frappe-ui'
|
||||
import {
|
||||
BookOpen,
|
||||
Clipboard,
|
||||
GraduationCap,
|
||||
Plus,
|
||||
ShieldCheck,
|
||||
Trash2,
|
||||
@@ -410,6 +426,17 @@ watch(students, () => {
|
||||
assessmentCount.value = Object.keys(students.data?.[0].assessments).length
|
||||
}
|
||||
})
|
||||
|
||||
const certificationCount = createResource({
|
||||
url: 'frappe.client.get_count',
|
||||
params: {
|
||||
doctype: 'LMS Certificate',
|
||||
filters: {
|
||||
batch_name: props.batch.name,
|
||||
},
|
||||
},
|
||||
auto: true,
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.apexcharts-legend {
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
{{ __('Announcement') }}
|
||||
</div>
|
||||
<TextEditor
|
||||
:bubbleMenu="true"
|
||||
:fixedMenu="true"
|
||||
@change="(val) => (announcement.announcement = val)"
|
||||
editorClass="prose-sm py-2 px-2 min-h-[200px] border-outline-gray-2 hover:border-outline-gray-3 rounded-md bg-surface-gray-3"
|
||||
editorClass="prose-sm py-2 px-2 min-h-[200px] border-outline-gray-2 hover:border-outline-gray-3 rounded-b-md bg-surface-gray-3"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,16 +67,13 @@ const announcement = reactive({
|
||||
})
|
||||
|
||||
const announcementResource = createResource({
|
||||
url: 'frappe.core.doctype.communication.email.make',
|
||||
url: 'lms.lms.api.make_announcement',
|
||||
makeParams(values) {
|
||||
return {
|
||||
recipients: props.students.join(', '),
|
||||
students: props.students,
|
||||
cc: announcement.replyTo,
|
||||
subject: announcement.subject,
|
||||
content: announcement.announcement,
|
||||
doctype: 'LMS Batch',
|
||||
name: props.batch,
|
||||
send_email: 1,
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -102,7 +99,7 @@ const makeAnnouncement = (close) => {
|
||||
)
|
||||
},
|
||||
onError(err) {
|
||||
showToast(__('Error'), __(err.messages?.[0] || err), 'check')
|
||||
showToast(__('Error'), __(err.messages?.[0] || err), 'alert-circle')
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1225,3 +1225,16 @@ def get_notifications(filters):
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def is_guest_allowed():
|
||||
return frappe.get_cached_value("LMS Settings", None, "allow_guest_access")
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_announcement(students, cc, subject, content):
|
||||
for student in students:
|
||||
frappe.sendmail(
|
||||
recipients=student,
|
||||
cc=cc,
|
||||
subject=subject,
|
||||
message=content,
|
||||
header=[subject, "green"],
|
||||
retry=3,
|
||||
)
|
||||
|
||||
@@ -325,9 +325,17 @@
|
||||
{
|
||||
"link_doctype": "LMS Batch Enrollment",
|
||||
"link_fieldname": "batch"
|
||||
},
|
||||
{
|
||||
"link_doctype": "LMS Certificate Evaluation",
|
||||
"link_fieldname": "batch_name"
|
||||
},
|
||||
{
|
||||
"link_doctype": "LMS Certificate",
|
||||
"link_fieldname": "batch_name"
|
||||
}
|
||||
],
|
||||
"modified": "2025-02-10 12:01:22.476325",
|
||||
"modified": "2025-02-12 11:59:35.312487",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Batch",
|
||||
|
||||
@@ -19,7 +19,8 @@ class LMSBatchEnrollment(Document):
|
||||
|
||||
def validate_duplicate_members(self):
|
||||
if frappe.db.exists(
|
||||
"LMS Batch Enrollment", {"batch": self.batch, "member": self.member}
|
||||
"LMS Batch Enrollment",
|
||||
{"batch": self.batch, "member": self.member, "name": ["!=", self.name]},
|
||||
):
|
||||
frappe.throw(_("Member already enrolled in this batch"))
|
||||
|
||||
@@ -70,7 +71,7 @@ def send_confirmation_email(doc):
|
||||
if not doc.confirmation_email_sent and (
|
||||
outgoing_email_account or frappe.conf.get("mail_login")
|
||||
):
|
||||
doc.send_mail()
|
||||
send_mail(doc)
|
||||
doc.db_set("confirmation_email_sent", 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user