feat: gate treasury as an org module and group money inputs
Link optional invoice and cheque settlements to cash accounts, and let superadmin enable the finance module per organization. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import type {
|
||||
CreateQuoteRequest,
|
||||
DealDto,
|
||||
DealLineItemInput,
|
||||
FinancialAccountDto,
|
||||
InvoiceDto,
|
||||
InvoiceInstallmentInput,
|
||||
InvoiceStatus,
|
||||
@@ -123,6 +124,8 @@ const lines = ref<LineDraft[]>([]);
|
||||
const installments = ref<InstallmentDraft[]>([]);
|
||||
const invoice = ref<InvoiceDto | null>(null);
|
||||
|
||||
const payAccountId = ref('');
|
||||
const financeAccounts = ref<FinancialAccountDto[]>([]);
|
||||
const payAmount = ref('');
|
||||
const payMethod = ref<PaymentMethod>('transfer');
|
||||
const payNotes = ref('');
|
||||
@@ -463,6 +466,8 @@ async function load() {
|
||||
error.value = '';
|
||||
mobileStep.value = 1;
|
||||
try {
|
||||
const accounts = await api.get<FinancialAccountDto[]>('/treasury/accounts').catch(() => null);
|
||||
financeAccounts.value = accounts?.data.filter((row) => row.isActive) ?? [];
|
||||
title.value = defaultTitle.value;
|
||||
status.value = 'draft';
|
||||
notes.value = '';
|
||||
@@ -740,6 +745,7 @@ async function submitPayment() {
|
||||
notes: payNotes.value || undefined,
|
||||
paidAt: payDate.value ? new Date(payDate.value).toISOString() : undefined,
|
||||
installmentId: payInstallmentId.value || null,
|
||||
financialAccountId: payAccountId.value || null,
|
||||
cheque:
|
||||
payMethod.value === 'check'
|
||||
? {
|
||||
@@ -1316,6 +1322,12 @@ onMounted(load);
|
||||
</option>
|
||||
</select>
|
||||
<input v-model="payNotes" placeholder="یادداشت پرداخت" />
|
||||
<select v-if="financeAccounts.length" v-model="payAccountId">
|
||||
<option value="">بدون اثر روی صندوق</option>
|
||||
<option v-for="account in financeAccounts" :key="account.id" :value="account.id">
|
||||
واریز به {{ account.name }}
|
||||
</option>
|
||||
</select>
|
||||
<div v-if="payMethod === 'check'" class="cheque-fields">
|
||||
<input v-model="chequeNumber" placeholder="شماره چک" />
|
||||
<input v-model="chequeBank" placeholder="بانک" />
|
||||
|
||||
Reference in New Issue
Block a user