2026-03-25 22:15:06 +01:00
|
|
|
|
import { A, useNavigate } from '@solidjs/router';
|
|
|
|
|
|
import { createResource, createSignal, For, Show } from 'solid-js';
|
|
|
|
|
|
import { Search } from 'lucide-solid';
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
import AdminShell from '~/components/AdminShell';
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
|
|
|
|
|
|
const API = '/api/gateway';
|
|
|
|
|
|
|
|
|
|
|
|
type Role = {
|
|
|
|
|
|
id: string;
|
2026-03-25 22:15:06 +01:00
|
|
|
|
key: string;
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
name: string;
|
2026-03-25 22:15:06 +01:00
|
|
|
|
audience: string;
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
description?: string;
|
2026-03-25 22:15:06 +01:00
|
|
|
|
department_name?: string;
|
|
|
|
|
|
is_active: boolean;
|
|
|
|
|
|
users_assigned: number;
|
|
|
|
|
|
permissions_count: number;
|
|
|
|
|
|
created_at: string;
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-03-25 22:15:06 +01:00
|
|
|
|
type ListResponse = {
|
|
|
|
|
|
roles: Role[];
|
|
|
|
|
|
total: number;
|
|
|
|
|
|
page: number;
|
|
|
|
|
|
per_page: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
async function loadRoles(params: { q: string; page: number }): Promise<ListResponse> {
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
try {
|
2026-03-25 22:15:06 +01:00
|
|
|
|
const qs = new URLSearchParams({
|
|
|
|
|
|
audience: 'INTERNAL',
|
|
|
|
|
|
q: params.q,
|
|
|
|
|
|
page: String(params.page),
|
|
|
|
|
|
per_page: '8',
|
|
|
|
|
|
});
|
|
|
|
|
|
const res = await fetch(`${API}/api/admin/roles?${qs}`);
|
|
|
|
|
|
if (!res.ok) throw new Error('Failed');
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
const data = await res.json();
|
2026-03-25 22:15:06 +01:00
|
|
|
|
if (data.roles) return data;
|
|
|
|
|
|
// flat array fallback
|
|
|
|
|
|
return { roles: Array.isArray(data) ? data : [], total: 0, page: 1, per_page: 8 };
|
|
|
|
|
|
} catch {
|
|
|
|
|
|
return { roles: [], total: 0, page: 1, per_page: 8 };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatDate(iso: string) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const d = new Date(iso);
|
|
|
|
|
|
return d.toISOString().slice(0, 10);
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
} catch {
|
2026-03-25 22:15:06 +01:00
|
|
|
|
return '—';
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-25 22:15:06 +01:00
|
|
|
|
export default function InternalRolesListPage() {
|
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
const [search, setSearch] = createSignal('');
|
|
|
|
|
|
const [debouncedSearch, setDebouncedSearch] = createSignal('');
|
|
|
|
|
|
const [page, setPage] = createSignal(1);
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
const [deleting, setDeleting] = createSignal('');
|
2026-03-25 22:15:06 +01:00
|
|
|
|
|
|
|
|
|
|
let debounceTimer: ReturnType<typeof setTimeout>;
|
|
|
|
|
|
const handleSearch = (val: string) => {
|
|
|
|
|
|
setSearch(val);
|
|
|
|
|
|
clearTimeout(debounceTimer);
|
|
|
|
|
|
debounceTimer = setTimeout(() => {
|
|
|
|
|
|
setDebouncedSearch(val);
|
|
|
|
|
|
setPage(1);
|
|
|
|
|
|
}, 300);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const [data, { refetch }] = createResource(
|
|
|
|
|
|
() => ({ q: debouncedSearch(), page: page() }),
|
|
|
|
|
|
loadRoles,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const totalPages = () => {
|
|
|
|
|
|
const d = data();
|
|
|
|
|
|
if (!d || d.per_page === 0) return 1;
|
|
|
|
|
|
return Math.max(1, Math.ceil(d.total / d.per_page));
|
|
|
|
|
|
};
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (id: string, name: string) => {
|
|
|
|
|
|
if (!confirm(`Delete role "${name}"? This cannot be undone.`)) return;
|
2026-03-25 22:15:06 +01:00
|
|
|
|
setDeleting(id);
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
try {
|
|
|
|
|
|
const res = await fetch(`${API}/api/admin/roles/${id}`, { method: 'DELETE' });
|
2026-03-25 22:15:06 +01:00
|
|
|
|
if (!res.ok) throw new Error('Failed');
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
refetch();
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setDeleting('');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<AdminShell>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<div class="flex flex-col gap-0 -mx-6 -mt-6 min-h-full">
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
|
2026-03-25 22:15:06 +01:00
|
|
|
|
{/* Page title */}
|
|
|
|
|
|
<div class="bg-white border-b border-[#e5e7eb] px-6 py-5">
|
|
|
|
|
|
<h1 class="text-[20px] font-semibold text-[#000032]">Internal Role Management</h1>
|
|
|
|
|
|
<p class="text-[13px] text-[rgba(0,0,50,0.5)] mt-0.5">Manage internal roles and permissions</p>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-03-25 22:15:06 +01:00
|
|
|
|
{/* Card */}
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
<div class="p-6">
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<div class="rounded-xl border border-[#e5e7eb] bg-white shadow-sm overflow-hidden">
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
|
2026-03-25 22:15:06 +01:00
|
|
|
|
{/* Tabs */}
|
|
|
|
|
|
<div class="flex border-b border-[#e5e7eb] px-6">
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="relative py-4 text-[14px] font-semibold text-[#fa5014] mr-6"
|
|
|
|
|
|
>
|
|
|
|
|
|
All Roles
|
|
|
|
|
|
<span class="absolute bottom-0 left-0 right-0 h-[2px] bg-[#fa5014] rounded-t" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<A
|
|
|
|
|
|
href="/admin/roles/create"
|
|
|
|
|
|
class="py-4 text-[14px] font-medium text-[rgba(0,0,50,0.5)] hover:text-[#000032]"
|
|
|
|
|
|
>
|
|
|
|
|
|
Create Role
|
|
|
|
|
|
</A>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Toolbar */}
|
|
|
|
|
|
<div class="flex items-center gap-3 px-6 py-4 border-b border-[#e5e7eb]">
|
|
|
|
|
|
<div class="relative flex-1 max-w-[280px]">
|
|
|
|
|
|
<Search size={15} class="absolute left-3 top-1/2 -translate-y-1/2 text-[#9195ad]" />
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder="Search roles..."
|
|
|
|
|
|
value={search()}
|
|
|
|
|
|
onInput={(e) => handleSearch(e.currentTarget.value)}
|
|
|
|
|
|
class="w-full pl-9 pr-3 py-2 text-[13px] border border-[#e5e7eb] rounded-lg outline-none focus:border-[#fa5014] focus:ring-1 focus:ring-[#fa5014] bg-white"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<select class="text-[13px] border border-[#e5e7eb] rounded-lg px-3 py-2 outline-none bg-white text-[rgba(0,0,50,0.6)] focus:border-[#fa5014]">
|
|
|
|
|
|
<option value="">All Departments</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select class="text-[13px] border border-[#e5e7eb] rounded-lg px-3 py-2 outline-none bg-white text-[rgba(0,0,50,0.6)] focus:border-[#fa5014]">
|
|
|
|
|
|
<option value="">All Statuses</option>
|
|
|
|
|
|
<option value="active">Active</option>
|
|
|
|
|
|
<option value="inactive">Inactive</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Table */}
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
<div class="overflow-x-auto">
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<table class="w-full">
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
<thead>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<tr class="bg-[#000032] text-white text-[12px] font-semibold uppercase tracking-wide">
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Role Name</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Department</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Users Assigned</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Permissions Count</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Status</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Created Date</th>
|
|
|
|
|
|
<th class="px-6 py-3 text-left">Actions</th>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
</tr>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</thead>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<tbody class="divide-y divide-[#e5e7eb]">
|
|
|
|
|
|
<Show when={data.loading}>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td colspan="7" class="px-6 py-10 text-center text-[13px] text-[rgba(0,0,50,0.4)]">
|
|
|
|
|
|
Loading roles…
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</Show>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<Show when={!data.loading && (data()?.roles?.length ?? 0) === 0}>
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td colspan="7" class="px-6 py-10 text-center text-[13px] text-[rgba(0,0,50,0.4)]">
|
|
|
|
|
|
No internal roles found.{' '}
|
|
|
|
|
|
<A href="/admin/roles/create" class="text-[#fa5014] hover:underline">
|
|
|
|
|
|
Create your first role.
|
|
|
|
|
|
</A>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</Show>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<For each={data()?.roles ?? []}>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
{(role) => (
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<tr class="hover:bg-[#fafafa] transition-colors">
|
|
|
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
|
<p class="text-[14px] font-semibold text-[#000032]">{role.name}</p>
|
|
|
|
|
|
<p class="text-[12px] text-[rgba(0,0,50,0.4)] mt-0.5">{role.key}</p>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-6 py-4 text-[13px] text-[rgba(0,0,50,0.7)]">
|
|
|
|
|
|
{role.department_name || '—'}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-6 py-4 text-[14px] font-semibold text-[#000032]">
|
|
|
|
|
|
{role.users_assigned}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
|
<span class="inline-flex items-center px-2.5 py-1 rounded-md bg-[rgba(250,80,20,0.1)] text-[#fa5014] text-[12px] font-semibold">
|
|
|
|
|
|
{role.permissions_count} Permissions
|
|
|
|
|
|
</span>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</td>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
|
<Show
|
|
|
|
|
|
when={role.is_active}
|
|
|
|
|
|
fallback={
|
|
|
|
|
|
<span class="inline-flex items-center px-2.5 py-1 rounded-md bg-[#f1f1f1] text-[rgba(0,0,50,0.5)] text-[12px] font-semibold">
|
|
|
|
|
|
Inactive
|
|
|
|
|
|
</span>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="inline-flex items-center px-2.5 py-1 rounded-md bg-[rgba(34,197,94,0.1)] text-[#16a34a] text-[12px] font-semibold">
|
|
|
|
|
|
Active
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</Show>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-6 py-4 text-[13px] text-[rgba(0,0,50,0.6)]">
|
|
|
|
|
|
{formatDate(role.created_at)}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
|
<A
|
|
|
|
|
|
href={`/admin/roles/${role.id}`}
|
|
|
|
|
|
class="text-[12px] font-medium text-[#000032] hover:text-[#fa5014] transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
View
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</A>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<span class="text-[#e5e7eb]">|</span>
|
|
|
|
|
|
<A
|
|
|
|
|
|
href={`/admin/roles/${role.id}/edit`}
|
|
|
|
|
|
class="text-[12px] font-medium text-[#000032] hover:text-[#fa5014] transition-colors"
|
|
|
|
|
|
>
|
|
|
|
|
|
Edit
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</A>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
<span class="text-[#e5e7eb]">|</span>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
<button
|
|
|
|
|
|
disabled={deleting() === role.id}
|
|
|
|
|
|
onClick={() => handleDelete(role.id, role.name)}
|
2026-03-25 22:15:06 +01:00
|
|
|
|
class="text-[12px] font-medium text-red-500 hover:text-red-700 transition-colors disabled:opacity-50"
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
{deleting() === role.id ? '…' : 'Delete'}
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</For>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
2026-03-25 22:15:06 +01:00
|
|
|
|
|
|
|
|
|
|
{/* Pagination */}
|
|
|
|
|
|
<Show when={!data.loading && (data()?.total ?? 0) > 0}>
|
|
|
|
|
|
<div class="flex items-center justify-between px-6 py-4 border-t border-[#e5e7eb]">
|
|
|
|
|
|
<p class="text-[13px] text-[rgba(0,0,50,0.5)]">
|
|
|
|
|
|
Showing {((page() - 1) * (data()?.per_page ?? 8)) + 1}–
|
|
|
|
|
|
{Math.min(page() * (data()?.per_page ?? 8), data()?.total ?? 0)} of {data()?.total ?? 0} roles
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div class="flex items-center gap-1">
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => setPage((p) => Math.max(1, p - 1))}
|
|
|
|
|
|
disabled={page() <= 1}
|
|
|
|
|
|
class="h-8 w-8 flex items-center justify-center rounded-lg border border-[#e5e7eb] text-[rgba(0,0,50,0.5)] hover:border-[#000032] disabled:opacity-40 transition-colors text-[13px]"
|
|
|
|
|
|
>
|
|
|
|
|
|
‹
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<For each={Array.from({ length: totalPages() }, (_, i) => i + 1)}>
|
|
|
|
|
|
{(p) => (
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => setPage(p)}
|
|
|
|
|
|
class={`h-8 w-8 flex items-center justify-center rounded-lg text-[13px] font-medium transition-colors ${
|
|
|
|
|
|
p === page()
|
|
|
|
|
|
? 'bg-[#fa5014] text-white'
|
|
|
|
|
|
: 'border border-[#e5e7eb] text-[rgba(0,0,50,0.6)] hover:border-[#000032]'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{p}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</For>
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => setPage((p) => Math.min(totalPages(), p + 1))}
|
|
|
|
|
|
disabled={page() >= totalPages()}
|
|
|
|
|
|
class="h-8 w-8 flex items-center justify-center rounded-lg border border-[#e5e7eb] text-[rgba(0,0,50,0.5)] hover:border-[#000032] disabled:opacity-40 transition-colors text-[13px]"
|
|
|
|
|
|
>
|
|
|
|
|
|
›
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Show>
|
2026-03-24 02:36:40 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
ui(step-1): match reference layout for dept/designation/employees/roles pages
- All pages: white sticky page header + tab bar with orange underline,
-mx-6 -mt-6 negative margin to stretch headers edge-to-edge
- department: full columns (ID, Name, Description, Created By, etc.),
icon-only action buttons, navy Add Department button
- designation: Designations List / Add Designation tabs, status filter
dropdown, inline create/edit form, full columns with status badge
- employees: View/Add tabs, icon-only action buttons, status badges
- roles/index: clean table with Name+code subtext, Description, actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 04:47:05 +01:00
|
|
|
|
</div>
|
feat(admin): build complete admin panel with UI parity and search/filter
- Implement all admin management pages (employees, users, jobs, leads, orders, companies, customers, candidates, approval, invoices, reviews, support, KB, pricing, coupons, credits, discounts, tax, reports, ledger)
- Implement 9 professional vertical pages (developers, designers, tutors, video editors, photographers, makeup artists, graphic designers, social media managers, fitness trainers)
- Implement internal/external dashboard and role management with builder UI
- Fix tab styling: replace inline border-bottom styles with admin-tab CSS class across 8+ pages
- Add search/filter functionality to invoice and review pages
- Add toggle status (activate/deactivate) to employees page with PATCH /api/admin/employees/{id}
- Align UI styling with NextJS admin panel for visual parity
- Add stat cards to approval page showing counts by status
- Implement graceful empty states for all list views
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 13:04:10 +01:00
|
|
|
|
</AdminShell>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|