feat: show retail dashboard figures to the super admin only
پنل: بخشهای «تک فروشی» داشبورد (کارت، نمودار روند و تفکیک عمده/تک) فقط برای مدیر اصلی نمایش داده میشود. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
0520aaf1b1
commit
640a42da05
@@ -80,12 +80,12 @@
|
||||
<div class="panel__head">
|
||||
<div>
|
||||
<h3 class="panel__title">روند سفارشها</h3>
|
||||
<p class="panel__sub">۳۰ روز گذشته، تفکیک تک و عمده</p>
|
||||
<p class="panel__sub">{{ isSuper ? '۳۰ روز گذشته، تفکیک تک و عمده' : '۳۰ روز گذشته' }}</p>
|
||||
</div>
|
||||
<a-segmented v-model:value="trendType" :options="trendTypeOptions" size="small" />
|
||||
</div>
|
||||
<div class="trend-totals">
|
||||
<div class="trend-totals__item">
|
||||
<div v-if="isSuper" class="trend-totals__item">
|
||||
<span class="dot" :style="{ background: COLOR_PRIMARY }"></span>
|
||||
<span>تک فروشی</span>
|
||||
<b>{{ fmt(retailTotal) }}</b>
|
||||
@@ -105,7 +105,7 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div v-if="isSuper" class="panel">
|
||||
<div class="panel__head">
|
||||
<div>
|
||||
<h3 class="panel__title">تفکیک عمده / تک</h3>
|
||||
@@ -295,10 +295,14 @@ import {
|
||||
} from '@ant-design/icons-vue';
|
||||
import { jdate, price } from '../utils/filters';
|
||||
import { useLayoutStore } from '../stores/layout';
|
||||
import { useUsersStore } from '../stores/users';
|
||||
import api from '../api/client';
|
||||
|
||||
const loading = ref(false);
|
||||
const layout = useLayoutStore();
|
||||
// Retail («تک فروشی») figures are for the super admin only; the API also omits them.
|
||||
const users = useUsersStore();
|
||||
const isSuper = computed(() => users.isSuperAdmin);
|
||||
|
||||
const chartHeight = computed(() => (layout.isMobile ? 240 : 300));
|
||||
const donutHeight = computed(() => (layout.isMobile ? 220 : 240));
|
||||
@@ -419,14 +423,13 @@ const wholesaleTotal = computed(() =>
|
||||
);
|
||||
const trendSeries = computed(() => {
|
||||
const trend: OrdersTrendPoint[] = data.ordersTrend ?? [];
|
||||
return [
|
||||
{ name: 'تک فروشی', data: trend.map((d) => d.retail) },
|
||||
{ name: 'عمده فروشی', data: trend.map((d) => d.wholesale) },
|
||||
];
|
||||
const wholesale = { name: 'عمده فروشی', data: trend.map((d) => d.wholesale) };
|
||||
if (!isSuper.value) return [wholesale];
|
||||
return [{ name: 'تک فروشی', data: trend.map((d) => d.retail) }, wholesale];
|
||||
});
|
||||
const trendChartOptions = computed(() => ({
|
||||
chart: { ...BASE_CHART, stacked: trendType.value === 'bar' },
|
||||
colors: [COLOR_PRIMARY, COLOR_SUCCESS],
|
||||
colors: isSuper.value ? [COLOR_PRIMARY, COLOR_SUCCESS] : [COLOR_SUCCESS],
|
||||
dataLabels: { enabled: false },
|
||||
stroke: trendType.value === 'area' ? { curve: 'smooth', width: 2.5 } : { width: 0 },
|
||||
fill:
|
||||
|
||||
Reference in New Issue
Block a user