mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
fix(ux): disable Pay, Submit buttons on conditions
This commit is contained in:
parent
97f9fbb80b
commit
a76953776b
@ -18,6 +18,7 @@
|
|||||||
"label": "Counter Cash Account",
|
"label": "Counter Cash Account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Account",
|
"target": "Account",
|
||||||
|
"default": "Cash In Hand",
|
||||||
"required": true,
|
"required": true,
|
||||||
"create": true,
|
"create": true,
|
||||||
"section": "Default"
|
"section": "Default"
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
class="mt-4 w-full bg-green-500 py-6"
|
class="mt-4 w-full bg-green-500 py-6"
|
||||||
:disabled="!sinvDoc.items?.length"
|
:disabled="disablePayButton"
|
||||||
@click="toggleModal('Payment', true)"
|
@click="toggleModal('Payment', true)"
|
||||||
>
|
>
|
||||||
<slot>
|
<slot>
|
||||||
@ -273,6 +273,16 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
disablePayButton(): boolean {
|
||||||
|
if (!this.sinvDoc.items?.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.sinvDoc.party) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
sinvDoc: {
|
sinvDoc: {
|
||||||
|
@ -300,6 +300,13 @@ export default defineComponent({
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.cashAmount.isZero() &&
|
||||||
|
(!this.transferRefNo || !this.transferClearanceDate)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -211,6 +211,14 @@ export async function transferPOSCashAndWriteOff(
|
|||||||
fyo: Fyo,
|
fyo: Fyo,
|
||||||
posShiftDoc: POSShift
|
posShiftDoc: POSShift
|
||||||
) {
|
) {
|
||||||
|
const differenceAmount = posShiftDoc?.closingAmounts?.find(
|
||||||
|
(row) => row.paymentMethod === 'Cash'
|
||||||
|
)?.differenceAmount as Money;
|
||||||
|
|
||||||
|
if (differenceAmount.isZero()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const closingCashAmount = posShiftDoc.closingAmounts?.find(
|
const closingCashAmount = posShiftDoc.closingAmounts?.find(
|
||||||
(row) => row.paymentMethod === 'Cash'
|
(row) => row.paymentMethod === 'Cash'
|
||||||
)?.closingAmount as Money;
|
)?.closingAmount as Money;
|
||||||
@ -229,10 +237,6 @@ export async function transferPOSCashAndWriteOff(
|
|||||||
credit: closingCashAmount,
|
credit: closingCashAmount,
|
||||||
});
|
});
|
||||||
|
|
||||||
const differenceAmount = posShiftDoc?.closingAmounts?.find(
|
|
||||||
(row) => row.paymentMethod === 'Cash'
|
|
||||||
)?.differenceAmount as Money;
|
|
||||||
|
|
||||||
if (differenceAmount.isNegative()) {
|
if (differenceAmount.isNegative()) {
|
||||||
await jvDoc.append('accounts', {
|
await jvDoc.append('accounts', {
|
||||||
account: AccountTypeEnum.Cash,
|
account: AccountTypeEnum.Cash,
|
||||||
|
Loading…
Reference in New Issue
Block a user