changes of giftCard page
This commit is contained in:
@@ -20,3 +20,8 @@
|
|||||||
- 2026-09-09 | رمز ادمین ≠ لاگین اپ | `Customer::setPasswordAttribute` + `AuthController` + `updateAdmin` | قبل از هش/لاگین ارقام فارسی→انگلیسی؛ jwt hash=false؛ آنلاین فقط password غیرخالی بفرست
|
- 2026-09-09 | رمز ادمین ≠ لاگین اپ | `Customer::setPasswordAttribute` + `AuthController` + `updateAdmin` | قبل از هش/لاگین ارقام فارسی→انگلیسی؛ jwt hash=false؛ آنلاین فقط password غیرخالی بفرست
|
||||||
- 2026-10-20 | دسترسی صفحات مدیر | `users.page_access` + `AdminPageAccess` + ادمین `adminPageAccess.ts` / ویرایش مدیران | null=کامل؛ درخت مشاهده/ویرایش/حذف؛ ورود=اولین صفحه مجاز؛ منوی ممنوع=«شما به این صفحه دسترسی ندارید»
|
- 2026-10-20 | دسترسی صفحات مدیر | `users.page_access` + `AdminPageAccess` + ادمین `adminPageAccess.ts` / ویرایش مدیران | null=کامل؛ درخت مشاهده/ویرایش/حذف؛ ورود=اولین صفحه مجاز؛ منوی ممنوع=«شما به این صفحه دسترسی ندارید»
|
||||||
- 2026-10-20 | ویرایش/حذف کارت هدیه | `GiftCardController::update/destroy` + `giftCards/components/table.vue` | PUT/DELETE `/admin/giftcard/{id}`؛ کارت استفادهشده حذف نمیشود و مقدار/تعدادش عوض نمیشود
|
- 2026-10-20 | ویرایش/حذف کارت هدیه | `GiftCardController::update/destroy` + `giftCards/components/table.vue` | PUT/DELETE `/admin/giftcard/{id}`؛ کارت استفادهشده حذف نمیشود و مقدار/تعدادش عوض نمیشود
|
||||||
|
- 2026-10-20 | دکمه ویرایش/حذف گیفت | `allowsPageFlag` + `giftCards/components/table.vue` | بدون edit/delete روی giftCardMain دکمه و دیالوگ باز نمیشود
|
||||||
|
- 2026-10-20 | دسترسی عملیات جدول | `PAGE_TABLE_ACTIONS` + `usePageActionAccess` + `AdminPageAccess::ACTIONS` | هر صفحه فقط عملیات ستون خودش؛ مشاهده جدا؛ رکورد قدیمی بدون actions ویرایش/حذف را از همان فیلد و بقیه را از مشاهده میگیرد
|
||||||
|
- 2026-10-20 | چیدمان درخت دسترسی | `users/components/ManagerPageAccessTree.vue` | هر صفحه یک کالپس؛ وضعیت روی هدر؛ عملیات جدول داخل همان صفحه
|
||||||
|
- 2026-10-20 | مشخصات کارت هدیه | `giftCards/index.vue` تابع `info` | کدهای یکتا در مودال مشخصات نیست؛ همان جدول کدها
|
||||||
|
- 2026-10-20 | کپی کد هدیه | `giftCards/components/GiftCardCodesSheet.vue` | کنار کد هر ردیف آیکون کپی؛ پیام «کد کپی شد»
|
||||||
|
|||||||
@@ -56,6 +56,31 @@ class AdminPageAccess
|
|||||||
'usersMain',
|
'usersMain',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** کلید عملیات ستون هر صفحه؛ با PAGE_TABLE_ACTIONS ادمین یکی بماند. */
|
||||||
|
public const ACTIONS = [
|
||||||
|
'customerMain_limitedOrder' => ['charge', 'tahesab', 'zarin', 'pargar', 'accountingCode', 'info', 'edit', 'referral', 'sms', 'approve', 'archive', 'active', 'trade'],
|
||||||
|
'customerMain_archive' => ['restore', 'info'],
|
||||||
|
'customerMain_specialPrice' => ['edit', 'toggle', 'delete'],
|
||||||
|
'customerMain_goldCredit' => ['detail', 'edit', 'approve', 'reject'],
|
||||||
|
'productsMain_limitedOrder' => ['buy', 'sell', 'list', 'tv', 'edit', 'archive'],
|
||||||
|
'productsMain_archive' => ['restore', 'info'],
|
||||||
|
'ordersMain' => ['info'],
|
||||||
|
'transactionsMain' => ['info'],
|
||||||
|
'accountsMain' => ['toggle', 'delete'],
|
||||||
|
'walletMain' => ['info'],
|
||||||
|
'physicalWithdrawMain' => ['amount', 'approve', 'status', 'factor'],
|
||||||
|
'withdrawMain' => ['confirm', 'factor', 'status', 'weight', 'tahesab', 'zarin'],
|
||||||
|
'pricingMain' => ['details'],
|
||||||
|
'priceTriggers' => ['edit', 'toggle', 'delete'],
|
||||||
|
'conditionalOrders' => ['edit', 'toggle', 'delete'],
|
||||||
|
'accountingMain' => ['doc', 'register', 'send'],
|
||||||
|
'appNotifications' => ['recipients', 'readers', 'edit', 'toggle', 'delete'],
|
||||||
|
'automations' => ['preview', 'log', 'edit', 'toggle', 'delete'],
|
||||||
|
'giftCardMain' => ['info', 'codes', 'edit', 'delete'],
|
||||||
|
'discounts' => ['edit'],
|
||||||
|
'usersMain' => ['info', 'edit', 'delete'],
|
||||||
|
];
|
||||||
|
|
||||||
private const ALIASES = [
|
private const ALIASES = [
|
||||||
'dashboard' => 'dashboardMain',
|
'dashboard' => 'dashboardMain',
|
||||||
'main' => 'dashboardMain',
|
'main' => 'dashboardMain',
|
||||||
@@ -113,21 +138,43 @@ class AdminPageAccess
|
|||||||
$view = self::toBool($row['view'] ?? false);
|
$view = self::toBool($row['view'] ?? false);
|
||||||
$edit = self::toBool($row['edit'] ?? false);
|
$edit = self::toBool($row['edit'] ?? false);
|
||||||
$delete = self::toBool($row['delete'] ?? false);
|
$delete = self::toBool($row['delete'] ?? false);
|
||||||
if ($edit || $delete) {
|
$actions = null;
|
||||||
|
if (is_array($row['actions'] ?? null)) {
|
||||||
|
$actions = [];
|
||||||
|
foreach (self::ACTIONS[$key] ?? [] as $actionKey) {
|
||||||
|
$actions[$actionKey] = self::toBool($row['actions'][$actionKey] ?? false);
|
||||||
|
}
|
||||||
|
if (array_key_exists('edit', $actions)) {
|
||||||
|
$edit = $actions['edit'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('delete', $actions)) {
|
||||||
|
$delete = $actions['delete'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($edit || $delete || ($actions && in_array(true, $actions, true))) {
|
||||||
$view = true;
|
$view = true;
|
||||||
}
|
}
|
||||||
if (!$view) {
|
if (!$view) {
|
||||||
$edit = false;
|
$edit = false;
|
||||||
$delete = false;
|
$delete = false;
|
||||||
|
if (is_array($actions)) {
|
||||||
|
foreach ($actions as $actionKey => $enabled) {
|
||||||
|
$actions[$actionKey] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$view && !$edit && !$delete) {
|
if (!$view && !$edit && !$delete && !($actions && in_array(true, $actions, true))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$out[$key] = [
|
$stored = [
|
||||||
'view' => $view,
|
'view' => $view,
|
||||||
'edit' => $edit,
|
'edit' => $edit,
|
||||||
'delete' => $delete,
|
'delete' => $delete,
|
||||||
];
|
];
|
||||||
|
if (is_array($actions) && $actions) {
|
||||||
|
$stored['actions'] = $actions;
|
||||||
|
}
|
||||||
|
$out[$key] = $stored;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
@@ -163,11 +210,12 @@ class AdminPageAccess
|
|||||||
if (!is_array($row)) {
|
if (!is_array($row)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($action === 'delete') {
|
if ($action === 'delete' || $action === 'edit') {
|
||||||
return !empty($row['delete']);
|
$actions = $row['actions'] ?? null;
|
||||||
}
|
if (is_array($actions) && array_key_exists($action, $actions)) {
|
||||||
if ($action === 'edit') {
|
return !empty($actions[$action]);
|
||||||
return !empty($row['edit']);
|
}
|
||||||
|
return !empty($row[$action]);
|
||||||
}
|
}
|
||||||
return !empty($row['view']);
|
return !empty($row['view']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user