<?php

/**
 * @var string $ticketNo
 * @var string $fromCustomerNo
 * @var array|null $ticket
 * @var bool $connectionError
 * @var string $ticketCustomerNo
 * @var string $ticketDescription
 * @var string $ticketCommunicationUrl
 */

$ticketNo = $ticketNo ?? '';
$fromCustomerNo = $fromCustomerNo ?? '';
$ticket = is_array($ticket ?? null) ? $ticket : null;
$connectionError = $connectionError ?? false;
$ticketCustomerNo = $ticketCustomerNo ?? '';
$ticketDescription = $ticketDescription ?? '';
$ticketCommunicationUrl = $ticketCommunicationUrl ?? '';

$backUrl = $ticketCustomerNo !== '' ? lurl('helpdesk/debitor/' . rawurlencode($ticketCustomerNo)) : lurl('helpdesk');

$titlebar = [
    'title' => t('Ticket') . ' ' . $ticketNo,
    'backHref' => $backUrl,
    'backTitle' => t('Back'),
    'actions' => $ticket !== null ? [
        [
            'label' => t('Refresh data'),
            'type' => 'button',
            'name' => 'ticket-refresh',
            'class' => 'secondary outline',
        ],
    ] : [],
];
require templatePath('partials/app-details-titlebar.phtml');
require __DIR__ . '/../../templates/helpdesk-ticket-detail.phtml';
