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',
|
||||
warningClose: 'Incomplte edit data, Do you want to close?',
|
||||
close: 'Do you want to close this window?',
|
||||
|
||||
confirmChangeStatus: 'Do you want to change your status?',
|
||||
},
|
||||
action: {
|
||||
ok: 'OK',
|
||||
|
|
|
|||
|
|
@ -791,6 +791,7 @@ export default {
|
|||
headquartersNotEstablished: 'ยังไม่ได้สร้างสำนักงานใหญ่',
|
||||
warningClose: 'มีการแก้ไขที่ยังไม่ได้บันทึก คุณต้องการปิดใช่หรือไม่',
|
||||
close: 'คุณต้องการปิดหน้าต่างนี้ใช่หรือไม่',
|
||||
confirmChangeStatus: 'คุณต้องการเปลี่ยนสถานะใช่หรือไม่',
|
||||
},
|
||||
action: {
|
||||
ok: 'ยืนยัน',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
<script setup lang="ts">
|
||||
import { baseUrl } from 'stores/utils';
|
||||
import { baseUrl, dialog } from 'stores/utils';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useConfigStore } from 'stores/config';
|
||||
import { formatNumberDecimal } from 'stores/utils';
|
||||
import { MainButton } from 'components/button';
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useQuotationPayment } from 'src/stores/quotations';
|
||||
import {
|
||||
|
|
@ -144,21 +148,29 @@ function triggerViewSlip(payment: QuotationPaymentData, name: string) {
|
|||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
function selectStatus(
|
||||
async function selectStatus(
|
||||
payment: QuotationPaymentData,
|
||||
status: string,
|
||||
index: number,
|
||||
) {
|
||||
const existingPayment = submitPaymentData.value.findIndex(
|
||||
(p: QuotationPaymentData) => p.id === payment.id,
|
||||
);
|
||||
|
||||
if (existingPayment !== -1) {
|
||||
submitPaymentData.value[existingPayment].paymentStatus = status;
|
||||
} else {
|
||||
payment.paymentStatus = status;
|
||||
submitPaymentData.value.push(payment);
|
||||
}
|
||||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('dialog.title.confirmChangeStatus'),
|
||||
actionText: t('general.confirm'),
|
||||
persistent: true,
|
||||
message: t('dialog.message.confirmChangeStatus'),
|
||||
action: async () => {
|
||||
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();
|
||||
}
|
||||
|
|
@ -438,14 +450,6 @@ onMounted(async () => {
|
|||
<span class="app-text-muted-2 q-pt-md">
|
||||
{{ $t('quotation.receiptDialog.billOfPayment') }}
|
||||
</span>
|
||||
<q-checkbox
|
||||
v-if="
|
||||
data.payCondition === 'BillSplit' || data.payCondition === 'Split'
|
||||
"
|
||||
size="xs"
|
||||
v-model="payAll"
|
||||
:label="$t('quotation.receiptDialog.payAll')"
|
||||
/>
|
||||
|
||||
<!-- payment item -->
|
||||
<section class="row">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue