Align task pages with access permissions

Use the shared page-permission helper across task routes and gate client creation controls on CREATE_CLIENT. Remove an unused profile permission import.
This commit is contained in:
Ichsan Kurniawan
2026-11-17 21:46:07 +07:00
parent 69a325a376
commit faa22e93e0
8 changed files with 25 additions and 22 deletions
+12 -9
View File
@@ -15,9 +15,10 @@ import { calculateOverviewStats } from '../utils/client-overview-helpers';
interface HomeTaskProps {
clients?: IClient[];
actions?: string[]
}
export default function HomeTask({ clients = [] }: HomeTaskProps) {
export default function HomeTask({ clients = [], actions }: HomeTaskProps) {
const router = useRouter();
const [showForm, setShowForm] = useState(false);
@@ -60,14 +61,16 @@ export default function HomeTask({ clients = [] }: HomeTaskProps) {
Complete overview of all clients, projects, personnel and work orders in one place.
</p>
</div>
<div className="flex items-center gap-3 shrink-0">
<Button
className="gap-2 w-full sm:w-auto shrink-0 font-medium"
onClick={() => setShowForm(true)}
>
<Plus className="w-4 h-4" /> Add Client
</Button>
</div>
{actions?.includes("CREATE_CLIENT") &&
<div className="flex items-center gap-3 shrink-0">
<Button
className="gap-2 w-full sm:w-auto shrink-0 font-medium"
onClick={() => setShowForm(true)}
>
<Plus className="w-4 h-4" /> Add Client
</Button>
</div>
}
</div>
{/* Top Stat Cards (4 Cards Grid) */}