added id attribute to elements

This commit is contained in:
Denis Duliçi
2022-09-06 13:54:56 +03:00
parent 862b905981
commit 7832680208
54 changed files with 278 additions and 153 deletions

View File

@@ -43,6 +43,9 @@ class Role extends LaratrustRole
'icon' => 'edit',
'url' => route('roles.roles.edit', $this->id),
'permission' => 'update-roles-roles',
'attributes' => [
'id' => 'index-line-actions-edit-role-' . $this->id,
],
];
$actions[] = [
@@ -50,6 +53,9 @@ class Role extends LaratrustRole
'icon' => 'file_copy',
'url' => route('roles.roles.duplicate', $this->id),
'permission' => 'create-roles-roles',
'attributes' => [
'id' => 'index-line-actions-duplicate-role-' . $this->id,
],
];
$actions[] = [
@@ -57,6 +63,9 @@ class Role extends LaratrustRole
'icon' => 'delete',
'route' => 'roles.roles.destroy',
'permission' => 'delete-roles-roles',
'attributes' => [
'id' => 'index-line-actions-delete-role-' . $this->id,
],
'model' => $this,
];

View File

@@ -326,6 +326,9 @@ class User extends Authenticatable implements HasLocalePreference
'icon' => 'edit',
'url' => route('users.edit', $this->id),
'permission' => 'update-auth-users',
'attributes' => [
'id' => 'index-line-actions-show-user-' . $this->id,
],
];
if ($this->hasPendingInvitation()) {
@@ -334,6 +337,9 @@ class User extends Authenticatable implements HasLocalePreference
'icon' => 'replay',
'url' => route('users.invite', $this->id),
'permission' => 'update-auth-users',
'attributes' => [
'id' => 'index-line-actions-resend-user-' . $this->id,
],
];
}
@@ -342,6 +348,9 @@ class User extends Authenticatable implements HasLocalePreference
'icon' => 'delete',
'route' => 'users.destroy',
'permission' => 'delete-auth-users',
'attributes' => [
'id' => 'index-line-actions-delete-user-' . $this->id,
],
'model' => $this,
];

View File

@@ -170,6 +170,9 @@ class Account extends Model
'icon' => 'visibility',
'url' => route('accounts.show', $this->id),
'permission' => 'read-banking-accounts',
'attributes' => [
'id' => 'index-line-actions-show-account-' . $this->id,
],
];
$actions[] = [
@@ -177,6 +180,9 @@ class Account extends Model
'icon' => 'edit',
'url' => route('accounts.edit', $this->id),
'permission' => 'update-banking-accounts',
'attributes' => [
'id' => 'index-line-actions-edit-account-' . $this->id,
],
];
$actions[] = [
@@ -185,6 +191,9 @@ class Account extends Model
'route' => 'accounts.destroy',
'permission' => 'delete-banking-accounts',
'model' => $this,
'attributes' => [
'id' => 'index-line-actions-delete-account-' . $this->id,
],
];
return $actions;

View File

@@ -57,6 +57,9 @@ class Reconciliation extends Model
'icon' => 'edit',
'url' => route('reconciliations.edit', $this->id),
'permission' => 'update-banking-reconciliations',
'attributes' => [
'id' => 'index-line-actions-edit-reconciliation-' . $this->id,
],
];
$actions[] = [
@@ -64,6 +67,9 @@ class Reconciliation extends Model
'icon' => 'delete',
'route' => 'reconciliations.destroy',
'permission' => 'delete-banking-reconciliations',
'attributes' => [
'id' => 'index-line-actions-delete-reconciliation-' . $this->id,
],
'model' => $this,
];

View File

@@ -455,7 +455,7 @@ class Transaction extends Model
'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) {}
@@ -468,7 +468,7 @@ class Transaction extends Model
'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,
],
];
}
@@ -482,7 +482,7 @@ class Transaction extends Model
'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,
],
];
}
@@ -496,7 +496,7 @@ class Transaction extends Model
'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) . '\')',
],
];
@@ -516,7 +516,7 @@ class Transaction extends Model
'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',
],
];
@@ -529,7 +529,7 @@ class Transaction extends Model
'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',
],
];
@@ -549,7 +549,7 @@ class Transaction extends Model
'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) . '")',
],
];
@@ -564,7 +564,7 @@ class Transaction extends Model
'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) . '")',
],
];
@@ -583,6 +583,9 @@ class Transaction extends Model
'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,
];
}
@@ -595,6 +598,9 @@ class Transaction extends Model
'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) {}
}

View File

@@ -246,6 +246,9 @@ class Transfer extends Model
'icon' => 'visibility',
'url' => route('transfers.show', $this->id),
'permission' => 'read-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-show-transfer-' . $this->id,
],
];
$actions[] = [
@@ -253,6 +256,9 @@ class Transfer extends Model
'icon' => 'edit',
'url' => route('transfers.edit', $this->id),
'permission' => 'update-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-edit-transfer-' . $this->id,
],
];
$actions[] = [
@@ -260,6 +266,9 @@ class Transfer extends Model
'icon' => 'file_copy',
'url' => route('transfers.duplicate', $this->id),
'permission' => 'update-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-duplicate-transfer-' . $this->id,
],
];
$actions[] = [
@@ -267,6 +276,9 @@ class Transfer extends Model
'icon' => 'delete',
'route' => 'transfers.destroy',
'permission' => 'delete-banking-transfers',
'attributes' => [
'id' => 'index-line-actions-delete-transfer-' . $this->id,
],
'model' => $this,
];

View File

@@ -70,7 +70,7 @@ class Company extends Eloquent implements Ownable
{
parent::boot();
try {
try {
// TODO will optimize..
static::retrieved(function($model) {
$model->setCommonSettingsAsAttributes();
@@ -550,6 +550,9 @@ class Company extends Eloquent implements Ownable
'icon' => 'settings_ethernet',
'url' => route('companies.switch', $this->id),
'permission' => 'read-common-companies',
'attributes' => [
'id' => 'index-line-actions-switch-company-' . $this->id,
],
];
}
@@ -558,6 +561,9 @@ class Company extends Eloquent implements Ownable
'icon' => 'edit',
'url' => route('companies.edit', $this->id),
'permission' => 'update-common-companies',
'attributes' => [
'id' => 'index-line-actions-edit-company-' . $this->id,
],
];
$actions[] = [
@@ -565,6 +571,9 @@ class Company extends Eloquent implements Ownable
'icon' => 'delete',
'route' => 'companies.destroy',
'permission' => 'delete-common-companies',
'attributes' => [
'id' => 'index-line-actions-delete-company-' . $this->id,
],
'model' => $this,
];

View File

@@ -291,6 +291,9 @@ class Contact extends Model
'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) {}
@@ -300,6 +303,9 @@ class Contact extends Model
'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) {}
@@ -309,6 +315,9 @@ class Contact extends Model
'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) {}
@@ -319,6 +328,9 @@ class Contact extends Model
'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) {}

View File

@@ -129,6 +129,9 @@ class Dashboard extends Model
'icon' => 'settings_ethernet',
'url' => route('dashboards.switch', $this->id),
'permission' => 'read-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-switch-dashboard-' . $this->id,
],
];
}
@@ -137,6 +140,9 @@ class Dashboard extends Model
'icon' => 'edit',
'url' => route('dashboards.edit', $this->id),
'permission' => 'update-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-edit-dashboard-' . $this->id,
],
];
$actions[] = [
@@ -144,6 +150,9 @@ class Dashboard extends Model
'icon' => 'delete',
'route' => 'dashboards.destroy',
'permission' => 'delete-common-dashboards',
'attributes' => [
'id' => 'index-line-actions-delete-dashboard-' . $this->id,
],
'model' => $this,
];

View File

@@ -174,6 +174,9 @@ class Item extends Model
'icon' => 'edit',
'url' => route('items.edit', $this->id),
'permission' => 'update-common-items',
'attributes' => [
'id' => 'index-line-actions-edit-item-' . $this->id,
],
];
$actions[] = [
@@ -181,6 +184,9 @@ class Item extends Model
'icon' => 'file_copy',
'url' => route('items.duplicate', $this->id),
'permission' => 'create-common-items',
'attributes' => [
'id' => 'index-line-actions-duplicate-item-' . $this->id,
],
];
$actions[] = [
@@ -188,6 +194,9 @@ class Item extends Model
'icon' => 'delete',
'route' => 'items.destroy',
'permission' => 'delete-common-items',
'attributes' => [
'id' => 'index-line-actions-delete-item-' . $this->id,
],
'model' => $this,
];

View File

@@ -496,7 +496,7 @@ class Document extends Model
'url' => route($prefix . '.edit', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-edit-' . $this->id,
'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id,
],
];
}
@@ -509,7 +509,7 @@ class Document extends Model
'url' => route($prefix . '.duplicate', $this->id),
'permission' => 'create-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-duplicate-' . $this->id,
'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}
@@ -523,7 +523,7 @@ class Document extends Model
'url' => route('modals.documents.document.transactions.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-payment-' . $this->id,
'id' => 'index-line-actions-payment-' . $this->type . '-' . $this->id,
'@click' => 'onPayment("' . $this->id . '")',
],
];
@@ -536,7 +536,7 @@ class Document extends Model
'url' => route($prefix . '.print', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-print-' . $this->id,
'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id,
'target' => '_blank',
],
];
@@ -551,7 +551,7 @@ class Document extends Model
'url' => route($prefix . '.print', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-print-' . $this->id,
'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id,
'target' => '_blank',
],
];
@@ -565,7 +565,7 @@ class Document extends Model
'url' => route($prefix . '.pdf', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-pdf-' . $this->id,
'id' => 'index-line-actions-pdf-' . $this->type . '-' . $this->id,
'target' => '_blank',
],
];
@@ -585,7 +585,7 @@ class Document extends Model
'url' => route('modals.'. $prefix . '.share.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-share-link-' . $this->id,
'id' => 'index-line-actions-share-link-' . $this->type . '-' . $this->id,
'@click' => 'onShareLink("' . route('modals.'. $prefix . '.share.create', $this->id) . '")',
],
];
@@ -600,7 +600,7 @@ class Document extends Model
'url' => route('modals.'. $prefix . '.emails.create', $this->id),
'permission' => 'read-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-send-email-' . $this->id,
'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id,
'@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")',
],
];
@@ -620,7 +620,7 @@ class Document extends Model
'url' => route($prefix . '.cancelled', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-more-actions-cancel-' . $this->id,
'id' => 'index-line-actions-cancel-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}
@@ -637,6 +637,9 @@ class Document extends Model
'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) {}
@@ -647,6 +650,9 @@ class Document extends Model
'icon' => 'block',
'url' => route($prefix. '.end', $this->id),
'permission' => 'update-' . $group . '-' . $permission_prefix,
'attributes' => [
'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id,
],
];
} catch (\Exception $e) {}
}

View File

@@ -240,6 +240,9 @@ class Category extends Model
'icon' => 'create',
'url' => route('categories.edit', $this->id),
'permission' => 'update-settings-categories',
'attributes' => [
'id' => 'index-line-actions-edit-category-' . $this->id,
],
];
if ($this->isTransferCategory()) {
@@ -251,6 +254,9 @@ class Category extends Model
'icon' => 'delete',
'route' => 'categories.destroy',
'permission' => 'delete-settings-categories',
'attributes' => [
'id' => 'index-line-actions-delete-category-' . $this->id,
],
'model' => $this,
];

View File

@@ -197,6 +197,9 @@ class Currency extends Model
'icon' => 'edit',
'url' => route('currencies.edit', $this->id),
'permission' => 'update-settings-currencies',
'attributes' => [
'id' => 'index-line-actions-edit-currency-' . $this->id,
],
];
$actions[] = [
@@ -204,6 +207,9 @@ class Currency extends Model
'icon' => 'delete',
'route' => 'currencies.destroy',
'permission' => 'delete-settings-currencies',
'attributes' => [
'id' => 'index-line-actions-delete-currency-' . $this->id,
],
'model' => $this,
];

View File

@@ -150,6 +150,9 @@ class Tax extends Model
'icon' => 'edit',
'url' => route('taxes.edit', $this->id),
'permission' => 'update-settings-taxes',
'attributes' => [
'id' => 'index-line-actions-edit-tax-' . $this->id,
],
];
$actions[] = [
@@ -157,6 +160,9 @@ class Tax extends Model
'icon' => 'delete',
'route' => 'taxes.destroy',
'permission' => 'delete-settings-taxes',
'attributes' => [
'id' => 'index-line-actions-delete-tax-' . $this->id,
],
'model' => $this,
];