'cancel',
'variant' => 'secondary',
'text' => __('Cancel'),
],
[
'clickFunction' => 'deleteEntry',
'variant' => 'danger',
'text' => __('Delete Message'),
],
[
'clickFunction' => 'resendMessage',
'text' => __('Re-Send Message'),
]
];
$tools = sprintf(
'
%s
%s
%s
',
sprintf('%s%s',
sprintf('/localTools/view/%s', h($request['localTool']->id)),
h($request['localTool']->description),
h($request['localTool']->name),
__('(local tool)')
),
sprintf('', $this->FontAwesome->getClass('long-arrow-alt-right')),
sprintf('%s%s',
sprintf('/localTools/broodTools/%s', h($request['data']['remote_tool']['id'])),
h($request['data']['remote_tool']['description'] ?? ''),
h($request['data']['remote_tool']['name']),
__('(remote tool)')
)
);
$table = $this->Bootstrap->table(['small' => true, 'bordered' => false, 'striped' => false, 'hover' => false], [
'fields' => [
['key' => 'created', 'label' => __('Date'), 'formatter' => function($value, $row) {
return $value->i18nFormat('yyyy-MM-dd HH:mm:ss');
}],
['key' => 'brood', 'label' => __('Brood'), 'formatter' => function($brood, $row) {
return sprintf('%s',
$this->Url->build(['controller' => 'broods', 'action' => 'view', $brood['id']]),
h($brood['name'])
);
}],
['key' => 'individual', 'label' => __('Individual'), 'formatter' => function($individual, $row) {
return sprintf('%s',
$this->Url->build(['controller' => 'users', 'action' => 'view', $individual['id']]),
h($individual['email'])
);
}],
['key' => 'individual.alignments', 'label' => __('Alignment'), 'formatter' => function($alignments, $row) {
$html = '';
foreach ($alignments as $alignment) {
$html .= sprintf('',
h($alignment['type']),
$this->Url->build(['controller' => 'users', 'action' => 'view', $alignment['organisation']['id']]),
h($alignment['organisation']['name'])
);
}
return $html;
}],
],
'items' => [$request->toArray()],
]);
$requestData = $this->Bootstrap->collapse([
'title' => __('Message data'),
'open' => true,
],
sprintf('%s
', json_encode($request['data']['sent'], JSON_PRETTY_PRINT))
);
$rows = sprintf('%s | %s |
', __('URL'), h($request['data']['url']));
$rows .= sprintf('%s | %s |
', __('Reason'), h($request['data']['reason']['message']) ?? '');
$rows .= sprintf('%s | %s |
', __('Errors'), h(json_encode($request['data']['reason']['errors'])) ?? '');
$table2 = sprintf('', $rows);
$form = $this->element('genericElements/Form/genericForm', [
'entity' => null,
'ajax' => false,
'raw' => true,
'data' => [
'model' => 'Inbox',
'fields' => [
[
'field' => 'is_delete',
'type' => 'checkbox',
'default' => false
]
],
'submit' => [
'action' => $this->request->getParam('action')
]
]
]);
$form = sprintf('%s
', $form);
$messageSent = $this->Bootstrap->card([
'headerHTML' => __('Message Sent'),
'bodyHTML' => sprintf('%s%s', $table2, $requestData),
'bodyClass' => 'p-2',
]);
$bodyHtml = sprintf('%s',
$tools,
$table,
$messageSent,
$form
);
echo $this->Bootstrap->modal([
'title' => $request['title'],
'size' => 'xl',
'type' => 'custom',
'bodyHtml' => sprintf('%s
',
$bodyHtml
),
'footerButtons' => $footerButtons
]);
?>