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:
2026-11-26 19:34:06 +03:30
co-authored by Cursor
parent 3eda36499b
commit 41fd7f7b2e
26 changed files with 1728 additions and 952 deletions
+9 -1
View File
@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, ref, watch } from 'vue'; import { nextTick, ref, watch } from 'vue';
import { Input as AInput } from 'ant-design-vue'; import { Input as AInput } from 'ant-design-vue';
import { WalletOutlined } from '@/icons/ant-bridge';
import { import {
caretIndexForDigitCount, caretIndexForDigitCount,
countDigitChars, countDigitChars,
@@ -23,6 +24,8 @@ const props = withDefaults(
asNumber?: boolean; asNumber?: boolean;
dir?: 'ltr' | 'rtl'; dir?: 'ltr' | 'rtl';
addonAfter?: string; addonAfter?: string;
/** آیکون داخل اینپوت؛ پیش‌فرض Wallet */
showPrefix?: boolean;
}>(), }>(),
{ {
required: false, required: false,
@@ -32,6 +35,7 @@ const props = withDefaults(
asNumber: false, asNumber: false,
dir: 'ltr', dir: 'ltr',
addonAfter: '', addonAfter: '',
showPrefix: true,
}, },
); );
@@ -136,5 +140,9 @@ function normalizeSep(raw: string): string {
@focus="onFocus" @focus="onFocus"
@blur="onBlur" @blur="onBlur"
@input="onInput" @input="onInput"
/> >
<template v-if="showPrefix" #prefix>
<WalletOutlined />
</template>
</a-input>
</template> </template>
+4 -33
View File
@@ -47,11 +47,6 @@ const currentSubtitle = computed(() => {
return 'محیط کاری'; return 'محیط کاری';
}); });
const currentInitial = computed(() => {
const name = currentName.value.trim();
return name ? name.charAt(0) : 'م';
});
const canSwitch = computed(() => orgs.value.length > 1); const canSwitch = computed(() => orgs.value.length > 1);
const isWorkspace = computed(() => props.variant === 'workspace'); const isWorkspace = computed(() => props.variant === 'workspace');
/** فقط وقتی بیش از یک محیط باشد نمایش و تعویض فعال است */ /** فقط وقتی بیش از یک محیط باشد نمایش و تعویض فعال است */
@@ -183,12 +178,12 @@ onUnmounted(() => {
@click.stop="toggle" @click.stop="toggle"
> >
<template v-if="isWorkspace"> <template v-if="isWorkspace">
<span class="org-mark" aria-hidden="true">{{ currentInitial }}</span> <UiIcon v-if="compact" name="building" :size="18" />
<span class="org-copy"> <span v-else class="org-copy">
<strong>{{ currentName }}</strong> <strong>{{ currentName }}</strong>
<small>{{ currentSubtitle }}</small> <small>{{ currentSubtitle }}</small>
</span> </span>
<i class="org-chev" :class="{ open }" aria-hidden="true" /> <i v-if="!compact" class="org-chev" :class="{ open }" aria-hidden="true" />
</template> </template>
<template v-else> <template v-else>
<UiIcon name="building" :size="18" /> <UiIcon name="building" :size="18" />
@@ -330,19 +325,6 @@ onUnmounted(() => {
color: #0f172a; 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 { .org-copy {
min-width: 0; min-width: 0;
flex: 1; flex: 1;
@@ -351,7 +333,7 @@ onUnmounted(() => {
} }
.org-copy strong { .org-copy strong {
font-size: 0.92rem; font-size: 14px;
font-weight: 800; font-weight: 800;
line-height: 1.25; line-height: 1.25;
overflow: hidden; overflow: hidden;
@@ -394,17 +376,6 @@ onUnmounted(() => {
border-radius: 14px; 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 { .menu {
position: fixed; position: fixed;
z-index: 90; z-index: 90;
@@ -197,7 +197,8 @@ defineExpose({ close });
font-weight: 500; 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; margin-inline-start: auto;
color: #94a3b8; color: #94a3b8;
transform: rotate(90deg); transform: rotate(90deg);
+2 -2
View File
@@ -362,8 +362,8 @@ function goBack() {
> >
<a-tab-pane v-for="tab in tabs" :key="tab.key" :disabled="tab.disabled"> <a-tab-pane v-for="tab in tabs" :key="tab.key" :disabled="tab.disabled">
<template #tab> <template #tab>
<a-flex align="center" :gap="token.marginXS"> <a-flex align="center" :gap="token.marginXXS">
<component :is="tab.icon" v-if="tab.icon" /> <component :is="tab.icon" v-if="tab.icon" :style="{ margin: 0 }" />
<span>{{ tab.label }}</span> <span>{{ tab.label }}</span>
<a-badge <a-badge
v-if="tab.count != null" 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, theme,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { import {
CreditCardOutlined,
DeleteOutlined, DeleteOutlined,
EditOutlined, EditOutlined,
EyeOutlined, EyeOutlined,
FileTextOutlined,
SearchOutlined,
StopOutlined, StopOutlined,
} from '@ant-design/icons-vue'; TagOutlined,
} from '@/icons/ant-bridge';
import { import {
canManageTreasuryDocuments, canManageTreasuryDocuments,
type FinancialCategoryDto, type FinancialCategoryDto,
@@ -36,6 +40,7 @@ import {
} from '@mento/shared'; } from '@mento/shared';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import { formatJalaliNumeric, formatLocalDateInput } from '@/lib/jalali'; import { formatJalaliNumeric, formatLocalDateInput } from '@/lib/jalali';
import { parseMoneyNumber } from '@/lib/money'; import { parseMoneyNumber } from '@/lib/money';
@@ -326,7 +331,9 @@ function modalContainer() {
placeholder="عنوان یا شماره پیگیری" placeholder="عنوان یا شماره پیگیری"
@press-enter="onSearch" @press-enter="onSearch"
@change="onSearch" @change="onSearch"
/> >
<template #prefix><SearchOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -575,7 +582,9 @@ function modalContainer() {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="عنوان" required> <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-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -585,6 +594,7 @@ function modalContainer() {
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
<a-form-item label="روش"> <a-form-item label="روش">
<SelectWithIcon :icon="CreditCardOutlined">
<a-select <a-select
v-model:value="editForm.method" v-model:value="editForm.method"
allow-clear allow-clear
@@ -595,10 +605,12 @@ function modalContainer() {
{{ opt.label }} {{ opt.label }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item label="دسته‌بندی"> <a-form-item label="دسته‌بندی">
<SelectWithIcon :icon="TagOutlined">
<a-select <a-select
v-model:value="editForm.categoryId" v-model:value="editForm.categoryId"
allow-clear allow-clear
@@ -608,6 +620,7 @@ function modalContainer() {
style="width: 100%" style="width: 100%"
:options="categories.map((c) => ({ value: c.id, label: c.name }))" :options="categories.map((c) => ({ value: c.id, label: c.name }))"
/> />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-if="!editAmountLocked" :xs="24" :md="12"> <a-col v-if="!editAmountLocked" :xs="24" :md="12">
@@ -617,7 +630,9 @@ function modalContainer() {
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="یادداشت"> <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-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -9,6 +9,8 @@ import {
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import type { CompanyDto, FinancialPartyKind, PersonDto, TreasuryPartySearchDto } from '@mento/shared'; 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 { UiModal } from '@/components/ui';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import CompanyFormView from '@/views/CompanyFormView.vue'; import CompanyFormView from '@/views/CompanyFormView.vue';
@@ -153,6 +155,7 @@ onMounted(() => {
<template> <template>
<a-flex vertical :gap="4"> <a-flex vertical :gap="4">
<SelectWithIcon :icon="UserOutlined">
<a-select <a-select
:open="selectOpen" :open="selectOpen"
show-search show-search
@@ -205,6 +208,7 @@ onMounted(() => {
</a-flex> </a-flex>
</template> </template>
</a-select> </a-select>
</SelectWithIcon>
<a-typography-text v-if="kind === 'other'" type="secondary"> <a-typography-text v-if="kind === 'other'" type="secondary">
برای سایر، مبلغ دریافت یا پرداخت با مبلغ کل یکی است و مانده نمی‌ماند. برای سایر، مبلغ دریافت یا پرداخت با مبلغ کل یکی است و مانده نمی‌ماند.
</a-typography-text> </a-typography-text>
+1 -25
View File
@@ -2030,7 +2030,7 @@ onUnmounted(() => {
.workspace-tabs.desktop-only { .workspace-tabs.desktop-only {
--ws-tab-bar: #fff; --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-active-ink: var(--accent, #10897d);
--ws-tab-radius: 10px; --ws-tab-radius: 10px;
display: block; display: block;
@@ -2107,30 +2107,6 @@ onUnmounted(() => {
border-radius: var(--ws-tab-radius) var(--ws-tab-radius) 0 0 !important; 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) { .workspace-tabs :deep(.ant-tabs-tab .ant-tabs-tab-remove) {
margin-inline-start: 6px; margin-inline-start: 6px;
margin-inline-end: 0; margin-inline-end: 0;
@@ -14,7 +14,9 @@ import {
} from '@mento/shared'; } from '@mento/shared';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import { parseMoneyNumber } from '@/lib/money'; 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 = { type RangeDraft = {
enabled: boolean; enabled: boolean;
@@ -234,9 +236,10 @@ onMounted(load);
<template> <template>
<section class="page"> <section class="page">
<UiPageHeader <PageHeader
title="تعیین محدوده مانده" title="تعیین محدوده مانده"
description="بازه مانده مالی و وزنی مشتریان ته‌حساب برای ساخت فعالیت در کاریز مطالبات." subtitle="بازه مانده مالی و وزنی مشتریان ته‌حساب برای ساخت فعالیت در کاریز مطالبات."
:icon="FundOutlined"
/> />
<p v-if="error" class="error">{{ error }}</p> <p v-if="error" class="error">{{ error }}</p>
+18 -33
View File
@@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'; 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 { api } from '@/lib/api';
import { useFeedback } from '@/composables/useFeedback'; import { useFeedback } from '@/composables/useFeedback';
import { useAuthStore } from '@/stores/auth'; import { useAuthStore } from '@/stores/auth';
@@ -27,7 +29,6 @@ import {
UiButton, UiButton,
UiInput, UiInput,
UiModal, UiModal,
UiPageHeader,
UiSelect, UiSelect,
UiTextarea, UiTextarea,
} from '@/components/ui'; } from '@/components/ui';
@@ -1075,43 +1076,26 @@ watch([id, isNew], () => void load(), { immediate: true });
<template> <template>
<section class="crm-page" :class="{ embedded }" @click="typeOpen = assigneeOpen = personOpen = false"> <section class="crm-page" :class="{ embedded }" @click="typeOpen = assigneeOpen = personOpen = false">
<UiPageHeader <PageHeader
v-if="!embedded" v-if="!embedded"
:title="pageTitle" :title="pageTitle"
subtitle="نوع، زمان، مسئول و توضیح فعالیت"
:icon="ScheduleOutlined"
:back-to="{ name: 'activities' }" :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> <template #actions>
<UiButton <a-button :disabled="saving" @click="submit('new')">
variant="primary" <template #icon><PlusOutlined /></template>
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" />
ذخیره و ایجاد جدید ذخیره و ایجاد جدید
</UiButton> </a-button>
<UiButton variant="ghost" type="button" :disabled="saving" @click="cancel"> <a-button :disabled="saving" @click="cancel">انصراف</a-button>
انصراف
</UiButton>
</template> </template>
</UiPageHeader> </PageHeader>
<p v-if="loading" class="muted">در حال بارگذاری…</p> <p v-if="loading" class="muted">در حال بارگذاری…</p>
@@ -1862,7 +1846,8 @@ watch([id, isNew], () => void load(), { immediate: true });
font-weight: 500; 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; margin-inline-start: auto;
color: #94a3b8; color: #94a3b8;
transform: rotate(90deg); transform: rotate(90deg);
@@ -3,8 +3,6 @@ import { computed, nextTick, onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import UiIcon from '@/components/UiIcon.vue';
import { UiButton, UiPageHeader } from '@/components/ui';
import type { import type {
LeadFormDto, LeadFormDto,
LeadFormDuplicateMode, LeadFormDuplicateMode,
+33 -29
View File
@@ -16,7 +16,6 @@ import {
UiEmptyState, UiEmptyState,
UiInput, UiInput,
UiModal, UiModal,
UiPageHeader,
UiPagination, UiPagination,
UiSelect, UiSelect,
} from '@/components/ui'; } from '@/components/ui';
@@ -25,6 +24,9 @@ import UiIcon from '@/components/UiIcon.vue';
import ProductFormView from '@/views/ProductFormView.vue'; import ProductFormView from '@/views/ProductFormView.vue';
import type { ImportContactsResult, ProductDto } from '@mento/shared'; import type { ImportContactsResult, ProductDto } from '@mento/shared';
import { brand } 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 SortKey = 'name' | 'newest' | 'price';
type StatusFilter = 'all' | 'active' | 'inactive'; type StatusFilter = 'all' | 'active' | 'inactive';
@@ -43,7 +45,21 @@ const page = ref(1);
const selected = ref<Set<string>>(new Set()); const selected = ref<Set<string>>(new Set());
const menuId = ref<string | null>(null); const menuId = ref<string | null>(null);
const sortOpen = ref(false); 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 productModal = ref(false);
const busy = ref(false); const busy = ref(false);
const pageBusy = ref(false); const pageBusy = ref(false);
@@ -99,7 +115,6 @@ watch([q, category, statusFilter, sort], () => {
function closeMenus() { function closeMenus() {
menuId.value = null; menuId.value = null;
sortOpen.value = false; sortOpen.value = false;
moreOpen.value = false;
} }
function toggleSelectAll() { function toggleSelectAll() {
@@ -254,14 +269,20 @@ onMounted(load);
<template> <template>
<section class="crm-page" @click="closeMenus"> <section class="crm-page" @click="closeMenus">
<UiBusyOverlay :open="pageBusy" :message="busyMessage" /> <UiBusyOverlay :open="pageBusy" :message="busyMessage" />
<UiPageHeader <PageHeader
title="محصولات" title="محصولات"
lead="مدیریت محصولات، قیمت‌ها و موجودی" subtitle="مدیریت محصولات، قیمت‌ها و موجودی"
:icon="ShoppingOutlined"
primary-label="محصول جدید"
:menu-items="headerMenuItems"
@primary="productModal = true"
@menu="onHeaderMenu"
> >
<template #actions> <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 <ExcelImportFlow
preview-path="/products/import/preview" preview-path="/products/import/preview"
import-path="/products/import" import-path="/products/import"
@@ -272,31 +293,14 @@ onMounted(load);
@settled="onImportSettled" @settled="onImportSettled"
> >
<template #default="{ loading }"> <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> </template>
</ExcelImportFlow> </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> </template>
<button type="button" :disabled="!selected.size" @click="removeSelected"> </PageHeader>
حذف انتخاب‌شده‌ها
</button>
<button type="button" @click="load">بروزرسانی لیست</button>
</UiDropdownMenu>
</template>
</UiPageHeader>
<div class="crm-toolbar" @click.stop> <div class="crm-toolbar" @click.stop>
<div class="search-box"> <div class="search-box">
+11 -19
View File
@@ -5,13 +5,9 @@ import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import type { SmsCampaignReportDto } from '@mento/shared'; import type { SmsCampaignReportDto } from '@mento/shared';
import { import { MessageOutlined, ReloadOutlined } from '@/icons/ant-bridge';
UiButton, import { PageHeader } from '@/components/page';
UiCard, import { UiCard, UiEmptyState } from '@/components/ui';
UiEmptyState,
UiPageHeader,
} from '@/components/ui';
import UiIcon from '@/components/UiIcon.vue';
import { formatClockFa, formatJalaliNumeric, toFaDigits } from '@/lib/jalali'; import { formatClockFa, formatJalaliNumeric, toFaDigits } from '@/lib/jalali';
const route = useRoute(); const route = useRoute();
@@ -74,23 +70,19 @@ onMounted(() => {
<template> <template>
<div class="page"> <div class="page">
<UiPageHeader <PageHeader
:title="report?.campaign.name || 'گزارش کمپین'" :title="report?.campaign.name || 'گزارش کمپین'"
description="آمار ارسال و کلیک لینک‌های ردیابی‌شده" subtitle="آمار ارسال و کلیک لینک‌های ردیابی‌شده"
:icon="MessageOutlined"
:back-to="{ name: 'sms-campaigns' }"
> >
<template #actions> <template #actions>
<UiButton <a-button :disabled="loading" @click="load">
variant="secondary" <template #icon><ReloadOutlined /></template>
@click="router.push({ name: 'sms-campaigns' })"
>
بازگشت
</UiButton>
<UiButton variant="secondary" :disabled="loading" @click="load">
<UiIcon name="refresh" />
بروزرسانی بروزرسانی
</UiButton> </a-button>
</template> </template>
</UiPageHeader> </PageHeader>
<p v-if="error" class="error">{{ error }}</p> <p v-if="error" class="error">{{ error }}</p>
<p v-if="loading" class="muted">در حال بارگذاری…</p> <p v-if="loading" class="muted">در حال بارگذاری…</p>
+5 -3
View File
@@ -12,6 +12,8 @@ import type {
UpdateTahesabConnectionRequest, UpdateTahesabConnectionRequest,
} from '@mento/shared'; } from '@mento/shared';
import { brand } 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 { formatJalaliDateTime, toFaDigits } from '@/lib/jalali';
import { import {
UiBadge, UiBadge,
@@ -20,7 +22,6 @@ import {
UiCard, UiCard,
UiField, UiField,
UiInput, UiInput,
UiPageHeader,
UiPagination, UiPagination,
UiSelect, UiSelect,
} from '@/components/ui'; } from '@/components/ui';
@@ -871,9 +872,10 @@ onMounted(load);
<template> <template>
<section class="crm-page tahesab-page" dir="rtl"> <section class="crm-page tahesab-page" dir="rtl">
<UiPageHeader <PageHeader
title="اتصال نرم‌افزار مالی ته‌حساب" title="اتصال نرم‌افزار مالی ته‌حساب"
description="همگام‌سازی اشخاص، مانده‌حساب‌ها و اسناد مالی بین ته‌حساب و نرم‌افزار مدیریت ارتباط با مشتریان" subtitle="همگام‌سازی اشخاص، مانده‌حساب‌ها و اسناد مالی بین ته‌حساب و نرم‌افزار مدیریت ارتباط با مشتریان"
:icon="DollarOutlined"
/> />
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div> <div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
+22 -47
View File
@@ -9,15 +9,16 @@ import type {
VoipCallLogDto, VoipCallLogDto,
VoipConnectionDto, VoipConnectionDto,
} from '@mento/shared'; } from '@mento/shared';
import { LinkOutlined, PhoneOutlined, ReloadOutlined } from '@/icons/ant-bridge';
import { PageHeader } from '@/components/page';
import type { PageHeaderTab } from '@/components/page';
import { import {
UiButton, UiButton,
UiCard, UiCard,
UiEmptyState, UiEmptyState,
UiField, UiField,
UiInput, UiInput,
UiPageHeader,
} from '@/components/ui'; } from '@/components/ui';
import UiIcon from '@/components/UiIcon.vue';
import { formatJalaliNumeric, rewriteGregorianDates, toFaDigits } from '@/lib/jalali'; import { formatJalaliNumeric, rewriteGregorianDates, toFaDigits } from '@/lib/jalali';
type TabKey = 'generic' | 'daftareshoma'; type TabKey = 'generic' | 'daftareshoma';
@@ -29,6 +30,15 @@ const ok = ref('');
const items = ref<VoipConnectionDto[]>([]); const items = ref<VoipConnectionDto[]>([]);
const calls = ref<VoipCallLogDto[]>([]); const calls = ref<VoipCallLogDto[]>([]);
const tab = ref<TabKey>('daftareshoma'); 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({ const callFilters = reactive({
direction: '', direction: '',
status: '', status: '',
@@ -268,34 +278,21 @@ onMounted(async () => {
<template> <template>
<div class="page"> <div class="page">
<UiPageHeader <PageHeader
title="تلفن سازمانی" title="تلفن سازمانی"
description="ثبت خودکار تماس، خلاصه گفتگو و اعلان تماس ورودی" subtitle="ثبت خودکار تماس، خلاصه گفتگو و اعلان تماس ورودی"
:icon="PhoneOutlined"
:tabs="voipTabs"
:active-tab="tab"
@update:active-tab="onVoipTab"
> >
<template #actions> <template #actions>
<UiButton variant="secondary" :disabled="loading" @click="load"> <a-button :disabled="loading" @click="load">
<UiIcon name="refresh" /> <template #icon><ReloadOutlined /></template>
بروزرسانی بروزرسانی
</UiButton> </a-button>
</template> </template>
</UiPageHeader> </PageHeader>
<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>
<p v-if="error" class="error">{{ error }}</p> <p v-if="error" class="error">{{ error }}</p>
<p v-if="ok" class="ok">{{ ok }}</p> <p v-if="ok" class="ok">{{ ok }}</p>
@@ -567,28 +564,6 @@ onMounted(async () => {
display: grid; display: grid;
gap: 1rem; 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, .hint,
.muted { .muted {
color: #64748b; color: #64748b;
@@ -5,12 +5,13 @@ import type { ActivityPriority, RoutineDto, RoutineEntityLink, SaveRoutineReques
import { ROUTINE_ENTITY_LINK_LABELS, ROUTINE_WEEKDAY_LABELS } from '@mento/shared'; import { ROUTINE_ENTITY_LINK_LABELS, ROUTINE_WEEKDAY_LABELS } from '@mento/shared';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import RecurrencePicker, { type RecurrenceValue } from '@/components/routines/RecurrencePicker.vue'; import RecurrencePicker, { type RecurrenceValue } from '@/components/routines/RecurrencePicker.vue';
import { SyncOutlined } from '@/icons/ant-bridge';
import { PageHeader } from '@/components/page';
import { import {
UiButton, UiButton,
UiCard, UiCard,
UiField, UiField,
UiInput, UiInput,
UiPageHeader,
UiSegmented, UiSegmented,
UiSelect, UiSelect,
UiTextarea, UiTextarea,
@@ -269,9 +270,10 @@ async function save() {
<template> <template>
<div class="rform"> <div class="rform">
<UiPageHeader <PageHeader
:title="isEdit ? 'ویرایش روتین' : 'روتین جدید'" :title="isEdit ? 'ویرایش روتین' : 'روتین جدید'"
lead="کاری که باید به‌صورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته می‌شود." subtitle="کاری که باید به‌صورت منظم انجام شود؛ هر روزِ تکرار، یک کار برای مسئول ساخته می‌شود."
:icon="SyncOutlined"
:back-to="backTo" :back-to="backTo"
/> />
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { import {
Alert as AAlert, Alert as AAlert,
Button as AButton, Button as AButton,
@@ -21,6 +21,7 @@ import {
List as AList, List as AList,
} from 'ant-design-vue'; } from 'ant-design-vue';
import type { TableColumnsType } from 'ant-design-vue'; import type { TableColumnsType } from 'ant-design-vue';
import { FileTextOutlined } from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import type { FinancialAccountDto, FinancialMovementDto } from '@mento/shared'; import type { FinancialAccountDto, FinancialMovementDto } from '@mento/shared';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
@@ -33,7 +34,6 @@ import { parseMoneyNumber } from '@/lib/money';
import { useTreasuryPageChrome } from './treasuryPageChrome'; import { useTreasuryPageChrome } from './treasuryPageChrome';
const route = useRoute(); const route = useRoute();
const router = useRouter();
const pageChrome = useTreasuryPageChrome(); const pageChrome = useTreasuryPageChrome();
const account = ref<FinancialAccountDto | null>(null); const account = ref<FinancialAccountDto | null>(null);
const items = ref<FinancialMovementDto[]>([]); const items = ref<FinancialMovementDto[]>([]);
@@ -149,10 +149,6 @@ onUnmounted(() => {
<template> <template>
<a-flex vertical :gap="16"> <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="error" type="error" show-icon :message="error" />
<a-alert v-if="note" type="success" show-icon :message="note" /> <a-alert v-if="note" type="success" show-icon :message="note" />
@@ -184,13 +180,13 @@ onUnmounted(() => {
<a-form layout="vertical"> <a-form layout="vertical">
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="موجودی واقعی"> <a-form-item label="موجودی واقعی"><MoneyInput addon-after="تومان" v-model="stated" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="stated" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="علت اصلاح"> <a-form-item label="علت اصلاح"><a-input v-model:value="reason">
<a-input v-model:value="reason" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <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 { computed, onMounted, ref } from 'vue';
import { RouterLink } from 'vue-router'; import { RouterLink } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
@@ -22,10 +22,12 @@ import {
Typography, Typography,
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { AppstoreOutlined, BankOutlined, FileTextOutlined, UserOutlined } from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import type { FinancialAccountDto, FinancialAccountType, OrgUserDto } from '@mento/shared'; import type { FinancialAccountDto, FinancialAccountType, OrgUserDto } from '@mento/shared';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue'; import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
import { toman } from './treasury-format'; import { toman } from './treasury-format';
import { useTreasuryListPaging } from './useTreasuryListPaging'; import { useTreasuryListPaging } from './useTreasuryListPaging';
@@ -274,15 +276,16 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="نام حساب"
name="name" name="name"
:rules="[{ required: true, message: 'نام حساب الزامی است' }]" :rules="[{ required: true, message: 'نام حساب الزامی است' }]"
> label="نام حساب"><a-input v-model:value="form.name">
<a-input v-model:value="form.name" /> <template #prefix><BankOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="نوع" name="type" :rules="[{ required: true }]"> <a-form-item name="type" :rules="[{ required: true }]" label="نوع">
<SelectWithIcon :icon="AppstoreOutlined">
<a-select <a-select
v-model:value="form.type" v-model:value="form.type"
show-search show-search
@@ -293,20 +296,24 @@ onMounted(() => {
<a-select-option value="bank" label="حساب بانکی">حساب بانکی</a-select-option> <a-select-option value="bank" label="حساب بانکی">حساب بانکی</a-select-option>
<a-select-option value="petty" label="تنخواه">تنخواه</a-select-option> <a-select-option value="petty" label="تنخواه">تنخواه</a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-if="form.type === 'bank'" :xs="24" :md="8"> <a-col v-if="form.type === 'bank'" :xs="24" :md="8">
<a-form-item label="نام بانک" name="bankName"> <a-form-item name="bankName" label="نام بانک"><a-input v-model:value="form.bankName">
<a-input v-model:value="form.bankName" /> <template #prefix><BankOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="شماره یا شناسه" name="accountRef"> <a-form-item name="accountRef" label="شماره یا شناسه"><a-input v-model:value="form.accountRef">
<a-input v-model:value="form.accountRef" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="مسئول"> <a-form-item label="مسئول">
<SelectWithIcon :icon="UserOutlined">
<a-select <a-select
v-model:value="responsibleKey" v-model:value="responsibleKey"
show-search show-search
@@ -324,21 +331,21 @@ onMounted(() => {
{{ user.fullName }} {{ user.fullName }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="موجودی اولیه" name="openingBalance"> <a-form-item name="openingBalance" label="موجودی اولیه"><MoneyInput addon-after="تومان" v-model="form.openingBalance" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="form.openingBalance" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="تاریخ شروع" name="openingDate"> <a-form-item name="openingDate" label="تاریخ شروع"><JalaliDateInput v-model="form.openingDate" />
<JalaliDateInput v-model="form.openingDate" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item label="توضیحات" name="notes"> <a-form-item name="notes" label="توضیحات"><a-input v-model:value="form.notes">
<a-input v-model:value="form.notes" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -359,10 +366,10 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="از حساب"
name="fromAccountId" name="fromAccountId"
:rules="[{ required: true, message: 'حساب مبدأ الزامی است' }]" :rules="[{ required: true, message: 'حساب مبدأ الزامی است' }]"
> label="از حساب">
<SelectWithIcon :icon="BankOutlined">
<a-select <a-select
v-model:value="transfer.fromAccountId" v-model:value="transfer.fromAccountId"
show-search show-search
@@ -380,14 +387,15 @@ onMounted(() => {
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="به حساب"
name="toAccountId" name="toAccountId"
:rules="[{ required: true, message: 'حساب مقصد الزامی است' }]" :rules="[{ required: true, message: 'حساب مقصد الزامی است' }]"
> label="به حساب">
<SelectWithIcon :icon="BankOutlined">
<a-select <a-select
v-model:value="transfer.toAccountId" v-model:value="transfer.toAccountId"
show-search show-search
@@ -405,20 +413,20 @@ onMounted(() => {
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item <a-form-item
label="مبلغ"
name="amount" name="amount"
:rules="[{ required: true, message: 'مبلغ الزامی است' }]" :rules="[{ required: true, message: 'مبلغ الزامی است' }]"
> label="مبلغ"><MoneyInput addon-after="تومان" v-model="transfer.amount" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="transfer.amount" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item label="شرح" name="memo"> <a-form-item name="memo" label="شرح"><a-input v-model:value="transfer.memo">
<a-input v-model:value="transfer.memo" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
@@ -21,8 +21,10 @@ import {
Tag as ATag, Tag as ATag,
Typography, Typography,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { AppstoreOutlined, FileTextOutlined } from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import type { FinancialCategoryDto } from '@mento/shared'; import type { FinancialCategoryDto } from '@mento/shared';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue'; import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
import { useTreasuryListPaging } from './useTreasuryListPaging'; import { useTreasuryListPaging } from './useTreasuryListPaging';
import { useTreasuryMobile } from './useTreasuryMobile'; import { useTreasuryMobile } from './useTreasuryMobile';
@@ -150,19 +152,21 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="نام"
name="name" name="name"
:rules="[{ required: true, message: 'نام الزامی است' }]" :rules="[{ required: true, message: 'نام الزامی است' }]"
> label="نام"><a-input v-model:value="form.name">
<a-input v-model:value="form.name" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="نوع" name="kind" :rules="[{ required: true }]"> <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 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="income" label="درآمد">درآمد</a-select-option>
<a-select-option value="expense" label="هزینه">هزینه</a-select-option> <a-select-option value="expense" label="هزینه">هزینه</a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="4"> <a-col :xs="24" :md="4">
@@ -258,7 +262,9 @@ onMounted(() => {
> >
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="نام" required> <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>
<a-form-item label="فعال در فرم‌ها"> <a-form-item label="فعال در فرم‌ها">
<a-switch v-model:checked="edit.isActive" /> <a-switch v-model:checked="edit.isActive" />
@@ -1,21 +1,37 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'; import { computed, h, onMounted, ref, watch } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
Alert as AAlert, Alert as AAlert,
Avatar as AAvatar,
Button as AButton, Button as AButton,
Card as ACard, Card as ACard,
Col as ACol, Col as ACol,
Flex as AFlex, Flex as AFlex,
Form as AForm, Form as AForm,
FormItem as AFormItem, FormItem as AFormItem,
Grid,
Input as AInput, Input as AInput,
Row as ARow, Row as ARow,
Segmented as ASegmented, Segmented as ASegmented,
Select as ASelect, Select as ASelect,
Space as ASpace,
Textarea as ATextarea,
Typography, Typography,
message, message,
theme,
type FormInstance,
} from 'ant-design-vue'; } from 'ant-design-vue';
import {
ArrowUpOutlined,
BankOutlined,
CheckOutlined,
ClockCircleOutlined,
CreditCardOutlined,
FileTextOutlined,
InfoCircleOutlined,
TagOutlined,
} from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import { formatLocalDateInput } from '@/lib/jalali'; import { formatLocalDateInput } from '@/lib/jalali';
import type { import type {
@@ -23,10 +39,12 @@ import type {
FinancialCategoryDto, FinancialCategoryDto,
FinancialDocumentDto, FinancialDocumentDto,
FinancialPartyKind, FinancialPartyKind,
TreasuryDashboardDto,
TreasuryPartyBalanceDto, TreasuryPartyBalanceDto,
} from '@mento/shared'; } from '@mento/shared';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue'; import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue';
import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue'; import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue';
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue'; import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
@@ -37,36 +55,59 @@ import {
type TreasuryPendingPhoto, type TreasuryPendingPhoto,
} from '@/lib/treasury-doc-photos'; } from '@/lib/treasury-doc-photos';
import { accountBalanceTone, partyNetPosition, toman } from './treasury-format'; import { accountBalanceTone, partyNetPosition, toman } from './treasury-format';
import { useTreasuryMobile } from './useTreasuryMobile';
import { parseMoneyNumber } from '@/lib/money'; import { parseMoneyNumber } from '@/lib/money';
const { Text: ATypographyText } = Typography; const { Text: ATypographyText } = Typography;
const ASelectOption = ASelect.Option; 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 kind = 'expense' as const;
const rows = ref<FinancialDocumentDto[]>([]); const rows = ref<FinancialDocumentDto[]>([]);
const balances = ref<TreasuryPartyBalanceDto[]>([]); const balances = ref<TreasuryPartyBalanceDto[]>([]);
const receivableBalances = ref<TreasuryPartyBalanceDto[]>([]); const receivableBalances = ref<TreasuryPartyBalanceDto[]>([]);
const categories = ref<FinancialCategoryDto[]>([]); const categories = ref<FinancialCategoryDto[]>([]);
const accounts = ref<FinancialAccountDto[]>([]); const accounts = ref<FinancialAccountDto[]>([]);
const dashboard = ref<TreasuryDashboardDto | null>(null);
const error = ref(''); const error = ref('');
const ok = ref(''); const ok = ref('');
const saving = ref(false); const saving = ref(false);
const pendingPhotos = ref<TreasuryPendingPhoto[]>([]); const pendingPhotos = ref<TreasuryPendingPhoto[]>([]);
const q = ref(''); const q = ref('');
const form = 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 {
title: '', title: '',
amount: '', amount: '',
categoryId: '', categoryId: undefined as string | undefined,
partyKind: undefined as FinancialPartyKind | undefined, partyKind: undefined as FinancialPartyKind | undefined,
partyId: undefined as string | undefined, partyId: undefined as string | undefined,
accountId: '', accountId: undefined as string | undefined,
settleAmount: '', settleAmount: '',
method: 'transfer', method: 'transfer',
notes: '', notes: '',
bookedAt: formatLocalDateInput(new Date()), bookedAt: formatLocalDateInput(new Date()),
}); };
}
const form = ref(emptyForm());
const settleMirror = useSettleDefault(form); const settleMirror = useSettleDefault(form);
const settleLabel = 'مبلغ پرداخت‌شده'; const settleLabel = 'مبلغ پرداخت‌شده';
@@ -91,6 +132,69 @@ const methodOptions = [
{ value: 'other', label: 'سایر' }, { 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) { function apiMessage(e: unknown) {
if (!axios.isAxiosError(e)) return 'ذخیره ناموفق بود.'; if (!axios.isAxiosError(e)) return 'ذخیره ناموفق بود.';
const msg = (e.response?.data as { message?: string | string[] })?.message; const msg = (e.response?.data as { message?: string | string[] })?.message;
@@ -98,7 +202,7 @@ function apiMessage(e: unknown) {
} }
async function load() { 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<FinancialDocumentDto[]>('/treasury/documents', { params: { kind, q: q.value || undefined } }),
api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => { api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => {
if (axios.isAxiosError(e) && (e.response?.status === 403 || e.response?.status === 404)) { 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[] }; if (axios.isAxiosError(e) && e.response?.status === 404) return { data: [] as TreasuryPartyBalanceDto[] };
throw e; throw e;
}), }),
api.get<TreasuryDashboardDto>('/treasury/dashboard').catch(() => ({ data: null })),
]); ]);
rows.value = docs.data; rows.value = docs.data;
balances.value = bals.data; balances.value = bals.data;
receivableBalances.value = receivables.data; receivableBalances.value = receivables.data;
categories.value = cats.data.filter((row) => row.isActive); categories.value = cats.data.filter((row) => row.isActive);
accounts.value = acc.data.filter((row) => row.isActive); accounts.value = acc.data.filter((row) => row.isActive);
dashboard.value = dash.data;
} }
function onFinishFailed() { 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('لطفاً فیلدهای الزامی را کامل کنید.'); message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
return;
}
await createDoc();
} }
async function createDoc() { async function createDoc() {
@@ -202,20 +324,7 @@ async function createDoc() {
error.value = apiMessage(e); error.value = apiMessage(e);
} }
} }
settleMirror.reset(); resetForm();
pendingPhotos.value = [];
form.value = {
title: '',
amount: '',
categoryId: '',
partyKind: undefined,
partyId: undefined,
accountId: '',
settleAmount: '',
method: 'transfer',
notes: '',
bookedAt: formatLocalDateInput(new Date()),
};
const base = collectsBalance const base = collectsBalance
? `${toman(settleAmount)} از ماندهٔ طرف حساب کم شد.` ? `${toman(settleAmount)} از ماندهٔ طرف حساب کم شد.`
: data.reference : 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(() => { onMounted(() => {
void load().catch(() => { void load().catch(() => {
error.value = 'بارگذاری ناموفق بود.'; error.value = 'بارگذاری ناموفق بود.';
@@ -297,7 +347,311 @@ onMounted(() => {
</script> </script>
<template> <template>
<a-flex vertical :gap="16"> <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-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 :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-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-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-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 :span="16">
<a-button type="primary" block :loading="saving" @click="submitMobileForm">
<template #icon><CheckOutlined /></template>
{{ isSettlement ? 'ثبت پرداخت' : 'ثبت هزینه' }}
</a-button>
</a-col>
</a-row>
</div>
</template>
<a-flex v-else vertical :gap="16">
<a-alert v-if="error" type="error" show-icon :message="error" /> <a-alert v-if="error" type="error" show-icon :message="error" />
<a-alert v-if="ok" type="success" show-icon :message="ok" /> <a-alert v-if="ok" type="success" show-icon :message="ok" />
@@ -335,7 +689,9 @@ onMounted(() => {
name="title" name="title"
:rules="[{ required: true, message: 'عنوان الزامی است' }]" :rules="[{ required: true, message: 'عنوان الزامی است' }]"
> >
<a-input v-model:value="form.title" /> <a-input v-model:value="form.title">
<template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -374,7 +730,8 @@ onMounted(() => {
</a-col> </a-col>
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8"> <a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
<a-form-item label="دسته‌بندی" name="categoryId"> <a-form-item name="categoryId" label="دسته‌بندی">
<SelectWithIcon :icon="TagOutlined">
<a-select <a-select
show-search show-search
option-filter-prop="label" option-filter-prop="label"
@@ -387,6 +744,7 @@ onMounted(() => {
{{ cat.name }} {{ cat.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -402,6 +760,7 @@ onMounted(() => {
</a-typography-text> </a-typography-text>
</a-flex> </a-flex>
</template> </template>
<SelectWithIcon :icon="BankOutlined">
<a-select <a-select
show-search show-search
option-filter-prop="label" option-filter-prop="label"
@@ -410,19 +769,32 @@ onMounted(() => {
style="width: 100%" style="width: 100%"
placeholder="انتخاب حساب" placeholder="انتخاب حساب"
> >
<a-select-option v-for="account in accounts" :key="account.id" :value="account.id" :label="account.name"> <a-select-option
v-for="account in accounts"
:key="account.id"
:value="account.id"
:label="account.name"
>
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
<a-form-item label="روش" name="method"> <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 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"> <a-select-option
v-for="opt in methodOptions"
:key="opt.value"
:value="opt.value"
:label="opt.label"
>
{{ opt.label }} {{ opt.label }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -432,7 +804,9 @@ onMounted(() => {
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
<a-form-item label="توضیحات" name="notes"> <a-form-item label="توضیحات" name="notes">
<a-input v-model:value="form.notes" /> <a-input v-model:value="form.notes">
<template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -442,7 +816,7 @@ onMounted(() => {
</a-col> </a-col>
</a-row> </a-row>
<a-space> <a-space>
<a-button type="primary" html-type="submit" :block="isMobile" :loading="saving">ثبت</a-button> <a-button type="primary" html-type="submit" :loading="saving">ثبت</a-button>
</a-space> </a-space>
</a-form> </a-form>
</a-card> </a-card>
@@ -459,4 +833,5 @@ onMounted(() => {
@reload="load" @reload="load"
/> />
</a-flex> </a-flex>
</div>
</template> </template>
@@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'; import { computed, h, onMounted, ref, watch } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
Alert as AAlert, Alert as AAlert,
Avatar as AAvatar,
Button as AButton, Button as AButton,
Card as ACard, Card as ACard,
Col as ACol, Col as ACol,
@@ -14,9 +15,23 @@ import {
Row as ARow, Row as ARow,
Segmented as ASegmented, Segmented as ASegmented,
Select as ASelect, Select as ASelect,
Space as ASpace,
Textarea as ATextarea,
Typography, Typography,
message, message,
theme,
type FormInstance,
} from 'ant-design-vue'; } from 'ant-design-vue';
import {
ArrowDownOutlined,
BankOutlined,
CheckOutlined,
ClockCircleOutlined,
CreditCardOutlined,
FileTextOutlined,
InfoCircleOutlined,
TagOutlined,
} from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import { formatLocalDateInput } from '@/lib/jalali'; import { formatLocalDateInput } from '@/lib/jalali';
import type { import type {
@@ -24,10 +39,12 @@ import type {
FinancialCategoryDto, FinancialCategoryDto,
FinancialDocumentDto, FinancialDocumentDto,
FinancialPartyKind, FinancialPartyKind,
TreasuryDashboardDto,
TreasuryPartyBalanceDto, TreasuryPartyBalanceDto,
} from '@mento/shared'; } from '@mento/shared';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue'; import TreasuryDocPhotoField from '@/components/treasury/TreasuryDocPhotoField.vue';
import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue'; import TreasuryDocumentsPanel from '@/components/treasury/TreasuryDocumentsPanel.vue';
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue'; import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
@@ -42,6 +59,8 @@ import { parseMoneyNumber } from '@/lib/money';
const { Text: ATypographyText } = Typography; const { Text: ATypographyText } = Typography;
const ASelectOption = ASelect.Option; const ASelectOption = ASelect.Option;
const { useToken } = theme;
const { token } = useToken();
const screens = Grid.useBreakpoint(); const screens = Grid.useBreakpoint();
const isMobile = computed(() => !screens.value.md); const isMobile = computed(() => !screens.value.md);
@@ -51,11 +70,27 @@ const balances = ref<TreasuryPartyBalanceDto[]>([]);
const payableBalances = ref<TreasuryPartyBalanceDto[]>([]); const payableBalances = ref<TreasuryPartyBalanceDto[]>([]);
const categories = ref<FinancialCategoryDto[]>([]); const categories = ref<FinancialCategoryDto[]>([]);
const accounts = ref<FinancialAccountDto[]>([]); const accounts = ref<FinancialAccountDto[]>([]);
const dashboard = ref<TreasuryDashboardDto | null>(null);
const error = ref(''); const error = ref('');
const ok = ref(''); const ok = ref('');
const saving = ref(false); const saving = ref(false);
const pendingPhotos = ref<TreasuryPendingPhoto[]>([]); const pendingPhotos = ref<TreasuryPendingPhoto[]>([]);
const q = ref(''); 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() { function emptyForm() {
return { return {
@@ -167,7 +202,7 @@ function apiMessage(e: unknown) {
} }
async function load() { 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<FinancialDocumentDto[]>('/treasury/documents', { params: { kind, q: q.value || undefined } }),
api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => { api.get<FinancialCategoryDto[]>('/treasury/categories', { params: { kind } }).catch((e: unknown) => {
if (axios.isAxiosError(e) && (e.response?.status === 403 || e.response?.status === 404)) { 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[] }; if (axios.isAxiosError(e) && e.response?.status === 404) return { data: [] as TreasuryPartyBalanceDto[] };
throw e; throw e;
}), }),
api.get<TreasuryDashboardDto>('/treasury/dashboard').catch(() => ({ data: null })),
]); ]);
rows.value = docs.data; rows.value = docs.data;
balances.value = bals.data; balances.value = bals.data;
payableBalances.value = payables.data; payableBalances.value = payables.data;
categories.value = cats.data.filter((row) => row.isActive); categories.value = cats.data.filter((row) => row.isActive);
accounts.value = acc.data.filter((row) => row.isActive); accounts.value = acc.data.filter((row) => row.isActive);
dashboard.value = dash.data;
} }
function resetForm() { function resetForm() {
settleMirror.reset(); settleMirror.reset();
form.value = emptyForm(); form.value = emptyForm();
pendingPhotos.value = []; pendingPhotos.value = [];
formTab.value = 'main';
error.value = ''; error.value = '';
ok.value = ''; ok.value = '';
} }
async function submitMobileForm() {
try {
await mobileFormRef.value?.validate();
} catch {
formTab.value = 'main';
message.warning('لطفاً فیلدهای الزامی را کامل کنید.');
return;
}
await createDoc();
}
async function createDoc() { async function createDoc() {
saving.value = true; saving.value = true;
error.value = ''; error.value = '';
@@ -298,7 +347,311 @@ onMounted(() => {
</script> </script>
<template> <template>
<a-flex vertical :gap="16"> <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-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 :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-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-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-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 :span="16">
<a-button type="primary" block :loading="saving" @click="submitMobileForm">
<template #icon><CheckOutlined /></template>
{{ isSettlement ? 'ثبت دریافت' : 'ثبت درآمد' }}
</a-button>
</a-col>
</a-row>
</div>
</template>
<a-flex v-else vertical :gap="16">
<a-alert v-if="error" type="error" show-icon :message="error" /> <a-alert v-if="error" type="error" show-icon :message="error" />
<a-alert v-if="ok" type="success" show-icon :message="ok" /> <a-alert v-if="ok" type="success" show-icon :message="ok" />
@@ -336,7 +689,9 @@ onMounted(() => {
name="title" name="title"
:rules="[{ required: true, message: 'عنوان الزامی است' }]" :rules="[{ required: true, message: 'عنوان الزامی است' }]"
> >
<a-input v-model:value="form.title" /> <a-input v-model:value="form.title">
<template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -375,7 +730,8 @@ onMounted(() => {
</a-col> </a-col>
<a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8"> <a-col v-if="!isSettlement" :xs="24" :sm="12" :md="8">
<a-form-item label="دسته‌بندی" name="categoryId"> <a-form-item name="categoryId" label="دسته‌بندی">
<SelectWithIcon :icon="TagOutlined">
<a-select <a-select
show-search show-search
option-filter-prop="label" option-filter-prop="label"
@@ -388,6 +744,7 @@ onMounted(() => {
{{ cat.name }} {{ cat.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -403,6 +760,7 @@ onMounted(() => {
</a-typography-text> </a-typography-text>
</a-flex> </a-flex>
</template> </template>
<SelectWithIcon :icon="BankOutlined">
<a-select <a-select
show-search show-search
option-filter-prop="label" option-filter-prop="label"
@@ -420,10 +778,12 @@ onMounted(() => {
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
<a-form-item label="روش" name="method"> <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 show-search option-filter-prop="label" v-model:value="form.method" style="width: 100%">
<a-select-option <a-select-option
v-for="opt in methodOptions" v-for="opt in methodOptions"
@@ -434,6 +794,7 @@ onMounted(() => {
{{ opt.label }} {{ opt.label }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -443,7 +804,9 @@ onMounted(() => {
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
<a-form-item label="توضیحات" name="notes"> <a-form-item label="توضیحات" name="notes">
<a-input v-model:value="form.notes" /> <a-input v-model:value="form.notes">
<template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12" :md="8"> <a-col :xs="24" :sm="12" :md="8">
@@ -453,7 +816,7 @@ onMounted(() => {
</a-col> </a-col>
</a-row> </a-row>
<a-space> <a-space>
<a-button type="primary" html-type="submit" :block="isMobile" :loading="saving">ثبت</a-button> <a-button type="primary" html-type="submit" :loading="saving">ثبت</a-button>
</a-space> </a-space>
</a-form> </a-form>
</a-card> </a-card>
@@ -470,4 +833,5 @@ onMounted(() => {
@reload="load" @reload="load"
/> />
</a-flex> </a-flex>
</div>
</template> </template>
+77 -26
View File
@@ -1,15 +1,30 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, watch } from 'vue'; import { computed, watch, type Component } from 'vue';
import { RouterView, useRoute } from 'vue-router'; import { RouterView, useRoute, useRouter } from 'vue-router';
import { Flex as AFlex, Grid, Typography, theme } from 'ant-design-vue'; import { Flex as AFlex, theme } from 'ant-design-vue';
import TreasuryNav from '@/components/treasury/TreasuryNav.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'; import { provideTreasuryPageChrome } from './treasuryPageChrome';
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
const { token } = theme.useToken(); const { token } = theme.useToken();
const screens = Grid.useBreakpoint();
const isMobile = computed(() => !screens.value.md);
const route = useRoute(); const route = useRoute();
const router = useRouter();
const auth = useAuthStore();
const chrome = provideTreasuryPageChrome(); const chrome = provideTreasuryPageChrome();
watch( watch(
@@ -33,29 +48,65 @@ const description = computed(
(typeof route.meta.treasuryDescription === 'string' ? route.meta.treasuryDescription : ''), (typeof route.meta.treasuryDescription === 'string' ? route.meta.treasuryDescription : ''),
); );
const headerStyle = computed(() => const links = computed(() => {
isMobile.value const role = auth.user?.role;
? undefined const permissions = auth.user?.permissions;
: { const all: Array<{
minHeight: `${token.value.controlHeightLG + token.value.fontSizeLG + token.value.marginXXS}px`, 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> </script>
<template> <template>
<a-flex vertical :gap="isMobile ? token.marginSM : token.margin" :style="{ width: '100%' }"> <a-flex vertical :gap="token.margin" :style="{ width: '100%' }">
<div :style="headerStyle"> <PageHeader
<a-typography-title :level="isMobile ? 4 : 3" :style="{ margin: 0 }">{{ title }}</a-typography-title> :title="title"
<a-typography-text :subtitle="description || undefined"
type="secondary" :icon="DollarOutlined"
:ellipsis="description ? { tooltip: description } : false" :tabs="headerTabs"
:style="{ display: 'block', margin: 0 }" :active-tab="activeTab"
> :back-to="backTo"
{{ description || '\u00a0' }} @update:active-tab="onTabChange"
</a-typography-text> />
</div>
<TreasuryNav />
<RouterView /> <RouterView />
</a-flex> </a-flex>
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
@@ -25,12 +25,22 @@ import {
message, message,
theme, theme,
} from 'ant-design-vue'; } 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 type { TableColumnsType } from 'ant-design-vue';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import type { FinancialAccountDto, OrgUserDto } from '@mento/shared'; import type { FinancialAccountDto, OrgUserDto } from '@mento/shared';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import { import {
addJalaliMonths, addJalaliMonths,
dateToJalali, dateToJalali,
@@ -504,11 +514,11 @@ onMounted(() => {
<a-row :gutter="[8, 0]"> <a-row :gutter="[8, 0]">
<a-col :xs="24" :sm="12"> <a-col :xs="24" :sm="12">
<a-form-item <a-form-item
label="پرسنل"
name="userId" name="userId"
style="margin-bottom: 8px" style="margin-bottom: 8px"
:rules="[{ required: true, message: 'پرسنل الزامی است' }]" :rules="[{ required: true, message: 'پرسنل الزامی است' }]"
> label="پرسنل">
<SelectWithIcon :icon="UserOutlined">
<a-select <a-select
v-model:value="form.userId" v-model:value="form.userId"
show-search show-search
@@ -518,11 +528,11 @@ onMounted(() => {
placeholder="انتخاب" placeholder="انتخاب"
:options="userOptions" :options="userOptions"
/> />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :sm="12"> <a-col :xs="24" :sm="12">
<a-form-item label="دوره" style="margin-bottom: 8px"> <a-form-item style="margin-bottom: 8px" label="دوره"><JalaliDateInput
<JalaliDateInput
v-model="periodDate" v-model="periodDate"
start-view="months" start-view="months"
:clearable="false" :clearable="false"
@@ -533,27 +543,22 @@ onMounted(() => {
</a-col> </a-col>
<a-col :xs="12" :md="6"> <a-col :xs="12" :md="6">
<a-form-item <a-form-item
label="پایه"
name="baseAmount" name="baseAmount"
style="margin-bottom: 8px" style="margin-bottom: 8px"
:rules="[{ required: true, message: 'مبلغ پایه الزامی است' }]" :rules="[{ required: true, message: 'مبلغ پایه الزامی است' }]"
> label="پایه"><MoneyInput v-model="form.baseAmount" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="form.baseAmount" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="12" :md="6"> <a-col :xs="12" :md="6">
<a-form-item label="مزایا" name="benefits" style="margin-bottom: 8px"> <a-form-item name="benefits" style="margin-bottom: 8px" label="مزایا"><MoneyInput v-model="form.benefits" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="form.benefits" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="12" :md="6"> <a-col :xs="12" :md="6">
<a-form-item label="پاداش" name="bonus" style="margin-bottom: 8px"> <a-form-item name="bonus" style="margin-bottom: 8px" label="پاداش"><MoneyInput v-model="form.bonus" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="form.bonus" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="12" :md="6"> <a-col :xs="12" :md="6">
<a-form-item label="کسورات" name="deductions" style="margin-bottom: 8px"> <a-form-item name="deductions" style="margin-bottom: 8px" label="کسورات"><MoneyInput v-model="form.deductions" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="form.deductions" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col v-if="moneyFilled(form.benefits)" :span="24"> <a-col v-if="moneyFilled(form.benefits)" :span="24">
@@ -623,10 +628,10 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="دورهٔ حقوق"
name="id" name="id"
:rules="[{ required: true, message: 'دوره الزامی است' }]" :rules="[{ required: true, message: 'دوره الزامی است' }]"
> label="دورهٔ حقوق">
<SelectWithIcon :icon="ScheduleOutlined">
<a-select <a-select
:value="pay.id || undefined" :value="pay.id || undefined"
allow-clear allow-clear
@@ -638,23 +643,22 @@ onMounted(() => {
:options="payOptions" :options="payOptions"
@change="onPayPick" @change="onPayPick"
/> />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="6"> <a-col :xs="24" :md="6">
<a-form-item <a-form-item
label="مبلغ این مرحله"
name="amount" name="amount"
:rules="[{ required: true, message: 'مبلغ الزامی است' }]" :rules="[{ required: true, message: 'مبلغ الزامی است' }]"
> label="مبلغ این مرحله"><MoneyInput v-model="pay.amount" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="pay.amount" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="6"> <a-col :xs="24" :md="6">
<a-form-item <a-form-item
label="حساب"
name="accountId" name="accountId"
:rules="[{ required: true, message: 'حساب الزامی است' }]" :rules="[{ required: true, message: 'حساب الزامی است' }]"
> label="حساب">
<SelectWithIcon :icon="BankOutlined">
<a-select <a-select
v-model:value="pay.accountId" v-model:value="pay.accountId"
show-search show-search
@@ -664,6 +668,7 @@ onMounted(() => {
placeholder="انتخاب حساب" placeholder="انتخاب حساب"
:options="accounts.map((account) => ({ value: account.id, label: account.name }))" :options="accounts.map((account) => ({ value: account.id, label: account.name }))"
/> />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -744,6 +749,7 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="پرسنل"> <a-form-item label="پرسنل">
<SelectWithIcon :icon="UserOutlined">
<a-select <a-select
v-model:value="filterUserId" v-model:value="filterUserId"
allow-clear allow-clear
@@ -753,12 +759,13 @@ onMounted(() => {
placeholder="همه" placeholder="همه"
:options="userOptions" :options="userOptions"
/> />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="دوره"> <a-form-item label="دوره"><a-row :gutter="[8, 0]">
<a-row :gutter="[8, 0]">
<a-col :span="12"> <a-col :span="12">
<SelectWithIcon :icon="CalendarOutlined">
<a-select <a-select
v-model:value="filterYear" v-model:value="filterYear"
allow-clear allow-clear
@@ -766,8 +773,10 @@ onMounted(() => {
style="width: 100%" style="width: 100%"
:options="yearOptions" :options="yearOptions"
/> />
</SelectWithIcon>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<SelectWithIcon :icon="CalendarOutlined">
<a-select <a-select
v-model:value="filterMonth" v-model:value="filterMonth"
allow-clear allow-clear
@@ -775,23 +784,24 @@ onMounted(() => {
style="width: 100%" style="width: 100%"
:options="monthOptions" :options="monthOptions"
/> />
</SelectWithIcon>
</a-col> </a-col>
</a-row> </a-row>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="وضعیت"> <a-form-item label="وضعیت">
<SelectWithIcon :icon="FilterOutlined">
<a-select v-model:value="filterStatus" style="width: 100%" :options="statusOptions" /> <a-select v-model:value="filterStatus" style="width: 100%" :options="statusOptions" />
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="حداقل قابل پرداخت"> <a-form-item label="حداقل قابل پرداخت"><MoneyInput v-model="filterMin" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="filterMin" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="حداکثر قابل پرداخت"> <a-form-item label="حداکثر قابل پرداخت"><MoneyInput v-model="filterMax" addon-after="تومان" :decimals="0" />
<MoneyInput v-model="filterMax" addon-after="تومان" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
@@ -25,10 +25,12 @@ import {
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import type { TableColumnsType } 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 { api } from '@/lib/api';
import type { FinancialAccountDto, FinancialReceivableDto } from '@mento/shared'; import type { FinancialAccountDto, FinancialReceivableDto } from '@mento/shared';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue'; import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
import { toman } from './treasury-format'; import { toman } from './treasury-format';
import { useTreasuryListPaging } from './useTreasuryListPaging'; import { useTreasuryListPaging } from './useTreasuryListPaging';
@@ -245,35 +247,36 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="عنوان"
name="title" name="title"
:rules="[{ required: true, message: 'عنوان الزامی است' }]" :rules="[{ required: true, message: 'عنوان الزامی است' }]"
> label="عنوان"><a-input v-model:value="form.title" placeholder="مثلاً قرارداد فروش">
<a-input v-model:value="form.title" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item label="طرف حساب" name="partyName"> <a-form-item name="partyName" label="طرف حساب"><a-input v-model:value="form.partyName">
<a-input v-model:value="form.partyName" /> <template #prefix><UserOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item <a-form-item
label="مبلغ کل"
name="totalAmount" name="totalAmount"
:rules="[{ required: true, message: 'مبلغ کل الزامی است' }]" :rules="[{ required: true, message: 'مبلغ کل الزامی است' }]"
> label="مبلغ کل"><MoneyInput addon-after="تومان" v-model="form.totalAmount" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="form.totalAmount" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="پیش‌پرداخت" name="prepaidAmount"> <a-form-item name="prepaidAmount" label="پیش‌پرداخت"><MoneyInput addon-after="تومان" v-model="form.prepaidAmount" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="form.prepaidAmount" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="حساب پیش‌پرداخت" name="accountId"> <a-form-item name="accountId" label="حساب پیش‌پرداخت">
<a-select show-search option-filter-prop="label" <SelectWithIcon :icon="BankOutlined">
<a-select
show-search
option-filter-prop="label"
v-model:value="form.accountId" v-model:value="form.accountId"
allow-clear allow-clear
style="width: 100%" style="width: 100%"
@@ -283,24 +286,28 @@ onMounted(() => {
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="تعداد قسط" name="count"> <a-form-item name="count" label="تعداد قسط">
<a-input v-model:value="form.count" :disabled="custom" /> <a-input v-model:value="form.count" :disabled="custom">
<template #prefix><NumberOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="دوره" name="interval"> <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 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="monthly" label="ماهانه">ماهانه</a-select-option>
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option> <a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="شروع" name="startDate"> <a-form-item name="startDate" label="شروع"><JalaliDateInput v-model="form.startDate" :disabled="custom" />
<JalaliDateInput v-model="form.startDate" :disabled="custom" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24"> <a-col :xs="24">
@@ -345,20 +352,20 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item <a-form-item
label="مبلغ"
name="amount" name="amount"
:rules="[{ required: true, message: 'مبلغ الزامی است' }]" :rules="[{ required: true, message: 'مبلغ الزامی است' }]"
> label="مبلغ"><MoneyInput addon-after="تومان" v-model="collect.amount" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="collect.amount" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item <a-form-item
label="حساب مقصد"
name="accountId" name="accountId"
:rules="[{ required: true, message: 'حساب الزامی است' }]" :rules="[{ required: true, message: 'حساب الزامی است' }]"
> label="حساب مقصد">
<a-select show-search option-filter-prop="label" <SelectWithIcon :icon="BankOutlined">
<a-select
show-search
option-filter-prop="label"
v-model:value="collect.accountId" v-model:value="collect.accountId"
allow-clear allow-clear
style="width: 100%" style="width: 100%"
@@ -373,6 +380,7 @@ onMounted(() => {
{{ account.name }} {{ account.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { import {
@@ -18,9 +18,11 @@ import {
Typography, Typography,
message, message,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { AppstoreOutlined, FileTextOutlined, ScheduleOutlined } from '@/icons/ant-bridge';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import MoneyInput from '@/components/MoneyInput.vue'; import MoneyInput from '@/components/MoneyInput.vue';
import JalaliDateInput from '@/components/JalaliDateInput.vue'; import JalaliDateInput from '@/components/JalaliDateInput.vue';
import SelectWithIcon from '@/components/treasury/SelectWithIcon.vue';
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue'; import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
import { toman } from './treasury-format'; import { toman } from './treasury-format';
import { useTreasuryListPaging } from './useTreasuryListPaging'; import { useTreasuryListPaging } from './useTreasuryListPaging';
@@ -115,42 +117,43 @@ onMounted(() => {
<a-row :gutter="[16, 0]"> <a-row :gutter="[16, 0]">
<a-col :xs="24" :md="12"> <a-col :xs="24" :md="12">
<a-form-item <a-form-item
label="عنوان"
name="title" name="title"
:rules="[{ required: true, message: 'عنوان الزامی است' }]" :rules="[{ required: true, message: 'عنوان الزامی است' }]"
> label="عنوان"><a-input v-model:value="form.title">
<a-input v-model:value="form.title" /> <template #prefix><FileTextOutlined /></template>
</a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="نوع" name="kind" :rules="[{ required: true }]"> <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 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="expense" label="هزینه">هزینه</a-select-option>
<a-select-option value="income" label="درآمد">درآمد</a-select-option> <a-select-option value="income" label="درآمد">درآمد</a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item <a-form-item
label="مبلغ"
name="amount" name="amount"
:rules="[{ required: true, message: 'مبلغ الزامی است' }]" :rules="[{ required: true, message: 'مبلغ الزامی است' }]"
> label="مبلغ"><MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
<MoneyInput addon-after="تومان" v-model="form.amount" :decimals="0" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="دوره" name="interval" :rules="[{ required: true }]"> <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 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="monthly" label="ماهانه">ماهانه</a-select-option>
<a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option> <a-select-option value="weekly" label="هفتگی">هفتگی</a-select-option>
<a-select-option value="yearly" label="سالانه">سالانه</a-select-option> <a-select-option value="yearly" label="سالانه">سالانه</a-select-option>
</a-select> </a-select>
</SelectWithIcon>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xs="24" :md="8"> <a-col :xs="24" :md="8">
<a-form-item label="شروع" name="startDate"> <a-form-item name="startDate" label="شروع"><JalaliDateInput v-model="form.startDate" />
<JalaliDateInput v-model="form.startDate" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@@ -16,7 +16,7 @@ import {
Typography, Typography,
} from 'ant-design-vue'; } from 'ant-design-vue';
import type { TableColumnsType } 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 * as XLSX from 'xlsx';
import type { TreasuryPartyBalanceDto } from '@mento/shared'; import type { TreasuryPartyBalanceDto } from '@mento/shared';
import { api } from '@/lib/api'; import { api } from '@/lib/api';