fix: Linting errors

This commit is contained in:
Deepesh Garg
2021-05-13 14:04:51 +05:30
parent a87e3fcb7c
commit fd380d34f9
6 changed files with 52 additions and 53 deletions

View File

@@ -16,14 +16,14 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.select_text()
},
select_text: function(){
select_text: function() {
var me = this;
$(this.$body).find('.form-control').click(function(){
$(this.$body).find('.form-control').click(function() {
$(this).select();
})
},
set_payment_primary_action: function(){
set_payment_primary_action: function() {
var me = this;
this.dialog.set_primary_action(__("Submit"), function() {
@@ -38,7 +38,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
})
},
make_keyboard: function(){
make_keyboard: function() {
var me = this;
$(this.$body).empty();
$(this.$body).html(frappe.render_template('pos_payment', this.frm.doc))
@@ -47,10 +47,10 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.clear_amount()
},
make_multimode_payment: function(){
make_multimode_payment: function() {
var me = this;
if(this.frm.doc.change_amount > 0){
if(this.frm.doc.change_amount > 0) {
me.payment_val = me.doc.outstanding_amount
}
@@ -59,7 +59,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.payments.amount = flt(this.payment_val);
},
show_payment_details: function(){
show_payment_details: function() {
var me = this;
var multimode_payments = $(this.$body).find('.multimode-payments').empty();
if(this.frm.doc.payments.length){
@@ -84,7 +84,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
}
},
set_outstanding_amount: function(){
set_outstanding_amount: function() {
this.selected_mode = $(this.$body).find(repl("input[idx='%(idx)s']",{'idx': this.idx}));
this.highlight_selected_row()
this.payment_val = 0.0
@@ -101,45 +101,45 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.bind_amount_change_event();
},
bind_keyboard_event: function(){
bind_keyboard_event: function() {
var me = this;
this.payment_val = '';
this.bind_form_control_event();
this.bind_numeric_keys_event();
},
bind_form_control_event: function(){
bind_form_control_event: function() {
var me = this;
$(this.$body).find('.pos-payment-row').click(function(){
$(this.$body).find('.pos-payment-row').click(function() {
me.idx = $(this).attr("idx");
me.set_outstanding_amount()
})
});
$(this.$body).find('.form-control').click(function(){
$(this.$body).find('.form-control').click(function() {
me.idx = $(this).attr("idx");
me.set_outstanding_amount();
me.update_paid_amount(true);
})
});
$(this.$body).find('.write_off_amount').change(function(){
$(this.$body).find('.write_off_amount').change(function() {
me.write_off_amount(flt($(this).val()), precision("write_off_amount"));
})
});
$(this.$body).find('.change_amount').change(function(){
$(this.$body).find('.change_amount').change(function() {
me.change_amount(flt($(this).val()), precision("change_amount"));
})
});
},
highlight_selected_row: function(){
highlight_selected_row: function() {
var me = this;
var selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']",{'idx': this.idx}));
var selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']", {'idx': this.idx}));
$(this.$body).find('.pos-payment-row').removeClass('selected-payment-mode')
selected_row.addClass('selected-payment-mode')
$(this.$body).find('.amount').attr('disabled', true);
this.selected_mode.attr('disabled', false);
},
bind_numeric_keys_event: function(){
bind_numeric_keys_event: function() {
var me = this;
$(this.$body).find('.pos-keyboard-key').click(function(){
me.payment_val += $(this).text();
@@ -148,7 +148,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
me.update_paid_amount()
})
$(this.$body).find('.delete-btn').click(function(){
$(this.$body).find('.delete-btn').click(function() {
me.payment_val = cstr(flt(me.selected_mode.val())).slice(0, -1);
me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency));
me.idx = me.selected_mode.attr("idx")
@@ -157,9 +157,9 @@ erpnext.payments = erpnext.stock.StockController.extend({
},
bind_amount_change_event: function(){
bind_amount_change_event: function() {
var me = this;
this.selected_mode.change(function(){
this.selected_mode.change(function() {
me.payment_val = flt($(this).val()) || 0.0;
me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
me.idx = me.selected_mode.attr("idx")
@@ -169,7 +169,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
clear_amount: function() {
var me = this;
$(this.$body).find('.clr').click(function(e){
$(this.$body).find('.clr').click(function(e) {
e.stopPropagation();
me.idx = $(this).attr("idx");
me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
@@ -215,10 +215,10 @@ erpnext.payments = erpnext.stock.StockController.extend({
}
},
update_payment_amount: function(){
update_payment_amount: function() {
var me = this;
$.each(this.frm.doc.payments, function(index, data){
$.each(this.frm.doc.payments, function(index, data) {
if(cint(me.idx) == cint(data.idx)){
data.amount = flt(me.selected_mode.val(), 2)
}
@@ -228,7 +228,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.show_amounts();
},
show_amounts: function(){
show_amounts: function() {
var me = this;
$(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency));
$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));