brotherton-erpnext/erpnext/hr/loan_common.js
Shreya Shah 4dc453d131 Loan Management for the Members (Non Profit Module) (#13149)
* Renamed - Employee Loan Application to Loan Application, Employee Loan to Loan and field Employee Loan Account to Loan Account

* Patch added

* Dynamic link fields 'applicant' and 'applicant_type'

* Member link visible only if domain non profit is active

* Modified loan_dashboard

* Make Repayment Entry button

* Common file loan_common.js for loan and loan_application

* repayment schedule rows selection in dialog

* validation if repayment amount > total paid amount

* repayment only if disbursement is done, make repayment by selecting the installment which falls in the current month

* fetch nowdate if disbursement date not found

* Rebased with develop

* updated non-profit module page

* updated patch for renamed fields

* dialog to select repayment entries

* hidden field to store reschedule paid status

* update paid check in loan on journal entry updation

* calculate total paid

* updated docs

* codacy fix
2018-04-24 12:19:36 +05:30

27 lines
859 B
JavaScript

// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on(cur_frm.doctype, {
refresh: function(frm) {
if (!frappe.boot.active_domains.includes("Non Profit")) {
frm.set_df_property('applicant_type', 'options', ['Employee']);
frm.refresh_field('applicant_type');
}
},
applicant_type: function(frm) {
frm.set_value("applicant", null);
frm.set_value("applicant_name", null);
},
applicant: function(frm) {
if (frm.doc.applicant) {
frappe.model.with_doc(frm.doc.applicant_type, frm.doc.applicant, function() {
var applicant = frappe.model.get_doc(frm.doc.applicant_type, frm.doc.applicant);
frm.set_value("applicant_name",
applicant.employee_name || applicant.member_name);
});
}
else {
frm.set_value("applicant_name", null);
}
}
});