Merge pull request #8013 from manassolanki/shishuv

[Fix] Student attendance tool- Handling double-click on button
This commit is contained in:
Nabin Hait 2017-03-14 14:28:58 +05:30 committed by GitHub
commit 468726320c

View File

@ -101,6 +101,7 @@ schools.StudentsEditor = Class.extend({
student_toolbar.find(".btn-mark-att") student_toolbar.find(".btn-mark-att")
.html(__('Mark Attendence')) .html(__('Mark Attendence'))
.on("click", function() { .on("click", function() {
$(me.wrapper.find(".btn-mark-att")).attr("disabled", true);
var studs = []; var studs = [];
$(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) { $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
var $check = $(check); var $check = $(check);
@ -122,22 +123,27 @@ schools.StudentsEditor = Class.extend({
}); });
frappe.confirm(__("Do you want to update attendance?<br>Present: {0}\ frappe.confirm(__("Do you want to update attendance?<br>Present: {0}\
<br>Absent: {1}", [students_present.length, students_absent.length]), function() { <br>Absent: {1}", [students_present.length, students_absent.length]),
frappe.call({ function() { //ifyes
method: "erpnext.schools.api.mark_attendance", frappe.call({
args: { method: "erpnext.schools.api.mark_attendance",
"students_present": students_present, args: {
"students_absent": students_absent, "students_present": students_present,
"student_batch": frm.doc.student_batch, "students_absent": students_absent,
"course_schedule": frm.doc.course_schedule, "student_batch": frm.doc.student_batch,
"date": frm.doc.date "course_schedule": frm.doc.course_schedule,
}, "date": frm.doc.date
callback: function(r) { },
frm.trigger("student_batch"); callback: function(r) {
} $(me.wrapper.find(".btn-mark-att")).attr("disabled", false);
}); frm.trigger("student_batch");
}); }
});
},
function() { //ifno
$(me.wrapper.find(".btn-mark-att")).attr("disabled", false);
}
);
}); });
var htmls = students.map(function(student) { var htmls = students.map(function(student) {