Skip to content

Commit

Permalink
increased menu order to ease the life of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jun 24, 2020
1 parent 361739d commit 46cd0ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
38 changes: 19 additions & 19 deletions app/Listeners/Menu/AddAdminItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handle(Event $event)
$sub->url('/', $dashboard->name, $key, $attr);
}
}
}, 1, [
}, 100, [
'url' => '/',
'title' => trans_choice('general.dashboards', 2),
'icon' => 'fa fa-tachometer-alt',
Expand All @@ -42,31 +42,31 @@ public function handle(Event $event)
'url' => '/',
'title' => trans_choice('general.dashboards', 1),
'icon' => 'fa fa-tachometer-alt',
'order' => 1,
'order' => 100,
]);
}
}

// Items
if ($user->can('read-common-items')) {
$menu->route('items.index', trans_choice('general.items', 2), [], 2, ['icon' => 'fa fa-cube']);
$menu->route('items.index', trans_choice('general.items', 2), [], 200, ['icon' => 'fa fa-cube']);
}

// Sales
if ($user->can(['read-sales-invoices', 'read-sales-revenues', 'read-sales-customers'])) {
$menu->dropdown(trim(trans_choice('general.sales', 2)), function ($sub) use ($user, $attr) {
if ($user->can('read-sales-invoices')) {
$sub->route('invoices.index', trans_choice('general.invoices', 2), [], 1, $attr);
$sub->route('invoices.index', trans_choice('general.invoices', 2), [], 310, $attr);
}

if ($user->can('read-sales-revenues')) {
$sub->route('revenues.index', trans_choice('general.revenues', 2), [], 2, $attr);
$sub->route('revenues.index', trans_choice('general.revenues', 2), [], 320, $attr);
}

if ($user->can('read-sales-customers')) {
$sub->route('customers.index', trans_choice('general.customers', 2), [], 3, $attr);
$sub->route('customers.index', trans_choice('general.customers', 2), [], 330, $attr);
}
}, 3, [
}, 300, [
'title' => trans_choice('general.sales', 2),
'icon' => 'fa fa-money-bill',
]);
Expand All @@ -76,17 +76,17 @@ public function handle(Event $event)
if ($user->can(['read-purchases-bills', 'read-purchases-payments', 'read-purchases-vendors'])) {
$menu->dropdown(trim(trans_choice('general.purchases', 2)), function ($sub) use ($user, $attr) {
if ($user->can('read-purchases-bills')) {
$sub->route('bills.index', trans_choice('general.bills', 2), [], 1, $attr);
$sub->route('bills.index', trans_choice('general.bills', 2), [], 410, $attr);
}

if ($user->can('read-purchases-payments')) {
$sub->route('payments.index', trans_choice('general.payments', 2), [], 2, $attr);
$sub->route('payments.index', trans_choice('general.payments', 2), [], 420, $attr);
}

if ($user->can('read-purchases-vendors')) {
$sub->route('vendors.index', trans_choice('general.vendors', 2), [], 3, $attr);
$sub->route('vendors.index', trans_choice('general.vendors', 2), [], 430, $attr);
}
}, 4, [
}, 400, [
'title' => trans_choice('general.purchases', 2),
'icon' => 'fa fa-shopping-cart',
]);
Expand All @@ -96,39 +96,39 @@ public function handle(Event $event)
if ($user->can(['read-banking-accounts', 'read-banking-transfers', 'read-banking-transactions', 'read-banking-reconciliations'])) {
$menu->dropdown(trim(trans('general.banking')), function ($sub) use ($user, $attr) {
if ($user->can('read-banking-accounts')) {
$sub->route('accounts.index', trans_choice('general.accounts', 2), [], 1, $attr);
$sub->route('accounts.index', trans_choice('general.accounts', 2), [], 510, $attr);
}

if ($user->can('read-banking-transfers')) {
$sub->route('transfers.index', trans_choice('general.transfers', 2), [], 2, $attr);
$sub->route('transfers.index', trans_choice('general.transfers', 2), [], 520, $attr);
}

if ($user->can('read-banking-transactions')) {
$sub->route('transactions.index', trans_choice('general.transactions', 2), [], 3, $attr);
$sub->route('transactions.index', trans_choice('general.transactions', 2), [], 530, $attr);
}

if ($user->can('read-banking-reconciliations')) {
$sub->route('reconciliations.index', trans_choice('general.reconciliations', 2), [], 4, $attr);
$sub->route('reconciliations.index', trans_choice('general.reconciliations', 2), [], 540, $attr);
}
}, 5, [
}, 500, [
'title' => trans('general.banking'),
'icon' => 'fa fa-briefcase',
]);
}

// Reports
if ($user->can('read-common-reports')) {
$menu->route('reports.index', trans_choice('general.reports', 2), [], 6, ['icon' => 'fa fa-chart-pie']);
$menu->route('reports.index', trans_choice('general.reports', 2), [], 600, ['icon' => 'fa fa-chart-pie']);
}

// Settings
if ($user->can('read-settings-settings')) {
$menu->route('settings.index', trans_choice('general.settings', 2), [], 7, ['icon' => 'fa fa-cog']);
$menu->route('settings.index', trans_choice('general.settings', 2), [], 700, ['icon' => 'fa fa-cog']);
}

// Apps
if ($user->can('read-modules-home')) {
$menu->route('apps.home.index', trans_choice('general.modules', 2), [], 8, ['icon' => 'fa fa-rocket']);
$menu->route('apps.home.index', trans_choice('general.modules', 2), [], 800, ['icon' => 'fa fa-rocket']);
}
}
}
6 changes: 3 additions & 3 deletions app/Listeners/Menu/AddPortalItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public function handle(Event $event)
{
$menu = $event->menu;

$menu->route('portal.dashboard', trans_choice('general.dashboards', 1), [], 1, ['icon' => 'fa fa-tachometer-alt']);
$menu->route('portal.dashboard', trans_choice('general.dashboards', 1), [], 100, ['icon' => 'fa fa-tachometer-alt']);

$menu->route('portal.invoices.index', trans_choice('general.invoices', 2), [], 2, ['icon' => 'fa fa-file-signature']);
$menu->route('portal.invoices.index', trans_choice('general.invoices', 2), [], 200, ['icon' => 'fa fa-file-signature']);

$menu->route('portal.payments.index', trans_choice('general.payments', 2), [], 3, ['icon' => 'fa fa-money-bill']);
$menu->route('portal.payments.index', trans_choice('general.payments', 2), [], 300, ['icon' => 'fa fa-money-bill']);
}
}

0 comments on commit 46cd0ab

Please sign in to comment.