refactor: refs #8667 modified client payment to be the same as Salix
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jon Elias 2025-03-24 09:07:59 +01:00
parent f2e65a7e65
commit 4460b7110e
2 changed files with 20 additions and 20 deletions

View File

@ -20,6 +20,7 @@ import VnFilter from 'components/VnTable/VnFilter.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue'; import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const { sendEmail, openReport } = usePrintService(); const { sendEmail, openReport } = usePrintService();
@ -89,15 +90,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
label: t('Employee'), label: t('Employee'),
columnField: { name: 'workerFk',
component: 'userLink',
attrs: ({ row }) => {
return {
workerId: row.workerFk,
name: row.userName,
};
},
},
cardVisible: true, cardVisible: true,
}, },
{ {
@ -146,12 +139,14 @@ const columns = computed(() => [
actions: [ actions: [
{ {
title: t('globals.downloadPdf'), title: t('globals.downloadPdf'),
isPrimary: true,
icon: 'cloud_download', icon: 'cloud_download',
show: (row) => row.isInvoice, show: (row) => row.isInvoice,
action: (row) => showBalancePdf(row), action: (row) => showBalancePdf(row),
}, },
{ {
title: t('Send compensation'), title: t('Send compensation'),
isPrimary: true,
icon: 'outgoing_mail', icon: 'outgoing_mail',
show: (row) => !!row.isCompensation, show: (row) => !!row.isCompensation,
action: ({ id }) => action: ({ id }) =>
@ -253,8 +248,14 @@ const showBalancePdf = ({ id }) => {
:disable-option="{ card: true }" :disable-option="{ card: true }"
auto-load auto-load
> >
<template #column-balance="{ rowIndex }"> <template #column-balance="{ row }">
{{ toCurrency(balances[rowIndex]?.balance) }} {{ toCurrency(balances[row]?.balance) }}
</template>
<template #column-workerFk="{ row }">
<span class="link">
{{ row.userName }}
<WorkerDescriptorProxy :id="row.workerFk" />
</span>
</template> </template>
<template #column-description="{ row }"> <template #column-description="{ row }">
<span class="link" v-if="row.isInvoice" @click.stop> <span class="link" v-if="row.isInvoice" @click.stop>

View File

@ -48,6 +48,7 @@ const maxAmount = ref();
const accountingType = ref({}); const accountingType = ref({});
const isCash = ref(false); const isCash = ref(false);
const formModelRef = ref(false); const formModelRef = ref(false);
const amountToReturn = ref();
const filterBanks = { const filterBanks = {
fields: ['id', 'bank', 'accountingTypeFk'], fields: ['id', 'bank', 'accountingTypeFk'],
@ -90,7 +91,7 @@ function setPaymentType(data, accounting) {
let descriptions = []; let descriptions = [];
if (accountingType.value.receiptDescription) if (accountingType.value.receiptDescription)
descriptions.push(accountingType.value.receiptDescription); descriptions.push(accountingType.value.receiptDescription);
if (data.description) descriptions.push(data.description); if (data.description > 0) descriptions.push(data.description);
data.description = descriptions.join(', '); data.description = descriptions.join(', ');
} }
@ -100,7 +101,7 @@ const calculateFromAmount = (event) => {
}; };
const calculateFromDeliveredAmount = (event) => { const calculateFromDeliveredAmount = (event) => {
initialData.amountToReturn = parseFloat(event) - initialData.amountPaid; amountToReturn.value = event - initialData.amountPaid;
}; };
function onBeforeSave(data) { function onBeforeSave(data) {
@ -121,7 +122,7 @@ async function onDataSaved(formData, { id }) {
recipient: formData.email, recipient: formData.email,
}); });
if (viewReceipt.value) openReport(`Receipts/${id}/receipt-pdf`); if (viewReceipt.value) openReport(`Receipts/${id}/receipt-pdf`, {}, '_blank');
} finally { } finally {
if ($props.promise) $props.promise(); if ($props.promise) $props.promise();
if (closeButton.value) closeButton.value.click(); if (closeButton.value) closeButton.value.click();
@ -241,13 +242,12 @@ async function getAmountPaid() {
@update:model-value="getAmountPaid()" @update:model-value="getAmountPaid()"
/> />
</VnRow> </VnRow>
<div v-if="accountingType.code == 'compensation'">
<div v-if="data.bankFk?.accountingType?.code == 'compensation'">
<div class="text-h6"> <div class="text-h6">
{{ t('Compensation') }} {{ t('Compensation') }}
</div> </div>
<VnRow> <VnRow>
<VnInputNumber <VnInput
:label="t('Compensation account')" :label="t('Compensation account')"
clearable clearable
v-model="data.compensationAccount" v-model="data.compensationAccount"
@ -261,8 +261,7 @@ async function getAmountPaid() {
clearable clearable
v-model="data.description" v-model="data.description"
/> />
<div v-if="accountingType.code == 'cash'">
<div v-if="data.bankFk?.accountingType?.code == 'cash'">
<div class="text-h6">{{ t('Cash') }}</div> <div class="text-h6">{{ t('Cash') }}</div>
<VnRow> <VnRow>
<VnInputNumber <VnInputNumber
@ -274,7 +273,7 @@ async function getAmountPaid() {
<VnInputNumber <VnInputNumber
:label="t('Amount to return')" :label="t('Amount to return')"
disable disable
v-model="data.amountToReturn" v-model="amountToReturn"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>