__('Request Sent'), 'icon' => 'paper-plane', 'title' => __(''), 'confirmButton' => __('Accept Request'), 'canDiscard' => true, ], [ 'text' => __('Request Accepted'), 'icon' => 'check-square', 'title' => __(''), 'confirmButton' => __('Finalise Connection') ], [ 'text' => __('Connection Done'), 'icon' => 'exchange-alt', 'title' => __(''), ] ]; $footerButtons = []; $progressVariant = !empty($progressVariant) ? $progressVariant : 'info'; $finalSteps = array_replace($defaultSteps, $steps ?? []); $currentStep = $finalSteps[$progressStep]; $progress = $this->Bootstrap->progressTimeline([ 'variant' => $progressVariant, 'selected' => !empty($progressStep) ? $progressStep : 0, 'steps' => $finalSteps, ]); $footerButtons[] = [ 'clickFunction' => 'cancel', 'variant' => 'secondary', 'text' => __('Cancel'), ]; if (!empty($currentStep['canDiscard'])) { $footerButtons[] = [ 'clickFunction' => 'discard', 'variant' => 'danger', 'text' => __('Decline Request'), ]; } $footerButtons[] = [ 'clickFunction' => 'accept', 'text' => $currentStep['confirmButton'] ?? __('Submit'), ]; $table = $this->Bootstrap->table(['small' => true, 'bordered' => false, 'striped' => false, 'hover' => false], [ 'fields' => [ ['path' => 'created', 'label' => __('Date'), 'formatter' => function($value, $row) { return $value->i18nFormat('yyyy-MM-dd HH:mm:ss'); }], ['path' => 'connector', 'label' => __('Tool Name'), 'formatter' => function($connector, $row) { return sprintf('%s', $this->Url->build(['controller' => 'localTools', 'action' => 'viewConnector', $connector['name']]), sprintf('%s (v%s)', h($connector['name']), h($connector['connector_version'])) ); }], ['path' => 'brood', 'label' => __('Brood'), 'formatter' => function($brood, $row) { return sprintf('%s', $this->Url->build(['controller' => 'broods', 'action' => 'view', $brood['id']]), h($brood['name']) ); }], ['path' => 'individual', 'label' => __('Individual'), 'formatter' => function($individual, $row) { return sprintf('%s', $this->Url->build(['controller' => 'users', 'action' => 'view', $individual['id']]), h($individual['email']) ); }], ['path' => 'individual.alignments', 'label' => __('Alignment'), 'formatter' => function($alignments, $row) { $html = ''; foreach ($alignments as $alignment) { $html .= sprintf('
%s @ %s
', h($alignment['type']), $this->Url->build(['controller' => 'users', 'action' => 'view', $alignment['organisation']['id']]), h($alignment['organisation']['name']) ); } return $html; }], ], 'items' => [$request->toArray()], ]); $form = $this->element('genericElements/Form/genericForm', [ 'entity' => null, 'ajax' => false, 'raw' => true, 'data' => [ 'model' => 'Inbox', 'fields' => [], 'submit' => [ 'action' => $this->request->getParam('action') ] ] ]); $localToolHTML = $this->fetch('content', sprintf('
%s
', $form));; $requestData = $this->Bootstrap->collapse( [ 'text' => __('Inter-connection data'), 'open' => true, ], sprintf('
%s
', json_encode($request['data'], JSON_PRETTY_PRINT)) ); $bodyHtml = sprintf('
%s
%s
%s', $table, $requestData, $localToolHTML ); echo $this->Bootstrap->modal([ 'title' => __('Interconnection Request for {0}', h($request->local_tool_connector_name)), 'size' => 'xl', 'type' => 'custom', 'bodyHtml' => sprintf('
%s
%s
', $progress, $bodyHtml ), 'footerButtons' => $footerButtons ]); ?>