fix: announcements should to go one student at a time
This commit is contained in:
@@ -428,16 +428,15 @@ watch(students, () => {
|
||||
})
|
||||
|
||||
const certificationCount = createResource({
|
||||
url: "frappe.client.get_count",
|
||||
url: 'frappe.client.get_count',
|
||||
params: {
|
||||
doctype: "LMS Certificate",
|
||||
doctype: 'LMS Certificate',
|
||||
filters: {
|
||||
"batch_name": props.batch.name,
|
||||
batch_name: props.batch.name,
|
||||
},
|
||||
},
|
||||
auto: true
|
||||
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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user