Skip to content

Fix Enrollment Flow Step petition preview #302

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>