fix(settings): every settings page renders the settings shell
Resources, branches, price lists, holidays and the new categories page sat in the settings menu but rendered bare, so clicking one made the settings sidebar disappear — the subscription page was the only one that kept it. Eleven pages now wrap in SettingsLayout with the key of the menu entry they belong to, and the four resource pages (list, types, skills, pools) share one menu entry plus a sub-nav between them, rather than four entries that would make the menu a third longer without making anything clearer. .seg accepts `a` as well as `button`, and treats `active` as an alias of `on`. Both were needed: cross-page tabs must be real links, and the pages already using `active` (service detail, clinic appointment settings) had no visible highlight at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { useUrlState } from '../hooks/useUrlState';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
import { useBranches } from '../hooks/useBranches';
|
||||
import type { Branch } from '../types';
|
||||
import SettingsLayout from '../components/layout/SettingsLayout';
|
||||
|
||||
/**
|
||||
* شعبهها — همان محلهای نوبتدهی محیط جاری.
|
||||
@@ -91,65 +92,67 @@ export default function BranchesPage() {
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="fade-in">
|
||||
<PageHeader
|
||||
title="شعبهها و اتاقها"
|
||||
description="ساعت کاری هر محل نوبتدهی و اتاقهای آن. نام و آدرس شعبه در صفحهٔ همان کلینیک یا پزشک ویرایش میشود."
|
||||
backTo="/admin/settings-menu"
|
||||
/>
|
||||
<SettingsLayout active="branches">
|
||||
<div className="fade-in">
|
||||
<PageHeader
|
||||
title="شعبهها و اتاقها"
|
||||
description="ساعت کاری هر محل نوبتدهی و اتاقهای آن. نام و آدرس شعبه در صفحهٔ همان کلینیک یا پزشک ویرایش میشود."
|
||||
backTo="/admin/settings-menu"
|
||||
/>
|
||||
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={rows}
|
||||
loading={loading}
|
||||
searchValue={urlState.search}
|
||||
onSearchChange={(v) => setUrlState({ search: v })}
|
||||
searchPlaceholder="جستجو در شعبهها..."
|
||||
emptyMessage="هیچ شعبهای برای این محیط ثبت نشده است"
|
||||
headerExtra={
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginRight: 'auto' }}>
|
||||
<StatusFilter
|
||||
value={urlState.status}
|
||||
onChange={(v) => setUrlState({ status: v })}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
actions={(b) => (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<Link className="btn secondary sm" to={`/admin/branches/${b.uuid}/working-hours`}>
|
||||
<ClockIcon style={{ width: 15 }} /> ساعت کاری
|
||||
</Link>
|
||||
<Link className="btn secondary sm" to={`/admin/branches/${b.uuid}/rooms`}>
|
||||
<Squares2X2Icon style={{ width: 15 }} /> اتاقها
|
||||
</Link>
|
||||
{canUpdate && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn secondary sm"
|
||||
disabled={update.isPending}
|
||||
title={
|
||||
b.active && activeCount === 1
|
||||
? 'با غیرفعال کردن این شعبه، هیچ شعبهٔ فعالی باقی نمیماند'
|
||||
: undefined
|
||||
}
|
||||
onClick={() => {
|
||||
if (
|
||||
b.active &&
|
||||
activeCount === 1 &&
|
||||
!window.confirm('این تنها شعبهٔ فعال است. با غیرفعال کردن آن، هیچ شعبهٔ فعالی باقی نمیماند. ادامه میدهید؟')
|
||||
) {
|
||||
return;
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={rows}
|
||||
loading={loading}
|
||||
searchValue={urlState.search}
|
||||
onSearchChange={(v) => setUrlState({ search: v })}
|
||||
searchPlaceholder="جستجو در شعبهها..."
|
||||
emptyMessage="هیچ شعبهای برای این محیط ثبت نشده است"
|
||||
headerExtra={
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginRight: 'auto' }}>
|
||||
<StatusFilter
|
||||
value={urlState.status}
|
||||
onChange={(v) => setUrlState({ status: v })}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
actions={(b) => (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<Link className="btn secondary sm" to={`/admin/branches/${b.uuid}/working-hours`}>
|
||||
<ClockIcon style={{ width: 15 }} /> ساعت کاری
|
||||
</Link>
|
||||
<Link className="btn secondary sm" to={`/admin/branches/${b.uuid}/rooms`}>
|
||||
<Squares2X2Icon style={{ width: 15 }} /> اتاقها
|
||||
</Link>
|
||||
{canUpdate && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn secondary sm"
|
||||
disabled={update.isPending}
|
||||
title={
|
||||
b.active && activeCount === 1
|
||||
? 'با غیرفعال کردن این شعبه، هیچ شعبهٔ فعالی باقی نمیماند'
|
||||
: undefined
|
||||
}
|
||||
update.mutate({ uuid: b.uuid, d: { active: !b.active } });
|
||||
}}
|
||||
>
|
||||
{b.active ? 'غیرفعال کردن' : 'فعال کردن'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
onClick={() => {
|
||||
if (
|
||||
b.active &&
|
||||
activeCount === 1 &&
|
||||
!window.confirm('این تنها شعبهٔ فعال است. با غیرفعال کردن آن، هیچ شعبهٔ فعالی باقی نمیماند. ادامه میدهید؟')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
update.mutate({ uuid: b.uuid, d: { active: !b.active } });
|
||||
}}
|
||||
>
|
||||
{b.active ? 'غیرفعال کردن' : 'فعال کردن'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</SettingsLayout>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user