Skip to content

Commit

Permalink
Fix enrollment flow step ux (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis authored Feb 15, 2025
1 parent 6f417cc commit 26a5f33
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

use Cake\ORM\TableRegistry;
use App\Controller\StandardEnrollerController;
use App\Lib\Enum\PetitionStatusEnum;

class BasicAttributeCollectorsController extends StandardEnrollerController {
public $paginate = [
Expand All @@ -40,6 +39,27 @@ class BasicAttributeCollectorsController extends StandardEnrollerController {
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.1.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->BasicAttributeCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->BasicAttributeCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->BasicAttributeCollectors->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
class BasicAttributeCollectorsTable extends Table {
use \App\Lib\Traits\AutoViewVarsTrait;
use \App\Lib\Traits\CoLinkTrait;
use \App\Lib\Traits\LayoutTrait;
use \App\Lib\Traits\LabeledLogTrait;
use \App\Lib\Traits\LayoutTrait;
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\TabTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;

Expand Down Expand Up @@ -91,6 +92,22 @@ public function initialize(array $config): void {
$this->setRequiresCO(true);
$this->setAllowLookupPrimaryLink(['dispatch', 'display']);

// All the tabs share the same configuration in the ModelTable file
$this->setTabsConfig(
[
// Ordered list of Tabs
'tabs' => ['EnrollmentFlowSteps', 'CoreEnroller.BasicAttributeCollectors'],
// What actions will include the subnavigation header
'action' => [
// If a model renders in a subnavigation mode in edit/view mode, it cannot
// render in index mode for the same use case/context
// XXX edit should go first.
'EnrollmentFlowSteps' => ['edit', 'view'],
'CoreEnroller.BasicAttributeCollectors' => ['edit'],
]
]
);

$this->setAutoViewVars([
'affiliationTypes' => [
'type' => 'type',
Expand Down
4 changes: 3 additions & 1 deletion app/src/Model/Table/EnrollmentFlowStepsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function initialize(array $config): void {
$this->setPrimaryLink('enrollment_flow_id');
$this->setRequiresCO(true);
$this->setRedirectGoal('self');
$this->setRedirectGoal(action: 'delete', goal: 'deleted');

$this->setAutoViewVars([
'actorTypes' => [
Expand Down Expand Up @@ -110,7 +111,8 @@ public function initialize(array $config): void {
// Actions that operate over a table (ie: do not require an $id)
'table' => [
'add' => ['platformAdmin', 'coAdmin'],
'index' => ['platformAdmin', 'coAdmin']
'index' => ['platformAdmin', 'coAdmin'],
'deleted' => ['platformAdmin', 'coAdmin']
],
'related' => [
'table' => [
Expand Down

0 comments on commit 26a5f33

Please sign in to comment.