<?php
use wap\assets\AppAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\StringHelper;
use yii\helpers\ArrayHelper;
use home\modules\reimbursement\models\Reimbursement;
use home\modules\reimbursement\models\Category;
use home\modules\reimbursement\models\Application;

$this->title = StringHelper::truncate($model['name'], 10);

/* @var $this \yii\web\View */

?>

<div class="mainbody">
    <div class="detail-content">
        <form class="detailform">
            <tbody>
                <table width="100%">
                    <tr>
                        <td width="80">申请状态</td>
                        <td>
                        <?php 
                            if ($model['isverify'] == Application::ISVERIFY_WAIT) {
                                echo '<font color="green">待审核</font>';
                            } elseif ($model['isverify'] == Application::ISVERIFY_ENABLE) {
                                echo '<font color="green">通过</font>';
                            } else {
                                echo '<font color="red">否决</font>';
                            }
                        ?>
                        </td>
                    </tr>
                    <tr>
                        <td width="80">用途</td>
                        <td><?= $model['name'] ?></td>
                    </tr>
                    <tr>
                        <td >关联信息</td>
                        <?php $data = common\models\Common::getLinkData($model['link_type'], $model['link_id']); ?>
                        <td><?= ArrayHelper::getValue($data, 'name'); ?></td>
                    </tr>
                    <?php if (isset($model['application']) && !empty($model['application'])) : ?>
                    <tr>
                        <td width="80" >申请单名称</td>  
                        <td >
                            <a href="<?= Url::to(['/application/detail', 'id' => $model['appli_id']]) ?>">
                                <?= $model['application']['name'] ?>
                            </a>
                        </td>
                    </tr>
                    <tr>
                        <td width="80">申请单状态</td>
                        <td >
                            <?php 
                                if ($model['application']['isverify'] == Application::ISVERIFY_WAIT) {
                                    echo '<font color="green">待审核</font>';
                                } elseif ($model['application']['isverify'] == Application::ISVERIFY_ENABLE) {
                                    echo '<font color="green">通过</font>';
                                } elseif ($model['application']['isverify'] == Application::ISVERIFY_DISABLE) {
                                    echo '<font color="red">否决</font>';
                                }
                            ?>
                        </td>
                    </tr>
                    <?php endif; ?>
                    <tr>
                        <td >日期</td>
                        <td><?= date('Y-m-d', $model['reim_time']) ?></td>
                    </tr>
                    <tr>
                    <tr>
                        <td>类别</td>
                        <td><?= Category::getNameWithAllParents($model['category_id']) ?></td>
                    </tr>
                    <tr>
                        <td>金额</td>
                        <td><?= $model['reim_money'] ?></td>
                    </tr>
                    <tr>
                        <td>票据</td>
                        <td><?= $model['bill_amount'] ?></td>
                    </tr>
                    <tr>
                        <td>报销人</td>
                        <td><?= $model['reim_people'] ?></td>
                    </tr>
                    <tr>
                        <td>审核人</td>
                        <td><?= implode(',', ArrayHelper::getColumn(\common\models\User::getUserByDot($model->verify_ids), 'realname')) ?></td>
                    </tr>
                    <tr>
                        <td valign="top">备注</td>
                        <td><?= $model['remark'] ?></td>
                    </tr>
                </table>
            </tbody>
        </form>
    </div>
</div>
