Skip to content

Commit

Permalink
Add Petition History Records output to petition view (CFM-31)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Nov 6, 2024
1 parent 9a1d61e commit 076ca56
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/src/Model/Table/PetitionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public function initialize(array $config): void {
'EnrollmentFlows' => ['EnrollmentFlowSteps' => ['sort' => ['ordr' => 'ASC']]],
'EnrolleePeople' => ['PrimaryName' => ['foreignKey' => 'person_id']],
'PetitionerPeople' => ['PrimaryName' => ['foreignKey' => 'person_id']],
'PetitionStepResults'
'PetitionStepResults',
'PetitionHistoryRecords'
]);

$this->setAutoViewVars([
Expand Down
30 changes: 30 additions & 0 deletions app/templates/Petitions/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,38 @@ if (!empty($vv_obj?->petitioner_person?->id)) {
</li>
<?php endforeach; ?>


<?php if(!empty($vv_obj->petition_history_records)):
// XXX Generalize this into an element for all history records if we use this output elsewhere
?>
<li class="form-list-header">
<h2>
<?= __d('information', 'petition.history') ?>
</h2>
</li>
<li class="petition-history">
<div class="table-container">
<table id="petition-history-table" class="history-table list-mode">
<thead>
<tr>
<th><?= __d('field', 'action'); ?></th>
<th><?= __d('field', 'actor'); ?></th>
<th><?= __d('field', 'comment'); ?></th>
<th><?= __d('field', 'created'); ?></th>
</tr>
</thead>

<tbody>
<?php foreach($vv_obj->petition_history_records as $hr): ?>
<tr>
<td><?= $hr['action'] ?></td>
<td><?= $hr['actor_person_id'] // XXX Replace with link to actor and name of ?></td>
<td><?= $hr['comment'] ?></td>
<td><?= $hr['created'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</li>
<?php endif; ?>
20 changes: 13 additions & 7 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1354,23 +1354,23 @@ field data is in the right column; see also ul.data-list
above. ***/
ul.form-list {
clear: both;
margin-top: 0.5rem;
padding: 0;
}
body.view ul.form-list {
border-bottom: 1px solid var(--cmg-color-bg-005);
border-top: 1px solid var(--cmg-color-bg-005);
}
.cm-time-picker-vals ul li,
ul.form-list li {
background-color: var(--cmg-color-body-bg);
border-left: 1px solid var(--cmg-color-bg-005);
border-top: 1px solid var(--cmg-color-bg-005);
border-bottom: 1px solid var(--cmg-color-bg-005);
border-right: 1px solid var(--cmg-color-bg-005);
margin: 0;
padding: 0;
list-style: none;
}
ul.fields li.form-list-header {
overflow-x: unset;
margin-top: 2rem;
}
ul.fields li.form-list-header h2 {
color: var(--cmg-color-txt-inverse);
Expand All @@ -1396,8 +1396,7 @@ ul.form-list li .field:hover {
}
ul.form-list li.fields-submit {
background-color: unset;
border-left: none;
border-right: none;
border: none;
}
ul.form-list li.fields-submit .field:hover {
background-color: var(--cmg-color-body-bg);
Expand Down Expand Up @@ -1893,8 +1892,12 @@ body.attributecollectors .submit {
padding-right: 1em;
white-space: nowrap;
}
ul#view_Petitions.form-list {
border-top: none;
}
ul.form-list li.petition-status-title {
margin-bottom: 1rem;
margin-top: 0.5rem;
margin-bottom: -1rem;
border: none;
}
ul.form-list li.petition-status-title h2 {
Expand Down Expand Up @@ -2131,6 +2134,9 @@ table.table-striped tbody tr:nth-child(2n) td {
td .alert {
margin-bottom: 0;
}
.history-table th {
font-weight: normal;
}
/* LOADING ANIMATION & SKELETONS */
@keyframes loading {
0% { opacity: 0.3; }
Expand Down

0 comments on commit 076ca56

Please sign in to comment.