Skip to content

Commit

Permalink
added id attribute to elements
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Sep 6, 2022
1 parent 862b905 commit 7832680
Show file tree
Hide file tree
Showing 54 changed files with 278 additions and 153 deletions.
4 changes: 2 additions & 2 deletions app/Http/Livewire/Report/Pin.php
Expand Up @@ -13,7 +13,7 @@ class Pin extends Component

public $pinned = false;

public $reportId = null;
public $report;

public function render(): View
{
Expand All @@ -38,7 +38,7 @@ public function render(): View
continue;
}

if (in_array($this->reportId, $pins)) {
if (in_array($this->report->id, $pins)) {
$this->pinned = true;

break;
Expand Down
9 changes: 9 additions & 0 deletions app/Models/Auth/Role.php
Expand Up @@ -43,20 +43,29 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('roles.roles.edit', $this->id),
'permission' => 'update-roles-roles',
'attributes' => [
'id' => 'index-line-actions-edit-role-' . $this->id,
],
];

$actions[] = [
'title' => trans('general.duplicate'),
'icon' => 'file_copy',
'url' => route('roles.roles.duplicate', $this->id),
'permission' => 'create-roles-roles',
'attributes' => [
'id' => 'index-line-actions-duplicate-role-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'roles.roles.destroy',
'permission' => 'delete-roles-roles',
'attributes' => [
'id' => 'index-line-actions-delete-role-' . $this->id,
],
'model' => $this,
];

Expand Down
9 changes: 9 additions & 0 deletions app/Models/Auth/User.php
Expand Up @@ -326,6 +326,9 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('users.edit', $this->id),
'permission' => 'update-auth-users',
'attributes' => [
'id' => 'index-line-actions-show-user-' . $this->id,
],
];

if ($this->hasPendingInvitation()) {
Expand All @@ -334,6 +337,9 @@ public function getLineActionsAttribute()
'icon' => 'replay',
'url' => route('users.invite', $this->id),
'permission' => 'update-auth-users',
'attributes' => [
'id' => 'index-line-actions-resend-user-' . $this->id,
],
];
}

Expand All @@ -342,6 +348,9 @@ public function getLineActionsAttribute()
'icon' => 'delete',
'route' => 'users.destroy',
'permission' => 'delete-auth-users',
'attributes' => [
'id' => 'index-line-actions-delete-user-' . $this->id,
],
'model' => $this,
];

Expand Down
9 changes: 9 additions & 0 deletions app/Models/Banking/Account.php
Expand Up @@ -170,13 +170,19 @@ public function getLineActionsAttribute()
'icon' => 'visibility',
'url' => route('accounts.show', $this->id),
'permission' => 'read-banking-accounts',
'attributes' => [
'id' => 'index-line-actions-show-account-' . $this->id,
],
];

$actions[] = [
'title' => trans('general.edit'),
'icon' => 'edit',
'url' => route('accounts.edit', $this->id),
'permission' => 'update-banking-accounts',
'attributes' => [
'id' => 'index-line-actions-edit-account-' . $this->id,
],
];

$actions[] = [
Expand All @@ -185,6 +191,9 @@ public function getLineActionsAttribute()
'route' => 'accounts.destroy',
'permission' => 'delete-banking-accounts',
'model' => $this,
'attributes' => [
'id' => 'index-line-actions-delete-account-' . $this->id,
],
];

return $actions;
Expand Down
6 changes: 6 additions & 0 deletions app/Models/Banking/Reconciliation.php
Expand Up @@ -57,13 +57,19 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('reconciliations.edit', $this->id),
'permission' => 'update-banking-reconciliations',
'attributes' => [
'id' => 'index-line-actions-edit-reconciliation-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'reconciliations.destroy',
'permission' => 'delete-banking-reconciliations',
'attributes' => [
'id' => 'index-line-actions-delete-reconciliation-' . $this->id,
],
'model' => $this,
];

Expand Down
22 changes: 14 additions & 8 deletions app/Models/Banking/Transaction.php
Expand Up @@ -455,7 +455,7 @@ public function getLineActionsAttribute()
'url' => route($prefix. '.show', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-show-' . $this->id,
'id' => 'index-line-actions-show-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}
Expand All @@ -468,7 +468,7 @@ public function getLineActionsAttribute()
'url' => route($prefix. '.edit', $this->id),
'permission' => 'update-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-edit-' . $this->id,
'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id,
],
];
}
Expand All @@ -482,7 +482,7 @@ public function getLineActionsAttribute()
'url' => route($prefix. '.duplicate', $this->id),
'permission' => 'create-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-duplicate-' . $this->id,
'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id,
],
];
}
Expand All @@ -496,7 +496,7 @@ public function getLineActionsAttribute()
'icon' => 'sensors',
'permission' => 'create-banking-transactions',
'attributes' => [
'id' => 'index-transactions-more-actions-connect-' . $this->id,
'id' => 'index-line-actions-connect-' . $this->type . '-' . $this->id,
'@click' => 'onConnectTransactions(\'' . route('transactions.dial', $this->id) . '\')',
],
];
Expand All @@ -516,7 +516,7 @@ public function getLineActionsAttribute()
'url' => route($prefix. '.print', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-print-' . $this->id,
'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id,
'target' => '_blank',
],
];
Expand All @@ -529,7 +529,7 @@ public function getLineActionsAttribute()
'url' => route($prefix. '.pdf', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-pdf-' . $this->id,
'id' => 'index-line-actions-pdf-' . $this->type . '-' . $this->id,
'target' => '_blank',
],
];
Expand All @@ -549,7 +549,7 @@ public function getLineActionsAttribute()
'url' => route('modals.transactions.share.create', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-share-' . $this->id,
'id' => 'index-line-actions-share-' . $this->type . '-' . $this->id,
'@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")',
],
];
Expand All @@ -564,7 +564,7 @@ public function getLineActionsAttribute()
'url' => route('modals.transactions.emails.create', $this->id),
'permission' => 'read-banking-transactions',
'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id,
'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id,
'@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")',
],
];
Expand All @@ -583,6 +583,9 @@ public function getLineActionsAttribute()
'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template',
'route' => $prefix. '.destroy',
'permission' => 'delete-banking-transactions',
'attributes' => [
'id' => 'index-line-actions-delete-' . $this->type . '-' . $this->id,
],
'model' => $this,
];
}
Expand All @@ -595,6 +598,9 @@ public function getLineActionsAttribute()
'icon' => 'block',
'url' => route($prefix. '.end', $this->id),
'permission' => 'update-banking-transactions',
'attributes' => [
'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}
}
Expand Down
12 changes: 12 additions & 0 deletions app/Models/Banking/Transfer.php
Expand Up @@ -246,27 +246,39 @@ public function getLineActionsAttribute()
'icon' => 'visibility',
'url' => route('transfers.show', $this->id),
'permission' => 'read-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-show-transfer-' . $this->id,
],
];

$actions[] = [
'title' => trans('general.edit'),
'icon' => 'edit',
'url' => route('transfers.edit', $this->id),
'permission' => 'update-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-edit-transfer-' . $this->id,
],
];

$actions[] = [
'title' => trans('general.duplicate'),
'icon' => 'file_copy',
'url' => route('transfers.duplicate', $this->id),
'permission' => 'update-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-duplicate-transfer-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'transfers.destroy',
'permission' => 'delete-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-delete-transfer-' . $this->id,
],
'model' => $this,
];

Expand Down
11 changes: 10 additions & 1 deletion app/Models/Common/Company.php
Expand Up @@ -70,7 +70,7 @@ public static function boot()
{
parent::boot();

try {
try {
// TODO will optimize..
static::retrieved(function($model) {
$model->setCommonSettingsAsAttributes();
Expand Down Expand Up @@ -550,6 +550,9 @@ public function getLineActionsAttribute()
'icon' => 'settings_ethernet',
'url' => route('companies.switch', $this->id),
'permission' => 'read-common-companies',
'attributes' => [
'id' => 'index-line-actions-switch-company-' . $this->id,
],
];
}

Expand All @@ -558,13 +561,19 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('companies.edit', $this->id),
'permission' => 'update-common-companies',
'attributes' => [
'id' => 'index-line-actions-edit-company-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'companies.destroy',
'permission' => 'delete-common-companies',
'attributes' => [
'id' => 'index-line-actions-delete-company-' . $this->id,
],
'model' => $this,
];

Expand Down
12 changes: 12 additions & 0 deletions app/Models/Common/Contact.php
Expand Up @@ -291,6 +291,9 @@ public function getLineActionsAttribute()
'icon' => 'visibility',
'url' => route($prefix . '.show', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-line-actions-show-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}

Expand All @@ -300,6 +303,9 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route($prefix . '.edit', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}

Expand All @@ -309,6 +315,9 @@ public function getLineActionsAttribute()
'icon' => 'file_copy',
'url' => route($prefix . '.duplicate', $this->id),
'permission' => 'create-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}

Expand All @@ -319,6 +328,9 @@ public function getLineActionsAttribute()
'title' => $translation_prefix,
'route' => $prefix . '.destroy',
'permission' => 'delete-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-line-actions-delete-' . $this->type . '-' . $this->id,
],
'model' => $this,
];
} catch (\Exception $e) {}
Expand Down
9 changes: 9 additions & 0 deletions app/Models/Common/Dashboard.php
Expand Up @@ -129,6 +129,9 @@ public function getLineActionsAttribute()
'icon' => 'settings_ethernet',
'url' => route('dashboards.switch', $this->id),
'permission' => 'read-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-switch-dashboard-' . $this->id,
],
];
}

Expand All @@ -137,13 +140,19 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('dashboards.edit', $this->id),
'permission' => 'update-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-edit-dashboard-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'dashboards.destroy',
'permission' => 'delete-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-delete-dashboard-' . $this->id,
],
'model' => $this,
];

Expand Down
9 changes: 9 additions & 0 deletions app/Models/Common/Item.php
Expand Up @@ -174,20 +174,29 @@ public function getLineActionsAttribute()
'icon' => 'edit',
'url' => route('items.edit', $this->id),
'permission' => 'update-common-items',
'attributes' => [
'id' => 'index-line-actions-edit-item-' . $this->id,
],
];

$actions[] = [
'title' => trans('general.duplicate'),
'icon' => 'file_copy',
'url' => route('items.duplicate', $this->id),
'permission' => 'create-common-items',
'attributes' => [
'id' => 'index-line-actions-duplicate-item-' . $this->id,
],
];

$actions[] = [
'type' => 'delete',
'icon' => 'delete',
'route' => 'items.destroy',
'permission' => 'delete-common-items',
'attributes' => [
'id' => 'index-line-actions-delete-item-' . $this->id,
],
'model' => $this,
];

Expand Down

0 comments on commit 7832680

Please sign in to comment.