feat(resource): remove ResourceCategoriesPanel and related functionality from ResourceDetailPage
This commit is contained in:
@@ -188,17 +188,18 @@ describe('ResourceDetailPage', () => {
|
||||
expect(screen.queryByRole('button', { name: /کپی/ })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('تب دستهبندی فقط انتخاب میدهد، نه ساخت', async () => {
|
||||
/**
|
||||
* دستهبندی از این صفحه برداشته شد: چیزی که کاربر مینوشت هیچجا خوانده نمیشد و
|
||||
* «کدام منبع این سرویس را میدهد» را تب سرویسها صریحتر جواب میدهد.
|
||||
*/
|
||||
it('تب دستهبندی وجود ندارد و لینک قدیمی به تب اطلاعات میافتد', async () => {
|
||||
mockApi();
|
||||
const user = userEvent.setup();
|
||||
renderPage();
|
||||
renderPage('/admin/resources/r1?tab=categories');
|
||||
|
||||
// نبودِ تب وقتی معنا دارد که صفحه واقعاً رندر شده باشد.
|
||||
await waitFor(() => expect(screen.getByText('ظرفیت همزمان')).toBeInTheDocument());
|
||||
await user.click(screen.getByRole('button', { name: 'دستهبندیها' }));
|
||||
|
||||
await waitFor(() => expect(screen.getByText(/فقط انتخاب میشود/)).toBeInTheDocument());
|
||||
expect(screen.queryByRole('button', { name: /افزودن دستهبندی جدید/ })).not.toBeInTheDocument();
|
||||
expect(screen.getByText('تنظیمات ← دستهبندیها')).toHaveAttribute('href', '/admin/service-categories');
|
||||
expect(screen.queryByRole('button', { name: 'دستهبندیها' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('دست')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
/** تب استثناها فقط دو ورودی دارد: تعطیلات رسمی، و مرخصی و سرویس. */
|
||||
|
||||
@@ -9,7 +9,6 @@ import ResourceWorkingHoursPanel from '../components/resources/ResourceWorkingHo
|
||||
import ResourceExceptionsPanel from '../components/resources/ResourceExceptionsPanel';
|
||||
import ResourceServicesPanel from '../components/resources/ResourceServicesPanel';
|
||||
import ResourceSkillsPanel from '../components/resources/ResourceSkillsPanel';
|
||||
import ResourceCategoriesPanel from '../components/resources/ResourceCategoriesPanel';
|
||||
import ResourceBlocksPanel from '../components/resources/ResourceBlocksPanel';
|
||||
import { useUrlState } from '../hooks/useUrlState';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
@@ -23,7 +22,6 @@ const TABS = [
|
||||
{ id: 'exceptions', label: 'تعطیلات و استثنا' },
|
||||
{ id: 'services', label: 'سرویسها' },
|
||||
{ id: 'skills', label: 'مهارتها' },
|
||||
{ id: 'categories', label: 'دستهبندیها' },
|
||||
{ id: 'blocks', label: 'غیرفعالسازی موقت' },
|
||||
] as const;
|
||||
type TabId = typeof TABS[number]['id'];
|
||||
@@ -49,7 +47,7 @@ export default function ResourceDetailPage() {
|
||||
const { resource, loading } = useResourceDetail(resourceUuid);
|
||||
const { types } = useResourceTypes();
|
||||
const { skills } = useSkills();
|
||||
const { update, setSkills, setCategories } = useResources();
|
||||
const { update, setSkills } = useResources();
|
||||
const { offerings, save: saveServices } = useResourceServices(resourceUuid);
|
||||
const { items: serviceOptions } = useAllServiceItems();
|
||||
const { can } = usePermissions();
|
||||
@@ -143,15 +141,6 @@ export default function ResourceDetailPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === 'categories' && (
|
||||
<ResourceCategoriesPanel
|
||||
resource={resource}
|
||||
canUpdate={canUpdate}
|
||||
saving={setCategories.isPending}
|
||||
onSave={(categoryUuids) => setCategories.mutate({ uuid: resource.uuid, categoryUuids })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{tab === 'blocks' && <ResourceBlocksPanel resourceUuid={resourceUuid} canUpdate={canUpdate} />}
|
||||
|
||||
<ConfirmDialog
|
||||
@@ -229,15 +218,6 @@ function InfoTab({ resource, canUpdate, toggling, onToggleActive }: {
|
||||
</span>
|
||||
)}
|
||||
</Row>
|
||||
<Row label="دستهبندیها">
|
||||
{(resource.categories ?? []).length === 0 ? '—' : (
|
||||
<span style={{ display: 'inline-flex', gap: 4, flexWrap: 'wrap' }}>
|
||||
{(resource.categories ?? []).map((c) => (
|
||||
<span key={c.uuid} className="badge gray" style={{ fontSize: 11 }}>{c.name}</span>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
</Row>
|
||||
{attributes.map(([key, value]) => (
|
||||
<Row key={key} label={key}>{String(value)}</Row>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user