<?php
$type = '<tr><th class="w-90px">' . $lang->refund->type . '</th><td>' . zget($lang->refund->typeList, $refund->type) . '</td></tr>';
if($refund->type == 'deduction') $type .= "<tr><th>{$lang->refund->deductionMonth}</th><td>" . date(DT_DATE5, strtotime($refund->deductionMonth . '01')) . '</td></tr>';
?>
<script>
$('.side-col .table-data tbody').prepend('<?php echo $type;?>');
<?php if($refund->type == 'deduction'):?>
$('.main-col > .panel > .panel-body > p:first').html('<?php echo sprintf($lang->refund->deductionTip, zget($users, $refund->createdBy), zget($currencySign, $refund->currency) . $refund->money);?>'); 
<?php endif;?>

<?php /* Begin multi review. */ ?>
<?php if(!empty($config->refund->multiReviewer)):?>
<?php
$reviewedBy = '';
$reviewers  = '';

if(strpos(',wait,doing,', ",$refund->status,") !== false)
{
    $reviewedBy = zget($users, $refund->assignedTo);

    $reviewedBy = <<<EOT
<tr>
  <th>{$lang->refund->reviewedBy}</th>
  <td>{$reviewedBy}</td>
</tr>
EOT;
}

if(isset($refund->reviewers) && is_array($refund->reviewers))
{
    $reviewers  = '<tr>';
    $reviewers .= "<th>{$lang->refund->reviewers}</th>";
    $reviewers .= "<td>";
    foreach($refund->reviewers as $reviewer => $status)
    {
        $reviewers .= "<span class='refund-$status'>" . zget($users, $reviewer) . ' </span>';
    }
    $reviewers .= '</td>';
    $reviewers .= '</tr>';
}
?>

<?php if($reviewedBy):?>
$('#firstReviewer').before(<?php echo helper::jsonEncode($reviewedBy);?>);
<?php endif;?>

<?php if($reviewers):?>
$('#firstReviewer').before(<?php echo helper::jsonEncode($reviewers);?>);
<?php endif;?>

$('#firstReviewer, #secondReviewer').remove();
<?php endif;?>
<?php /* End multi review. */ ?>

<?php $company = $this->loadModel('company')->getByID($refund->refundCompany);?>
<?php if($company):?>
$('.side-col .table-data tbody').prepend('<tr><th class="w-90px"><?php echo $lang->refund->refundCompany;?></th><td><?php echo $company->name;?></td></tr>');
$('.main-actions a[href*=review]').attr('data-width', '900');
<?php endif;?>
</script>
