Skip to content

Commit

Permalink
First pass at cleaning up Petition view (CFM-31)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Nov 5, 2024
1 parent 68db3dd commit 3785c31
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 30 deletions.
6 changes: 6 additions & 0 deletions app/resources/locales/en_US/information.po
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ msgstr "not set"
msgid "pagination.format"
msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}"

msgid "enrollment.steps"
msgstr "Enrollment Steps"

msgid "ExternalIdentities.source"
msgstr "This External Identity was created from {0}."

Expand Down Expand Up @@ -105,6 +108,9 @@ msgstr "Additional History Records may be available via Petitions and Provisioni
msgid "pagination.format"
msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}"

msgid "petition.information"
msgstr "Petition Information"

msgid "Petitions.pending"
msgstr "This Petition has now been assigned to someone else. There is no further action for you at this time."

Expand Down
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ msgstr "View {0}"
msgid "view.PersonRoles.a"
msgstr "View Role {0}"

msgid "view.Petitions.a"
msgstr "View Petition {0}"

msgid "view.ExternalIdentityRoles.a"
msgstr "View Role {0}"

5 changes: 4 additions & 1 deletion app/src/Lib/Util/StringUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ public static function entityAndActionToTitle($entity,
$field = $linkTable->getDisplayField();

if(!empty($entity->$field)) {
$title = __d($domain, $msgId, $entity->$field);
$title = __d($domain, $msgIdOverride, $entity->$field);
if($msgIdOverride === $title) {
$title = __d($domain, $msgId, $entity->$field);
}
} else {
$title = __d($domain, $msgId, __d('controller', $modelsName, [1]));
}
Expand Down
87 changes: 58 additions & 29 deletions app/templates/Petitions/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,37 @@
declare(strict_types = 1);

use \Cake\Utility\Hash;
use Cake\Utility\Inflector;

// Petitions are read-only, though they can link to other actions
if ($vv_action !== 'view') {
return;
}

// Start with the petition metadata
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'status',
]
]);
$statusTitle = __d('enumeration','PetitionStatusEnum.' . $vv_obj->status);
$statusCssClass = 'petition-status-title petition-status-title-' . Inflector::dasherize($statusTitle);
?>

<li class="form-list-header <?= $statusCssClass ?>">
<h2>
<?= $statusTitle ?>
</h2>
</li>
<li class="form-list-header">
<h2>
<?= __d('information', 'petition.information') ?>
</h2>
</li>

<?php
// Enrollee Email, if provided
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'enrollee_email',
]
]);

]);
// Enrollee
if (!empty($vv_obj?->enrollee_person?->id)) {
$enrolleeStatus = $vv_obj->enrollee_person->primary_name->full_name ?? __d('field', 'Petitions.enrollee.new');
Expand Down Expand Up @@ -86,30 +97,48 @@ if (!empty($vv_obj?->petitioner_person?->id)) {
]);
}

// XXX Keep status available (even though it's presented above)
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'status',
]
]);
?>

<li class="form-list-header">
<h2>
<?= __d('information', 'enrollment.steps') ?>
</h2>
</li>


<!-- XXX This needs work -->
<ol>
<?php foreach($vv_obj->enrollment_flow->enrollment_flow_steps as $step): ?>
<?php
$result = Hash::extract($vv_obj->petition_step_results, "{n}[enrollment_flow_step_id=$step->id]");
<?php foreach($vv_obj->enrollment_flow->enrollment_flow_steps as $step): ?>
<?php
$result = Hash::extract($vv_obj->petition_step_results, "{n}[enrollment_flow_step_id=$step->id]");

if(!empty($result)) {
$resultLink = [
'controller' => 'petitions',
'action' => 'result',
$vv_obj->id,
'?' => [
'enrollment_flow_step_id' => $step->id
]
];
}
?>
if(!empty($result)) {
$resultLink = [
'controller' => 'petitions',
'action' => 'result',
$vv_obj->id,
'?' => [
'enrollment_flow_step_id' => $step->id
]
];
}
?>

<li><?= $step->description ?></li>
<ul>
<li><?= !empty($result) ? $this->Html->link($result[0]->comment, $resultLink) : "" ?></li>
</ul>
</li>
<?php endforeach; ?>
</ol>
<li>
<div class="field">
<div class="field-name ">
<div class="field-title">
<?= $step->description ?>
</div>
</div>
<div class="field-info">
<?= !empty($result) ? $this->Html->link($result[0]->comment, $resultLink) : "" ?>
</div>
</div>
</li>
<?php endforeach; ?>
24 changes: 24 additions & 0 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,15 @@ ul.form-list li {
padding: 0;
list-style: none;
}
ul.fields li.form-list-header {
overflow-x: unset;
}
ul.fields li.form-list-header h2 {
color: var(--cmg-color-txt-inverse);
background-color: var(--cmg-color-btn-bg-001);
font-size: 1.4em;
padding: 1rem;
}
ul.form-list li:focus-within {
background-color: var(--cmg-color-bg-001);
}
Expand Down Expand Up @@ -1884,6 +1893,21 @@ body.attributecollectors .submit {
padding-right: 1em;
white-space: nowrap;
}
ul.form-list li.petition-status-title {
margin-bottom: 1rem;
border: none;
}
ul.form-list li.petition-status-title h2 {
/* default colors for most status titles */
background-color: var(--cmg-color-highlight-009);
color: var(--cmg-color-highlight-010);
border: 1px solid var(--cmg-color-highlight-011);
}
ul.form-list li.petition-status-title-finalized h2 {
background-color: var(--cmg-color-highlight-006);
color: var(--cmg-color-highlight-007);
border: 1px solid var(--cmg-color-highlight-008);
}
/* GENERAL */
.hidden,
.invisible,
Expand Down

0 comments on commit 3785c31

Please sign in to comment.