feat(web): share the page header and icon finance fields.
Remaining screens and finance use the shared page header, tab icons sit closer to their labels, and the active workspace tab no longer paints a broken corner. Treasury selects and the money field show a leading icon. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { Input as AInput } from 'ant-design-vue';
|
||||
import { WalletOutlined } from '@/icons/ant-bridge';
|
||||
import {
|
||||
caretIndexForDigitCount,
|
||||
countDigitChars,
|
||||
@@ -23,6 +24,8 @@ const props = withDefaults(
|
||||
asNumber?: boolean;
|
||||
dir?: 'ltr' | 'rtl';
|
||||
addonAfter?: string;
|
||||
/** آیکون داخل اینپوت؛ پیشفرض Wallet */
|
||||
showPrefix?: boolean;
|
||||
}>(),
|
||||
{
|
||||
required: false,
|
||||
@@ -32,6 +35,7 @@ const props = withDefaults(
|
||||
asNumber: false,
|
||||
dir: 'ltr',
|
||||
addonAfter: '',
|
||||
showPrefix: true,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -136,5 +140,9 @@ function normalizeSep(raw: string): string {
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
@input="onInput"
|
||||
/>
|
||||
>
|
||||
<template v-if="showPrefix" #prefix>
|
||||
<WalletOutlined />
|
||||
</template>
|
||||
</a-input>
|
||||
</template>
|
||||
|
||||
@@ -47,11 +47,6 @@ const currentSubtitle = computed(() => {
|
||||
return 'محیط کاری';
|
||||
});
|
||||
|
||||
const currentInitial = computed(() => {
|
||||
const name = currentName.value.trim();
|
||||
return name ? name.charAt(0) : 'م';
|
||||
});
|
||||
|
||||
const canSwitch = computed(() => orgs.value.length > 1);
|
||||
const isWorkspace = computed(() => props.variant === 'workspace');
|
||||
/** فقط وقتی بیش از یک محیط باشد نمایش و تعویض فعال است */
|
||||
@@ -183,12 +178,12 @@ onUnmounted(() => {
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<template v-if="isWorkspace">
|
||||
<span class="org-mark" aria-hidden="true">{{ currentInitial }}</span>
|
||||
<span class="org-copy">
|
||||
<UiIcon v-if="compact" name="building" :size="18" />
|
||||
<span v-else class="org-copy">
|
||||
<strong>{{ currentName }}</strong>
|
||||
<small>{{ currentSubtitle }}</small>
|
||||
</span>
|
||||
<i class="org-chev" :class="{ open }" aria-hidden="true" />
|
||||
<i v-if="!compact" class="org-chev" :class="{ open }" aria-hidden="true" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<UiIcon name="building" :size="18" />
|
||||
@@ -330,19 +325,6 @@ onUnmounted(() => {
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.org-mark {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 999px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
flex-shrink: 0;
|
||||
background: color-mix(in srgb, var(--accent-soft) 80%, white);
|
||||
color: var(--accent-deep);
|
||||
font-size: 0.92rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.org-copy {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
@@ -351,7 +333,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.org-copy strong {
|
||||
font-size: 0.92rem;
|
||||
font-size: 14px;
|
||||
font-weight: 800;
|
||||
line-height: 1.25;
|
||||
overflow: hidden;
|
||||
@@ -394,17 +376,6 @@ onUnmounted(() => {
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.org-btn.compact.org-ws .org-copy,
|
||||
.org-btn.compact.org-ws .org-chev {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.org-btn.compact.org-ws .org-mark {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.menu {
|
||||
position: fixed;
|
||||
z-index: 90;
|
||||
|
||||
@@ -197,7 +197,8 @@ defineExpose({ close });
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.picker :deep(.ico:last-child) {
|
||||
/* only the trailing chevron — not icons nested in chips/checkmarks */
|
||||
.picker > :deep(.ico) {
|
||||
margin-inline-start: auto;
|
||||
color: #94a3b8;
|
||||
transform: rotate(90deg);
|
||||
|
||||
@@ -362,8 +362,8 @@ function goBack() {
|
||||
>
|
||||
<a-tab-pane v-for="tab in tabs" :key="tab.key" :disabled="tab.disabled">
|
||||
<template #tab>
|
||||
<a-flex align="center" :gap="token.marginXS">
|
||||
<component :is="tab.icon" v-if="tab.icon" />
|
||||
<a-flex align="center" :gap="token.marginXXS">
|
||||
<component :is="tab.icon" v-if="tab.icon" :style="{ margin: 0 }" />
|
||||
<span>{{ tab.label }}</span>
|
||||
<a-badge
|
||||
v-if="tab.count != null"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import type { Component } from 'vue';
|
||||
import { Button as AButton, Space as ASpace } from 'ant-design-vue';
|
||||
|
||||
const ASpaceCompact = ASpace.Compact;
|
||||
|
||||
defineProps<{
|
||||
icon: Component;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-space-compact block style="width: 100%">
|
||||
<a-button tabindex="-1" @mousedown.prevent @click.prevent>
|
||||
<template #icon><component :is="icon" /></template>
|
||||
</a-button>
|
||||
<slot />
|
||||
</a-space-compact>
|
||||
</template>
|
||||
@@ -24,11 +24,15 @@ import {
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
CreditCardOutlined,
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
EyeOutlined,
|
||||
FileTextOutlined,
|
||||
SearchOutlined,
|
||||
StopOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
TagOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import {
|
||||
canManageTreasuryDocuments,
|
||||
type FinancialCategoryDto,
|
||||
@@ -36,6 +40,7 @@ import {
|
||||
} from '@mento/shared';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatJalaliNumeric, formatLocalDateInput } from '@/lib/jalali';
|
||||
import { parseMoneyNumber } from '@/lib/money';
|
||||
@@ -326,7 +331,9 @@ function modalContainer() {
|
||||
placeholder="عنوان یا شماره پیگیری"
|
||||
@press-enter="onSearch"
|
||||
@change="onSearch"
|
||||
/>
|
||||
>
|
||||
<template #prefix><SearchOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -575,7 +582,9 @@ function modalContainer() {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="عنوان" required>
|
||||
<a-input v-model:value="editForm.title" />
|
||||
<a-input v-model:value="editForm.title">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
@@ -585,29 +594,33 @@ function modalContainer() {
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="روش">
|
||||
<a-select
|
||||
v-model:value="editForm.method"
|
||||
allow-clear
|
||||
placeholder="روش"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option v-for="opt in methodOptions" :key="opt.value" :value="opt.value">
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<SelectWithIcon :icon="CreditCardOutlined">
|
||||
<a-select
|
||||
v-model:value="editForm.method"
|
||||
allow-clear
|
||||
placeholder="روش"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option v-for="opt in methodOptions" :key="opt.value" :value="opt.value">
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="دستهبندی">
|
||||
<a-select
|
||||
v-model:value="editForm.categoryId"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
placeholder="دسته"
|
||||
style="width: 100%"
|
||||
:options="categories.map((c) => ({ value: c.id, label: c.name }))"
|
||||
/>
|
||||
<SelectWithIcon :icon="TagOutlined">
|
||||
<a-select
|
||||
v-model:value="editForm.categoryId"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
placeholder="دسته"
|
||||
style="width: 100%"
|
||||
:options="categories.map((c) => ({ value: c.id, label: c.name }))"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="!editAmountLocked" :xs="24" :md="12">
|
||||
@@ -617,7 +630,9 @@ function modalContainer() {
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="یادداشت">
|
||||
<a-input v-model:value="editForm.notes" />
|
||||
<a-input v-model:value="editForm.notes">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import type { CompanyDto, FinancialPartyKind, PersonDto, TreasuryPartySearchDto } from '@mento/shared';
|
||||
import { UserOutlined } from '@/icons/ant-bridge';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import { UiModal } from '@/components/ui';
|
||||
import { api } from '@/lib/api';
|
||||
import CompanyFormView from '@/views/CompanyFormView.vue';
|
||||
@@ -153,58 +155,60 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="4">
|
||||
<a-select
|
||||
:open="selectOpen"
|
||||
show-search
|
||||
@dropdownVisibleChange="onDropdown"
|
||||
allow-clear
|
||||
:filter-option="false"
|
||||
:loading="loading"
|
||||
:value="selectValue"
|
||||
:placeholder="placeholder"
|
||||
style="width: 100%"
|
||||
@search="onSearch"
|
||||
@change="onChange"
|
||||
>
|
||||
<a-select-option v-if="allowOther" value="other" label="سایر">سایر</a-select-option>
|
||||
<a-select-opt-group v-if="peopleOptions.length" label="مشتریان">
|
||||
<a-select-option
|
||||
v-for="row in peopleOptions"
|
||||
:key="`person:${row.id}`"
|
||||
:value="`person:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<a-select-opt-group v-if="companyOptions.length" label="شرکتها">
|
||||
<a-select-option
|
||||
v-for="row in companyOptions"
|
||||
:key="`company:${row.id}`"
|
||||
:value="`company:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<a-select-opt-group v-if="userOptions.length" label="کاربران">
|
||||
<a-select-option
|
||||
v-for="row in userOptions"
|
||||
:key="`user:${row.id}`"
|
||||
:value="`user:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<template #dropdownRender="{ menuNode }">
|
||||
<v-nodes :vnodes="menuNode" />
|
||||
<a-flex @mousedown.prevent>
|
||||
<a-button type="link" @click="openPersonForm">شخص جدید</a-button>
|
||||
<a-button type="link" @click="openCompanyForm">شرکت جدید</a-button>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-select>
|
||||
<SelectWithIcon :icon="UserOutlined">
|
||||
<a-select
|
||||
:open="selectOpen"
|
||||
show-search
|
||||
@dropdownVisibleChange="onDropdown"
|
||||
allow-clear
|
||||
:filter-option="false"
|
||||
:loading="loading"
|
||||
:value="selectValue"
|
||||
:placeholder="placeholder"
|
||||
style="width: 100%"
|
||||
@search="onSearch"
|
||||
@change="onChange"
|
||||
>
|
||||
<a-select-option v-if="allowOther" value="other" label="سایر">سایر</a-select-option>
|
||||
<a-select-opt-group v-if="peopleOptions.length" label="مشتریان">
|
||||
<a-select-option
|
||||
v-for="row in peopleOptions"
|
||||
:key="`person:${row.id}`"
|
||||
:value="`person:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<a-select-opt-group v-if="companyOptions.length" label="شرکتها">
|
||||
<a-select-option
|
||||
v-for="row in companyOptions"
|
||||
:key="`company:${row.id}`"
|
||||
:value="`company:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<a-select-opt-group v-if="userOptions.length" label="کاربران">
|
||||
<a-select-option
|
||||
v-for="row in userOptions"
|
||||
:key="`user:${row.id}`"
|
||||
:value="`user:${row.id}`"
|
||||
:label="row.name"
|
||||
>
|
||||
{{ row.name }}
|
||||
</a-select-option>
|
||||
</a-select-opt-group>
|
||||
<template #dropdownRender="{ menuNode }">
|
||||
<v-nodes :vnodes="menuNode" />
|
||||
<a-flex @mousedown.prevent>
|
||||
<a-button type="link" @click="openPersonForm">شخص جدید</a-button>
|
||||
<a-button type="link" @click="openCompanyForm">شرکت جدید</a-button>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
<a-typography-text v-if="kind === 'other'" type="secondary">
|
||||
برای سایر، مبلغ دریافت یا پرداخت با مبلغ کل یکی است و مانده نمیماند.
|
||||
</a-typography-text>
|
||||
|
||||
@@ -2030,7 +2030,7 @@ onUnmounted(() => {
|
||||
|
||||
.workspace-tabs.desktop-only {
|
||||
--ws-tab-bar: #fff;
|
||||
--ws-tab-active: var(--accent-subtle, #eef8f7);
|
||||
--ws-tab-active: var(--accent-soft, #d0ebe8);
|
||||
--ws-tab-active-ink: var(--accent, #10897d);
|
||||
--ws-tab-radius: 10px;
|
||||
display: block;
|
||||
@@ -2107,30 +2107,6 @@ onUnmounted(() => {
|
||||
border-radius: var(--ws-tab-radius) var(--ws-tab-radius) 0 0 !important;
|
||||
}
|
||||
|
||||
/* concave corners — same shape as Chrome tabs, CRM colors only */
|
||||
.workspace-tabs :deep(.ant-tabs-tab-active)::before,
|
||||
.workspace-tabs :deep(.ant-tabs-tab-active)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: var(--ws-tab-radius);
|
||||
height: var(--ws-tab-radius);
|
||||
background: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.workspace-tabs :deep(.ant-tabs-tab-active)::before {
|
||||
left: calc(var(--ws-tab-radius) * -1);
|
||||
border-radius: 0 0 var(--ws-tab-radius) 0;
|
||||
box-shadow: 5px 0 0 0 var(--ws-tab-active);
|
||||
}
|
||||
|
||||
.workspace-tabs :deep(.ant-tabs-tab-active)::after {
|
||||
right: calc(var(--ws-tab-radius) * -1);
|
||||
border-radius: 0 0 0 var(--ws-tab-radius);
|
||||
box-shadow: -5px 0 0 0 var(--ws-tab-active);
|
||||
}
|
||||
|
||||
.workspace-tabs :deep(.ant-tabs-tab .ant-tabs-tab-remove) {
|
||||
margin-inline-start: 6px;
|
||||
margin-inline-end: 0;
|
||||
|
||||
@@ -14,7 +14,9 @@ import {
|
||||
} from '@mento/shared';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import { parseMoneyNumber } from '@/lib/money';
|
||||
import { UiButton, UiCard, UiField, UiInput, UiPageHeader } from '@/components/ui';
|
||||
import { FundOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import { UiButton, UiCard, UiField, UiInput } from '@/components/ui';
|
||||
|
||||
type RangeDraft = {
|
||||
enabled: boolean;
|
||||
@@ -234,9 +236,10 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<section class="page">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
title="تعیین محدوده مانده"
|
||||
description="بازه مانده مالی و وزنی مشتریان تهحساب برای ساخت فعالیت در کاریز مطالبات."
|
||||
subtitle="بازه مانده مالی و وزنی مشتریان تهحساب برای ساخت فعالیت در کاریز مطالبات."
|
||||
:icon="FundOutlined"
|
||||
/>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
|
||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { CheckOutlined, PlusOutlined, ScheduleOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import { api } from '@/lib/api';
|
||||
import { useFeedback } from '@/composables/useFeedback';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
@@ -27,7 +29,6 @@ import {
|
||||
UiButton,
|
||||
UiInput,
|
||||
UiModal,
|
||||
UiPageHeader,
|
||||
UiSelect,
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
@@ -1075,43 +1076,26 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
|
||||
<template>
|
||||
<section class="crm-page" :class="{ embedded }" @click="typeOpen = assigneeOpen = personOpen = false">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
v-if="!embedded"
|
||||
:title="pageTitle"
|
||||
subtitle="نوع، زمان، مسئول و توضیح فعالیت"
|
||||
:icon="ScheduleOutlined"
|
||||
:back-to="{ name: 'activities' }"
|
||||
primary-label="ذخیره فعالیت"
|
||||
:primary-icon="CheckOutlined"
|
||||
:primary-loading="saving"
|
||||
:primary-disabled="saving"
|
||||
@primary="submit('detail')"
|
||||
>
|
||||
<template #lead>
|
||||
<span class="crumb">
|
||||
<RouterLink :to="{ name: 'activities' }">فعالیتها</RouterLink>
|
||||
<span>›</span>
|
||||
<strong>{{ pageTitle }}</strong>
|
||||
</span>
|
||||
</template>
|
||||
<template #actions>
|
||||
<UiButton
|
||||
variant="primary"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:loading="saving"
|
||||
@click="submit('detail')"
|
||||
>
|
||||
<UiIcon name="check" :size="16" />
|
||||
{{ saving ? 'در حال ذخیره…' : 'ذخیره فعالیت' }}
|
||||
</UiButton>
|
||||
<UiButton
|
||||
variant="outline"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
@click="submit('new')"
|
||||
>
|
||||
<UiIcon name="plus" :size="16" />
|
||||
<a-button :disabled="saving" @click="submit('new')">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
ذخیره و ایجاد جدید
|
||||
</UiButton>
|
||||
<UiButton variant="ghost" type="button" :disabled="saving" @click="cancel">
|
||||
انصراف
|
||||
</UiButton>
|
||||
</a-button>
|
||||
<a-button :disabled="saving" @click="cancel">انصراف</a-button>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="loading" class="muted">در حال بارگذاری…</p>
|
||||
|
||||
@@ -1862,7 +1846,8 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.picker :deep(.ico:last-child) {
|
||||
/* only the trailing chevron — not the type icon nested in .type-ico */
|
||||
.picker > :deep(.ico) {
|
||||
margin-inline-start: auto;
|
||||
color: #94a3b8;
|
||||
transform: rotate(90deg);
|
||||
|
||||
@@ -3,8 +3,6 @@ import { computed, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { api } from '@/lib/api';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import { UiButton, UiPageHeader } from '@/components/ui';
|
||||
import type {
|
||||
LeadFormDto,
|
||||
LeadFormDuplicateMode,
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
UiEmptyState,
|
||||
UiInput,
|
||||
UiModal,
|
||||
UiPageHeader,
|
||||
UiPagination,
|
||||
UiSelect,
|
||||
} from '@/components/ui';
|
||||
@@ -25,6 +24,9 @@ import UiIcon from '@/components/UiIcon.vue';
|
||||
import ProductFormView from '@/views/ProductFormView.vue';
|
||||
import type { ImportContactsResult, ProductDto } from '@mento/shared';
|
||||
import { brand } from '@mento/shared';
|
||||
import { DeleteOutlined, FileExcelOutlined, ReloadOutlined, ShoppingOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import type { PageHeaderMenuItem } from '@/components/page';
|
||||
|
||||
type SortKey = 'name' | 'newest' | 'price';
|
||||
type StatusFilter = 'all' | 'active' | 'inactive';
|
||||
@@ -43,7 +45,21 @@ const page = ref(1);
|
||||
const selected = ref<Set<string>>(new Set());
|
||||
const menuId = ref<string | null>(null);
|
||||
const sortOpen = ref(false);
|
||||
const moreOpen = ref(false);
|
||||
const headerMenuItems = computed<PageHeaderMenuItem[]>(() => [
|
||||
{
|
||||
key: 'delete',
|
||||
label: 'حذف انتخابشدهها',
|
||||
icon: DeleteOutlined,
|
||||
danger: true,
|
||||
disabled: selected.value.size === 0,
|
||||
},
|
||||
{ key: 'reload', label: 'بروزرسانی لیست', icon: ReloadOutlined, dividerBefore: true },
|
||||
]);
|
||||
|
||||
function onHeaderMenu(key: string) {
|
||||
if (key === 'delete') removeSelected();
|
||||
if (key === 'reload') void load();
|
||||
}
|
||||
const productModal = ref(false);
|
||||
const busy = ref(false);
|
||||
const pageBusy = ref(false);
|
||||
@@ -99,7 +115,6 @@ watch([q, category, statusFilter, sort], () => {
|
||||
function closeMenus() {
|
||||
menuId.value = null;
|
||||
sortOpen.value = false;
|
||||
moreOpen.value = false;
|
||||
}
|
||||
|
||||
function toggleSelectAll() {
|
||||
@@ -254,14 +269,20 @@ onMounted(load);
|
||||
<template>
|
||||
<section class="crm-page" @click="closeMenus">
|
||||
<UiBusyOverlay :open="pageBusy" :message="busyMessage" />
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
title="محصولات"
|
||||
lead="مدیریت محصولات، قیمتها و موجودی"
|
||||
subtitle="مدیریت محصولات، قیمتها و موجودی"
|
||||
:icon="ShoppingOutlined"
|
||||
primary-label="محصول جدید"
|
||||
:menu-items="headerMenuItems"
|
||||
@primary="productModal = true"
|
||||
@menu="onHeaderMenu"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="pageBusy" @click="exportExcel">
|
||||
<a-button :disabled="busy" :loading="pageBusy" @click="exportExcel">
|
||||
<template #icon><FileExcelOutlined /></template>
|
||||
خروجی اکسل
|
||||
</UiButton>
|
||||
</a-button>
|
||||
<ExcelImportFlow
|
||||
preview-path="/products/import/preview"
|
||||
import-path="/products/import"
|
||||
@@ -272,31 +293,14 @@ onMounted(load);
|
||||
@settled="onImportSettled"
|
||||
>
|
||||
<template #default="{ loading }">
|
||||
<UiButton variant="ghost" type="button" :disabled="busy" :loading="loading">ورود از اکسل</UiButton>
|
||||
<a-button :disabled="busy" :loading="loading">
|
||||
<template #icon><FileExcelOutlined /></template>
|
||||
ورود از اکسل
|
||||
</a-button>
|
||||
</template>
|
||||
</ExcelImportFlow>
|
||||
<UiButton variant="primary" @click="productModal = true">
|
||||
<UiIcon name="plus" :size="16" />
|
||||
محصول جدید
|
||||
</UiButton>
|
||||
<UiDropdownMenu v-model:open="moreOpen" align="end">
|
||||
<template #trigger="{ toggle }">
|
||||
<UiButton
|
||||
variant="ghost"
|
||||
size="md"
|
||||
aria-label="عملیات بیشتر"
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<UiIcon name="dots" :size="18" />
|
||||
</UiButton>
|
||||
</template>
|
||||
<button type="button" :disabled="!selected.size" @click="removeSelected">
|
||||
حذف انتخابشدهها
|
||||
</button>
|
||||
<button type="button" @click="load">بروزرسانی لیست</button>
|
||||
</UiDropdownMenu>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
</PageHeader>
|
||||
|
||||
<div class="crm-toolbar" @click.stop>
|
||||
<div class="search-box">
|
||||
|
||||
@@ -5,13 +5,9 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { api } from '@/lib/api';
|
||||
import type { SmsCampaignReportDto } from '@mento/shared';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiEmptyState,
|
||||
UiPageHeader,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import { MessageOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import { UiCard, UiEmptyState } from '@/components/ui';
|
||||
import { formatClockFa, formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
|
||||
|
||||
const route = useRoute();
|
||||
@@ -74,23 +70,19 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
:title="report?.campaign.name || 'گزارش کمپین'"
|
||||
description="آمار ارسال و کلیک لینکهای ردیابیشده"
|
||||
subtitle="آمار ارسال و کلیک لینکهای ردیابیشده"
|
||||
:icon="MessageOutlined"
|
||||
:back-to="{ name: 'sms-campaigns' }"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton
|
||||
variant="secondary"
|
||||
@click="router.push({ name: 'sms-campaigns' })"
|
||||
>
|
||||
بازگشت
|
||||
</UiButton>
|
||||
<UiButton variant="secondary" :disabled="loading" @click="load">
|
||||
<UiIcon name="refresh" />
|
||||
<a-button :disabled="loading" @click="load">
|
||||
<template #icon><ReloadOutlined /></template>
|
||||
بروزرسانی
|
||||
</UiButton>
|
||||
</a-button>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="loading" class="muted">در حال بارگذاری…</p>
|
||||
|
||||
@@ -12,6 +12,8 @@ import type {
|
||||
UpdateTahesabConnectionRequest,
|
||||
} from '@mento/shared';
|
||||
import { brand } from '@mento/shared';
|
||||
import { DollarOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import { formatJalaliDateTime, toFaDigits } from '@/lib/jalali';
|
||||
import {
|
||||
UiBadge,
|
||||
@@ -20,7 +22,6 @@ import {
|
||||
UiCard,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiPagination,
|
||||
UiSelect,
|
||||
} from '@/components/ui';
|
||||
@@ -871,9 +872,10 @@ onMounted(load);
|
||||
|
||||
<template>
|
||||
<section class="crm-page tahesab-page" dir="rtl">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
title="اتصال نرمافزار مالی تهحساب"
|
||||
description="همگامسازی اشخاص، ماندهحسابها و اسناد مالی بین تهحساب و نرمافزار مدیریت ارتباط با مشتریان"
|
||||
subtitle="همگامسازی اشخاص، ماندهحسابها و اسناد مالی بین تهحساب و نرمافزار مدیریت ارتباط با مشتریان"
|
||||
:icon="DollarOutlined"
|
||||
/>
|
||||
|
||||
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
||||
|
||||
@@ -9,15 +9,16 @@ import type {
|
||||
VoipCallLogDto,
|
||||
VoipConnectionDto,
|
||||
} from '@mento/shared';
|
||||
import { LinkOutlined, PhoneOutlined, ReloadOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import type { PageHeaderTab } from '@/components/page';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiEmptyState,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import { formatJalaliNumeric, rewriteGregorianDates, toFaDigits } from '@/lib/jalali';
|
||||
|
||||
type TabKey = 'generic' | 'daftareshoma';
|
||||
@@ -29,6 +30,15 @@ const ok = ref('');
|
||||
const items = ref<VoipConnectionDto[]>([]);
|
||||
const calls = ref<VoipCallLogDto[]>([]);
|
||||
const tab = ref<TabKey>('daftareshoma');
|
||||
const voipTabs: PageHeaderTab[] = [
|
||||
{ key: 'daftareshoma', label: 'دفتر شما', icon: PhoneOutlined },
|
||||
{ key: 'generic', label: 'وبهوک عمومی', icon: LinkOutlined },
|
||||
];
|
||||
|
||||
function onVoipTab(key: string | number | undefined) {
|
||||
const next = String(key ?? '');
|
||||
if (next === 'generic' || next === 'daftareshoma') tab.value = next;
|
||||
}
|
||||
const callFilters = reactive({
|
||||
direction: '',
|
||||
status: '',
|
||||
@@ -268,34 +278,21 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
title="تلفن سازمانی"
|
||||
description="ثبت خودکار تماس، خلاصه گفتگو و اعلان تماس ورودی"
|
||||
subtitle="ثبت خودکار تماس، خلاصه گفتگو و اعلان تماس ورودی"
|
||||
:icon="PhoneOutlined"
|
||||
:tabs="voipTabs"
|
||||
:active-tab="tab"
|
||||
@update:active-tab="onVoipTab"
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton variant="secondary" :disabled="loading" @click="load">
|
||||
<UiIcon name="refresh" />
|
||||
<a-button :disabled="loading" @click="load">
|
||||
<template #icon><ReloadOutlined /></template>
|
||||
بروزرسانی
|
||||
</UiButton>
|
||||
</a-button>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
|
||||
<nav class="tabs" aria-label="نوع اتصال تلفن">
|
||||
<button
|
||||
type="button"
|
||||
:class="{ on: tab === 'daftareshoma' }"
|
||||
@click="tab = 'daftareshoma'"
|
||||
>
|
||||
دفتر شما
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="{ on: tab === 'generic' }"
|
||||
@click="tab = 'generic'"
|
||||
>
|
||||
وبهوک عمومی
|
||||
</button>
|
||||
</nav>
|
||||
</PageHeader>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="ok" class="ok">{{ ok }}</p>
|
||||
@@ -567,28 +564,6 @@ onMounted(async () => {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
gap: 1.75rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
.tabs button {
|
||||
appearance: none;
|
||||
background: none;
|
||||
border: 0;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
padding: 0.55rem 0.15rem;
|
||||
color: #94a3b8;
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tabs button.on {
|
||||
color: #0d9488;
|
||||
border-bottom-color: #14b8a6;
|
||||
}
|
||||
.hint,
|
||||
.muted {
|
||||
color: #64748b;
|
||||
|
||||
@@ -5,12 +5,13 @@ import type { ActivityPriority, RoutineDto, RoutineEntityLink, SaveRoutineReques
|
||||
import { ROUTINE_ENTITY_LINK_LABELS, ROUTINE_WEEKDAY_LABELS } from '@mento/shared';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import RecurrencePicker, { type RecurrenceValue } from '@/components/routines/RecurrencePicker.vue';
|
||||
import { SyncOutlined } from '@/icons/ant-bridge';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import {
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiField,
|
||||
UiInput,
|
||||
UiPageHeader,
|
||||
UiSegmented,
|
||||
UiSelect,
|
||||
UiTextarea,
|
||||
@@ -269,9 +270,10 @@ async function save() {
|
||||
|
||||
<template>
|
||||
<div class="rform">
|
||||
<UiPageHeader
|
||||
<PageHeader
|
||||
:title="isEdit ? 'ویرایش روتین' : 'روتین جدید'"
|
||||
lead="کاری که باید بهصورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته میشود."
|
||||
subtitle="کاری که باید بهصورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته میشود."
|
||||
:icon="SyncOutlined"
|
||||
:back-to="backTo"
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
List as AList,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { FileTextOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import type { FinancialAccountDto, FinancialMovementDto } from '@mento/shared';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
@@ -33,7 +34,6 @@ import { parseMoneyNumber } from '@/lib/money';
|
||||
import { useTreasuryPageChrome } from './treasuryPageChrome';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const pageChrome = useTreasuryPageChrome();
|
||||
const account = ref<FinancialAccountDto | null>(null);
|
||||
const items = ref<FinancialMovementDto[]>([]);
|
||||
@@ -149,10 +149,6 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-space>
|
||||
<a-button type="link" @click="router.push('/finance/accounts')">بازگشت به حسابها</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="note" type="success" show-icon :message="note" />
|
||||
|
||||
@@ -184,13 +180,13 @@ onUnmounted(() => {
|
||||
<a-form layout="vertical">
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="موجودی واقعی">
|
||||
<MoneyInput addon-after="تومان" v-model="stated" :decimals="0" />
|
||||
<a-form-item label="موجودی واقعی"><MoneyInput addon-after="تومان" v-model="stated" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="علت اصلاح">
|
||||
<a-input v-model:value="reason" />
|
||||
<a-form-item label="علت اصلاح"><a-input v-model:value="reason">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { RouterLink } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
@@ -22,10 +22,12 @@ import {
|
||||
Typography,
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import { AppstoreOutlined, BankOutlined, FileTextOutlined, UserOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import type { FinancialAccountDto, FinancialAccountType, OrgUserDto } from '@mento/shared';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import { toman } from './treasury-format';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
@@ -274,71 +276,76 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="نام حساب"
|
||||
name="name"
|
||||
:rules="[{ required: true, message: 'نام حساب الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.name" />
|
||||
label="نام حساب"><a-input v-model:value="form.name">
|
||||
<template #prefix><BankOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="نوع" name="type" :rules="[{ required: true }]">
|
||||
<a-select
|
||||
v-model:value="form.type"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option value="cash" label="صندوق نقدی">صندوق نقدی</a-select-option>
|
||||
<a-select-option value="bank" label="حساب بانکی">حساب بانکی</a-select-option>
|
||||
<a-select-option value="petty" label="تنخواه">تنخواه</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="type" :rules="[{ required: true }]" label="نوع">
|
||||
<SelectWithIcon :icon="AppstoreOutlined">
|
||||
<a-select
|
||||
v-model:value="form.type"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option value="cash" label="صندوق نقدی">صندوق نقدی</a-select-option>
|
||||
<a-select-option value="bank" label="حساب بانکی">حساب بانکی</a-select-option>
|
||||
<a-select-option value="petty" label="تنخواه">تنخواه</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="form.type === 'bank'" :xs="24" :md="8">
|
||||
<a-form-item label="نام بانک" name="bankName">
|
||||
<a-input v-model:value="form.bankName" />
|
||||
<a-form-item name="bankName" label="نام بانک"><a-input v-model:value="form.bankName">
|
||||
<template #prefix><BankOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="شماره یا شناسه" name="accountRef">
|
||||
<a-input v-model:value="form.accountRef" />
|
||||
<a-form-item name="accountRef" label="شماره یا شناسه"><a-input v-model:value="form.accountRef">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="مسئول">
|
||||
<a-select
|
||||
v-model:value="responsibleKey"
|
||||
show-search
|
||||
allow-clear
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب کاربر"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="user in responsibleOptions"
|
||||
:key="user.id"
|
||||
:value="user.id"
|
||||
:label="user.fullName"
|
||||
<SelectWithIcon :icon="UserOutlined">
|
||||
<a-select
|
||||
v-model:value="responsibleKey"
|
||||
show-search
|
||||
allow-clear
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب کاربر"
|
||||
>
|
||||
{{ user.fullName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select-option
|
||||
v-for="user in responsibleOptions"
|
||||
:key="user.id"
|
||||
:value="user.id"
|
||||
:label="user.fullName"
|
||||
>
|
||||
{{ user.fullName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="موجودی اولیه" name="openingBalance">
|
||||
<MoneyInput addon-after="تومان" v-model="form.openingBalance" :decimals="0" />
|
||||
<a-form-item name="openingBalance" label="موجودی اولیه"><MoneyInput addon-after="تومان" v-model="form.openingBalance" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="تاریخ شروع" name="openingDate">
|
||||
<JalaliDateInput v-model="form.openingDate" />
|
||||
<a-form-item name="openingDate" label="تاریخ شروع"><JalaliDateInput v-model="form.openingDate" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-input v-model:value="form.notes" />
|
||||
<a-form-item name="notes" label="توضیحات"><a-input v-model:value="form.notes">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -359,66 +366,67 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="از حساب"
|
||||
name="fromAccountId"
|
||||
:rules="[{ required: true, message: 'حساب مبدأ الزامی است' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="transfer.fromAccountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in active"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
label="از حساب">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
v-model:value="transfer.fromAccountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select-option
|
||||
v-for="account in active"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="به حساب"
|
||||
name="toAccountId"
|
||||
:rules="[{ required: true, message: 'حساب مقصد الزامی است' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="transfer.toAccountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in active"
|
||||
:key="`to-${account.id}`"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
label="به حساب">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
v-model:value="transfer.toAccountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select-option
|
||||
v-for="account in active"
|
||||
:key="`to-${account.id}`"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="transfer.amount" :decimals="0" />
|
||||
label="مبلغ"><MoneyInput addon-after="تومان" v-model="transfer.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="شرح" name="memo">
|
||||
<a-input v-model:value="transfer.memo" />
|
||||
<a-form-item name="memo" label="شرح"><a-input v-model:value="transfer.memo">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
@@ -21,8 +21,10 @@ import {
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { AppstoreOutlined, FileTextOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import type { FinancialCategoryDto } from '@mento/shared';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
import { useTreasuryMobile } from './useTreasuryMobile';
|
||||
@@ -150,19 +152,21 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="نام"
|
||||
name="name"
|
||||
:rules="[{ required: true, message: 'نام الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.name" />
|
||||
label="نام"><a-input v-model:value="form.name">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="نوع" name="kind" :rules="[{ required: true }]">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.kind" style="width: 100%">
|
||||
<a-select-option value="income" label="درآمد">درآمد</a-select-option>
|
||||
<a-select-option value="expense" label="هزینه">هزینه</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="kind" :rules="[{ required: true }]" label="نوع">
|
||||
<SelectWithIcon :icon="AppstoreOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.kind" style="width: 100%">
|
||||
<a-select-option value="income" label="درآمد">درآمد</a-select-option>
|
||||
<a-select-option value="expense" label="هزینه">هزینه</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="4">
|
||||
@@ -258,7 +262,9 @@ onMounted(() => {
|
||||
>
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="نام" required>
|
||||
<a-input v-model:value="edit.name" />
|
||||
<a-input v-model:value="edit.name">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="فعال در فرمها">
|
||||
<a-switch v-model:checked="edit.isActive" />
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
<script setup lang="ts">
|
||||
import { computed, h, onMounted, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Avatar as AAvatar,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
Flex as AFlex,
|
||||
Form as AForm,
|
||||
FormItem as AFormItem,
|
||||
Grid,
|
||||
Input as AInput,
|
||||
Row as ARow,
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
message,
|
||||
theme,
|
||||
type FormInstance,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
ArrowUpOutlined,
|
||||
BankOutlined,
|
||||
CheckOutlined,
|
||||
ClockCircleOutlined,
|
||||
CreditCardOutlined,
|
||||
FileTextOutlined,
|
||||
InfoCircleOutlined,
|
||||
TagOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatLocalDateInput } from '@/lib/jalali';
|
||||
import type {
|
||||
@@ -23,10 +39,12 @@ import type {
|
||||
FinancialCategoryDto,
|
||||
FinancialDocumentDto,
|
||||
FinancialPartyKind,
|
||||
TreasuryDashboardDto,
|
||||
TreasuryPartyBalanceDto,
|
||||
} from '@mento/shared';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue';
|
||||
import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue';
|
||||
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
|
||||
@@ -37,36 +55,59 @@ import {
|
||||
type TreasuryPendingPhoto,
|
||||
} from '@/lib/treasury-doc-photos';
|
||||
import { accountBalanceTone, partyNetPosition, toman } from './treasury-format';
|
||||
import { useTreasuryMobile } from './useTreasuryMobile';
|
||||
import { parseMoneyNumber } from '@/lib/money';
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
const ASelectOption = ASelect.Option;
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
const screens = Grid.useBreakpoint();
|
||||
const isMobile = computed(() => !screens.value.md);
|
||||
|
||||
const isMobile = useTreasuryMobile();
|
||||
const kind = 'expense' as const;
|
||||
const rows = ref<FinancialDocumentDto[]>([]);
|
||||
const balances = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const receivableBalances = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const categories = ref<FinancialCategoryDto[]>([]);
|
||||
const accounts = ref<FinancialAccountDto[]>([]);
|
||||
const dashboard = ref<TreasuryDashboardDto | null>(null);
|
||||
const error = ref('');
|
||||
const ok = ref('');
|
||||
const saving = ref(false);
|
||||
const pendingPhotos = ref<TreasuryPendingPhoto[]>([]);
|
||||
const q = ref('');
|
||||
const form = ref({
|
||||
title: '',
|
||||
amount: '',
|
||||
categoryId: '',
|
||||
partyKind: undefined as FinancialPartyKind | undefined,
|
||||
partyId: undefined as string | undefined,
|
||||
accountId: '',
|
||||
settleAmount: '',
|
||||
method: 'transfer',
|
||||
notes: '',
|
||||
bookedAt: formatLocalDateInput(new Date()),
|
||||
});
|
||||
const formTab = ref<'main' | 'extra'>('main');
|
||||
const mobileFormRef = ref<FormInstance>();
|
||||
|
||||
const formTabOptions = [
|
||||
{
|
||||
value: 'main',
|
||||
payload: 'main',
|
||||
label: h('span', {}, [h(InfoCircleOutlined), ' اطلاعات اصلی']),
|
||||
},
|
||||
{
|
||||
value: 'extra',
|
||||
payload: 'extra',
|
||||
label: h('span', {}, [h(FileTextOutlined), ' جزئیات تکمیلی']),
|
||||
},
|
||||
];
|
||||
|
||||
function emptyForm() {
|
||||
return {
|
||||
title: '',
|
||||
amount: '',
|
||||
categoryId: undefined as string | undefined,
|
||||
partyKind: undefined as FinancialPartyKind | undefined,
|
||||
partyId: undefined as string | undefined,
|
||||
accountId: undefined as string | undefined,
|
||||
settleAmount: '',
|
||||
method: 'transfer',
|
||||
notes: '',
|
||||
bookedAt: formatLocalDateInput(new Date()),
|
||||
};
|
||||
}
|
||||
|
||||
const form = ref(emptyForm());
|
||||
const settleMirror = useSettleDefault(form);
|
||||
|
||||
const settleLabel = 'مبلغ پرداختشده';
|
||||
@@ -91,6 +132,69 @@ const methodOptions = [
|
||||
{ value: 'other', label: 'سایر' },
|
||||
];
|
||||
|
||||
const partyRules = [
|
||||
{
|
||||
validator: async () => {
|
||||
if (!form.value.partyKind) throw new Error('طرف حساب الزامی است');
|
||||
if (isSettlement.value && form.value.partyKind === 'other') {
|
||||
throw new Error('برای پرداخت، طرف حساب واقعی لازم است');
|
||||
}
|
||||
if (form.value.partyKind !== 'other' && !form.value.partyId) {
|
||||
throw new Error('طرف حساب را انتخاب کنید');
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const accountRules = [
|
||||
{
|
||||
validator: async () => {
|
||||
const settled = parseMoneyNumber(String(form.value.settleAmount ?? ''), 0) ?? 0;
|
||||
if ((isSettlement.value || settled > 0) && !form.value.accountId) {
|
||||
throw new Error('حساب را انتخاب کنید');
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const partyPosition = computed(() => {
|
||||
const partyKind = form.value.partyKind;
|
||||
const id = form.value.partyId;
|
||||
if (!partyKind || partyKind === 'other' || !id) return null;
|
||||
const key = `${partyKind}:${id}`;
|
||||
const receivable = Number(receivableBalances.value.find((item) => item.key === key)?.remaining || 0);
|
||||
const payable = Number(balances.value.find((item) => item.key === key)?.remaining || 0);
|
||||
return partyNetPosition(receivable, payable);
|
||||
});
|
||||
|
||||
const selectedAccountBalance = computed(() => {
|
||||
const id = form.value.accountId;
|
||||
if (!id) return null;
|
||||
const account = accounts.value.find((row) => row.id === id);
|
||||
if (!account) return null;
|
||||
return accountBalanceTone(account.balance);
|
||||
});
|
||||
|
||||
watch(entryMode, () => {
|
||||
settleMirror.reset();
|
||||
form.value.amount = '';
|
||||
form.value.settleAmount = '';
|
||||
if (isSettlement.value && form.value.partyKind === 'other') {
|
||||
form.value.partyKind = undefined;
|
||||
form.value.partyId = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
const remainingAmount = computed(() => {
|
||||
const total = parseMoneyNumber(String(form.value.amount ?? ''), 0) ?? 0;
|
||||
const settled = parseMoneyNumber(String(form.value.settleAmount ?? ''), 0) ?? 0;
|
||||
return Math.max(0, total - settled);
|
||||
});
|
||||
|
||||
function onFinishFailed() {
|
||||
message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
|
||||
}
|
||||
|
||||
function apiMessage(e: unknown) {
|
||||
if (!axios.isAxiosError(e)) return 'ذخیره ناموفق بود.';
|
||||
const msg = (e.response?.data as { message?: string | string[] })?.message;
|
||||
@@ -98,7 +202,7 @@ function apiMessage(e: unknown) {
|
||||
}
|
||||
|
||||
async function load() {
|
||||
const [docs, cats, acc, bals, receivables] = await Promise.all([
|
||||
const [docs, cats, acc, bals, receivables, dash] = await Promise.all([
|
||||
api.get<FinancialDocumentDto[]>('/treasury/documents', { params: { kind, q: q.value || undefined } }),
|
||||
api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => {
|
||||
if (axios.isAxiosError(e) && (e.response?.status === 403 || e.response?.status === 404)) {
|
||||
@@ -120,16 +224,34 @@ async function load() {
|
||||
if (axios.isAxiosError(e) && e.response?.status === 404) return { data: [] as TreasuryPartyBalanceDto[] };
|
||||
throw e;
|
||||
}),
|
||||
api.get<TreasuryDashboardDto>('/treasury/dashboard').catch(() => ({ data: null })),
|
||||
]);
|
||||
rows.value = docs.data;
|
||||
balances.value = bals.data;
|
||||
receivableBalances.value = receivables.data;
|
||||
categories.value = cats.data.filter((row) => row.isActive);
|
||||
accounts.value = acc.data.filter((row) => row.isActive);
|
||||
dashboard.value = dash.data;
|
||||
}
|
||||
|
||||
function onFinishFailed() {
|
||||
message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
|
||||
function resetForm() {
|
||||
settleMirror.reset();
|
||||
form.value = emptyForm();
|
||||
pendingPhotos.value = [];
|
||||
formTab.value = 'main';
|
||||
error.value = '';
|
||||
ok.value = '';
|
||||
}
|
||||
|
||||
async function submitMobileForm() {
|
||||
try {
|
||||
await mobileFormRef.value?.validate();
|
||||
} catch {
|
||||
formTab.value = 'main';
|
||||
message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
|
||||
return;
|
||||
}
|
||||
await createDoc();
|
||||
}
|
||||
|
||||
async function createDoc() {
|
||||
@@ -202,20 +324,7 @@ async function createDoc() {
|
||||
error.value = apiMessage(e);
|
||||
}
|
||||
}
|
||||
settleMirror.reset();
|
||||
pendingPhotos.value = [];
|
||||
form.value = {
|
||||
title: '',
|
||||
amount: '',
|
||||
categoryId: '',
|
||||
partyKind: undefined,
|
||||
partyId: undefined,
|
||||
accountId: '',
|
||||
settleAmount: '',
|
||||
method: 'transfer',
|
||||
notes: '',
|
||||
bookedAt: formatLocalDateInput(new Date()),
|
||||
};
|
||||
resetForm();
|
||||
const base = collectsBalance
|
||||
? `${toman(settleAmount)} از ماندهٔ طرف حساب کم شد.`
|
||||
: data.reference
|
||||
@@ -230,65 +339,6 @@ async function createDoc() {
|
||||
}
|
||||
}
|
||||
|
||||
const partyRules = [
|
||||
{
|
||||
validator: async () => {
|
||||
if (!form.value.partyKind) throw new Error('طرف حساب الزامی است');
|
||||
if (isSettlement.value && form.value.partyKind === 'other') {
|
||||
throw new Error('برای پرداخت، طرف حساب واقعی لازم است');
|
||||
}
|
||||
if (form.value.partyKind !== 'other' && !form.value.partyId) {
|
||||
throw new Error('طرف حساب را انتخاب کنید');
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const accountRules = [
|
||||
{
|
||||
validator: async () => {
|
||||
const settled = parseMoneyNumber(String(form.value.settleAmount ?? ''), 0) ?? 0;
|
||||
if ((isSettlement.value || settled > 0) && !form.value.accountId) {
|
||||
throw new Error('حساب را انتخاب کنید');
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const remainingAmount = computed(() => {
|
||||
const total = parseMoneyNumber(String(form.value.amount ?? ''), 0) ?? 0;
|
||||
const settled = parseMoneyNumber(String(form.value.settleAmount ?? ''), 0) ?? 0;
|
||||
return Math.max(0, total - settled);
|
||||
});
|
||||
|
||||
watch(entryMode, () => {
|
||||
settleMirror.reset();
|
||||
form.value.amount = '';
|
||||
form.value.settleAmount = '';
|
||||
if (isSettlement.value && form.value.partyKind === 'other') {
|
||||
form.value.partyKind = undefined;
|
||||
form.value.partyId = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
const partyPosition = computed(() => {
|
||||
const partyKind = form.value.partyKind;
|
||||
const id = form.value.partyId;
|
||||
if (!partyKind || partyKind === 'other' || !id) return null;
|
||||
const key = `${partyKind}:${id}`;
|
||||
const receivable = Number(receivableBalances.value.find((item) => item.key === key)?.remaining || 0);
|
||||
const payable = Number(balances.value.find((item) => item.key === key)?.remaining || 0);
|
||||
return partyNetPosition(receivable, payable);
|
||||
});
|
||||
|
||||
const selectedAccountBalance = computed(() => {
|
||||
const id = form.value.accountId;
|
||||
if (!id) return null;
|
||||
const account = accounts.value.find((row) => row.id === id);
|
||||
if (!account) return null;
|
||||
return accountBalanceTone(account.balance);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
void load().catch(() => {
|
||||
error.value = 'بارگذاری ناموفق بود.';
|
||||
@@ -297,166 +347,491 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||
<div
|
||||
:style="
|
||||
isMobile
|
||||
? { paddingBottom: 'calc(96px + var(--mobile-tabbar-h, 3.65rem))' }
|
||||
: undefined
|
||||
"
|
||||
>
|
||||
<template v-if="isMobile">
|
||||
<a-flex vertical :gap="token.margin">
|
||||
<a-row :gutter="[12, 12]">
|
||||
<a-col :span="12">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
background: token.colorPrimaryBg,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
boxShadow: token.boxShadow,
|
||||
}"
|
||||
>
|
||||
<a-flex align="center" justify="space-between" :gap="8">
|
||||
<div :style="{ minWidth: 0, flex: 1 }">
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
پرداختهای این ماه
|
||||
</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong :style="{ fontSize: '15px', color: token.colorPrimary }">
|
||||
{{ toman(dashboard?.actualPayments) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
<a-avatar
|
||||
:size="36"
|
||||
:style="{
|
||||
background: token.colorPrimary,
|
||||
color: token.colorTextLightSolid,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><ArrowUpOutlined /></template>
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
background: token.colorPrimaryBg,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
boxShadow: token.boxShadow,
|
||||
}"
|
||||
>
|
||||
<a-flex align="center" justify="space-between" :gap="8">
|
||||
<div :style="{ minWidth: 0, flex: 1 }">
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
در انتظار پرداخت
|
||||
</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong :style="{ fontSize: '15px', color: token.colorPrimary }">
|
||||
{{ toman(dashboard?.payables) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
<a-avatar
|
||||
:size="36"
|
||||
:style="{
|
||||
background: token.colorPrimary,
|
||||
color: token.colorTextLightSolid,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><ClockCircleOutlined /></template>
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-card :bordered="false" title="سند جدید">
|
||||
<template #extra>
|
||||
<a-segmented v-model:value="entryMode" :options="entryOptions" />
|
||||
</template>
|
||||
<a-form
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
@finish="createDoc"
|
||||
@finishFailed="onFinishFailed"
|
||||
>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-segmented v-model:value="entryMode" block :options="entryOptions" />
|
||||
<a-segmented
|
||||
v-model:value="formTab"
|
||||
block
|
||||
:options="formTabOptions"
|
||||
:style="{ background: token.colorFillTertiary }"
|
||||
/>
|
||||
|
||||
<a-card :bordered="false">
|
||||
<a-form ref="mobileFormRef" layout="vertical" :model="form" @finish="createDoc">
|
||||
<div v-show="formTab === 'main'">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="form.title"
|
||||
placeholder="مثلاً: پرداخت قسط پروژه الف"
|
||||
>
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item name="method" label="روش پرداخت">
|
||||
<SelectWithIcon :icon="CreditCardOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option
|
||||
v-for="opt in methodOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
:label="opt.label"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-if="!isSettlement" name="categoryId" label="دستهبندی هزینه">
|
||||
<SelectWithIcon :icon="TagOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
placeholder="انتخاب دسته"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
|
||||
<a-row :gutter="[12, 0]">
|
||||
<a-col v-if="!isSettlement" :span="12">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" placeholder="۰" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
<a-col :span="isSettlement ? 24 : 12">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
placeholder="۰"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مانده این سند">
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
:model-value="remainingAmount"
|
||||
:decimals="0"
|
||||
disabled
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="دستهبندی" name="categoryId">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="بدون دسته"
|
||||
<a-flex
|
||||
v-if="!isSettlement"
|
||||
align="center"
|
||||
justify="space-between"
|
||||
:style="{
|
||||
background: token.colorSuccessBg,
|
||||
borderRadius: `${token.borderRadiusLG * 2}px`,
|
||||
padding: `${token.paddingSM}px ${token.padding}px`,
|
||||
marginBottom: `${token.margin}px`,
|
||||
}"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="accountId" :rules="accountRules">
|
||||
<template #label>
|
||||
<a-flex align="center" justify="space-between" gap="small" style="width: 100%">
|
||||
<span>حساب</span>
|
||||
<a-space :size="8">
|
||||
<span
|
||||
:style="{
|
||||
width: '8px',
|
||||
height: '8px',
|
||||
borderRadius: '50%',
|
||||
background: token.colorSuccess,
|
||||
display: 'inline-block',
|
||||
}"
|
||||
/>
|
||||
<a-typography-text type="secondary">مانده این سند</a-typography-text>
|
||||
</a-space>
|
||||
<a-typography-text strong :style="{ color: token.colorSuccess }">
|
||||
{{ toman(remainingAmount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
|
||||
<a-row :gutter="[12, 0]">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="تاریخ پرداخت" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item name="accountId" :rules="accountRules" label="حساب مبدأ">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
placeholder="انتخاب حساب"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
<a-typography-text
|
||||
v-if="selectedAccountBalance"
|
||||
:type="selectedAccountBalance.type"
|
||||
:style="{ fontSize: '12px' }"
|
||||
>
|
||||
{{ selectedAccountBalance.text }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
<a-select-option v-for="account in accounts" :key="account.id" :value="account.id" :label="account.name">
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
|
||||
<div v-show="formTab === 'extra'">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-textarea
|
||||
v-model:value="form.notes"
|
||||
:rows="4"
|
||||
placeholder="توضیحات اختیاری…"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" title="مانده پرداختنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="پرداختشده" />
|
||||
</a-card>
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
|
||||
<div
|
||||
:style="{
|
||||
position: 'fixed',
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 'var(--mobile-tabbar-h, 3.65rem)',
|
||||
zIndex: 90,
|
||||
background: token.colorBgElevated,
|
||||
borderTop: `1px solid ${token.colorBorderSecondary}`,
|
||||
padding: `${token.paddingSM}px ${token.padding}px`,
|
||||
boxShadow: token.boxShadowSecondary,
|
||||
}"
|
||||
>
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="8">
|
||||
<a-button block @click="resetForm">انصراف</a-button>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="روش" name="method">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option v-for="opt in methodOptions" :key="opt.value" :value="opt.value" :label="opt.label">
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="تاریخ" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-input v-model:value="form.notes" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
<a-col :span="16">
|
||||
<a-button type="primary" block :loading="saving" @click="submitMobileForm">
|
||||
<template #icon><CheckOutlined /></template>
|
||||
{{ isSettlement ? 'ثبت پرداخت' : 'ثبت هزینه' }}
|
||||
</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" :block="isMobile" :loading="saving">ثبت</a-button>
|
||||
</a-space>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<a-card :bordered="false" title="مانده پرداختنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="پرداختشده" />
|
||||
</a-card>
|
||||
<a-flex v-else vertical :gap="16">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-card :bordered="false" title="سند جدید">
|
||||
<template #extra>
|
||||
<a-segmented v-model:value="entryMode" :options="entryOptions" />
|
||||
</template>
|
||||
<a-form
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
@finish="createDoc"
|
||||
@finishFailed="onFinishFailed"
|
||||
>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مانده این سند">
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
:model-value="remainingAmount"
|
||||
:decimals="0"
|
||||
disabled
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="categoryId" label="دستهبندی">
|
||||
<SelectWithIcon :icon="TagOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="بدون دسته"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="accountId" :rules="accountRules">
|
||||
<template #label>
|
||||
<a-flex align="center" justify="space-between" gap="small" style="width: 100%">
|
||||
<span>حساب</span>
|
||||
<a-typography-text
|
||||
v-if="selectedAccountBalance"
|
||||
:type="selectedAccountBalance.type"
|
||||
>
|
||||
{{ selectedAccountBalance.text }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="method" label="روش">
|
||||
<SelectWithIcon :icon="CreditCardOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option
|
||||
v-for="opt in methodOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
:label="opt.label"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="تاریخ" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-input v-model:value="form.notes">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" :loading="saving">ثبت</a-button>
|
||||
</a-space>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" title="مانده پرداختنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="پرداختشده" />
|
||||
</a-card>
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
<script setup lang="ts">
|
||||
import { computed, h, onMounted, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Avatar as AAvatar,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Col as ACol,
|
||||
@@ -14,9 +15,23 @@ import {
|
||||
Row as ARow,
|
||||
Segmented as ASegmented,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Textarea as ATextarea,
|
||||
Typography,
|
||||
message,
|
||||
theme,
|
||||
type FormInstance,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
ArrowDownOutlined,
|
||||
BankOutlined,
|
||||
CheckOutlined,
|
||||
ClockCircleOutlined,
|
||||
CreditCardOutlined,
|
||||
FileTextOutlined,
|
||||
InfoCircleOutlined,
|
||||
TagOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import { formatLocalDateInput } from '@/lib/jalali';
|
||||
import type {
|
||||
@@ -24,10 +39,12 @@ import type {
|
||||
FinancialCategoryDto,
|
||||
FinancialDocumentDto,
|
||||
FinancialPartyKind,
|
||||
TreasuryDashboardDto,
|
||||
TreasuryPartyBalanceDto,
|
||||
} from '@mento/shared';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue';
|
||||
import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue';
|
||||
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
|
||||
@@ -42,6 +59,8 @@ import { parseMoneyNumber } from '@/lib/money';
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
const ASelectOption = ASelect.Option;
|
||||
const { useToken } = theme;
|
||||
const { token } = useToken();
|
||||
const screens = Grid.useBreakpoint();
|
||||
const isMobile = computed(() => !screens.value.md);
|
||||
|
||||
@@ -51,11 +70,27 @@ const balances = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const payableBalances = ref<TreasuryPartyBalanceDto[]>([]);
|
||||
const categories = ref<FinancialCategoryDto[]>([]);
|
||||
const accounts = ref<FinancialAccountDto[]>([]);
|
||||
const dashboard = ref<TreasuryDashboardDto | null>(null);
|
||||
const error = ref('');
|
||||
const ok = ref('');
|
||||
const saving = ref(false);
|
||||
const pendingPhotos = ref<TreasuryPendingPhoto[]>([]);
|
||||
const q = ref('');
|
||||
const formTab = ref<'main' | 'extra'>('main');
|
||||
const mobileFormRef = ref<FormInstance>();
|
||||
|
||||
const formTabOptions = [
|
||||
{
|
||||
value: 'main',
|
||||
payload: 'main',
|
||||
label: h('span', {}, [h(InfoCircleOutlined), ' اطلاعات اصلی']),
|
||||
},
|
||||
{
|
||||
value: 'extra',
|
||||
payload: 'extra',
|
||||
label: h('span', {}, [h(FileTextOutlined), ' جزئیات تکمیلی']),
|
||||
},
|
||||
];
|
||||
|
||||
function emptyForm() {
|
||||
return {
|
||||
@@ -167,7 +202,7 @@ function apiMessage(e: unknown) {
|
||||
}
|
||||
|
||||
async function load() {
|
||||
const [docs, cats, acc, bals, payables] = await Promise.all([
|
||||
const [docs, cats, acc, bals, payables, dash] = await Promise.all([
|
||||
api.get<FinancialDocumentDto[]>('/treasury/documents', { params: { kind, q: q.value || undefined } }),
|
||||
api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => {
|
||||
if (axios.isAxiosError(e) && (e.response?.status === 403 || e.response?.status === 404)) {
|
||||
@@ -189,22 +224,36 @@ async function load() {
|
||||
if (axios.isAxiosError(e) && e.response?.status === 404) return { data: [] as TreasuryPartyBalanceDto[] };
|
||||
throw e;
|
||||
}),
|
||||
api.get<TreasuryDashboardDto>('/treasury/dashboard').catch(() => ({ data: null })),
|
||||
]);
|
||||
rows.value = docs.data;
|
||||
balances.value = bals.data;
|
||||
payableBalances.value = payables.data;
|
||||
categories.value = cats.data.filter((row) => row.isActive);
|
||||
accounts.value = acc.data.filter((row) => row.isActive);
|
||||
dashboard.value = dash.data;
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
settleMirror.reset();
|
||||
form.value = emptyForm();
|
||||
pendingPhotos.value = [];
|
||||
formTab.value = 'main';
|
||||
error.value = '';
|
||||
ok.value = '';
|
||||
}
|
||||
|
||||
async function submitMobileForm() {
|
||||
try {
|
||||
await mobileFormRef.value?.validate();
|
||||
} catch {
|
||||
formTab.value = 'main';
|
||||
message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
|
||||
return;
|
||||
}
|
||||
await createDoc();
|
||||
}
|
||||
|
||||
async function createDoc() {
|
||||
saving.value = true;
|
||||
error.value = '';
|
||||
@@ -298,176 +347,491 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||
<div
|
||||
:style="
|
||||
isMobile
|
||||
? { paddingBottom: 'calc(96px + var(--mobile-tabbar-h, 3.65rem))' }
|
||||
: undefined
|
||||
"
|
||||
>
|
||||
<template v-if="isMobile">
|
||||
<a-flex vertical :gap="token.margin">
|
||||
<a-row :gutter="[12, 12]">
|
||||
<a-col :span="12">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
background: token.colorPrimaryBg,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
boxShadow: token.boxShadow,
|
||||
}"
|
||||
>
|
||||
<a-flex align="center" justify="space-between" :gap="8">
|
||||
<div :style="{ minWidth: 0, flex: 1 }">
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
دریافتهای این ماه
|
||||
</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong :style="{ fontSize: '15px', color: token.colorPrimary }">
|
||||
{{ toman(dashboard?.actualReceipts) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
<a-avatar
|
||||
:size="36"
|
||||
:style="{
|
||||
background: token.colorPrimary,
|
||||
color: token.colorTextLightSolid,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><ArrowDownOutlined /></template>
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-card
|
||||
:bordered="false"
|
||||
:body-style="{ padding: `${token.paddingSM}px` }"
|
||||
:style="{
|
||||
background: token.colorPrimaryBg,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
boxShadow: token.boxShadow,
|
||||
}"
|
||||
>
|
||||
<a-flex align="center" justify="space-between" :gap="8">
|
||||
<div :style="{ minWidth: 0, flex: 1 }">
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
در انتظار دریافت
|
||||
</a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong :style="{ fontSize: '15px', color: token.colorPrimary }">
|
||||
{{ toman(dashboard?.receivables) }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
<a-avatar
|
||||
:size="36"
|
||||
:style="{
|
||||
background: token.colorPrimary,
|
||||
color: token.colorTextLightSolid,
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<template #icon><ClockCircleOutlined /></template>
|
||||
</a-avatar>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-card :bordered="false" title="سند جدید">
|
||||
<template #extra>
|
||||
<a-segmented v-model:value="entryMode" :options="entryOptions" />
|
||||
</template>
|
||||
<a-form
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
@finish="createDoc"
|
||||
@finishFailed="onFinishFailed"
|
||||
>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
|
||||
<a-segmented v-model:value="entryMode" block :options="entryOptions" />
|
||||
<a-segmented
|
||||
v-model:value="formTab"
|
||||
block
|
||||
:options="formTabOptions"
|
||||
:style="{ background: token.colorFillTertiary }"
|
||||
/>
|
||||
|
||||
<a-card :bordered="false">
|
||||
<a-form ref="mobileFormRef" layout="vertical" :model="form" @finish="createDoc">
|
||||
<div v-show="formTab === 'main'">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="form.title"
|
||||
placeholder="مثلاً: دریافت قسط پروژه الف"
|
||||
>
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item name="method" label="روش دریافت">
|
||||
<SelectWithIcon :icon="CreditCardOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option
|
||||
v-for="opt in methodOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
:label="opt.label"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-if="!isSettlement" name="categoryId" label="دستهبندی درآمد">
|
||||
<SelectWithIcon :icon="TagOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
placeholder="انتخاب دسته"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
|
||||
<a-row :gutter="[12, 0]">
|
||||
<a-col v-if="!isSettlement" :span="12">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" placeholder="۰" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
<a-col :span="isSettlement ? 24 : 12">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
placeholder="۰"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مانده این سند">
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
:model-value="remainingAmount"
|
||||
:decimals="0"
|
||||
disabled
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="دستهبندی" name="categoryId">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="بدون دسته"
|
||||
<a-flex
|
||||
v-if="!isSettlement"
|
||||
align="center"
|
||||
justify="space-between"
|
||||
:style="{
|
||||
background: token.colorSuccessBg,
|
||||
borderRadius: `${token.borderRadiusLG * 2}px`,
|
||||
padding: `${token.paddingSM}px ${token.padding}px`,
|
||||
marginBottom: `${token.margin}px`,
|
||||
}"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="accountId" :rules="accountRules">
|
||||
<template #label>
|
||||
<a-flex align="center" justify="space-between" gap="small" style="width: 100%">
|
||||
<span>حساب</span>
|
||||
<a-space :size="8">
|
||||
<span
|
||||
:style="{
|
||||
width: '8px',
|
||||
height: '8px',
|
||||
borderRadius: '50%',
|
||||
background: token.colorSuccess,
|
||||
display: 'inline-block',
|
||||
}"
|
||||
/>
|
||||
<a-typography-text type="secondary">مانده این سند</a-typography-text>
|
||||
</a-space>
|
||||
<a-typography-text strong :style="{ color: token.colorSuccess }">
|
||||
{{ toman(remainingAmount) }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
|
||||
<a-row :gutter="[12, 0]">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="تاریخ دریافت" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item name="accountId" :rules="accountRules" label="حساب مقصد">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
placeholder="انتخاب حساب"
|
||||
style="width: 100%"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
<a-typography-text
|
||||
v-if="selectedAccountBalance"
|
||||
:type="selectedAccountBalance.type"
|
||||
:style="{ fontSize: '12px' }"
|
||||
>
|
||||
{{ selectedAccountBalance.text }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
|
||||
<div v-show="formTab === 'extra'">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-textarea
|
||||
v-model:value="form.notes"
|
||||
:rows="4"
|
||||
placeholder="توضیحات اختیاری…"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" title="مانده دریافتنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="دریافتشده" />
|
||||
</a-card>
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
|
||||
<div
|
||||
:style="{
|
||||
position: 'fixed',
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 'var(--mobile-tabbar-h, 3.65rem)',
|
||||
zIndex: 90,
|
||||
background: token.colorBgElevated,
|
||||
borderTop: `1px solid ${token.colorBorderSecondary}`,
|
||||
padding: `${token.paddingSM}px ${token.padding}px`,
|
||||
boxShadow: token.boxShadowSecondary,
|
||||
}"
|
||||
>
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="8">
|
||||
<a-button block @click="resetForm">انصراف</a-button>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="روش" name="method">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option
|
||||
v-for="opt in methodOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
:label="opt.label"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="تاریخ" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-input v-model:value="form.notes" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
<a-col :span="16">
|
||||
<a-button type="primary" block :loading="saving" @click="submitMobileForm">
|
||||
<template #icon><CheckOutlined /></template>
|
||||
{{ isSettlement ? 'ثبت دریافت' : 'ثبت درآمد' }}
|
||||
</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" :block="isMobile" :loading="saving">ثبت</a-button>
|
||||
</a-space>
|
||||
</a-form>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<a-card :bordered="false" title="مانده دریافتنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="دریافتشده" />
|
||||
</a-card>
|
||||
<a-flex v-else vertical :gap="16">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" />
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
<a-card :bordered="false" title="سند جدید">
|
||||
<template #extra>
|
||||
<a-segmented v-model:value="entryMode" :options="entryOptions" />
|
||||
</template>
|
||||
<a-form
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
@finish="createDoc"
|
||||
@finishFailed="onFinishFailed"
|
||||
>
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="طرف حساب" name="partyKind" :rules="partyRules">
|
||||
<a-row :gutter="8" align="middle">
|
||||
<a-col :span="partyPosition ? 16 : 24">
|
||||
<TreasuryPartySelect
|
||||
v-model:kind="form.partyKind"
|
||||
v-model:party-id="form.partyId"
|
||||
:allow-other="!isSettlement"
|
||||
:placeholder="isSettlement ? 'مشتری، شرکت یا کاربر' : undefined"
|
||||
/>
|
||||
</a-col>
|
||||
<a-col v-if="partyPosition" :span="8">
|
||||
<a-typography-text :type="partyPosition.type">{{ partyPosition.text }}</a-typography-text>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item
|
||||
:label="settleLabel"
|
||||
name="settleAmount"
|
||||
:rules="isSettlement ? [{ required: true, message: 'مبلغ را وارد کنید' }] : []"
|
||||
>
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
v-model="form.settleAmount"
|
||||
:decimals="0"
|
||||
:disabled="!isSettlement && form.partyKind === 'other'"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="مانده این سند">
|
||||
<MoneyInput
|
||||
addon-after="تومان"
|
||||
:model-value="remainingAmount"
|
||||
:decimals="0"
|
||||
disabled
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="categoryId" label="دستهبندی">
|
||||
<SelectWithIcon :icon="TagOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.categoryId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="بدون دسته"
|
||||
>
|
||||
<a-select-option v-for="cat in categories" :key="cat.id" :value="cat.id" :label="cat.name">
|
||||
{{ cat.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="accountId" :rules="accountRules">
|
||||
<template #label>
|
||||
<a-flex align="center" justify="space-between" gap="small" style="width: 100%">
|
||||
<span>حساب</span>
|
||||
<a-typography-text
|
||||
v-if="selectedAccountBalance"
|
||||
:type="selectedAccountBalance.type"
|
||||
>
|
||||
{{ selectedAccountBalance.text }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item name="method" label="روش">
|
||||
<SelectWithIcon :icon="CreditCardOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
|
||||
<a-select-option
|
||||
v-for="opt in methodOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
:label="opt.label"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="تاریخ" name="bookedAt">
|
||||
<JalaliDateInput v-model="form.bookedAt" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="توضیحات" name="notes">
|
||||
<a-input v-model:value="form.notes">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12" :md="8">
|
||||
<a-form-item label="عکس فاکتور / رسید">
|
||||
<TreasuryDocPhotoField v-model="pendingPhotos" :disabled="saving" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-space>
|
||||
<a-button type="primary" html-type="submit" :loading="saving">ثبت</a-button>
|
||||
</a-space>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
||||
<a-card :bordered="false" title="مانده دریافتنی">
|
||||
<TreasuryPartyBalanceTable :rows="balances" settled-label="دریافتشده" />
|
||||
</a-card>
|
||||
|
||||
<TreasuryDocumentsPanel
|
||||
v-model:q="q"
|
||||
:rows="rows"
|
||||
:categories="categories"
|
||||
:status-label="statusLabel"
|
||||
@reload="load"
|
||||
/>
|
||||
</a-flex>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import { RouterView, useRoute } from 'vue-router';
|
||||
import { Flex as AFlex, Grid, Typography, theme } from 'ant-design-vue';
|
||||
import TreasuryNav from '@/components/treasury/TreasuryNav.vue';
|
||||
import { computed, watch, type Component } from 'vue';
|
||||
import { RouterView, useRoute, useRouter } from 'vue-router';
|
||||
import { Flex as AFlex, theme } from 'ant-design-vue';
|
||||
import { treasurySectionAllowed, type TreasurySectionKey } from '@mento/shared';
|
||||
import { PageHeader } from '@/components/page';
|
||||
import type { PageHeaderTab } from '@/components/page';
|
||||
import {
|
||||
ArrowDownOutlined,
|
||||
ArrowUpOutlined,
|
||||
BankOutlined,
|
||||
BarChartOutlined,
|
||||
ClockCircleOutlined,
|
||||
DollarOutlined,
|
||||
HistoryOutlined,
|
||||
HomeOutlined,
|
||||
SyncOutlined,
|
||||
TagOutlined,
|
||||
WalletOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { provideTreasuryPageChrome } from './treasuryPageChrome';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
const { token } = theme.useToken();
|
||||
const screens = Grid.useBreakpoint();
|
||||
const isMobile = computed(() => !screens.value.md);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
const chrome = provideTreasuryPageChrome();
|
||||
|
||||
watch(
|
||||
@@ -33,29 +48,65 @@ const description = computed(
|
||||
(typeof route.meta.treasuryDescription === 'string' ? route.meta.treasuryDescription : ''),
|
||||
);
|
||||
|
||||
const headerStyle = computed(() =>
|
||||
isMobile.value
|
||||
? undefined
|
||||
: {
|
||||
minHeight: `${token.value.controlHeightLG + token.value.fontSizeLG + token.value.marginXXS}px`,
|
||||
},
|
||||
const links = computed(() => {
|
||||
const role = auth.user?.role;
|
||||
const permissions = auth.user?.permissions;
|
||||
const all: Array<{
|
||||
value: string;
|
||||
label: string;
|
||||
exact?: boolean;
|
||||
section: TreasurySectionKey;
|
||||
icon: Component;
|
||||
}> = [
|
||||
{ value: '/finance', label: 'داشبورد', exact: true, section: 'treasury_dashboard', icon: HomeOutlined },
|
||||
{ value: '/finance/incomes', label: 'دریافتها و درآمدها', section: 'treasury_incomes', icon: ArrowDownOutlined },
|
||||
{ value: '/finance/expenses', label: 'پرداختها و هزینهها', section: 'treasury_expenses', icon: ArrowUpOutlined },
|
||||
{ value: '/finance/receivables', label: 'اقساط و مطالبات', section: 'treasury_receivables', icon: ClockCircleOutlined },
|
||||
{ value: '/finance/accounts', label: 'صندوق و حسابها', section: 'treasury_accounts', icon: BankOutlined },
|
||||
{ value: '/finance/payroll', label: 'حقوق', section: 'treasury_payroll', icon: WalletOutlined },
|
||||
{ value: '/finance/recurring', label: 'تکرارشونده', section: 'treasury_recurring', icon: SyncOutlined },
|
||||
{ value: '/finance/reports', label: 'گزارش', section: 'treasury_reports', icon: BarChartOutlined },
|
||||
{ value: '/finance/audit', label: 'سوابق', section: 'treasury_audit', icon: HistoryOutlined },
|
||||
{ value: '/finance/categories', label: 'دستهبندی', section: 'treasury_categories', icon: TagOutlined },
|
||||
];
|
||||
return all.filter((link) => treasurySectionAllowed(role, permissions, link.section));
|
||||
});
|
||||
|
||||
const headerTabs = computed<PageHeaderTab[]>(() =>
|
||||
links.value.map((link) => ({ key: link.value, label: link.label, icon: link.icon })),
|
||||
);
|
||||
|
||||
const activeTab = computed(() => {
|
||||
const path = route.path;
|
||||
for (const link of links.value) {
|
||||
if (link.exact) {
|
||||
if (path === link.value) return link.value;
|
||||
} else if (path === link.value || path.startsWith(`${link.value}/`)) {
|
||||
return link.value;
|
||||
}
|
||||
}
|
||||
return '/finance';
|
||||
});
|
||||
|
||||
const backTo = computed(() => (route.name === 'finance-account' ? '/finance/accounts' : undefined));
|
||||
|
||||
function onTabChange(key: string | number | undefined) {
|
||||
const next = String(key ?? '');
|
||||
if (next && next !== route.path) void router.push(next);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="isMobile ? token.marginSM : token.margin" :style="{ width: '100%' }">
|
||||
<div :style="headerStyle">
|
||||
<a-typography-title :level="isMobile ? 4 : 3" :style="{ margin: 0 }">{{ title }}</a-typography-title>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:ellipsis="description ? { tooltip: description } : false"
|
||||
:style="{ display: 'block', margin: 0 }"
|
||||
>
|
||||
{{ description || '\u00a0' }}
|
||||
</a-typography-text>
|
||||
</div>
|
||||
|
||||
<TreasuryNav />
|
||||
<a-flex vertical :gap="token.margin" :style="{ width: '100%' }">
|
||||
<PageHeader
|
||||
:title="title"
|
||||
:subtitle="description || undefined"
|
||||
:icon="DollarOutlined"
|
||||
:tabs="headerTabs"
|
||||
:active-tab="activeTab"
|
||||
:back-to="backTo"
|
||||
@update:active-tab="onTabChange"
|
||||
/>
|
||||
|
||||
<RouterView />
|
||||
</a-flex>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
@@ -25,12 +25,22 @@ import {
|
||||
message,
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import { EditOutlined, EyeOutlined, WalletOutlined } from '@ant-design/icons-vue';
|
||||
import {
|
||||
BankOutlined,
|
||||
CalendarOutlined,
|
||||
EditOutlined,
|
||||
EyeOutlined,
|
||||
FilterOutlined,
|
||||
ScheduleOutlined,
|
||||
UserOutlined,
|
||||
WalletOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { api } from '@/lib/api';
|
||||
import type { FinancialAccountDto, OrgUserDto } from '@mento/shared';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import {
|
||||
addJalaliMonths,
|
||||
dateToJalali,
|
||||
@@ -504,25 +514,25 @@ onMounted(() => {
|
||||
<a-row :gutter="[8, 0]">
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-form-item
|
||||
label="پرسنل"
|
||||
name="userId"
|
||||
style="margin-bottom: 8px"
|
||||
:rules="[{ required: true, message: 'پرسنل الزامی است' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="form.userId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
:options="userOptions"
|
||||
/>
|
||||
label="پرسنل">
|
||||
<SelectWithIcon :icon="UserOutlined">
|
||||
<a-select
|
||||
v-model:value="form.userId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
:options="userOptions"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-form-item label="دوره" style="margin-bottom: 8px">
|
||||
<JalaliDateInput
|
||||
<a-form-item style="margin-bottom: 8px" label="دوره"><JalaliDateInput
|
||||
v-model="periodDate"
|
||||
start-view="months"
|
||||
:clearable="false"
|
||||
@@ -533,27 +543,22 @@ onMounted(() => {
|
||||
</a-col>
|
||||
<a-col :xs="12" :md="6">
|
||||
<a-form-item
|
||||
label="پایه"
|
||||
name="baseAmount"
|
||||
style="margin-bottom: 8px"
|
||||
:rules="[{ required: true, message: 'مبلغ پایه الزامی است' }]"
|
||||
>
|
||||
<MoneyInput v-model="form.baseAmount" addon-after="تومان" :decimals="0" />
|
||||
label="پایه"><MoneyInput v-model="form.baseAmount" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="12" :md="6">
|
||||
<a-form-item label="مزایا" name="benefits" style="margin-bottom: 8px">
|
||||
<MoneyInput v-model="form.benefits" addon-after="تومان" :decimals="0" />
|
||||
<a-form-item name="benefits" style="margin-bottom: 8px" label="مزایا"><MoneyInput v-model="form.benefits" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="12" :md="6">
|
||||
<a-form-item label="پاداش" name="bonus" style="margin-bottom: 8px">
|
||||
<MoneyInput v-model="form.bonus" addon-after="تومان" :decimals="0" />
|
||||
<a-form-item name="bonus" style="margin-bottom: 8px" label="پاداش"><MoneyInput v-model="form.bonus" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="12" :md="6">
|
||||
<a-form-item label="کسورات" name="deductions" style="margin-bottom: 8px">
|
||||
<MoneyInput v-model="form.deductions" addon-after="تومان" :decimals="0" />
|
||||
<a-form-item name="deductions" style="margin-bottom: 8px" label="کسورات"><MoneyInput v-model="form.deductions" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="moneyFilled(form.benefits)" :span="24">
|
||||
@@ -623,47 +628,47 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="دورهٔ حقوق"
|
||||
name="id"
|
||||
:rules="[{ required: true, message: 'دوره الزامی است' }]"
|
||||
>
|
||||
<a-select
|
||||
:value="pay.id || undefined"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
:filter-option="filterPayOption"
|
||||
style="width: 100%"
|
||||
placeholder="جستجوی نام یا دوره"
|
||||
:options="payOptions"
|
||||
@change="onPayPick"
|
||||
/>
|
||||
label="دورهٔ حقوق">
|
||||
<SelectWithIcon :icon="ScheduleOutlined">
|
||||
<a-select
|
||||
:value="pay.id || undefined"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
:filter-option="filterPayOption"
|
||||
style="width: 100%"
|
||||
placeholder="جستجوی نام یا دوره"
|
||||
:options="payOptions"
|
||||
@change="onPayPick"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="6">
|
||||
<a-form-item
|
||||
label="مبلغ این مرحله"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput v-model="pay.amount" addon-after="تومان" :decimals="0" />
|
||||
label="مبلغ این مرحله"><MoneyInput v-model="pay.amount" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="6">
|
||||
<a-form-item
|
||||
label="حساب"
|
||||
name="accountId"
|
||||
:rules="[{ required: true, message: 'حساب الزامی است' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="pay.accountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
:options="accounts.map((account) => ({ value: account.id, label: account.name }))"
|
||||
/>
|
||||
label="حساب">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
v-model:value="pay.accountId"
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
:options="accounts.map((account) => ({ value: account.id, label: account.name }))"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -744,54 +749,59 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="پرسنل">
|
||||
<a-select
|
||||
v-model:value="filterUserId"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
placeholder="همه"
|
||||
:options="userOptions"
|
||||
/>
|
||||
<SelectWithIcon :icon="UserOutlined">
|
||||
<a-select
|
||||
v-model:value="filterUserId"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
style="width: 100%"
|
||||
placeholder="همه"
|
||||
:options="userOptions"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="دوره">
|
||||
<a-row :gutter="[8, 0]">
|
||||
<a-form-item label="دوره"><a-row :gutter="[8, 0]">
|
||||
<a-col :span="12">
|
||||
<a-select
|
||||
v-model:value="filterYear"
|
||||
allow-clear
|
||||
placeholder="سال"
|
||||
style="width: 100%"
|
||||
:options="yearOptions"
|
||||
/>
|
||||
<SelectWithIcon :icon="CalendarOutlined">
|
||||
<a-select
|
||||
v-model:value="filterYear"
|
||||
allow-clear
|
||||
placeholder="سال"
|
||||
style="width: 100%"
|
||||
:options="yearOptions"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-select
|
||||
v-model:value="filterMonth"
|
||||
allow-clear
|
||||
placeholder="ماه"
|
||||
style="width: 100%"
|
||||
:options="monthOptions"
|
||||
/>
|
||||
<SelectWithIcon :icon="CalendarOutlined">
|
||||
<a-select
|
||||
v-model:value="filterMonth"
|
||||
allow-clear
|
||||
placeholder="ماه"
|
||||
style="width: 100%"
|
||||
:options="monthOptions"
|
||||
/>
|
||||
</SelectWithIcon>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="وضعیت">
|
||||
<a-select v-model:value="filterStatus" style="width: 100%" :options="statusOptions" />
|
||||
<SelectWithIcon :icon="FilterOutlined">
|
||||
<a-select v-model:value="filterStatus" style="width: 100%" :options="statusOptions" />
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="حداقل قابل پرداخت">
|
||||
<MoneyInput v-model="filterMin" addon-after="تومان" :decimals="0" />
|
||||
<a-form-item label="حداقل قابل پرداخت"><MoneyInput v-model="filterMin" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="حداکثر قابل پرداخت">
|
||||
<MoneyInput v-model="filterMax" addon-after="تومان" :decimals="0" />
|
||||
<a-form-item label="حداکثر قابل پرداخت"><MoneyInput v-model="filterMax" addon-after="تومان" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
@@ -25,10 +25,12 @@ import {
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { BankOutlined, FileTextOutlined, NumberOutlined, ScheduleOutlined, UserOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import type { FinancialAccountDto, FinancialReceivableDto } from '@mento/shared';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import { toman } from './treasury-format';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
@@ -245,62 +247,67 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title" />
|
||||
label="عنوان"><a-input v-model:value="form.title" placeholder="مثلاً قرارداد فروش">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item label="طرف حساب" name="partyName">
|
||||
<a-input v-model:value="form.partyName" />
|
||||
<a-form-item name="partyName" label="طرف حساب"><a-input v-model:value="form.partyName">
|
||||
<template #prefix><UserOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ کل"
|
||||
name="totalAmount"
|
||||
:rules="[{ required: true, message: 'مبلغ کل الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.totalAmount" :decimals="0" />
|
||||
label="مبلغ کل"><MoneyInput addon-after="تومان" v-model="form.totalAmount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="پیشپرداخت" name="prepaidAmount">
|
||||
<MoneyInput addon-after="تومان" v-model="form.prepaidAmount" :decimals="0" />
|
||||
<a-form-item name="prepaidAmount" label="پیشپرداخت"><MoneyInput addon-after="تومان" v-model="form.prepaidAmount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="حساب پیشپرداخت" name="accountId">
|
||||
<a-select show-search option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
<a-select-option v-for="account in accounts" :key="account.id" :value="account.id" :label="account.name">
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="accountId" label="حساب پیشپرداخت">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="form.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب"
|
||||
>
|
||||
<a-select-option v-for="account in accounts" :key="account.id" :value="account.id" :label="account.name">
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="تعداد قسط" name="count">
|
||||
<a-input v-model:value="form.count" :disabled="custom" />
|
||||
<a-form-item name="count" label="تعداد قسط">
|
||||
<a-input v-model:value="form.count" :disabled="custom">
|
||||
<template #prefix><NumberOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="دوره" name="interval">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.interval" style="width: 100%" :disabled="custom">
|
||||
<a-select-option value="monthly" label="ماهانه">ماهانه</a-select-option>
|
||||
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="interval" label="دوره">
|
||||
<SelectWithIcon :icon="ScheduleOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.interval" style="width: 100%" :disabled="custom">
|
||||
<a-select-option value="monthly" label="ماهانه">ماهانه</a-select-option>
|
||||
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="شروع" name="startDate">
|
||||
<JalaliDateInput v-model="form.startDate" :disabled="custom" />
|
||||
<a-form-item name="startDate" label="شروع"><JalaliDateInput v-model="form.startDate" :disabled="custom" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24">
|
||||
@@ -345,34 +352,35 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="collect.amount" :decimals="0" />
|
||||
label="مبلغ"><MoneyInput addon-after="تومان" v-model="collect.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item
|
||||
label="حساب مقصد"
|
||||
name="accountId"
|
||||
:rules="[{ required: true, message: 'حساب الزامی است' }]"
|
||||
>
|
||||
<a-select show-search option-filter-prop="label"
|
||||
v-model:value="collect.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
label="حساب مقصد">
|
||||
<SelectWithIcon :icon="BankOutlined">
|
||||
<a-select
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
v-model:value="collect.accountId"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
placeholder="انتخاب حساب"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select-option
|
||||
v-for="account in accounts"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
:label="account.name"
|
||||
>
|
||||
{{ account.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
@@ -18,9 +18,11 @@ import {
|
||||
Typography,
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import { AppstoreOutlined, FileTextOutlined, ScheduleOutlined } from '@/icons/ant-bridge';
|
||||
import { api } from '@/lib/api';
|
||||
import MoneyInput from '@/components/MoneyInput.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import { toman } from './treasury-format';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
@@ -115,42 +117,43 @@ onMounted(() => {
|
||||
<a-row :gutter="[16, 0]">
|
||||
<a-col :xs="24" :md="12">
|
||||
<a-form-item
|
||||
label="عنوان"
|
||||
name="title"
|
||||
:rules="[{ required: true, message: 'عنوان الزامی است' }]"
|
||||
>
|
||||
<a-input v-model:value="form.title" />
|
||||
label="عنوان"><a-input v-model:value="form.title">
|
||||
<template #prefix><FileTextOutlined /></template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="نوع" name="kind" :rules="[{ required: true }]">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.kind" style="width: 100%">
|
||||
<a-select-option value="expense" label="هزینه">هزینه</a-select-option>
|
||||
<a-select-option value="income" label="درآمد">درآمد</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="kind" :rules="[{ required: true }]" label="نوع">
|
||||
<SelectWithIcon :icon="AppstoreOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.kind" style="width: 100%">
|
||||
<a-select-option value="expense" label="هزینه">هزینه</a-select-option>
|
||||
<a-select-option value="income" label="درآمد">درآمد</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item
|
||||
label="مبلغ"
|
||||
name="amount"
|
||||
:rules="[{ required: true, message: 'مبلغ الزامی است' }]"
|
||||
>
|
||||
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
label="مبلغ"><MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="دوره" name="interval" :rules="[{ required: true }]">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.interval" style="width: 100%">
|
||||
<a-select-option value="monthly" label="ماهانه">ماهانه</a-select-option>
|
||||
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
|
||||
<a-select-option value="yearly" label="سالانه">سالانه</a-select-option>
|
||||
</a-select>
|
||||
<a-form-item name="interval" :rules="[{ required: true }]" label="دوره">
|
||||
<SelectWithIcon :icon="ScheduleOutlined">
|
||||
<a-select show-search option-filter-prop="label" v-model:value="form.interval" style="width: 100%">
|
||||
<a-select-option value="monthly" label="ماهانه">ماهانه</a-select-option>
|
||||
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
|
||||
<a-select-option value="yearly" label="سالانه">سالانه</a-select-option>
|
||||
</a-select>
|
||||
</SelectWithIcon>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="شروع" name="startDate">
|
||||
<JalaliDateInput v-model="form.startDate" />
|
||||
<a-form-item name="startDate" label="شروع"><JalaliDateInput v-model="form.startDate" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { DownloadOutlined } from '@ant-design/icons-vue';
|
||||
import { DownloadOutlined } from '@/icons/ant-bridge';
|
||||
import * as XLSX from 'xlsx';
|
||||
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||||
import { api } from '@/lib/api';
|
||||
|
||||
Reference in New Issue
Block a user