')
+ .appendTo(frm.fields_dict.students_html.wrapper);
+ }
+ frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
+ }
});
schools.StudentsEditor = Class.extend({
- init: function(frm, wrapper, students) {
- this.wrapper = wrapper;
- this.frm = frm;
- this.make(frm, students);
- },
- make: function(frm, students) {
- var me = this;
+ init: function(frm, wrapper, students) {
+ this.wrapper = wrapper;
+ this.frm = frm;
+ this.make(frm, students);
+ },
+ make: function(frm, students) {
+ var me = this;
- $(this.wrapper).empty();
- var student_toolbar = $('
\
+ $(this.wrapper).empty();
+ var student_toolbar = $('
\
\
\
').appendTo($(this.wrapper));
- student_toolbar.find(".btn-add")
- .html(__('Check all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if (!$(check).prop("disabled")) {
- check.checked = true;
- }
- });
- });
+ student_toolbar.find(".btn-add")
+ .html(__('Check all'))
+ .on("click", function() {
+ $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+ if (!$(check).prop("disabled")) {
+ check.checked = true;
+ }
+ });
+ });
- student_toolbar.find(".btn-remove")
- .html(__('Uncheck all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if (!$(check).prop("disabled")) {
- check.checked = false;
- }
- });
- });
+ student_toolbar.find(".btn-remove")
+ .html(__('Uncheck all'))
+ .on("click", function() {
+ $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+ if (!$(check).prop("disabled")) {
+ check.checked = false;
+ }
+ });
+ });
- var get_present_student = function(student) {
- return students.filter(function(s) {
- return s.idx === idx;
- })
- }
- var get_absent_student = function(idx) {
- return students.filter(function(s) {
- return s.idx === idx;
- })
- }
+ var get_present_student = function(student) {
+ return students.filter(function(s) {
+ return s.idx === idx;
+ })
+ }
+ var get_absent_student = function(idx) {
+ return students.filter(function(s) {
+ return s.idx === idx;
+ })
+ }
- student_toolbar.find(".btn-mark-att")
- .html(__('Mark Attendence'))
- .on("click", function() {
- var studs = [];
- $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
- var $check = $(check);
- studs.push({
- student: $check.data().student,
- student_name: $check.data().studentName,
- idx: $check.data().idx,
- disabled: $check.prop("disabled"),
- checked: $check.is(":checked")
- });
- });
+ student_toolbar.find(".btn-mark-att")
+ .html(__('Mark Attendence'))
+ .on("click", function() {
+ var studs = [];
+ $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
+ var $check = $(check);
+ studs.push({
+ student: $check.data().student,
+ student_name: $check.data().studentName,
+ idx: $check.data().idx,
+ disabled: $check.prop("disabled"),
+ checked: $check.is(":checked")
+ });
+ });
- var students_present = studs.filter(function(stud) {
- return !stud.disabled && stud.checked;
- });
+ var students_present = studs.filter(function(stud) {
+ return !stud.disabled && stud.checked;
+ });
- var students_absent = studs.filter(function(stud) {
- return !stud.disabled && !stud.checked;
- });
+ var students_absent = studs.filter(function(stud) {
+ return !stud.disabled && !stud.checked;
+ });
- 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");
- }
- });
- });
+ frappe.confirm(__("Do you want to save 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");
+ }
+ });
+ });
- var htmls = students.map(function(student) {
- return frappe.render_template("student_button", {
- student: student.student,
- student_name: student.student_name,
- idx: student.idx,
- status: student.status
- })
- });
+ });
- $(htmls.join("")).appendTo(me.wrapper);
- }
+ var htmls = students.map(function(student) {
+ return frappe.render_template("student_button", {
+ student: student.student,
+ student_name: student.student_name,
+ idx: student.idx,
+ status: student.status
+ })
+ });
+
+ $(htmls.join("")).appendTo(me.wrapper);
+ }
});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
index 092af041a9..51b015caa3 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
@@ -23,6 +23,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Based On",
@@ -52,6 +53,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@@ -80,6 +82,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Student Batch",
@@ -110,6 +113,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Course Schedule",
@@ -140,6 +144,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Date",
@@ -169,6 +174,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Attendance",
@@ -197,6 +203,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Students HTML",
@@ -225,7 +232,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-12-09 17:36:28.739318",
+ "modified": "2017-02-21 01:15:11.435110",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Attendance Tool",
@@ -242,7 +249,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
- "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -263,7 +269,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
- "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -278,7 +283,9 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
+ "show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
+ "track_changes": 0,
"track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
index 58588a9058..54b0293c6f 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
@@ -27,10 +27,10 @@ def get_student_attendance_records(based_on, date=None, student_batch=None, cour
if course_schedule:
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
- course_schedule= %s and docstatus=1""", (course_schedule), as_dict=1)
+ course_schedule= %s""", (course_schedule), as_dict=1)
else:
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
- student_batch= %s and date= %s and docstatus=1 and \
+ student_batch= %s and date= %s and \
(course_schedule is Null or course_schedule='')""",
(student_batch, date), as_dict=1)
@@ -38,4 +38,5 @@ def get_student_attendance_records(based_on, date=None, student_batch=None, cour
for student in student_list:
if student.student == attendance.student:
student.status = attendance.status
+ print student_list
return student_list
\ No newline at end of file