From 2922660b3498a7174edb7d05d59a6aa48bc260c0 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Tue, 14 Mar 2017 12:30:01 +0530 Subject: [PATCH] [Fix] Student attendance tool- Handling double-click on button --- .../student_attendance_tool.js | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) 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 20fb2fdf41..fd37a15578 100644 --- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js +++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js @@ -101,6 +101,7 @@ schools.StudentsEditor = Class.extend({ student_toolbar.find(".btn-mark-att") .html(__('Mark Attendence')) .on("click", function() { + $(me.wrapper.find(".btn-mark-att")).attr("disabled", true); var studs = []; $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) { var $check = $(check); @@ -122,22 +123,27 @@ schools.StudentsEditor = Class.extend({ }); frappe.confirm(__("Do you want to update attendance?
Present: {0}\ -
Absent: {1}", [students_present.length, students_absent.length]), function() { - frappe.call({ - method: "erpnext.schools.api.mark_attendance", - args: { - "students_present": students_present, - "students_absent": students_absent, - "student_batch": frm.doc.student_batch, - "course_schedule": frm.doc.course_schedule, - "date": frm.doc.date - }, - callback: function(r) { - frm.trigger("student_batch"); - } - }); - }); - +
Absent: {1}", [students_present.length, students_absent.length]), + function() { //ifyes + frappe.call({ + method: "erpnext.schools.api.mark_attendance", + args: { + "students_present": students_present, + "students_absent": students_absent, + "student_batch": frm.doc.student_batch, + "course_schedule": frm.doc.course_schedule, + "date": frm.doc.date + }, + 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) {