feat: custom roles with per-permission matrix for café owners

- Owner can define named custom roles (e.g. Barista, Supervisor) with
  color, description, and a fine-grained permission set (21 permissions
  across 7 categories: admin, menu, staff, customer, reports, ops, kitchen)
- Employee assigned a custom role gets its permissions embedded in the
  JWT at login (customPerms claim) and parsed by TenantMiddleware —
  overrides the static EmployeeRole matrix for all API permission checks
- New endpoints: GET/POST/PATCH/DELETE /api/cafes/{id}/custom-roles and
  PUT /api/cafes/{id}/employees/{id}/custom-role for assignment
- Dashboard Settings → Team & Staff → Custom Roles panel with grouped
  checkbox matrix, group-level toggles, color preset picker, CRUD forms,
  and employee-count display; translations in fa/en/ar
- EF migration adds CustomRoles table + nullable CustomRoleId FK on Employees
- POS slip now shows per-item notes on both thermal print and bill preview

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-21 03:12:43 +03:30
parent 73a5e5183b
commit aebfa825cd
23 changed files with 1126 additions and 20 deletions
+48 -1
View File
@@ -1276,7 +1276,54 @@
"printer": "پرینتر",
"printerSettings": "تنظیمات پرینتر",
"printTest": "صفحه تست چاپ",
"shopDiscover": "کشف و AI"
"shopDiscover": "کشف و AI",
"team": "تیم و کارمندان",
"customRoles": "نقش‌های سفارشی"
},
"customRoles": {
"title": "نقش‌های سفارشی",
"subtitle": "نقش‌هایی با دسترسی دلخواه برای کارمندان تعریف کنید",
"newRole": "نقش جدید",
"editRole": "ویرایش نقش",
"name": "نام نقش",
"namePlaceholder": "مثلاً: باریستا، مسئول طبقه",
"description": "توضیح (اختیاری)",
"descriptionPlaceholder": "توضیح مختصر درباره این نقش",
"color": "رنگ",
"permissions": "دسترسی‌ها",
"empty": "هنوز نقش سفارشی تعریف نشده است",
"saveError": "ذخیره نقش ناموفق بود",
"deleteConfirm": "نقش «{name}» حذف شود؟ این کارمندان به دسترسی پیش‌فرض نقش اصلی خود بازمی‌گردند.",
"groupAdmin": "مدیریت کافه",
"groupMenu": "منو و انبار",
"groupStaff": "پرسنل",
"groupCustomer": "مشتری و میز",
"groupReports": "گزارش و مالی",
"groupOps": "عملیات صندوق",
"groupKitchen": "آشپزخانه و تحویل",
"perm": {
"ManageCafeSettings": "تنظیمات کافه",
"ManageBilling": "اشتراک و پرداخت",
"ManageBranches": "مدیریت شعب",
"ManageMenu": "مدیریت منو",
"ManageInventory": "انبار و موجودی",
"ManageTaxes": "مالیات",
"ManagePrintSettings": "تنظیمات چاپ",
"ManageStaff": "مدیریت کارمندان",
"ManageSalaries": "حقوق و دستمزد",
"ReviewLeave": "بررسی مرخصی",
"ManageReservations": "رزروها",
"ManageTables": "میزها",
"ManageCoupons": "کوپن‌ها",
"ViewReports": "گزارش‌ها",
"ManageExpenses": "هزینه‌ها",
"ProcessOrders": "ثبت سفارش",
"HandlePayments": "پردازش پرداخت",
"OperateRegister": "صندوق",
"ManageQueue": "صف انتظار",
"ViewKitchen": "نمایش آشپزخانه",
"HandleDelivery": "تحویل و پیک"
}
},
"appearance": {
"paletteSection": "پالت رنگ",