fix: [users] added the country information to the index / view

pull/163/head
iglocska 2023-05-25 16:22:49 +02:00
parent 7a8eb6ba50
commit 41749ae5a8
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
6 changed files with 17 additions and 4 deletions

View File

@ -11,7 +11,7 @@ use Cake\Http\Exception\NotFoundException;
class UsersController extends AppController
{
public $filterFields = ['Individuals.uuid', 'username', 'Individuals.email', 'Individuals.first_name', 'Individuals.last_name', 'Organisations.name'];
public $filterFields = ['Individuals.uuid', 'username', 'Individuals.email', 'Individuals.first_name', 'Individuals.last_name', 'Organisations.name', 'Organisation.nationality'];
public $quickFilterFields = ['Individuals.uuid', ['username' => true], ['Individuals.first_name' => true], ['Individuals.last_name' => true], 'Individuals.email'];
public $containFields = ['Individuals', 'Roles', 'UserSettings', 'Organisations'];

View File

@ -47,7 +47,8 @@ class UsersTable extends AppTable
'Organisations',
[
'dependent' => false,
'cascadeCallbacks' => false
'cascadeCallbacks' => false,
'strategy' => 'join'
]
);
$this->hasMany(

View File

@ -2,7 +2,7 @@
echo $this->element('genericElements/Form/genericForm', array(
'data' => array(
'description' => __('Organisations can be equivalent to legal entities or specific individual teams within such entities. Their purpose is to relate individuals to their affiliations and for release control of information using the Trust Circles.'),
'model' => 'Organisations',
'model' => 'Organisation',
'fields' => array(
array(
'field' => 'name'

View File

@ -1,7 +1,6 @@
<?php
use Cake\Core\Configure;
echo $this->element('genericElements/IndexTable/index_table', [
'data' => [
'data' => $data,
@ -88,6 +87,11 @@ echo $this->element('genericElements/IndexTable/index_table', [
'url' => '/roles/view/{{0}}',
'url_vars' => ['role.id']
],
[
'name' => __('Country'),
'sort' => 'organisation.nationality',
'data_path' => 'organisation.nationality'
],
[
'name' => __('# User Settings'),
'element' => 'count_summary',

View File

@ -44,6 +44,10 @@ $fields = [
'key' => __('Last name'),
'path' => 'individual.last_name'
],
[
'key' => __('Country'),
'path' => 'organisation.nationality'
],
[
'key' => __('Alignments'),
'type' => 'alignment',

View File

@ -1,5 +1,9 @@
<?php
if (is_array($fieldData)) {
// Don't barf if the model is not explicitly passed
$modelForForm = empty($data['model']) ?
h(\Cake\Utility\Inflector::singularize(\Cake\Utility\Inflector::classify($this->request->getParam('controller')))) :
h($data['model']);
$fieldTemplate = 'genericField';
if (!empty($fieldData['type'])) {
if (file_exists(ROOT . '/templates/element/genericElements/Form/Fields/' . $fieldData['type'] . 'Field.php')) {