TorbatYar/frontend/modules/beauty/features/owner/staff-commissions.tsx
Mortezakoohjani 6f4a484051 Migrate Beauty, Healthcare, and Accounting frontend to modular src/modules architecture.
Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:28:27 +03:30

50 lines
1.5 KiB
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { beautyBusinessApi } from "@/modules/beauty/services/beauty-business-api";
import { useTenantId } from "@/hooks/useTenantId";
import {
PageHeader,
DataTable,
EmptyState,
LoadingState,
ErrorState,
Badge,
} from "@/components/ds";
export default function CommissionsPage() {
const { tenantId } = useTenantId();
const listQ = useQuery({
queryKey: ["beauty", tenantId, "commission-rules"],
queryFn: () => beautyBusinessApi.commissionRules.list(tenantId!),
enabled: !!tenantId,
});
if (!tenantId || listQ.isLoading) return <LoadingState />;
if (listQ.error) {
return <ErrorState message={listQ.error.message} onRetry={() => listQ.refetch()} />;
}
return (
<div>
<PageHeader title="قوانین کمیسیون" description="قوانین پورسانت پرسنل." />
<DataTable
columns={[
{ key: "code", header: "کد" },
{ key: "name", header: "نام" },
{ key: "rule_type", header: "نوع" },
{ key: "rate_percent", header: "درصد" },
{
key: "status",
header: "وضعیت",
render: (r) => <Badge>{String(r.status)}</Badge>,
},
]}
rows={(listQ.data ?? []) as unknown as Record<string, unknown>[]}
empty={<EmptyState title="قانون کمیسیونی ثبت نشده" />}
/>
</div>
);
}