Skip to content

Commit

Permalink
style: prettify code
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory authored and actions-user committed Feb 28, 2023
1 parent 19d43fa commit e1d0bb1
Show file tree
Hide file tree
Showing 13 changed files with 707 additions and 672 deletions.
318 changes: 163 additions & 155 deletions check_run/check_run/doctype/check_run/check_run.js

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions check_run/check_run/doctype/check_run/check_run_list.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
frappe.listview_settings['Check Run'] = {
add_fields: ["status"],
hide_name_column: true,
has_indicator_for_draft: 1,
get_indicator: doc => {
return [__(doc.status), {
"Draft": "red",
"Submitted": "blue",
"Ready to Print": "purple",
"Confirm Print": "yellow",
"Printed": "green",
}[doc.status], "status,=," + doc.status]
},
}
frappe.listview_settings['Check Run'] = {
add_fields: ['status'],
hide_name_column: true,
has_indicator_for_draft: 1,
get_indicator: doc => {
return [
__(doc.status),
{
Draft: 'red',
Submitted: 'blue',
'Ready to Print': 'purple',
'Confirm Print': 'yellow',
Printed: 'green',
}[doc.status],
'status,=,' + doc.status,
]
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@

frappe.ui.form.on('Check Run Settings', {
// refresh: function(frm) {

// }
});
})
24 changes: 12 additions & 12 deletions check_run/check_run/report/positive_pay/positive_pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Positive Pay"] = {
"filters": [
frappe.query_reports['Positive Pay'] = {
filters: [
{
fieldname: "bank_account",
label: __("Bank Account"),
fieldtype: "Link",
fieldname: 'bank_account',
label: __('Bank Account'),
fieldtype: 'Link',
options: 'Bank Account',
reqd: 1,
},
{
fieldname: "start_date",
label: __("Start Date"),
fieldtype: "Date",
fieldname: 'start_date',
label: __('Start Date'),
fieldtype: 'Date',
default: moment().date(0).startOf('month').format(),
reqd: 1,
},
{
fieldname: "end_date",
label: __("End Date"),
fieldtype: "Date",
fieldname: 'end_date',
label: __('End Date'),
fieldtype: 'Date',
default: moment().date(0).format(),
reqd: 1,
},
]
],
}
4 changes: 2 additions & 2 deletions check_run/public/js/check_run.bundle.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import './check_run/check_run_quick_entry.js'
import './check_run/check_run.js'
import './check_run/check_run_quick_entry.js'
import './check_run/check_run.js'
190 changes: 100 additions & 90 deletions check_run/public/js/check_run/check_run.js
Original file line number Diff line number Diff line change
@@ -1,90 +1,100 @@
import CheckRun from './CheckRun.vue'
import ADropdown from './ADropdown.vue'

frappe.provide('check_run')

check_run.mount_table = frm => {
check_run.frm = frm
frm.transactions.forEach(val => {
val.mopIsOpen = false
val.pay = val.pay ? val.pay : false
})
frm.check_run_state = Vue.observable({
transactions: frm.transactions,
party_filter: "",
docstatus: frm.doc.docstatus,
modes_of_payment: frm.modes_of_payment,
show_party_filter: false,
check_run_total: function() {
return this.transactions.reduce((partialSum, t) => {
return t.pay ? partialSum + t.amount : partialSum
}, 0);
},
selectedRow: 0,
mopsOpen: 0
})
if (frm.$check_run instanceof Vue) {
frm.$check_run.$destroy()
}
$('#check-run-vue').remove()
$(frm.fields_dict['check_run_table'].wrapper).html($("<div id='check-run-vue'></div>").get(0));
frm.$check_run = new window.Vue({
el: $("#check-run-vue").get(0),
render: h => h(
CheckRun,
{ props: {
transactions: frm.check_run_state.transactions, //list of transtactions
modes_of_payment: frm.check_run_state.modes_of_payment, // populate modes_of_payment select. doesn't get updated
docstatus: frm.check_run_state.docstatus, // used to conditionally render column inputs based on submission status. doesn't get updated
state: frm.check_run_state
}
})
})

}

check_run.keyDownHandler = e => {

if(!check_run.frm) {
return
}

if(document.activeElement.tagName == "INPUT" || document.activeElement.tagName == "TEXTAREA") {
return
}

if(e.keyCode == 40 && check_run.frm.check_run_state.selectedRow < (check_run.frm.check_run_state.transactions.length - 1)){
for(let j=0;j<check_run.frm.check_run_state.transactions.length;j++) {
if(check_run.frm.check_run_state.transactions[j].mopIsOpen) {
return
}
}
document.getElementById(`mop-input-${check_run.frm.check_run_state.selectedRow}`).blur()
check_run.frm.check_run_state.selectedRow += 1
}

if(e.keyCode == 38 && check_run.frm.check_run_state.selectedRow > 0){
for(let j=0;j<check_run.frm.check_run_state.transactions.length;j++) {
if(check_run.frm.check_run_state.transactions[j].mopIsOpen) {
return
}
}
document.getElementById(`mop-input-${check_run.frm.check_run_state.selectedRow}`).blur()
check_run.frm.check_run_state.selectedRow -= 1
}

if(e.keyCode == 32 && check_run.frm.check_run_state.selectedRow != null && check_run.frm.check_run_state.transactions.length){
e.preventDefault()
if(check_run.frm.check_run_component) {
check_run.frm.check_run_component.checkPay()
}
}

if(e.keyCode && e.keyCode >= 65 && e.keyCode <= 90 && check_run.frm.check_run_state.selectedRow != null && check_run.frm.check_run_state.transactions.length){
check_run.frm.check_run_component.openMopWithSearch(e.keyCode)
}

}

window.removeEventListener('keydown', check_run.keyDownHandler)
window.addEventListener('keydown', check_run.keyDownHandler)
import CheckRun from './CheckRun.vue'
import ADropdown from './ADropdown.vue'

frappe.provide('check_run')

check_run.mount_table = frm => {
check_run.frm = frm
frm.transactions.forEach(val => {
val.mopIsOpen = false
val.pay = val.pay ? val.pay : false
})
frm.check_run_state = Vue.observable({
transactions: frm.transactions,
party_filter: '',
docstatus: frm.doc.docstatus,
modes_of_payment: frm.modes_of_payment,
show_party_filter: false,
check_run_total: function () {
return this.transactions.reduce((partialSum, t) => {
return t.pay ? partialSum + t.amount : partialSum
}, 0)
},
selectedRow: 0,
mopsOpen: 0,
})
if (frm.$check_run instanceof Vue) {
frm.$check_run.$destroy()
}
$('#check-run-vue').remove()
$(frm.fields_dict['check_run_table'].wrapper).html($("<div id='check-run-vue'></div>").get(0))
frm.$check_run = new window.Vue({
el: $('#check-run-vue').get(0),
render: h =>
h(CheckRun, {
props: {
transactions: frm.check_run_state.transactions, //list of transtactions
modes_of_payment: frm.check_run_state.modes_of_payment, // populate modes_of_payment select. doesn't get updated
docstatus: frm.check_run_state.docstatus, // used to conditionally render column inputs based on submission status. doesn't get updated
state: frm.check_run_state,
},
}),
})
}

check_run.keyDownHandler = e => {
if (!check_run.frm) {
return
}

if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
return
}

if (
e.keyCode == 40 &&
check_run.frm.check_run_state.selectedRow < check_run.frm.check_run_state.transactions.length - 1
) {
for (let j = 0; j < check_run.frm.check_run_state.transactions.length; j++) {
if (check_run.frm.check_run_state.transactions[j].mopIsOpen) {
return
}
}
document.getElementById(`mop-input-${check_run.frm.check_run_state.selectedRow}`).blur()
check_run.frm.check_run_state.selectedRow += 1
}

if (e.keyCode == 38 && check_run.frm.check_run_state.selectedRow > 0) {
for (let j = 0; j < check_run.frm.check_run_state.transactions.length; j++) {
if (check_run.frm.check_run_state.transactions[j].mopIsOpen) {
return
}
}
document.getElementById(`mop-input-${check_run.frm.check_run_state.selectedRow}`).blur()
check_run.frm.check_run_state.selectedRow -= 1
}

if (
e.keyCode == 32 &&
check_run.frm.check_run_state.selectedRow != null &&
check_run.frm.check_run_state.transactions.length
) {
e.preventDefault()
if (check_run.frm.check_run_component) {
check_run.frm.check_run_component.checkPay()
}
}

if (
e.keyCode &&
e.keyCode >= 65 &&
e.keyCode <= 90 &&
check_run.frm.check_run_state.selectedRow != null &&
check_run.frm.check_run_state.transactions.length
) {
check_run.frm.check_run_component.openMopWithSearch(e.keyCode)
}
}

window.removeEventListener('keydown', check_run.keyDownHandler)
window.addEventListener('keydown', check_run.keyDownHandler)
Loading

0 comments on commit e1d0bb1

Please sign in to comment.