fix: [open APIs] fixed some minor issues

pull/17/head
iglocska 2020-06-24 23:18:52 +02:00
parent 1a50e2ded1
commit cb9e650b5f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 78 additions and 3 deletions

View File

@ -0,0 +1,74 @@
<?php
echo $this->element('genericElements/IndexTable/index_table', [
'data' => [
'data' => $data,
'top_bar' => [
'pull' => 'right',
'children' => [
[
'type' => 'search',
'button' => __('Filter'),
'placeholder' => __('Enter value to search'),
'data' => '',
'searchKey' => 'value'
]
]
],
'fields' => [
[
'name' => '#',
'sort' => 'id',
'data_path' => 'id',
],
[
'name' => __('Email'),
'sort' => 'email',
'data_path' => 'email',
],
[
'name' => __('First Name'),
'sort' => 'first_name',
'data_path' => 'first_name',
],
[
'name' => __('Last Name'),
'sort' => 'last_name',
'data_path' => 'last_name',
],
[
'name' => __('Alignments'),
'data_path' => 'alignments',
'element' => 'alignments',
'scope' => $alignmentScope
],
[
'name' => __('UUID'),
'sort' => 'uuid',
'data_path' => 'uuid',
'placeholder' => __('Leave empty to auto generate')
],
],
'title' => __('ContactDB Individuals Index'),
'description' => __('A list of individuals known by your Cerebrate instance. This list can get populated either directly, by adding new individuals or by fetching them from trusted remote sources. Additionally, users created for the platform will always have an individual identity.'),
'pull' => 'right',
'actions' => [
[
'url' => '/individuals/view',
'url_params_data_paths' => ['id'],
'icon' => 'eye'
],
[
'onclick' => 'populateAndLoadModal(\'/individuals/edit/[onclick_params_data_path]\');',
'onclick_params_data_path' => 'id',
'icon' => 'edit'
],
[
'onclick' => 'populateAndLoadModal(\'/individuals/delete/[onclick_params_data_path]\');',
'onclick_params_data_path' => 'id',
'icon' => 'trash'
]
]
]
]);
echo '</div>';
?>

View File

@ -47,7 +47,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
'name' => __('Members'),
'data_path' => 'alignments',
'element' => 'count_summary',
'url' => '/individuals/index/?Organisations.id={{url_data}}',
'url' => '/open/individuals/index/?Organisations.id={{url_data}}',
'url_data_path' => 'id'
],
[

View File

@ -1,6 +1,7 @@
<?php
$raw_alignments = $this->Hash->extract($row, $field['data_path']);
$alignments = '';
$canRemove = $this->request->getParam('prefix') !== 'Open';
if ($field['scope'] === 'individuals') {
foreach ($raw_alignments as $alignment) {
$alignments .= sprintf(
@ -11,7 +12,7 @@ if ($field['scope'] === 'individuals') {
h($alignment['organisation']['id']),
h($alignment['organisation']['name'])
),
sprintf(
!$canRemove ? '' : sprintf(
"populateAndLoadModal(%s);",
sprintf(
"'/alignments/delete/%s'",
@ -30,7 +31,7 @@ if ($field['scope'] === 'individuals') {
h($alignment['individual']['id']),
h($alignment['individual']['email'])
),
sprintf(
!$canRemove ? '' : sprintf(
"populateAndLoadModal(%s);",
sprintf(
"'/alignments/delete/%s'",