blob: 3e754fafab310d744bc152f436285e21092cd4aa [file] [log] [blame]
Shreya Shah4dc453d2018-04-24 12:19:36 +05301// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
2// For license information, please see license.txt
3
4frappe.ui.form.on(cur_frm.doctype, {
5 refresh: function(frm) {
6 if (!frappe.boot.active_domains.includes("Non Profit")) {
7 frm.set_df_property('applicant_type', 'options', ['Employee']);
8 frm.refresh_field('applicant_type');
9 }
10 },
11 applicant_type: function(frm) {
12 frm.set_value("applicant", null);
13 frm.set_value("applicant_name", null);
14 },
15 applicant: function(frm) {
16 if (frm.doc.applicant) {
17 frappe.model.with_doc(frm.doc.applicant_type, frm.doc.applicant, function() {
18 var applicant = frappe.model.get_doc(frm.doc.applicant_type, frm.doc.applicant);
19 frm.set_value("applicant_name",
20 applicant.employee_name || applicant.member_name);
21 });
22 }
23 else {
24 frm.set_value("applicant_name", null);
25 }
26 }
27});