Compare commits
5 Commits
91cd9eb180
...
305274f636
Author | SHA1 | Date |
---|---|---|
Sami Mokaddem | 305274f636 | |
Sami Mokaddem | 96d53f4b6a | |
Sami Mokaddem | 1111290cea | |
Sami Mokaddem | acb8fa21d3 | |
Sami Mokaddem | f4f17a1fa0 |
|
@ -97,6 +97,8 @@ class CRUDComponent extends Component
|
||||||
if ($sort[0] != $this->Table->getAlias()) {
|
if ($sort[0] != $this->Table->getAlias()) {
|
||||||
$sort[0] = Inflector::camelize(Inflector::pluralize($sort[0]));
|
$sort[0] = Inflector::camelize(Inflector::pluralize($sort[0]));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
array_unshift($sort, $this->Table->getAlias());
|
||||||
}
|
}
|
||||||
$sort = implode('.', $sort);
|
$sort = implode('.', $sort);
|
||||||
$query->order($sort . ' ' . $direction);
|
$query->order($sort . ' ' . $direction);
|
||||||
|
|
|
@ -14,7 +14,15 @@ use Cake\ORM\TableRegistry;
|
||||||
class IndividualsController extends AppController
|
class IndividualsController extends AppController
|
||||||
{
|
{
|
||||||
public $quickFilterFields = ['uuid', ['email' => true], ['first_name' => true], ['last_name' => true], 'position'];
|
public $quickFilterFields = ['uuid', ['email' => true], ['first_name' => true], ['last_name' => true], 'position'];
|
||||||
public $filterFields = ['uuid', 'email', 'first_name', 'last_name', 'position', 'Organisations.id', 'Alignments.type'];
|
public $filterFields = [
|
||||||
|
'uuid',
|
||||||
|
'email',
|
||||||
|
'first_name',
|
||||||
|
'last_name',
|
||||||
|
'position',
|
||||||
|
'Alignments.type',
|
||||||
|
['name' => 'Organisations.id', 'multiple' => true, 'options' => 'getAllOrganisations', 'select2' => true],
|
||||||
|
];
|
||||||
public $containFields = ['Alignments' => 'Organisations'];
|
public $containFields = ['Alignments' => 'Organisations'];
|
||||||
public $statisticsFields = ['position'];
|
public $statisticsFields = ['position'];
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,15 @@ use Cake\Http\Exception\NotFoundException;
|
||||||
|
|
||||||
class UsersController extends AppController
|
class UsersController extends AppController
|
||||||
{
|
{
|
||||||
public $filterFields = ['Individuals.uuid', 'username', 'Individuals.email', 'Individuals.first_name', 'Individuals.last_name', 'Organisations.name', 'Organisations.nationality'];
|
public $filterFields = [
|
||||||
|
'Individuals.uuid',
|
||||||
|
'username',
|
||||||
|
'Individuals.email',
|
||||||
|
'Individuals.first_name',
|
||||||
|
'Individuals.last_name',
|
||||||
|
['name' => 'Organisations.id', 'multiple' => true, 'options' => 'getAllOrganisations', 'select2' => true],
|
||||||
|
'Organisations.nationality'
|
||||||
|
];
|
||||||
public $quickFilterFields = ['Individuals.uuid', ['username' => true], ['Individuals.first_name' => true], ['Individuals.last_name' => true], 'Individuals.email'];
|
public $quickFilterFields = ['Individuals.uuid', ['username' => true], ['Individuals.first_name' => true], ['Individuals.last_name' => true], 'Individuals.email'];
|
||||||
public $containFields = ['Individuals', 'Roles', 'UserSettings', 'Organisations', 'OrgGroups'];
|
public $containFields = ['Individuals', 'Roles', 'UserSettings', 'Organisations', 'OrgGroups'];
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Model\Table;
|
namespace App\Model\Table;
|
||||||
|
|
||||||
use App\Model\Table\AppTable;
|
use App\Model\Table\AppTable;
|
||||||
|
use Cake\Utility\Hash;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
use Cake\ORM\Query;
|
use Cake\ORM\Query;
|
||||||
|
@ -137,4 +138,11 @@ class IndividualsTable extends AppTable
|
||||||
)->all()->extract('individual_id')->toArray();
|
)->all()->extract('individual_id')->toArray();
|
||||||
return $validIndividualIds;
|
return $validIndividualIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAllOrganisations($currentUser): array
|
||||||
|
{
|
||||||
|
$this->Organisations = \Cake\ORM\TableRegistry::getTableLocator()->get('Organisations');
|
||||||
|
$orgs = $this->Organisations->find()->select(['id', 'name'])->all()->toList();
|
||||||
|
return Hash::combine($orgs, '{n}.id', '{n}.name');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,4 +292,9 @@ class UsersTable extends AppTable
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAllOrganisations($currentUser) {
|
||||||
|
$this->Individuals = TableRegistry::get('Individuals');
|
||||||
|
return $this->Individuals->getAllOrganisations($currentUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,27 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'skip_full_reload' => true
|
'skip_full_reload' => true,
|
||||||
|
'confirm' => [
|
||||||
|
'enable' => [
|
||||||
|
'titleHtml' => __('Confirm disabling the user?'),
|
||||||
|
'type' => 'confirm-warning',
|
||||||
|
'bodyHtml' => __('You\'re about to change the state of the user {{0}}.'),
|
||||||
|
'confirmText' => __('Disable user'),
|
||||||
|
'arguments' => [
|
||||||
|
'bodyHtml' => ['individual.email'],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'disable' => [
|
||||||
|
'titleHtml' => __('Confirm enabling the user?'),
|
||||||
|
'type' => 'confirm-success',
|
||||||
|
'bodyHtml' => __('You\'re about to change the state of the user {{0}}.'),
|
||||||
|
'confirmText' => __('Enable user'),
|
||||||
|
'arguments' => [
|
||||||
|
'bodyHtml' => ['individual.email'],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -168,5 +188,4 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
echo '</div>';
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -102,7 +102,7 @@ $filteringTags = '';
|
||||||
if ($taggingEnabled) {
|
if ($taggingEnabled) {
|
||||||
$helpText = $this->Bootstrap->node('sup', [
|
$helpText = $this->Bootstrap->node('sup', [
|
||||||
'class' => ['ms-1 fa fa-info'],
|
'class' => ['ms-1 fa fa-info'],
|
||||||
'title' => __('Supports negation matches (with the `!` character) and LIKE matches (with the `%` character). Example: `!exportable`, `%able`'),
|
'title' => __('Supports negation matches (with the `!` character) and LIKE matches (with the `%` character). Example: `!exportable`, `%able`'),
|
||||||
'data-bs-toggle' => 'tooltip',
|
'data-bs-toggle' => 'tooltip',
|
||||||
]);
|
]);
|
||||||
$filteringTags = $this->Bootstrap->node('h5', [
|
$filteringTags = $this->Bootstrap->node('h5', [
|
||||||
|
|
Loading…
Reference in New Issue