Add firm admin onboarding for partner manager and staff
This commit is contained in:
+30
-5
@@ -1,22 +1,47 @@
|
||||
<div class="rounded-3xl border border-slate-200 bg-white shadow-soft">
|
||||
<div class="flex flex-col gap-3 border-b border-slate-100 p-5 md:flex-row md:items-center md:justify-between">
|
||||
<div><h2 class="text-lg font-bold text-slate-900">Users & Roles</h2><p class="text-sm text-slate-500">Firm Admin controls user invitations, branch mapping and role mapping.</p></div>
|
||||
<a href="/system-settings/users" class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-700">Manage Users</a>
|
||||
<div class="flex flex-col gap-3 border-b border-slate-100 p-5 xl:flex-row xl:items-center xl:justify-between">
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-slate-900">Users & Roles</h2>
|
||||
<p class="text-sm text-slate-500">Firm Admin controls user invitations, branch mapping, employee linking and role mapping.</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<a href="/firm-admin/users/new?role=partner" class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-700">+ Add Partner</a>
|
||||
<a href="/firm-admin/users/new?role=manager" class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-700">+ Add Manager</a>
|
||||
<a href="/firm-admin/users/new?role=staff" class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-700">+ Add Staff</a>
|
||||
<a href="/system-settings/users" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Manage Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-slate-100 text-sm">
|
||||
<thead class="bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500"><tr><th class="px-5 py-3">User</th><th class="px-5 py-3">Roles</th><th class="px-5 py-3">Login Status</th><th class="px-5 py-3">Designation</th><th class="px-5 py-3">Mobile</th></tr></thead>
|
||||
<thead class="bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">
|
||||
<tr>
|
||||
<th class="px-5 py-3">User</th>
|
||||
<th class="px-5 py-3">Roles</th>
|
||||
<th class="px-5 py-3">Employee Link</th>
|
||||
<th class="px-5 py-3">Login Status</th>
|
||||
<th class="px-5 py-3">Designation</th>
|
||||
<th class="px-5 py-3">Mobile</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
{% for user in users %}
|
||||
<tr class="hover:bg-slate-50">
|
||||
<td class="px-5 py-3"><div class="font-semibold text-slate-900">{{ user.name }}</div><div class="text-xs text-slate-500">{{ user.email }}</div></td>
|
||||
<td class="px-5 py-3"><div class="flex flex-wrap gap-1">{% for role in user.roles %}<span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-700">{{ role }}</span>{% else %}<span class="text-xs text-amber-700">No role</span>{% endfor %}</div></td>
|
||||
<td class="px-5 py-3 text-xs">
|
||||
{% if user.employee_linked %}
|
||||
<span class="rounded-full bg-emerald-50 px-2 py-1 font-semibold text-emerald-700">Linked</span>
|
||||
<div class="mt-1 text-slate-500">{{ user.employee_code or ('#' ~ user.employee_id) }}</div>
|
||||
{% else %}
|
||||
<span class="rounded-full bg-amber-50 px-2 py-1 font-semibold text-amber-700">Not linked</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="px-5 py-3 text-xs"><span class="rounded-full px-2 py-1 font-semibold {% if user.is_active and user.allow_login and not user.is_locked %}bg-emerald-50 text-emerald-700{% else %}bg-red-50 text-red-700{% endif %}">{% if user.is_locked %}Locked{% elif not user.is_active %}Inactive{% elif not user.allow_login %}Login Blocked{% else %}Active{% endif %}</span>{% if user.must_change_password %}<div class="mt-1 font-semibold text-amber-700">Invite/password pending</div>{% endif %}</td>
|
||||
<td class="px-5 py-3 text-slate-600">{{ user.designation or '-' }}</td>
|
||||
<td class="px-5 py-3 text-slate-600">{{ user.mobile or '-' }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="5" class="px-5 py-8 text-center text-slate-500">No users found.</td></tr>
|
||||
<tr><td colspan="6" class="px-5 py-8 text-center text-slate-500">No users found.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
<div class="rounded-3xl border border-slate-200 bg-white p-5 shadow-soft">
|
||||
<h2 class="text-lg font-bold text-slate-900">Firm Admin Wizards & Setup Shortcuts</h2>
|
||||
<p class="mt-1 text-sm text-slate-500">These cards link to existing setup screens. They do not duplicate existing features.</p>
|
||||
<p class="mt-1 text-sm text-slate-500">These cards link to existing setup screens and focused Firm Admin onboarding flows. They do not remove the existing system settings screens.</p>
|
||||
<div class="mt-5 grid gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||
<a href="/firm-admin/users/new?role=partner" class="rounded-2xl border border-brand-200 bg-brand-50 p-4 hover:bg-brand-100"><div class="font-semibold text-brand-900">Add Partner</div><p class="mt-1 text-sm text-brand-700">Create partner user, link employee master and generate invite.</p><div class="mt-3 text-xs font-semibold text-brand-700">Open</div></a>
|
||||
<a href="/firm-admin/users/new?role=manager" class="rounded-2xl border border-brand-200 bg-brand-50 p-4 hover:bg-brand-100"><div class="font-semibold text-brand-900">Add Manager</div><p class="mt-1 text-sm text-brand-700">Creates user with Branch Manager role.</p><div class="mt-3 text-xs font-semibold text-brand-700">Open</div></a>
|
||||
<a href="/firm-admin/users/new?role=staff" class="rounded-2xl border border-brand-200 bg-brand-50 p-4 hover:bg-brand-100"><div class="font-semibold text-brand-900">Add Staff</div><p class="mt-1 text-sm text-brand-700">Create staff user, employee master and invite link.</p><div class="mt-3 text-xs font-semibold text-brand-700">Open</div></a>
|
||||
{% for wizard in wizards %}
|
||||
<a href="{{ wizard.href }}" class="rounded-2xl border border-slate-200 p-4 hover:border-brand-200 hover:bg-brand-50/40"><div class="font-semibold text-slate-900">{{ wizard.title }}</div><p class="mt-1 text-sm text-slate-500">{{ wizard.desc }}</p><div class="mt-3 text-xs font-semibold text-brand-700">Open</div></a>
|
||||
{% endfor %}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
{% extends "ui/templates/base/layout.html" %}
|
||||
{% block content %}
|
||||
{% set data = form_data if form_data is defined and form_data else {} %}
|
||||
<section class="mx-auto max-w-4xl space-y-6">
|
||||
<div class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft">
|
||||
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-semibold uppercase tracking-[0.24em] text-brand-600">Firm Admin User Onboarding</p>
|
||||
<h1 class="mt-2 text-2xl font-bold text-slate-900">Add {{ role_config.label if role_config else 'Firm User' }}</h1>
|
||||
<p class="mt-1 text-sm text-slate-500">Create the user account, assign branch and role, create/link employee master, generate invite link and attempt invite email.</p>
|
||||
</div>
|
||||
<a href="/firm-admin/dashboard?tab=users" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50">Back to Users</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not tenant_id %}
|
||||
<div class="rounded-3xl border border-amber-200 bg-amber-50 p-5 text-sm font-semibold text-amber-900 shadow-soft">
|
||||
Active firm context was not found. Please select/open a firm context before adding users.
|
||||
</div>
|
||||
{% elif not branches %}
|
||||
<div class="rounded-3xl border border-amber-200 bg-amber-50 p-5 text-sm font-semibold text-amber-900 shadow-soft">
|
||||
No active branch is available for this firm. Create a branch first, then add Partner / Manager / Staff.
|
||||
</div>
|
||||
{% elif not role_config %}
|
||||
<div class="rounded-3xl border border-red-200 bg-red-50 p-5 text-sm font-semibold text-red-800 shadow-soft">
|
||||
Invalid onboarding role.
|
||||
</div>
|
||||
{% else %}
|
||||
{% if flash %}
|
||||
<div class="rounded-3xl border border-red-200 bg-red-50 p-5 text-sm font-semibold text-red-800 shadow-soft">{{ flash }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/firm-admin/users/new" class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}" />
|
||||
<input type="hidden" name="role" value="{{ role_key }}" />
|
||||
|
||||
<div class="grid gap-5 md:grid-cols-2">
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Firm</span>
|
||||
<input value="{{ tenant.display_name or tenant.name if tenant else '' }}" disabled class="mt-1 w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Role</span>
|
||||
<input value="{{ role_config.role_name }}" disabled class="mt-1 w-full rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-600" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Full Name <span class="text-red-600">*</span></span>
|
||||
<input name="full_name" value="{{ data.full_name or '' }}" required class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Email <span class="text-red-600">*</span></span>
|
||||
<input type="email" name="email" value="{{ data.email or '' }}" required class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Branch <span class="text-red-600">*</span></span>
|
||||
<select name="branch_id" required class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100">
|
||||
<option value="">-- Select Branch --</option>
|
||||
{% for branch in branches %}
|
||||
{% if branch.is_active %}
|
||||
<option value="{{ branch.id }}" {% if data.branch_id|string == branch.id|string %}selected{% endif %}>{{ branch.name }}{% if branch.is_head_office %} / Head Office{% endif %}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Mobile</span>
|
||||
<input name="mobile" value="{{ data.mobile or '' }}" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Employee Code</span>
|
||||
<input name="employee_code" value="{{ data.employee_code or employee_code_suggestion }}" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
<span class="mt-1 block text-xs text-slate-500">Leave as-is or edit. Must be unique inside the firm.</span>
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Date of Joining</span>
|
||||
<input type="date" name="date_of_joining" value="{{ data.date_of_joining or '' }}" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Department</span>
|
||||
<input name="department" value="{{ data.department or role_config.default_department }}" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="text-sm font-semibold text-slate-700">Designation</span>
|
||||
<input name="designation" value="{{ data.designation or role_config.default_designation }}" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100" />
|
||||
</label>
|
||||
<label class="block md:col-span-2">
|
||||
<span class="text-sm font-semibold text-slate-700">Employment Type</span>
|
||||
<select name="employment_type" class="mt-1 w-full rounded-xl border border-slate-300 px-3 py-2 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-100">
|
||||
{% set selected_emp_type = data.employment_type or role_config.default_employment_type %}
|
||||
{% for code, label in [('full_time','Full time'),('part_time','Part time'),('article_assistant','Article Assistant'),('intern','Intern'),('contract','Contract')] %}
|
||||
<option value="{{ code }}" {% if selected_emp_type == code %}selected{% endif %}>{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 rounded-2xl border border-brand-100 bg-brand-50 p-4 text-sm text-brand-900">
|
||||
The system will generate an invite token and show the fallback invite link after saving. The user will set their own password from that link.
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex flex-wrap justify-end gap-3">
|
||||
<a href="/firm-admin/dashboard?tab=users" class="rounded-xl border border-slate-300 px-4 py-2.5 text-sm font-semibold text-slate-700 hover:bg-slate-50">Cancel</a>
|
||||
<button class="rounded-xl bg-brand-600 px-4 py-2.5 text-sm font-semibold text-white shadow-soft hover:bg-brand-700">Create {{ role_config.label }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
{% extends "ui/templates/base/layout.html" %}
|
||||
{% block content %}
|
||||
{% set result = onboarding_result %}
|
||||
<section class="mx-auto max-w-3xl space-y-6">
|
||||
<div class="rounded-3xl border border-emerald-200 bg-emerald-50 p-6 shadow-soft">
|
||||
<p class="text-xs font-semibold uppercase tracking-[0.24em] text-emerald-700">User Created</p>
|
||||
<h1 class="mt-2 text-2xl font-bold text-emerald-950">{{ result.role_label }} invite is ready</h1>
|
||||
<p class="mt-1 text-sm text-emerald-800">The user account, role mapping, branch assignment and employee master link have been completed.</p>
|
||||
</div>
|
||||
|
||||
<div class="rounded-3xl border border-slate-200 bg-white p-6 shadow-soft">
|
||||
<div class="grid gap-4 text-sm md:grid-cols-2">
|
||||
<div><div class="text-xs font-semibold uppercase tracking-wide text-slate-400">User</div><div class="mt-1 font-semibold text-slate-900">{{ result.user.full_name or result.user.email }}</div><div class="text-slate-500">{{ result.user.email }}</div></div>
|
||||
<div><div class="text-xs font-semibold uppercase tracking-wide text-slate-400">Role</div><div class="mt-1 font-semibold text-slate-900">{{ result.role_name }}</div></div>
|
||||
<div><div class="text-xs font-semibold uppercase tracking-wide text-slate-400">Branch</div><div class="mt-1 font-semibold text-slate-900">{{ result.branch.name }}</div></div>
|
||||
<div><div class="text-xs font-semibold uppercase tracking-wide text-slate-400">Employee Link</div><div class="mt-1 font-semibold text-slate-900">{% if result.employee_link_result.employee_id %}Linked #{{ result.employee_link_result.employee_id }}{% else %}Not linked{% endif %}</div></div>
|
||||
<div class="md:col-span-2"><div class="text-xs font-semibold uppercase tracking-wide text-slate-400">Invite Email</div><div class="mt-1 font-semibold text-slate-900">{{ result.email_status }}</div>{% if result.email_error %}<div class="mt-1 text-xs text-amber-700">{{ result.email_error }}</div>{% endif %}</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6">
|
||||
<div class="text-sm font-semibold text-slate-700">Fallback Invite Link</div>
|
||||
<div class="mt-2 break-all rounded-2xl border border-brand-200 bg-brand-50 p-4 text-sm text-brand-900">{{ result.invite_url }}</div>
|
||||
<p class="mt-2 text-xs text-slate-500">Copy and share this link manually if the email is not delivered.</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex flex-wrap gap-3">
|
||||
<a href="/firm-admin/dashboard?tab=users" class="rounded-xl bg-brand-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-700">Back to Users & Roles</a>
|
||||
<a href="/firm-admin/users/new?role={{ result.role_label|lower }}" class="rounded-xl border border-slate-300 px-4 py-2.5 text-sm font-semibold text-slate-700 hover:bg-slate-50">Add another {{ result.role_label }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user