Show cached rial and weight balances on balance-claims activity cards and details.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -158,6 +158,7 @@ function toCard(item: ActivityDto, stageId: string): PipelineDeal {
|
||||
assigneeIds: (item.assignees ?? []).map((a) => a.id),
|
||||
priority: item.priority,
|
||||
activityStatus: item.status,
|
||||
accountBalance: item.accountBalance ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { theme } from 'ant-design-vue';
|
||||
import type { ActivityAccountBalanceDto } from '@mento/shared';
|
||||
import { formatTahesabBedBes } from '@/lib/tahesab';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
balance: ActivityAccountBalanceDto | null | undefined;
|
||||
/** فشردهتر برای کارت کانبان */
|
||||
compact?: boolean;
|
||||
}>(),
|
||||
{ compact: false },
|
||||
);
|
||||
|
||||
const { token } = theme.useToken();
|
||||
|
||||
type Line = {
|
||||
key: string;
|
||||
label: string;
|
||||
text: string;
|
||||
value: number | null;
|
||||
};
|
||||
|
||||
const lines = computed<Line[]>(() => {
|
||||
const bal = props.balance;
|
||||
if (!bal) return [];
|
||||
const out: Line[] = [];
|
||||
if (bal.rialBalance != null && Number.isFinite(bal.rialBalance)) {
|
||||
out.push({
|
||||
key: 'rial',
|
||||
label: 'مانده ریالی',
|
||||
text: `${formatTahesabBedBes(bal.rialBalance, 0)} ریال`,
|
||||
value: bal.rialBalance,
|
||||
});
|
||||
}
|
||||
for (const w of bal.weights ?? []) {
|
||||
if (w.value == null || !Number.isFinite(w.value)) continue;
|
||||
out.push({
|
||||
key: w.key,
|
||||
label: w.label,
|
||||
text: `${formatTahesabBedBes(w.value, 3)} گرم`,
|
||||
value: w.value,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
});
|
||||
|
||||
const visible = computed(() => lines.value.length > 0);
|
||||
|
||||
function toneColor(value: number | null) {
|
||||
if (value == null || !Number.isFinite(value) || value === 0) {
|
||||
return token.value.colorTextSecondary;
|
||||
}
|
||||
return value < 0 ? token.value.colorError : token.value.colorSuccess;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex
|
||||
v-if="visible"
|
||||
vertical
|
||||
:gap="compact ? 2 : 4"
|
||||
:style="{ minWidth: 0, width: '100%' }"
|
||||
>
|
||||
<a-typography-text
|
||||
v-for="line in lines"
|
||||
:key="line.key"
|
||||
dir="ltr"
|
||||
:style="{
|
||||
margin: 0,
|
||||
display: 'block',
|
||||
fontSize: `${compact ? token.fontSizeSM : token.fontSize}px`,
|
||||
fontWeight: 600,
|
||||
color: toneColor(line.value),
|
||||
textAlign: 'right',
|
||||
direction: 'rtl',
|
||||
}"
|
||||
:title="`${line.label}: ${line.text}`"
|
||||
>
|
||||
<a-typography-text
|
||||
type="secondary"
|
||||
:style="{
|
||||
fontSize: `${token.fontSizeSM}px`,
|
||||
fontWeight: 500,
|
||||
marginInlineEnd: '6px',
|
||||
}"
|
||||
>
|
||||
{{ line.label }}:
|
||||
</a-typography-text>
|
||||
{{ line.text }}
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</template>
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { canCollaborateOnActivity, canMutateActivity } from '@/lib/activity-access';
|
||||
import ActivityCommentSheet from '@/components/activities/ActivityCommentSheet.vue';
|
||||
import ActivityAccountBalances from '@/components/activities/ActivityAccountBalances.vue';
|
||||
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -555,6 +556,16 @@ function openFull() {
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<div
|
||||
v-if="activity.accountBalance"
|
||||
:style="{ marginTop: '12px' }"
|
||||
>
|
||||
<a-typography-text type="secondary" :style="{ display: 'block', marginBottom: '4px' }">
|
||||
مانده حساب
|
||||
</a-typography-text>
|
||||
<ActivityAccountBalances :balance="activity.accountBalance" />
|
||||
</div>
|
||||
|
||||
<a-divider :style="{ margin: '16px 0 12px' }" />
|
||||
<a-flex justify="space-between" align="center" :style="{ marginBottom: '8px' }">
|
||||
<a-typography-text strong>یادداشت</a-typography-text>
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import DealQuickActivityPopover from '@/components/pipeline/DealQuickActivityPopover.vue';
|
||||
import ActivityAccountBalances from '@/components/activities/ActivityAccountBalances.vue';
|
||||
import { calendarDaysBetween, formatJalaliNumeric } from '@/lib/jalali';
|
||||
import { userAvatarSrc } from '@/lib/userAvatars';
|
||||
import type { PipelineAccent, PipelineDeal, PipelineUiCopy } from '@/lib/pipeline-board';
|
||||
@@ -244,6 +245,12 @@ const cardStyle = computed(() => ({
|
||||
>
|
||||
{{ deal.description }}
|
||||
</a-typography-text>
|
||||
<ActivityAccountBalances
|
||||
v-if="deal.accountBalance"
|
||||
:balance="deal.accountBalance"
|
||||
compact
|
||||
:style="{ marginTop: '6px' }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span :data-card-id="deal.id">
|
||||
|
||||
Reference in New Issue
Block a user