Skip to content

Commit

Permalink
Fix Enrollment Flow Step petition preview (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis authored Feb 24, 2025
1 parent d966733 commit b2c5bcc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ public function display(int $petitionId): void
{
$vv_enrollment_atttributes_ids = Hash::extract($this->vv_obj->petition_attributes, '{n}.enrollment_attribute_id');
$vv_enrollment_atttributes_ids = array_unique($vv_enrollment_atttributes_ids);
$vv_enrollment_attributes = [];

$vv_enrollment_attributes = $this->fetchTable('EnrollmentAttributes')
->find()
->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids))
->order(['ordr' => 'ASC'])
->toArray();
if (!empty($vv_enrollment_atttributes_ids)) {
$vv_enrollment_attributes = $this->fetchTable('EnrollmentAttributes')
->find()
->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids))
->order(['ordr' => 'ASC'])
->toArray();
}

$this->set('vv_enrollment_attributes', $vv_enrollment_attributes);
$this->set('vv_step', $this->vv_step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@

declare(strict_types = 1);

if (empty($vv_enrollment_attributes)) {
print $this->element('emptyPetitionFlowStep', [], [
'cache' => '_html_elements',
]);
return;
}

?>

<ul>
Expand Down
38 changes: 22 additions & 16 deletions app/plugins/CoreEnroller/templates/cell/EmailVerifiers/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,27 @@

use App\Lib\Enum\VerificationMethodEnum;

if (empty($vv_pv)) {
print $this->element('emptyPetitionFlowStep', [], [
'cache' => '_html_elements',
]);
return;
}

?>

<?php if(!empty($vv_pv)): ?>
<ul>
<?php foreach($vv_pv as $pv): ?>
<li><?= $pv->mail ?>:
<?php if(!empty($pv->verification) && $pv->verification->isVerified()): ?>
<?= __d('result', 'Verifications.status', [
VerificationMethodEnum::getLocalization($pv->verification->method),
$this->Time->nice($pv->verification->verification_time, $viewVars["vv_tz"])
]) ?>
<?php else: ?>
<span class="mr-1 badge bg-warning unverified"><?= __d('field','unverified') ?></span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

<ul>
<?php foreach($vv_pv as $pv): ?>
<li><?= $pv->mail ?>:
<?php if(!empty($pv->verification) && $pv->verification->isVerified()): ?>
<?= __d('result', 'Verifications.status', [
VerificationMethodEnum::getLocalization($pv->verification->method),
$this->Time->nice($pv->verification->verification_time, $viewVars["vv_tz"])
]) ?>
<?php else: ?>
<span class="mr-1 badge bg-warning unverified"><?= __d('field','unverified') ?></span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>

0 comments on commit b2c5bcc

Please sign in to comment.