renamed 'active' in Student Batch to 'enabled'
This commit is contained in:
parent
c6e74680ee
commit
19e8bd2221
@ -6,56 +6,46 @@ cur_frm.add_fetch("examiner", "instructor_name", "examiner_name");
|
|||||||
cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
|
cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
|
||||||
cur_frm.add_fetch("student", "title", "student_name");
|
cur_frm.add_fetch("student", "title", "student_name");
|
||||||
|
|
||||||
frappe.ui.form.on("Assessment" ,{
|
frappe.ui.form.on("Assessment", {
|
||||||
onload: function(frm){
|
student_group: function(frm) {
|
||||||
cur_frm.set_query("student_batch", function(){
|
frm.set_value("results", "");
|
||||||
return{
|
if (frm.doc.student_group) {
|
||||||
"filters": {
|
frappe.call({
|
||||||
"active": 1
|
method: "erpnext.schools.api.get_student_group_students",
|
||||||
}
|
args: {
|
||||||
};
|
"student_group": frm.doc.student_group
|
||||||
});
|
},
|
||||||
},
|
callback: function(r) {
|
||||||
|
if (r.message) {
|
||||||
student_group : function(frm) {
|
$.each(r.message, function(i, d) {
|
||||||
frm.set_value("results" ,"");
|
var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results");
|
||||||
if (frm.doc.student_group) {
|
row.student = d.student;
|
||||||
frappe.call({
|
row.student_name = d.student_name;
|
||||||
method: "erpnext.schools.api.get_student_group_students",
|
});
|
||||||
args: {
|
}
|
||||||
"student_group": frm.doc.student_group
|
refresh_field("results");
|
||||||
},
|
}
|
||||||
callback: function(r) {
|
});
|
||||||
if (r.message) {
|
}
|
||||||
$.each(r.message, function(i, d) {
|
}
|
||||||
var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results");
|
|
||||||
row.student = d.student;
|
|
||||||
row.student_name = d.student_name;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
refresh_field("results");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on("Assessment Result" ,{
|
frappe.ui.form.on("Assessment Result", {
|
||||||
result : function(frm, cdt, cdn) {
|
result: function(frm, cdt, cdn) {
|
||||||
if(frm.doc.grading_structure){
|
if (frm.doc.grading_structure) {
|
||||||
var assessment_result = locals[cdt][cdn];
|
var assessment_result = locals[cdt][cdn];
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:"erpnext.schools.doctype.assessment.assessment.get_grade",
|
method: "erpnext.schools.doctype.assessment.assessment.get_grade",
|
||||||
args:{
|
args: {
|
||||||
grading_structure: frm.doc.grading_structure,
|
grading_structure: frm.doc.grading_structure,
|
||||||
result: assessment_result.result
|
result: assessment_result.result
|
||||||
},
|
},
|
||||||
callback: function(r){
|
callback: function(r) {
|
||||||
if(r.message){
|
if (r.message) {
|
||||||
frappe.model.set_value(cdt, cdn, 'grade', r.message);
|
frappe.model.set_value(cdt, cdn, 'grade', r.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -6,15 +6,11 @@ from __future__ import unicode_literals
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
|
|
||||||
|
|
||||||
class Assessment(Document):
|
class Assessment(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_overlap()
|
self.validate_overlap()
|
||||||
|
|
||||||
if self.student_batch:
|
|
||||||
validate_active_student_batch(self.student_batch)
|
|
||||||
|
|
||||||
def validate_overlap(self):
|
def validate_overlap(self):
|
||||||
"""Validates overlap for Student Group/Student Batch, Instructor, Room"""
|
"""Validates overlap for Student Group/Student Batch, Instructor, Room"""
|
||||||
|
|
||||||
|
@ -1,145 +1,134 @@
|
|||||||
frappe.provide("schools")
|
frappe.provide("schools")
|
||||||
|
|
||||||
frappe.ui.form.on("Course Schedule" ,{
|
frappe.ui.form.on("Course Schedule", {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if (frm.doc.from_datetime && frm.doc.to_datetime) {
|
if (frm.doc.from_datetime && frm.doc.to_datetime) {
|
||||||
var from_datetime = moment(frm.doc.from_datetime);
|
var from_datetime = moment(frm.doc.from_datetime);
|
||||||
var to_datetime = moment(frm.doc.to_datetime);
|
var to_datetime = moment(frm.doc.to_datetime);
|
||||||
frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
|
frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
|
||||||
frm.doc.from_time = from_datetime.format("HH:mm:ss");
|
frm.doc.from_time = from_datetime.format("HH:mm:ss");
|
||||||
frm.doc.to_time = to_datetime.format("HH:mm:ss");
|
frm.doc.to_time = to_datetime.format("HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
cur_frm.set_query("student_batch", function(){
|
|
||||||
return{
|
refresh: function(frm) {
|
||||||
"filters": {
|
if (!frm.doc.__islocal && frm.doc.student_group) {
|
||||||
"active": 1
|
frappe.call({
|
||||||
}
|
method: "erpnext.schools.api.check_attendance_records_exist",
|
||||||
};
|
args: {
|
||||||
});
|
"course_schedule": frm.doc.name
|
||||||
},
|
},
|
||||||
|
callback: function(r) {
|
||||||
refresh :function(frm) {
|
if (r.message) {
|
||||||
if(!frm.doc.__islocal && frm.doc.student_group) {
|
hide_field('attendance');
|
||||||
frappe.call({
|
frm.events.view_attendance(frm)
|
||||||
method: "erpnext.schools.api.check_attendance_records_exist",
|
} else {
|
||||||
args: {
|
frappe.call({
|
||||||
"course_schedule": frm.doc.name
|
method: "erpnext.schools.api.get_student_group_students",
|
||||||
},
|
args: {
|
||||||
callback: function(r) {
|
"student_group": frm.doc.student_group
|
||||||
if(r.message) {
|
},
|
||||||
hide_field('attendance');
|
callback: function(r) {
|
||||||
frm.events.view_attendance(frm)
|
if (r.message) {
|
||||||
}
|
frm.events.get_students(frm, r.message)
|
||||||
else {
|
}
|
||||||
frappe.call({
|
}
|
||||||
method: "erpnext.schools.api.get_student_group_students",
|
});
|
||||||
args: {
|
}
|
||||||
"student_group": frm.doc.student_group
|
}
|
||||||
},
|
});
|
||||||
callback: function(r) {
|
} else {
|
||||||
if (r.message) {
|
hide_field('attendance');
|
||||||
frm.events.get_students(frm, r.message)
|
}
|
||||||
}
|
},
|
||||||
}
|
|
||||||
});
|
view_attendance: function(frm) {
|
||||||
}
|
hide_field('attendance');
|
||||||
}
|
frm.add_custom_button(__("View attendance"), function() {
|
||||||
});
|
frappe.route_options = {
|
||||||
}
|
course_schedule: frm.doc.name
|
||||||
else {
|
}
|
||||||
hide_field('attendance');
|
frappe.set_route("List", "Student Attendance");
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
view_attendance: function(frm) {
|
get_students: function(frm, students) {
|
||||||
hide_field('attendance');
|
if (!frm.students_area) {
|
||||||
frm.add_custom_button(__("View attendance"), function() {
|
frm.students_area = $('<div>')
|
||||||
frappe.route_options = {
|
.appendTo(frm.fields_dict.students_html.wrapper);
|
||||||
course_schedule: frm.doc.name
|
}
|
||||||
}
|
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
|
||||||
frappe.set_route("List", "Student Attendance");
|
}
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
get_students: function(frm, students) {
|
|
||||||
if(!frm.students_area) {
|
|
||||||
frm.students_area = $('<div>')
|
|
||||||
.appendTo(frm.fields_dict.students_html.wrapper);
|
|
||||||
}
|
|
||||||
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
schools.StudentsEditor = Class.extend({
|
schools.StudentsEditor = Class.extend({
|
||||||
init: function(frm, wrapper, students) {
|
init: function(frm, wrapper, students) {
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.frm = frm;
|
this.frm = frm;
|
||||||
this.make(frm, students);
|
this.make(frm, students);
|
||||||
},
|
},
|
||||||
make: function(frm, students) {
|
make: function(frm, students) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
$(this.wrapper).empty();
|
$(this.wrapper).empty();
|
||||||
var student_toolbar = $('<p>\
|
var student_toolbar = $('<p>\
|
||||||
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
|
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
|
||||||
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
|
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
|
||||||
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
|
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
|
||||||
|
|
||||||
student_toolbar.find(".btn-add")
|
student_toolbar.find(".btn-add")
|
||||||
.html(__('Check all'))
|
.html(__('Check all'))
|
||||||
.on("click", function() {
|
.on("click", function() {
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
if(!$(check).is(":checked")) {
|
if (!$(check).is(":checked")) {
|
||||||
check.checked = true;
|
check.checked = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
student_toolbar.find(".btn-remove")
|
student_toolbar.find(".btn-remove")
|
||||||
.html(__('Uncheck all'))
|
.html(__('Uncheck all'))
|
||||||
.on("click", function() {
|
.on("click", function() {
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
if($(check).is(":checked")) {
|
if ($(check).is(":checked")) {
|
||||||
check.checked = false;
|
check.checked = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
student_toolbar.find(".btn-mark-att")
|
|
||||||
.html(__('Mark Attendence'))
|
|
||||||
.on("click", function() {
|
|
||||||
var students_present = [];
|
|
||||||
var students_absent = [];
|
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
|
||||||
if($(check).is(":checked")) {
|
|
||||||
students_present.push(students[i]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
students_absent.push(students[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.schools.api.mark_attendance",
|
|
||||||
args: {
|
|
||||||
"students_present": students_present,
|
|
||||||
"students_absent": students_absent,
|
|
||||||
"course_schedule": frm.doc.name
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
frm.events.view_attendance(frm)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
student_toolbar.find(".btn-mark-att")
|
||||||
$.each(students, function(i, m) {
|
.html(__('Mark Attendence'))
|
||||||
$(repl('<div class="col-sm-6">\
|
.on("click", function() {
|
||||||
|
var students_present = [];
|
||||||
|
var students_absent = [];
|
||||||
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
|
if ($(check).is(":checked")) {
|
||||||
|
students_present.push(students[i]);
|
||||||
|
} else {
|
||||||
|
students_absent.push(students[i]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.schools.api.mark_attendance",
|
||||||
|
args: {
|
||||||
|
"students_present": students_present,
|
||||||
|
"students_absent": students_absent,
|
||||||
|
"course_schedule": frm.doc.name
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
frm.events.view_attendance(frm)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$.each(students, function(i, m) {
|
||||||
|
$(repl('<div class="col-sm-6">\
|
||||||
<div class="checkbox">\
|
<div class="checkbox">\
|
||||||
<label><input type="checkbox" class="students-check" student="%(student)s">\
|
<label><input type="checkbox" class="students-check" student="%(student)s">\
|
||||||
%(student)s</label>\
|
%(student)s</label>\
|
||||||
</div></div>', {student: m.student_name})).appendTo(me.wrapper);
|
</div></div>', { student: m.student_name })).appendTo(me.wrapper);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -6,7 +6,6 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
|
|
||||||
|
|
||||||
class CourseSchedule(Document):
|
class CourseSchedule(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -17,9 +16,6 @@ class CourseSchedule(Document):
|
|||||||
self.set_student_batch()
|
self.set_student_batch()
|
||||||
self.validate_date()
|
self.validate_date()
|
||||||
self.validate_overlap()
|
self.validate_overlap()
|
||||||
|
|
||||||
if self.student_batch:
|
|
||||||
validate_active_student_batch(self.student_batch)
|
|
||||||
|
|
||||||
def set_title(self):
|
def set_title(self):
|
||||||
"""Set document Title"""
|
"""Set document Title"""
|
||||||
|
@ -8,24 +8,14 @@ cur_frm.add_fetch("student_group", "academic_year", "academic_year");
|
|||||||
cur_frm.add_fetch("student_group", "academic_term", "academic_term");
|
cur_frm.add_fetch("student_group", "academic_term", "academic_term");
|
||||||
|
|
||||||
frappe.ui.form.on("Course Scheduling Tool", {
|
frappe.ui.form.on("Course Scheduling Tool", {
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
frm.page.set_primary_action(__("Schedule Course"), function() {
|
frm.page.set_primary_action(__("Schedule Course"), function() {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "schedule_course",
|
method: "schedule_course",
|
||||||
doc:frm.doc
|
doc: frm.doc
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
onload: function(frm){
|
|
||||||
cur_frm.set_query("student_batch", function(){
|
|
||||||
return{
|
|
||||||
"filters": {
|
|
||||||
"active": 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
@ -2,16 +2,4 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
cur_frm.add_fetch("course_schedule", "schedule_date", "date");
|
cur_frm.add_fetch("course_schedule", "schedule_date", "date");
|
||||||
cur_frm.add_fetch("course_schedule", "student_batch", "student_batch");
|
cur_frm.add_fetch("course_schedule", "student_batch", "student_batch")
|
||||||
|
|
||||||
frappe.ui.form.on('Student Attendance', {
|
|
||||||
onload: function(frm){
|
|
||||||
cur_frm.set_query("student_batch", function(){
|
|
||||||
return{
|
|
||||||
"filters": {
|
|
||||||
"active": 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -6,7 +6,6 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
|
|
||||||
|
|
||||||
class StudentAttendance(Document):
|
class StudentAttendance(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -14,9 +13,6 @@ class StudentAttendance(Document):
|
|||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
self.validate_duplication()
|
self.validate_duplication()
|
||||||
|
|
||||||
if self.student_batch:
|
|
||||||
validate_active_student_batch(self.student_batch)
|
|
||||||
|
|
||||||
def validate_date(self):
|
def validate_date(self):
|
||||||
if self.course_schedule:
|
if self.course_schedule:
|
||||||
self.date = frappe.db.get_value("Course Schedule", self.course_schedule, "schedule_date")
|
self.date = frappe.db.get_value("Course Schedule", self.course_schedule, "schedule_date")
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"default": "1",
|
"default": "1",
|
||||||
"fieldname": "active",
|
"fieldname": "enabled",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
@ -309,7 +309,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-12-01 12:56:51.727827",
|
"modified": "2016-12-01 13:18:12.024001",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Batch",
|
"name": "Student Batch",
|
||||||
|
@ -6,7 +6,6 @@ from __future__ import unicode_literals
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from erpnext.schools.utils import validate_duplicate_student
|
from erpnext.schools.utils import validate_duplicate_student
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
|
||||||
|
|
||||||
class StudentBatch(Document):
|
class StudentBatch(Document):
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
@ -17,7 +16,3 @@ class StudentBatch(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
validate_duplicate_student(self.students)
|
validate_duplicate_student(self.students)
|
||||||
|
|
||||||
def validate_active_student_batch(student_batch):
|
|
||||||
if not frappe.db.get_value("Student Batch", student_batch, "active"):
|
|
||||||
frappe.throw(_("Student Batch is not Active."))
|
|
@ -3,136 +3,124 @@
|
|||||||
frappe.provide("schools")
|
frappe.provide("schools")
|
||||||
|
|
||||||
frappe.ui.form.on('Student Batch Attendance Tool', {
|
frappe.ui.form.on('Student Batch Attendance Tool', {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
hide_field('attendance');
|
hide_field('attendance');
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm){
|
student_batch: function(frm) {
|
||||||
cur_frm.set_query("student_batch", function(){
|
if (frm.doc.student_batch && frm.doc.date) {
|
||||||
return{
|
frappe.call({
|
||||||
"filters": {
|
method: "erpnext.schools.api.check_attendance_records_exist",
|
||||||
"active": 1
|
args: {
|
||||||
}
|
"student_batch": frm.doc.student_batch,
|
||||||
};
|
"date": frm.doc.date
|
||||||
});
|
},
|
||||||
},
|
callback: function(r) {
|
||||||
|
if (r.message) {
|
||||||
student_batch :function(frm) {
|
frappe.msgprint("Attendance already marked.");
|
||||||
if(frm.doc.student_batch && frm.doc.date) {
|
hide_field('attendance');
|
||||||
frappe.call({
|
} else {
|
||||||
method: "erpnext.schools.api.check_attendance_records_exist",
|
frappe.call({
|
||||||
args: {
|
method: "erpnext.schools.api.get_student_batch_students",
|
||||||
"student_batch": frm.doc.student_batch,
|
args: {
|
||||||
"date": frm.doc.date
|
"student_batch": frm.doc.student_batch
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.message) {
|
if (r.message) {
|
||||||
frappe.msgprint("Attendance already marked.");
|
unhide_field('attendance');
|
||||||
hide_field('attendance');
|
frm.events.get_students(frm, r.message)
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
frappe.call({
|
});
|
||||||
method: "erpnext.schools.api.get_student_batch_students",
|
}
|
||||||
args: {
|
}
|
||||||
"student_batch": frm.doc.student_batch
|
});
|
||||||
},
|
}
|
||||||
callback: function(r) {
|
},
|
||||||
if (r.message) {
|
|
||||||
unhide_field('attendance');
|
date: function(frm) {
|
||||||
frm.events.get_students(frm, r.message)
|
frm.trigger("student_batch");
|
||||||
}
|
},
|
||||||
}
|
|
||||||
});
|
get_students: function(frm, students) {
|
||||||
}
|
if (!frm.students_area) {
|
||||||
}
|
frm.students_area = $('<div>')
|
||||||
});
|
.appendTo(frm.fields_dict.students_html.wrapper);
|
||||||
}
|
}
|
||||||
},
|
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
|
||||||
|
}
|
||||||
date: function(frm) {
|
|
||||||
frm.trigger("student_batch");
|
|
||||||
},
|
|
||||||
|
|
||||||
get_students: function(frm, students) {
|
|
||||||
if(!frm.students_area) {
|
|
||||||
frm.students_area = $('<div>')
|
|
||||||
.appendTo(frm.fields_dict.students_html.wrapper);
|
|
||||||
}
|
|
||||||
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
schools.StudentsEditor = Class.extend({
|
schools.StudentsEditor = Class.extend({
|
||||||
init: function(frm, wrapper, students) {
|
init: function(frm, wrapper, students) {
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.frm = frm;
|
this.frm = frm;
|
||||||
this.make(frm, students);
|
this.make(frm, students);
|
||||||
},
|
},
|
||||||
make: function(frm, students) {
|
make: function(frm, students) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
$(this.wrapper).empty();
|
$(this.wrapper).empty();
|
||||||
var student_toolbar = $('<p>\
|
var student_toolbar = $('<p>\
|
||||||
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
|
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
|
||||||
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
|
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
|
||||||
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
|
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
|
||||||
|
|
||||||
student_toolbar.find(".btn-add")
|
student_toolbar.find(".btn-add")
|
||||||
.html(__('Check all'))
|
.html(__('Check all'))
|
||||||
.on("click", function() {
|
.on("click", function() {
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
if(!$(check).is(":checked")) {
|
if (!$(check).is(":checked")) {
|
||||||
check.checked = true;
|
check.checked = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
student_toolbar.find(".btn-remove")
|
student_toolbar.find(".btn-remove")
|
||||||
.html(__('Uncheck all'))
|
.html(__('Uncheck all'))
|
||||||
.on("click", function() {
|
.on("click", function() {
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
if($(check).is(":checked")) {
|
if ($(check).is(":checked")) {
|
||||||
check.checked = false;
|
check.checked = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
student_toolbar.find(".btn-mark-att")
|
|
||||||
.html(__('Mark Attendence'))
|
|
||||||
.on("click", function() {
|
|
||||||
var students_present = [];
|
|
||||||
var students_absent = [];
|
|
||||||
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
|
||||||
if($(check).is(":checked")) {
|
|
||||||
students_present.push(students[i]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
students_absent.push(students[i]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.schools.api.mark_attendance",
|
|
||||||
args: {
|
|
||||||
"students_present": students_present,
|
|
||||||
"students_absent": students_absent,
|
|
||||||
"student_batch": frm.doc.student_batch,
|
|
||||||
"date": frm.doc.date
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
hide_field('attendance');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
student_toolbar.find(".btn-mark-att")
|
||||||
$.each(students, function(i, m) {
|
.html(__('Mark Attendence'))
|
||||||
$(repl('<div class="col-sm-6">\
|
.on("click", function() {
|
||||||
|
var students_present = [];
|
||||||
|
var students_absent = [];
|
||||||
|
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
|
||||||
|
if ($(check).is(":checked")) {
|
||||||
|
students_present.push(students[i]);
|
||||||
|
} else {
|
||||||
|
students_absent.push(students[i]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.schools.api.mark_attendance",
|
||||||
|
args: {
|
||||||
|
"students_present": students_present,
|
||||||
|
"students_absent": students_absent,
|
||||||
|
"student_batch": frm.doc.student_batch,
|
||||||
|
"date": frm.doc.date
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
hide_field('attendance');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$.each(students, function(i, m) {
|
||||||
|
$(repl('<div class="col-sm-6">\
|
||||||
<div class="checkbox">\
|
<div class="checkbox">\
|
||||||
<label><input type="checkbox" class="students-check" student="%(student)s">\
|
<label><input type="checkbox" class="students-check" student="%(student)s">\
|
||||||
%(student)s</label>\
|
%(student)s</label>\
|
||||||
</div></div>', {student: m.student_name})).appendTo(me.wrapper);
|
</div></div>', { student: m.student_name })).appendTo(me.wrapper);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -1,44 +1,36 @@
|
|||||||
cur_frm.add_fetch("student", "title", "student_name");
|
cur_frm.add_fetch("student", "title", "student_name");
|
||||||
|
|
||||||
frappe.ui.form.on("Student Group", {
|
frappe.ui.form.on("Student Group", {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
if(!frm.doc.__islocal) {
|
if (!frm.doc.__islocal) {
|
||||||
frm.add_custom_button(__("Course Schedule"), function() {
|
frm.add_custom_button(__("Course Schedule"), function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
student_group: frm.doc.name
|
student_group: frm.doc.name
|
||||||
}
|
}
|
||||||
frappe.set_route("List", "Course Schedule");
|
frappe.set_route("List", "Course Schedule");
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.add_custom_button(__("Assessment"), function() {
|
frm.add_custom_button(__("Assessment"), function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
student_group: frm.doc.name
|
student_group: frm.doc.name
|
||||||
}
|
}
|
||||||
frappe.set_route("List", "Assessment");
|
frappe.set_route("List", "Assessment");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm){
|
onload: function(frm) {
|
||||||
cur_frm.set_query("academic_term",function(){
|
cur_frm.set_query("academic_term", function() {
|
||||||
return{
|
return {
|
||||||
"filters":{
|
"filters": {
|
||||||
"academic_year": (frm.doc.academic_year)
|
"academic_year": (frm.doc.academic_year)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}
|
||||||
cur_frm.set_query("student_batch", function(){
|
|
||||||
return{
|
|
||||||
"filters": {
|
|
||||||
"active": 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//If Student Batch is entered, deduce program, academic_year and academic term from it
|
//If Student Batch is entered, deduce program, academic_year and academic term from it
|
||||||
cur_frm.add_fetch("student_batch", "program", "program");
|
cur_frm.add_fetch("student_batch", "program", "program");
|
||||||
cur_frm.add_fetch("student_batch", "academic_term", "academic_term");
|
cur_frm.add_fetch("student_batch", "academic_term", "academic_term");
|
||||||
cur_frm.add_fetch("student_batch", "academic_year", "academic_year");
|
cur_frm.add_fetch("student_batch", "academic_year", "academic_year");
|
@ -7,7 +7,6 @@ import frappe
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from erpnext.schools.utils import validate_duplicate_student
|
from erpnext.schools.utils import validate_duplicate_student
|
||||||
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
|
|
||||||
|
|
||||||
class StudentGroup(Document):
|
class StudentGroup(Document):
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
@ -31,9 +30,6 @@ class StudentGroup(Document):
|
|||||||
self.validate_strength()
|
self.validate_strength()
|
||||||
self.validate_student_name()
|
self.validate_student_name()
|
||||||
validate_duplicate_student(self.students)
|
validate_duplicate_student(self.students)
|
||||||
|
|
||||||
if self.student_batch:
|
|
||||||
validate_active_student_batch(self.student_batch)
|
|
||||||
|
|
||||||
def validate_strength(self):
|
def validate_strength(self):
|
||||||
if self.max_strength and len(self.students) > self.max_strength:
|
if self.max_strength and len(self.students) > self.max_strength:
|
||||||
|
@ -2,16 +2,17 @@
|
|||||||
"add_total_row": 0,
|
"add_total_row": 0,
|
||||||
"apply_user_permissions": 1,
|
"apply_user_permissions": 1,
|
||||||
"creation": "2013-05-13 14:04:03",
|
"creation": "2013-05-13 14:04:03",
|
||||||
|
"disabled": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2014-06-03 07:18:17.181332",
|
"modified": "2016-12-01 14:28:27.184668",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Absent Student Report",
|
"name": "Absent Student Report",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"ref_doctype": "Attendance",
|
"ref_doctype": "Student Attendance",
|
||||||
"report_name": "Absent Student Report",
|
"report_name": "Absent Student Report",
|
||||||
"report_type": "Script Report"
|
"report_type": "Script Report"
|
||||||
}
|
}
|
@ -2,16 +2,17 @@
|
|||||||
"add_total_row": 0,
|
"add_total_row": 0,
|
||||||
"apply_user_permissions": 1,
|
"apply_user_permissions": 1,
|
||||||
"creation": "2013-05-13 14:04:03",
|
"creation": "2013-05-13 14:04:03",
|
||||||
|
"disabled": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2014-06-03 07:18:17.181332",
|
"modified": "2016-12-01 14:29:53.547378",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Monthly Attendance Sheet",
|
"name": "Student Monthly Attendance Sheet",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"ref_doctype": "Attendance",
|
"ref_doctype": "Student Attendance",
|
||||||
"report_name": "Student Monthly Attendance Sheet",
|
"report_name": "Student Monthly Attendance Sheet",
|
||||||
"report_type": "Script Report"
|
"report_type": "Script Report"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user