mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 17:46:28 +00:00
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:
@@ -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) */}
|
||||
|
||||
Reference in New Issue
Block a user