Skip to content

Commit

Permalink
fix: resolved linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Oct 14, 2024
1 parent d532dd0 commit 5619d44
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
14 changes: 9 additions & 5 deletions src/pages/POS/POS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@
<div class="w-full">
<Button
class="w-full bg-violet-500 dark:bg-violet-700 py-6"
:disabled="!sinvDoc.party || !sinvDoc.items?.length"
@click="
sinvDoc.party && sinvDoc.items?.length
? saveOrder()
: null
"
:disabled="!sinvDoc.party || !sinvDoc.items?.length"
>
<slot>
<p class="uppercase text-lg text-white font-semibold">
Expand Down Expand Up @@ -549,7 +549,7 @@ export default defineComponent({
duration: 'short',
});
await this.afterSync();
this.afterSync();
},
async setItems() {
const items = (await fyo.db.getAll(ModelNameEnum.Item, {
Expand Down Expand Up @@ -631,8 +631,12 @@ export default defineComponent({
this.sinvDoc.grandTotal = total;
},
async selectedInvoiceName(doc: SalesInvoice) {
const salesInvoiceDoc = await this.fyo.doc.getDoc(ModelNameEnum.SalesInvoice,doc.name) as SalesInvoice
this.sinvDoc = salesInvoiceDoc
const salesInvoiceDoc = (await this.fyo.doc.getDoc(
ModelNameEnum.SalesInvoice,
doc.name
)) as SalesInvoice;
this.sinvDoc = salesInvoiceDoc;
this.toggleModal('SavedInvoice', false);
},
setTransferAmount(amount: Money = fyo.pesa(0)) {
Expand Down Expand Up @@ -847,7 +851,7 @@ export default defineComponent({
});
}
},
async afterSync() {
afterSync() {
this.clearValues();

Check warning on line 855 in src/pages/POS/POS.vue

View workflow job for this annotation

GitHub Actions / setup_and_lint

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
this.setSinvDoc();
},
Expand Down
50 changes: 25 additions & 25 deletions src/pages/POS/SavedInvoiceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@
</div>
</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
v-if="savedInvoices.length"
v-for="row in savedInvoices as any"
:key="row.name"
:ratio="ratio"
:border="true"
class="
Expand All @@ -50,24 +54,23 @@
px-2
w-full
"
@click="$emit('selectedInvoiceName', row)"
>
@click="$emit('selectedInvoiceName', row)"
>
<FormControl
v-for="df in tableFields"
:key="df.fieldname"
size="large"
class=""
:df="df"
:value="row[df.fieldname]"
:readOnly="true"
:read-only="true"
/>
</Row>
</div>

<div class="row-start-6 grid grid-cols-2 gap-4 mt-auto p-10">
<div class="col-span-2">
<Button
class="w-full bg-red-500"
class="w-full bg-red-500 dark:bg-red-700"
style="padding: 1.35rem"
@click="$emit('toggleModal', 'SavedInvoice')"
>
Expand All @@ -84,11 +87,9 @@

<script lang="ts">
import Button from 'src/components/Button.vue';
import Data from 'src/components/Controls/Data.vue';
import Modal from 'src/components/Modal.vue';
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
import { defineComponent, inject } from 'vue';
import { t } from 'fyo';
import { ModelNameEnum } from 'models/types';
import { Field } from 'schemas/types';
import Row from 'src/components/Row.vue';
Expand All @@ -99,10 +100,18 @@ export default defineComponent({
components: {
Modal,
Button,
Data,
FormControl,
Row,
},
props: {
modalStatus: Boolean,
},
emits: ['toggleModal', 'selectedInvoiceName'],
setup() {
return {
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
},
data() {
return {
savedInvoices: [] as SalesInvoice[],
Expand Down Expand Up @@ -145,28 +154,19 @@ export default defineComponent({
] as Field[];
},
},
props: {
modalStatus: Boolean,
},
emits: ['toggleModal' , 'selectedInvoiceName'],
setup() {
return {
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
watch: {
async modalStatus(newVal) {
if (newVal) {
await this.setSavedInvoices();
}
},
},
async mounted() {
await this.setSavedInvoices();
},
async activated() {
await this.setSavedInvoices();
},
watch: {
modalStatus(newVal) {
if (newVal) {
this.setSavedInvoices();
}
},
},
methods: {
async setSavedInvoices() {
Expand Down

0 comments on commit 5619d44

Please sign in to comment.