Show/hide columns programatically
This commit is contained in:
@@ -1103,6 +1103,9 @@ class OrganisationController extends SimpleController
|
|||||||
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
|
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
|
||||||
$authorizer = $this->ci->authorizer;
|
$authorizer = $this->ci->authorizer;
|
||||||
|
|
||||||
|
/** @var \UserFrosting\Support\Repository\Repository $config */
|
||||||
|
$config = $this->ci->config;
|
||||||
|
|
||||||
/** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */
|
/** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */
|
||||||
$currentUser = $this->ci->currentUser;
|
$currentUser = $this->ci->currentUser;
|
||||||
|
|
||||||
@@ -1111,7 +1114,34 @@ class OrganisationController extends SimpleController
|
|||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->ci->view->render($response, 'pages/organisations.html.twig');
|
$tableColumns = [ 'description' ];
|
||||||
|
|
||||||
|
if ($currentUser->organisations(true)->count() == 0) {
|
||||||
|
$tableColumns[] = 'join';
|
||||||
|
} else {
|
||||||
|
if (!$config['organisation']['membership']['single_membership']) {
|
||||||
|
$tableColumns[] = 'join';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($currentUser->organisations(true)->wherePivot('flag_admin', true) |
|
||||||
|
$authorizer->checkAccess($currentUser, 'delete_organisation') |
|
||||||
|
$authorizer->checkAccess($currentUser, 'update_organisation_field') |
|
||||||
|
$authorizer->checkAccess($currentUser, 'approve_organisation') |
|
||||||
|
$authorizer->checkAccess($currentUser, 'merge_organisations')) {
|
||||||
|
$tableColumns[] = 'status';
|
||||||
|
$tableColumns[] = 'actions';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->ci->view->render(
|
||||||
|
$response,
|
||||||
|
'pages/organisations.html.twig',
|
||||||
|
[
|
||||||
|
'table' => [
|
||||||
|
'columns' => $tableColumns
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1142,7 +1172,23 @@ class OrganisationController extends SimpleController
|
|||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->ci->view->render($response, 'pages/deleted-organisations.html.twig');
|
$tableColumns = [ 'description' ];
|
||||||
|
|
||||||
|
if ($authorizer->checkAccess($currentUser, 'restore_organisation') |
|
||||||
|
$authorizer->checkAccess($currentUser, 'permanently_delete_organisation')) {
|
||||||
|
$tableColumns[] = 'status';
|
||||||
|
$tableColumns[] = 'actions';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->ci->view->render(
|
||||||
|
$response,
|
||||||
|
'pages/deleted-organisations.html.twig',
|
||||||
|
[
|
||||||
|
'table' => [
|
||||||
|
'columns' => $tableColumns
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{% include "tables/deleted-organisations.html.twig" with {
|
{% include "tables/deleted-organisations.html.twig" with {
|
||||||
"table" : {
|
"table" : {
|
||||||
"id" : "table-organisations"
|
"id" : "table-organisations",
|
||||||
|
"columns" : table.columns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{% include "tables/organisations.html.twig" with {
|
{% include "tables/organisations.html.twig" with {
|
||||||
"table" : {
|
"table" : {
|
||||||
"id" : "table-organisations"
|
"id" : "table-organisations",
|
||||||
|
"columns" : table.columns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|||||||
Reference in New Issue
Block a user