Skip to content

Commit

Permalink
People
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 29, 2024
1 parent 5944be3 commit 16fe4c2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion app/src/Controller/ApiUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function generate(string $id) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
6 changes: 3 additions & 3 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function add() {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -441,7 +441,7 @@ public function edit(string $id) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -900,7 +900,7 @@ public function view($id = null) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords', 'People'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
40 changes: 26 additions & 14 deletions app/templates/People/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@ if($vv_action == 'add') {

foreach(['honorific', 'given', 'middle', 'family', 'suffix'] as $f) {
if(in_array($f, $vv_permitted_name_fields)) {
print $this->Field->control(
fieldName: 'names.0.'.$f,
options: ['required' => in_array($f, $vv_required_name_fields)],
controlType: 'string'
);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'names.0.'.$f,
'options' => [
'required' => in_array($f, $vv_required_name_fields)
],
'fieldType' => 'string'
]]);
}
}

print $this->Field->control(
fieldName: 'names.0.type_id',
options: ['empty' => false, 'default' => $vv_default_name_type],
controlType: 'string'
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'names.0.type_id',
'options' => [
'default' => $vv_default_name_type
],
'fieldType' => 'string'
]]);

// AR-Name-1 Since this is the first name for this Person, it must be
// designated primary
Expand All @@ -58,7 +64,13 @@ if($vv_action == 'add') {
}

if($vv_action == 'add' || $vv_action == 'edit') {
print $this->Field->control('status', ['empty' => false]);

print $this->Field->dateControl('date_of_birth', \App\Lib\Enum\DateTypeEnum::DateOnly);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'status'
]]);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'date_of_birth'
]]);
}
8 changes: 0 additions & 8 deletions app/templates/Standard/add-edit-view-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@
// Form body
print $this->element('form/unorderedList');

// Import all the hidden fields in the Form
if(!empty($hidden)) {
// Inject any hidden variables set by the included file
foreach($hidden as $attr => $v) {
print $this->Form->hidden($attr, ['value' => $v]);
}
}

if(!empty($linkId)
&& ($vv_action == 'add' || $vv_action == 'edit')) {
// We don't want/need to output these for view actions
Expand Down
2 changes: 2 additions & 0 deletions app/templates/element/form/nameDiv.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

declare(strict_types = 1);

use Cake\Utility\Inflector;

// $fieldName: parameter

$classes = '';
Expand Down
12 changes: 11 additions & 1 deletion app/templates/element/form/unorderedList.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<?php
// We allow the fields.inc file to be specified for Controllers that have more
// complicated/non-default actions.
// XXX Each fields.inc file will calculate and provide the hidden controls.
$fieldsFile = $vv_fields_inc ?? 'fields.inc';
// The controller will calculate the template path for us, since it could be
// in one of several paths if we are in a plugin context.
Expand All @@ -51,4 +52,13 @@
// The Submit element will be printed only if we are adding or updating
print $this->element('form/submit', ['label' => __d('operation', 'save')]);
?>
</ul>
</ul>

<?php
// Import all the hidden fields in the Form
if(!empty($hidden)) {
// Inject any hidden variables set by the included file
foreach($hidden as $attr => $v) {
print $this->Form->hidden($attr, ['value' => $v]);
}
}

0 comments on commit 16fe4c2

Please sign in to comment.