Skip to content

Commit

Permalink
feat: add mop alert
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory committed Aug 3, 2022
1 parent eaf4cfe commit ba6029a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions check_run/public/js/check_run/CheckRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@
class="mop-onclick"
:data-mop-index="i"
>

<ADropdown ref="dropdowns" v-model="state.transactions[i].mode_of_payment" :items="modeOfPaymentNames" v-if="state.docstatus < 1" :transactionIndex="i" :isOpen="state.transactions[i].mopIsOpen" @isOpenChanged="val => state.transactions[i].mopIsOpen = val"/>
<ADropdown
ref="dropdowns"
v-model="state.transactions[i].mode_of_payment"
:items="modeOfPaymentNames"
v-if="state.docstatus < 1" :transactionIndex="i"
:isOpen="state.transactions[i].mopIsOpen"
@isOpenChanged="val => state.transactions[i].mopIsOpen = val"
/>

<span v-else>{{ transactions[i].mode_of_payment }}</span>
</td>
Expand All @@ -74,7 +80,7 @@
type="checkbox"
class="input-with-feedback checkrun-check-box"
data-fieldtype="Check"
@change="onPayChange()"
@change="onPayChange(i)"
:data-checkbox-index="i"
v-model="item.pay"
:id="item.id" />Pay
Expand Down Expand Up @@ -116,7 +122,7 @@ export default {
cur_frm.doc.amount_check_run = cur_frm.check_run_state.check_run_total()
cur_frm.refresh_field("amount_check_run")
cur_frm.dirty();
},
}
},
methods: {
transactionUrl: transactionId => {
Expand Down Expand Up @@ -145,17 +151,21 @@ export default {
markDirty() {
cur_frm.dirty()
},
onPayChange() {
onPayChange(selectedRow) {
cur_frm.doc.amount_check_run = cur_frm.check_run_state.check_run_total()
cur_frm.refresh_field("amount_check_run")
this.markDirty()
console.log(this.transactions[selectedRow].pay == true)
if(this.transactions[selectedRow].pay && !this.transactions[selectedRow].mode_of_payment){
frappe.show_alert(__('Please add a Mode of Payment for this row'))
}
},
checkPay() {
if(this.state.docstatus >= 1 || !this.transactions.length) {
return
}
this.transactions[this.state.selectedRow].pay = !this.transactions[this.state.selectedRow].pay
this.onPayChange()
this.onPayChange(this.state.selectedRow)
},
openMopWithSearch(keycode) {
Expand Down

0 comments on commit ba6029a

Please sign in to comment.