Show empty state when no students are found in student attendance tool (#8862)
- fixes #8839
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
index b092a3f..6f8c6cd 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
@@ -47,7 +47,7 @@
frm.students_area = $('<div>')
.appendTo(frm.fields_dict.students_html.wrapper);
}
- console.log(students);
+ students = students || [];
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
}
});
@@ -57,7 +57,11 @@
init: function(frm, wrapper, students) {
this.wrapper = wrapper;
this.frm = frm;
- this.make(frm, students);
+ if(students.length > 0) {
+ this.make(frm, students);
+ } else {
+ this.show_empty_state();
+ }
},
make: function(frm, students) {
var me = this;
@@ -159,5 +163,13 @@
});
$(htmls.join("")).appendTo(me.wrapper);
+ },
+
+ show_empty_state: function() {
+ $(this.wrapper).html(
+ `<div class="text-center text-muted" style="line-height: 100px;">
+ ${__("No Students in")} ${this.frm.doc.student_group}
+ </div>`
+ );
}
});
\ No newline at end of file