2
0
mirror of https://github.com/frappe/books.git synced 2025-01-03 07:12:21 +00:00

fix: resolved linting issues

This commit is contained in:
AbleKSaju 2024-10-14 11:21:26 +05:30
parent c173dc51b0
commit bb5ac42eb4
2 changed files with 34 additions and 30 deletions

View File

@ -335,12 +335,12 @@
<div class="w-full"> <div class="w-full">
<Button <Button
class="w-full bg-violet-500 dark:bg-violet-700 py-6" class="w-full bg-violet-500 dark:bg-violet-700 py-6"
:disabled="!sinvDoc.party || !sinvDoc.items?.length"
@click=" @click="
sinvDoc.party && sinvDoc.items?.length sinvDoc.party && sinvDoc.items?.length
? saveOrder() ? saveOrder()
: null : null
" "
:disabled="!sinvDoc.party || !sinvDoc.items?.length"
> >
<slot> <slot>
<p class="uppercase text-lg text-white font-semibold"> <p class="uppercase text-lg text-white font-semibold">
@ -596,7 +596,7 @@ export default defineComponent({
duration: 'short', duration: 'short',
}); });
await this.afterSync(); this.afterSync();
}, },
async setItems() { async setItems() {
const items = (await fyo.db.getAll(ModelNameEnum.Item, { const items = (await fyo.db.getAll(ModelNameEnum.Item, {
@ -678,8 +678,12 @@ export default defineComponent({
this.sinvDoc.grandTotal = total; this.sinvDoc.grandTotal = total;
}, },
async selectedInvoiceName(doc: SalesInvoice) { async selectedInvoiceName(doc: SalesInvoice) {
const salesInvoiceDoc = await this.fyo.doc.getDoc(ModelNameEnum.SalesInvoice,doc.name) as SalesInvoice const salesInvoiceDoc = (await this.fyo.doc.getDoc(
this.sinvDoc = salesInvoiceDoc ModelNameEnum.SalesInvoice,
doc.name
)) as SalesInvoice;
this.sinvDoc = salesInvoiceDoc;
this.toggleModal('SavedInvoice', false); this.toggleModal('SavedInvoice', false);
}, },
setTransferAmount(amount: Money = fyo.pesa(0)) { setTransferAmount(amount: Money = fyo.pesa(0)) {
@ -894,7 +898,7 @@ export default defineComponent({
}); });
} }
}, },
async afterSync() { afterSync() {
this.clearValues(); this.clearValues();
this.setSinvDoc(); this.setSinvDoc();
}, },

View File

@ -31,10 +31,14 @@
</div> </div>
</Row> </Row>
<div class="overflow-y-auto" style="height: 65vh; width: 60vh"> <div
v-if="savedInvoices.length"
class="overflow-y-auto"
style="height: 65vh; width: 60vh"
>
<Row <Row
v-if="savedInvoices.length"
v-for="row in savedInvoices as any" v-for="row in savedInvoices as any"
:key="row.name"
:ratio="ratio" :ratio="ratio"
:border="true" :border="true"
class=" class="
@ -50,16 +54,15 @@
px-2 px-2
w-full w-full
" "
@click="$emit('selectedInvoiceName', row)" @click="$emit('selectedInvoiceName', row)"
> >
<FormControl <FormControl
v-for="df in tableFields" v-for="df in tableFields"
:key="df.fieldname" :key="df.fieldname"
size="large" size="large"
class=""
:df="df" :df="df"
:value="row[df.fieldname]" :value="row[df.fieldname]"
:readOnly="true" :read-only="true"
/> />
</Row> </Row>
</div> </div>
@ -67,7 +70,7 @@
<div class="row-start-6 grid grid-cols-2 gap-4 mt-auto p-10"> <div class="row-start-6 grid grid-cols-2 gap-4 mt-auto p-10">
<div class="col-span-2"> <div class="col-span-2">
<Button <Button
class="w-full bg-red-500" class="w-full bg-red-500 dark:bg-red-700"
style="padding: 1.35rem" style="padding: 1.35rem"
@click="$emit('toggleModal', 'SavedInvoice')" @click="$emit('toggleModal', 'SavedInvoice')"
> >
@ -84,11 +87,9 @@
<script lang="ts"> <script lang="ts">
import Button from 'src/components/Button.vue'; import Button from 'src/components/Button.vue';
import Data from 'src/components/Controls/Data.vue';
import Modal from 'src/components/Modal.vue'; import Modal from 'src/components/Modal.vue';
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice'; import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
import { defineComponent, inject } from 'vue'; import { defineComponent, inject } from 'vue';
import { t } from 'fyo';
import { ModelNameEnum } from 'models/types'; import { ModelNameEnum } from 'models/types';
import { Field } from 'schemas/types'; import { Field } from 'schemas/types';
import Row from 'src/components/Row.vue'; import Row from 'src/components/Row.vue';
@ -99,10 +100,18 @@ export default defineComponent({
components: { components: {
Modal, Modal,
Button, Button,
Data,
FormControl, FormControl,
Row, Row,
}, },
props: {
modalStatus: Boolean,
},
emits: ['toggleModal', 'selectedInvoiceName'],
setup() {
return {
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
},
data() { data() {
return { return {
savedInvoices: [] as SalesInvoice[], savedInvoices: [] as SalesInvoice[],
@ -145,14 +154,12 @@ export default defineComponent({
] as Field[]; ] as Field[];
}, },
}, },
props: { watch: {
modalStatus: Boolean, async modalStatus(newVal) {
}, if (newVal) {
emits: ['toggleModal' , 'selectedInvoiceName'], await this.setSavedInvoices();
setup() { }
return { },
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
}, },
async mounted() { async mounted() {
await this.setSavedInvoices(); await this.setSavedInvoices();
@ -160,13 +167,6 @@ export default defineComponent({
async activated() { async activated() {
await this.setSavedInvoices(); await this.setSavedInvoices();
}, },
watch: {
modalStatus(newVal) {
if (newVal) {
this.setSavedInvoices();
}
},
},
methods: { methods: {
async setSavedInvoices() { async setSavedInvoices() {