feat(ui): AppSwitcherMenu parity + hub-only warehouse headers + calendar badge removal
- shared AppSwitcherMenu ('پنلها' title, active filled item with ✓ فعلی,
«مدیریت انبار»/«مدیریت تدارکات» switcher, divider + خروج از حساب) used by
both the procurement dashboard and the warehouse hub (PM variant keeps
logout-only); replaced the old raw «بازگشت به دفتر» link
- warehouse header mirrors the procurement pattern: icon + hamburger only
on the hub dashboard; sub-views (تغییر موجودی، کنترل روزانه، انبارها،
کالاهای در راه، سازماندهی) render a minimal header with just the title
and «بازگشت به داشبورد»
- removed the self-referencing «داشبورد انبار» tab from the hub strip
- removed the red per-day transaction-count badges from the daily-control
calendar (backend untouched — purely visual)
- removed the test subtitle «دادهها در پایگاه داده ذخیره میشوند» from the
procurement dashboard header
This commit is contained in:
@@ -5,9 +5,10 @@ import { toast } from "sonner";
|
||||
import { Header, PageLayout } from "../../components/layout/Header";
|
||||
import { EmptyState } from "../../components/EmptyState";
|
||||
import { useAuthStore } from "../../store/auth";
|
||||
import { PanelMenu } from "../../components/PanelMenu";
|
||||
import { accountMenuItems, inventorySubheader, useLogout } from "../Inventory/panelMenu";
|
||||
import { AppSwitcherMenu } from "../../components/AppSwitcherMenu";
|
||||
import { inventorySubheader } from "../Inventory/panelMenu";
|
||||
import { apiV26, type UserRow } from "../../lib/api";
|
||||
import { refreshProcurementStore } from "../../hooks";
|
||||
import { faNum } from "../../lib/formatters";
|
||||
|
||||
const ROLE_LABELS: Record<string, string> = {
|
||||
@@ -21,7 +22,6 @@ const ROLE_LABELS: Record<string, string> = {
|
||||
// (مدیریت پروژهها در «سازماندهی» توسط مدیر تدارکات انجام میشود).
|
||||
export function AdminPanel() {
|
||||
const navigate = useNavigate();
|
||||
const logout = useLogout();
|
||||
const user = useAuthStore((s) => s.user);
|
||||
|
||||
const [users, setUsers] = useState<UserRow[]>([]);
|
||||
@@ -53,6 +53,7 @@ export function AdminPanel() {
|
||||
toast.success(
|
||||
created > 0 ? `همگامسازی انجام شد — ${faNum(created)} کاربر جدید از Casdoor اضافه شد ✓` : "همگامسازی انجام شد — کاربر جدیدی یافت نشد",
|
||||
);
|
||||
refreshProcurementStore();
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : "خطا در همگامسازی با Casdoor");
|
||||
} finally {
|
||||
@@ -71,6 +72,7 @@ export function AdminPanel() {
|
||||
: `نقش مدیر تدارکات از «${u.first_name} ${u.last_name}» گرفته شد`,
|
||||
);
|
||||
await load();
|
||||
refreshProcurementStore();
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : "خطا در تغییر نقش");
|
||||
} finally {
|
||||
@@ -81,7 +83,7 @@ export function AdminPanel() {
|
||||
if (!isAdmin) {
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
<Header title="پنل مدیریت ادمین" menu={<PanelMenu title="پنل مدیریت انبار" items={accountMenuItems(logout)} />} />
|
||||
<Header title="پنل مدیریت ادمین" backTo="/inventory" backLabel="بازگشت به داشبورد انبار" />
|
||||
<PageLayout>
|
||||
<EmptyState emoji="🔒" text="این پنل فقط برای ادمین (سوپر یوزر) است." />
|
||||
</PageLayout>
|
||||
@@ -97,7 +99,7 @@ export function AdminPanel() {
|
||||
backTo="/inventory"
|
||||
backLabel="بازگشت به داشبورد انبار"
|
||||
icon={<ShieldCheck className="h-4.5 w-4.5" strokeWidth={2} />}
|
||||
menu={<PanelMenu title="پنل مدیریت انبار" items={accountMenuItems(logout)} />}
|
||||
menu={<AppSwitcherMenu activeModule="warehouse" />}
|
||||
actions={
|
||||
<button
|
||||
onClick={() => void sync()}
|
||||
|
||||
Reference in New Issue
Block a user