mirror of
https://github.com/frappe/books.git
synced 2024-11-15 01:44:04 +00:00
fix: resolve linting issues
This commit is contained in:
parent
53cf61d4fe
commit
dc7b4b0c60
@ -35,8 +35,8 @@
|
||||
<Button
|
||||
class="w-full bg-green-500"
|
||||
style="padding: 1.35rem"
|
||||
@click="setLoyaltyPoints()"
|
||||
:disabled="validationError"
|
||||
@click="setLoyaltyPoints()"
|
||||
>
|
||||
<slot>
|
||||
<p class="uppercase text-lg text-white font-semibold">
|
||||
@ -67,9 +67,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Button from 'src/components/Button.vue';
|
||||
import Currency from 'src/components/Controls/Currency.vue';
|
||||
import Data from 'src/components/Controls/Data.vue';
|
||||
import Date from 'src/components/Controls/Date.vue';
|
||||
import Modal from 'src/components/Modal.vue';
|
||||
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
|
||||
import { defineComponent, inject } from 'vue';
|
||||
@ -81,17 +79,10 @@ export default defineComponent({
|
||||
name: 'LoyaltyProgramModal',
|
||||
components: {
|
||||
Modal,
|
||||
Currency,
|
||||
Button,
|
||||
Data,
|
||||
Date,
|
||||
},
|
||||
emits: ['setLoyaltyPoints', 'toggleModal'],
|
||||
props: {
|
||||
sinvDoc: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
loyaltyPoints: {
|
||||
type: Number,
|
||||
required: true,
|
||||
@ -101,16 +92,17 @@ export default defineComponent({
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
validationError: false,
|
||||
};
|
||||
},
|
||||
emits: ['setLoyaltyPoints', 'toggleModal'],
|
||||
setup() {
|
||||
return {
|
||||
sinvDoc: inject('sinvDoc') as SalesInvoice,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
validationError: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async updateLoyaltyPoints(newValue: number) {
|
||||
try {
|
||||
@ -119,7 +111,7 @@ export default defineComponent({
|
||||
} else {
|
||||
throw new Error(
|
||||
`${this.sinvDoc.party as string} only has ${
|
||||
this.loyaltyPoints as number
|
||||
this.loyaltyPoints
|
||||
} points`
|
||||
);
|
||||
}
|
||||
@ -128,7 +120,7 @@ export default defineComponent({
|
||||
ModelNameEnum.LoyaltyProgram,
|
||||
{
|
||||
fields: ['conversionFactor'],
|
||||
filters: { name: this.loyaltyProgram as string },
|
||||
filters: { name: this.loyaltyProgram },
|
||||
}
|
||||
);
|
||||
|
||||
@ -136,9 +128,7 @@ export default defineComponent({
|
||||
newValue * ((loyaltyProgramDoc[0]?.conversionFactor as number) || 0);
|
||||
|
||||
if (this.sinvDoc.baseGrandTotal?.lt(loyaltyPoint)) {
|
||||
throw new Error(
|
||||
t`no need ${newValue as number} points to purchase this item`
|
||||
);
|
||||
throw new Error(t`no need ${newValue} points to purchase this item`);
|
||||
}
|
||||
this.validationError = false;
|
||||
} catch (error) {
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
<LoyaltyProgramModal
|
||||
:open-modal="openLoyaltyProgramModal"
|
||||
:sinvDoc="sinvDoc"
|
||||
:loyalty-points="loyaltyPoints"
|
||||
:loyalty-program="loyaltyProgram"
|
||||
@set-loyalty-points="setLoyaltyPoints"
|
||||
@ -486,7 +485,7 @@ export default defineComponent({
|
||||
|
||||
const party = await this.fyo.db.getAll(ModelNameEnum.Party, {
|
||||
fields: ['loyaltyProgram', 'loyaltyPoints'],
|
||||
filters: { name: value as string },
|
||||
filters: { name: value },
|
||||
});
|
||||
|
||||
this.loyaltyProgram = party[0]?.loyaltyProgram as string;
|
||||
@ -561,8 +560,8 @@ export default defineComponent({
|
||||
|
||||
const totalLotaltyAmount = await getAddedLPWithGrandTotal(
|
||||
this.fyo,
|
||||
this.loyaltyProgram as string,
|
||||
value as number
|
||||
this.loyaltyProgram,
|
||||
value
|
||||
);
|
||||
|
||||
const total = totalLotaltyAmount
|
||||
|
Loading…
Reference in New Issue
Block a user