Show empty state when no students are found in student attendance tool (#8862)

- fixes #8839
This commit is contained in:
Faris Ansari 2017-05-17 19:37:31 +05:30 committed by Nabin Hait
parent 3d6567411d
commit f7a9023fda

View File

@ -47,7 +47,7 @@ frappe.ui.form.on('Student Attendance Tool', {
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 @@ schools.StudentsEditor = Class.extend({
init: function(frm, wrapper, students) {
this.wrapper = wrapper;
this.frm = frm;
if(students.length > 0) {
this.make(frm, students);
} else {
this.show_empty_state();
}
},
make: function(frm, students) {
var me = this;
@ -159,5 +163,13 @@ schools.StudentsEditor = Class.extend({
});
$(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>`
);
}
});