diff --git a/templates/Open/Individuals/index.php b/templates/Open/Individuals/index.php new file mode 100644 index 0000000..30ee3f5 --- /dev/null +++ b/templates/Open/Individuals/index.php @@ -0,0 +1,74 @@ +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 ''; +?> diff --git a/templates/Open/Organisations/index.php b/templates/Open/Organisations/index.php index 3870899..794f929 100644 --- a/templates/Open/Organisations/index.php +++ b/templates/Open/Organisations/index.php @@ -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' ], [ diff --git a/templates/element/genericElements/IndexTable/Fields/alignments.php b/templates/element/genericElements/IndexTable/Fields/alignments.php index bfb7652..1ee3df6 100644 --- a/templates/element/genericElements/IndexTable/Fields/alignments.php +++ b/templates/element/genericElements/IndexTable/Fields/alignments.php @@ -1,6 +1,7 @@ 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'",