fix: payment (#36)
* refactor: remove pay all checkbox * fix: select status * refactor: add i18n * refactor: add dialog --------- Co-authored-by: puriphatt <puriphat@frappet.com> Co-authored-by: Thanaphon Frappet <thanaphon@frappet.com>
This commit is contained in:
parent
5058f3cbaf
commit
a9c9467643
3 changed files with 27 additions and 20 deletions
|
|
@ -795,6 +795,8 @@ export default {
|
||||||
headquartersNotEstablished: 'Headoffice not established',
|
headquartersNotEstablished: 'Headoffice not established',
|
||||||
warningClose: 'Incomplte edit data, Do you want to close?',
|
warningClose: 'Incomplte edit data, Do you want to close?',
|
||||||
close: 'Do you want to close this window?',
|
close: 'Do you want to close this window?',
|
||||||
|
|
||||||
|
confirmChangeStatus: 'Do you want to change your status?',
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
ok: 'OK',
|
ok: 'OK',
|
||||||
|
|
|
||||||
|
|
@ -791,6 +791,7 @@ export default {
|
||||||
headquartersNotEstablished: 'ยังไม่ได้สร้างสำนักงานใหญ่',
|
headquartersNotEstablished: 'ยังไม่ได้สร้างสำนักงานใหญ่',
|
||||||
warningClose: 'มีการแก้ไขที่ยังไม่ได้บันทึก คุณต้องการปิดใช่หรือไม่',
|
warningClose: 'มีการแก้ไขที่ยังไม่ได้บันทึก คุณต้องการปิดใช่หรือไม่',
|
||||||
close: 'คุณต้องการปิดหน้าต่างนี้ใช่หรือไม่',
|
close: 'คุณต้องการปิดหน้าต่างนี้ใช่หรือไม่',
|
||||||
|
confirmChangeStatus: 'คุณต้องการเปลี่ยนสถานะใช่หรือไม่',
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
ok: 'ยืนยัน',
|
ok: 'ยืนยัน',
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { baseUrl } from 'stores/utils';
|
import { baseUrl, dialog } from 'stores/utils';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useConfigStore } from 'stores/config';
|
import { useConfigStore } from 'stores/config';
|
||||||
import { formatNumberDecimal } from 'stores/utils';
|
import { formatNumberDecimal } from 'stores/utils';
|
||||||
import { MainButton } from 'components/button';
|
import { MainButton } from 'components/button';
|
||||||
|
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useQuotationPayment } from 'src/stores/quotations';
|
import { useQuotationPayment } from 'src/stores/quotations';
|
||||||
import {
|
import {
|
||||||
|
|
@ -144,21 +148,29 @@ function triggerViewSlip(payment: QuotationPaymentData, name: string) {
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectStatus(
|
async function selectStatus(
|
||||||
payment: QuotationPaymentData,
|
payment: QuotationPaymentData,
|
||||||
status: string,
|
status: string,
|
||||||
index: number,
|
index: number,
|
||||||
) {
|
) {
|
||||||
const existingPayment = submitPaymentData.value.findIndex(
|
dialog({
|
||||||
(p: QuotationPaymentData) => p.id === payment.id,
|
color: 'warning',
|
||||||
);
|
icon: 'mdi-alert',
|
||||||
|
title: t('dialog.title.confirmChangeStatus'),
|
||||||
if (existingPayment !== -1) {
|
actionText: t('general.confirm'),
|
||||||
submitPaymentData.value[existingPayment].paymentStatus = status;
|
persistent: true,
|
||||||
} else {
|
message: t('dialog.message.confirmChangeStatus'),
|
||||||
payment.paymentStatus = status;
|
action: async () => {
|
||||||
submitPaymentData.value.push(payment);
|
payment.paymentStatus = status;
|
||||||
}
|
const payload = {
|
||||||
|
paymentStatus: payment.paymentStatus,
|
||||||
|
date: new Date(payment.date),
|
||||||
|
amount: payment.amount,
|
||||||
|
};
|
||||||
|
await quotationPayment.updateQuotationPayment(payment.id, payload);
|
||||||
|
},
|
||||||
|
cancel: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
refQMenu.value[index].hide();
|
refQMenu.value[index].hide();
|
||||||
}
|
}
|
||||||
|
|
@ -438,14 +450,6 @@ onMounted(async () => {
|
||||||
<span class="app-text-muted-2 q-pt-md">
|
<span class="app-text-muted-2 q-pt-md">
|
||||||
{{ $t('quotation.receiptDialog.billOfPayment') }}
|
{{ $t('quotation.receiptDialog.billOfPayment') }}
|
||||||
</span>
|
</span>
|
||||||
<q-checkbox
|
|
||||||
v-if="
|
|
||||||
data.payCondition === 'BillSplit' || data.payCondition === 'Split'
|
|
||||||
"
|
|
||||||
size="xs"
|
|
||||||
v-model="payAll"
|
|
||||||
:label="$t('quotation.receiptDialog.payAll')"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- payment item -->
|
<!-- payment item -->
|
||||||
<section class="row">
|
<section class="row">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue