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) {
|
if (submissionResource.doc.answer) {
|
||||||
answer.value = submissionResource.doc.answer
|
answer.value = submissionResource.doc.answer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submissionResource.isDirty) {
|
if (submissionResource.isDirty) {
|
||||||
isDirty.value = true
|
isDirty.value = true
|
||||||
} else if (showUploader() && !submissionFile.value) {
|
} else if (showUploader() && !submissionFile.value) {
|
||||||
@@ -309,6 +308,7 @@ const submitAssignment = () => {
|
|||||||
submissionResource.setValue.submit(
|
submissionResource.setValue.submit(
|
||||||
{
|
{
|
||||||
...submissionResource.doc,
|
...submissionResource.doc,
|
||||||
|
assignment_attachment: submissionFile.value?.file_url,
|
||||||
evaluator: evaluator,
|
evaluator: evaluator,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -351,6 +351,7 @@ const addNewSubmission = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const saveSubmission = (file) => {
|
const saveSubmission = (file) => {
|
||||||
|
isDirty.value = true
|
||||||
submissionFile.value = file
|
submissionFile.value = file
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,6 +402,7 @@ const validateFile = (file) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const removeSubmission = () => {
|
const removeSubmission = () => {
|
||||||
|
isDirty.value = true
|
||||||
submissionFile.value = null
|
submissionFile.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{{ __('Statistics') }}
|
{{ __('Statistics') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-3 gap-5 mb-8">
|
<div class="grid grid-cols-4 gap-5 mb-8">
|
||||||
<div
|
<div
|
||||||
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
||||||
>
|
>
|
||||||
@@ -22,6 +22,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</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
|
<div
|
||||||
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
class="flex items-center border py-2 px-3 rounded-md text-ink-gray-7"
|
||||||
>
|
>
|
||||||
@@ -210,7 +226,7 @@ import {
|
|||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import {
|
import {
|
||||||
BookOpen,
|
BookOpen,
|
||||||
Clipboard,
|
GraduationCap,
|
||||||
Plus,
|
Plus,
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
Trash2,
|
Trash2,
|
||||||
@@ -410,6 +426,17 @@ watch(students, () => {
|
|||||||
assessmentCount.value = Object.keys(students.data?.[0].assessments).length
|
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>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.apexcharts-legend {
|
.apexcharts-legend {
|
||||||
|
|||||||
@@ -33,9 +33,9 @@
|
|||||||
{{ __('Announcement') }}
|
{{ __('Announcement') }}
|
||||||
</div>
|
</div>
|
||||||
<TextEditor
|
<TextEditor
|
||||||
:bubbleMenu="true"
|
:fixedMenu="true"
|
||||||
@change="(val) => (announcement.announcement = val)"
|
@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>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,16 +67,13 @@ const announcement = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const announcementResource = createResource({
|
const announcementResource = createResource({
|
||||||
url: 'frappe.core.doctype.communication.email.make',
|
url: 'lms.lms.api.make_announcement',
|
||||||
makeParams(values) {
|
makeParams(values) {
|
||||||
return {
|
return {
|
||||||
recipients: props.students.join(', '),
|
students: props.students,
|
||||||
cc: announcement.replyTo,
|
cc: announcement.replyTo,
|
||||||
subject: announcement.subject,
|
subject: announcement.subject,
|
||||||
content: announcement.announcement,
|
content: announcement.announcement,
|
||||||
doctype: 'LMS Batch',
|
|
||||||
name: props.batch,
|
|
||||||
send_email: 1,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -102,7 +99,7 @@ const makeAnnouncement = (close) => {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
onError(err) {
|
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)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def is_guest_allowed():
|
def is_guest_allowed():
|
||||||
return frappe.get_cached_value("LMS Settings", None, "allow_guest_access")
|
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_doctype": "LMS Batch Enrollment",
|
||||||
"link_fieldname": "batch"
|
"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",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Batch",
|
"name": "LMS Batch",
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class LMSBatchEnrollment(Document):
|
|||||||
|
|
||||||
def validate_duplicate_members(self):
|
def validate_duplicate_members(self):
|
||||||
if frappe.db.exists(
|
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"))
|
frappe.throw(_("Member already enrolled in this batch"))
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ def send_confirmation_email(doc):
|
|||||||
if not doc.confirmation_email_sent and (
|
if not doc.confirmation_email_sent and (
|
||||||
outgoing_email_account or frappe.conf.get("mail_login")
|
outgoing_email_account or frappe.conf.get("mail_login")
|
||||||
):
|
):
|
||||||
doc.send_mail()
|
send_mail(doc)
|
||||||
doc.db_set("confirmation_email_sent", 1)
|
doc.db_set("confirmation_email_sent", 1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user