feat: debit note (#172)

* feat: new file

* feat: function api debit

* feat: add route debit

* feat: new form page

* refactor: show menu debit

* refactor: add type debit note status

* feat: add i18n

* feat: add constants

* feat: add stores

* feat: layout

* feat: add function

* refactor: change name value

* feat: form select quotation

* refactor: change name url

* refactor: use form debit

* refactor: change src import

* refactor: move file form debit

* refactor: add i18n

* feat: add type debit note

* refactor: add columns

* refactor: bind value columns

* refactor: change name Table

* refactor: edit type

* refactor: bind type debit note

* refactor: bind value debit

* refactor: chame name function

* fix: calculate page

* refactor: delete table

* refactor: change name get list

* refactor: change i18n

* refactor: change name value

* refactor: bind navigate and trigger delete

* refactor: format number deciml

* refactor: add i18n

* feat: new page

* refactor: add color debit

* feat: Debit tab

#178

* feat: TableRequest

* refactor: edit type pay condition

* refactor: add i18n btn submit

* refactor: use type enum

* feat: edit layout product expansion

* refactor: bind function

* refactor: show code

* feat: add input search and select  status

* feat: paymentform

* refactor: edit type

* refactor: add manage file and edit end point

* feat: add form.ts

* refactor: send mode

* refactor: edit v-model of due date

* feat: submit create debit

* fix: status

* refactor: handle data not allow

* fix: call updateDebitNote in edit mode and simplify payload handling

* refactor: hide edit

* refactor: handle pay condition only full

* refactor: delete pay split

* refactor: add query

* refactor: handle is debit note

* refactor: handle is quotation

* refactor: add props hide

* refactor: tap payment and receipt

* refactor: add i18n

* feat: view document

* refactor: handle btn view doc

* refactor: use my remark

---------

Co-authored-by: Thanaphon Frappet <thanaphon@frappet.com>
Co-authored-by: nwpptrs <jay02499@gmail.com>
Co-authored-by: aif912752 <siripak@chamomind.com>
This commit is contained in:
Methapon Metanipat 2025-01-27 09:04:08 +07:00 committed by GitHub
parent e3c781f857
commit 79240f53b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 4172 additions and 12 deletions

View file

@ -21,12 +21,16 @@ import { dateFormatJS } from 'src/utils/datetime';
import { QFile, QMenu } from 'quasar';
import UploadFileCard from 'src/components/upload-file/UploadFileCard.vue';
import { onMounted } from 'vue';
import { DebitNote } from 'src/stores/debit-note';
const configStore = useConfigStore();
const quotationPayment = useQuotationPayment();
const { data: config } = storeToRefs(configStore);
const prop = defineProps<{ data?: Quotation | QuotationFull }>();
const prop = defineProps<{
data?: Quotation | QuotationFull | DebitNote;
isDebitNote?: boolean;
}>();
const refQFile = ref<InstanceType<typeof QFile>[]>([]);
const refQMenu = ref<InstanceType<typeof QMenu>[]>([]);
@ -194,7 +198,12 @@ async function triggerSubmit() {
onMounted(async () => {
if (!prop.data) return;
const ret = await quotationPayment.getQuotationPayment(prop.data.id);
const ret = await quotationPayment.getQuotationPayment({
quotationId: prop.isDebitNote === true ? undefined : prop.data.id,
debitNoteId: prop.isDebitNote === true ? prop.data.id : undefined,
quotationOnly: !!prop.isDebitNote ? false : true,
debitNoteOnly: !!prop.isDebitNote ? true : false,
});
if (ret) {
paymentData.value = ret.result;
slipFile.value = paymentData.value.map((v) => ({

View file

@ -443,6 +443,8 @@ async function fetchQuotation() {
async function fetchReceipt() {
const res = await useReceiptStore.getReceiptList({
quotationId: quotationFormData.value.id,
quotationOnly: true,
debitNoteOnly: false,
});
if (res) {
@ -856,7 +858,7 @@ function convertToTable(nodes: Node[]) {
} else {
quotationFormData.value.paySplit = [];
quotationFormData.value.paySplitCount = 0;
quotationFormData.value.payCondition = 'Full';
quotationFormData.value.payCondition = PayCondition.Full;
}
tempPaySplit.value = JSON.parse(

View file

@ -36,6 +36,7 @@ defineProps<{
};
taskOrder?: boolean;
taskOrderComplete?: boolean;
debitNote?: boolean;
}>();
const { t } = useI18n();
@ -216,6 +217,7 @@ watch(
'invoice-color': view === View.Invoice,
'receipt-color': view === View.Receipt,
'task-order-color': taskOrder && !taskOrderComplete,
'debit-note-color': debitNote,
}"
>
<div class="col bordered-r" v-if="!taskOrder">
@ -530,6 +532,10 @@ watch(
--_color: var(--pink-7-hsl);
}
.debit-note-color {
--_color: var(--cyan-7-hsl);
}
.bg-color {
color: white;
background: hsla(var(--_color));

View file

@ -1,6 +1,7 @@
<script lang="ts" setup>
import { formatNumberDecimal } from 'stores/utils';
import { dateFormatJS } from 'src/utils/datetime';
import { Icon } from '@iconify/vue';
import { MainButton, ViewButton } from 'components/button';
@ -12,8 +13,10 @@ defineEmits<{
withDefaults(
defineProps<{
title?: string;
hideExampleBtn?: boolean;
successLabel?: string;
useBtnDownload?: boolean;
hideViewBtn?: boolean;
hideExampleBtn?: boolean;
payType?: string;
amount?: number;
@ -52,7 +55,7 @@ withDefaults(
</aside>
<aside class="column col q-py-md text-right self-center q-px-md">
<div class="q-gutter-x-xs">
<div class="q-gutter-x-xs row justify-end">
<MainButton
v-if="!hideExampleBtn"
icon="mdi-play-box-outline"
@ -60,7 +63,40 @@ withDefaults(
@click="() => $emit('example', index)"
/>
<ViewButton icon-only @click="() => $emit('view', index)" />
<ViewButton
v-if="!hideViewBtn"
icon-only
@click="() => $emit('view', index)"
/>
<q-btn-dropdown
v-if="!!useBtnDownload"
flat
outline
dropdown-icon="mdi-download"
no-icon-animation
padding="0 0"
>
<q-list>
<q-item clickable>
<q-item-section side>
<Icon
icon="fluent:receipt-money-24-regular"
width="24px"
height="24px"
/>
</q-item-section>
{{ $t('debitNote.downloadReceipt') }}
</q-item>
<q-item clickable>
<q-item-section side>
<Icon icon="hugeicons:invoice-03" width="24px" height="24px" />
</q-item-section>
{{ $t('debitNote.downloadTaxInvoice') }}
</q-item>
</q-list>
</q-btn-dropdown>
</div>
<span class="app-text-positive text-weight-bold text-body1">
{{ successLabel || $t('quotation.receiptDialog.receiptIssued') }}

View file

@ -64,12 +64,11 @@ function goToRequestList(id: string) {
}))
"
:columns
hide-bottom
bordered
flat
hide-pagination
selection="multiple"
card-container-class="q-col-gutter-sm"
:no-data-label="$t('general.noDataTable')"
class="full-width"
>
<template v-slot:header="props">