Created
June 4, 2016 03:38
-
-
Save ccfiel/62caee4c748949a02433b068d568d94d to your computer and use it in GitHub Desktop.
working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("oooooooooooooooooooooo"); | |
frappe.ui.form.on("Enrollees", "status", function(frm) { | |
frm.toggle_display("student", frm.doc.status == "Continuing" || frm.doc.status == "Returnee"); | |
return frappe.call({ | |
method: "wela.registration.doctype.enrollees.enrollees.generate_id_number", | |
args: { | |
"status": frm.doc.status | |
}, | |
callback: function(r, rt) { | |
if(r.message) { | |
if (frm.doc.status == 'New' || frm.doc.status == 'Transferee') { | |
cur_frm.set_value("id_number", r.message['id_number']); | |
} else { | |
cur_frm.set_value("id_number", ""); | |
} | |
} | |
} | |
}); | |
}); | |
frappe.ui.form.on("Enrollees", "student", function(frm) { | |
var student = "" | |
if (frm.doc.student != null) { | |
student = frm.doc.student | |
} | |
return frappe.call({ | |
method: "wela.registration.doctype.enrollees.enrollees.get_student_data", | |
args: { | |
"student": student | |
}, | |
callback: function(r, rt) { | |
if(r.message) { | |
cur_frm.set_value("id_number", r.message['id_number']); | |
cur_frm.set_value("first_name", r.message['first_name']); | |
cur_frm.set_value("last_name", r.message['last_name']); | |
cur_frm.set_value("middle_name", r.message['middle_name']); | |
cur_frm.set_value("birthdate", r.message['birthday']); | |
cur_frm.set_value("gender", r.message['gender']); | |
cur_frm.set_value("father_name", r.message['father_name']); | |
cur_frm.set_value("mother_name", r.message['mother_name']); | |
cur_frm.set_value("student_phone_number", r.message['student_phone_number']); | |
cur_frm.set_value("father_phone_number", r.message['father_phone_number']); | |
cur_frm.set_value("mother_phone_number", r.message['mother_phone_number']); | |
cur_frm.set_value("incoming_level", String(r.message['incoming_level']).trim()); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment