From 2dabda03af4407d39c58c0074656048a0860ce8d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 26 Feb 2022 11:32:54 +0530 Subject: [PATCH] fix(minor): student_attendance_tool.js fix fetching UX --- .../student_attendance_tool.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js index d8a03049419..45265851758 100644 --- a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js +++ b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js @@ -3,6 +3,10 @@ frappe.provide("education"); frappe.ui.form.on('Student Attendance Tool', { + setup: (frm) => { + frm.students_area = $('
') + .appendTo(frm.fields_dict.students_html.wrapper); + }, onload: function(frm) { frm.set_query("student_group", function() { return { @@ -34,6 +38,7 @@ frappe.ui.form.on('Student Attendance Tool', { student_group: function(frm) { if ((frm.doc.student_group && frm.doc.date) || frm.doc.course_schedule) { + frm.students_area.find('.student-attendance-checks').html(`
Fetching...
`); var method = "erpnext.education.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records"; frappe.call({ @@ -62,10 +67,6 @@ frappe.ui.form.on('Student Attendance Tool', { }, get_students: function(frm, students) { - if (!frm.students_area) { - frm.students_area = $('
') - .appendTo(frm.fields_dict.students_html.wrapper); - } students = students || []; frm.students_editor = new education.StudentsEditor(frm, frm.students_area, students); } @@ -182,7 +183,7 @@ education.StudentsEditor = class StudentsEditor {
`; } - $(student_html).appendTo(me.wrapper); + $(`
${student_html}
`).appendTo(me.wrapper); } show_empty_state() {