<?php
use wap\assets\AppAsset;
use common\assets\MobiscrollAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use home\modules\reimbursement\models\Reimbursement;
use home\modules\reimbursement\models\Category;

$this->title = '报销申请';

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

MobiscrollAsset::register($this);
$asset = $this->getAssetManager()->getBundle(AppAsset::className());
$this->registerJsFile($asset->baseUrl.'/js/scroll.load.js', ['depends' => [AppAsset::className()]]);
$this->registerJsFile($asset->baseUrl.'/js/reimbursement.create.js', ['depends' => [AppAsset::className()]]);
?>

<div class="modal fade">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-body">
      </div>
    </div>
  </div>
</div>

<?= $this->render('/task/_task-overview', ['task' => $linkData]) ?>

<div class="apply-account">
    <form action="<?= Url::to(['create']) ?>" method="post" id="main-form">
        <table width="100%">
            <tr>
                <td width="40">日期</td>
                <td><input type="text" class="form-control" name="Reimbursement[reim_time]" value="<?= (!empty($model['reim_time'])) ? $model['reim_time'] : date('Y-m-d') ?>" placeholder="点击选择日期"></td>
            </tr>
            <tr>
                <td>用途</td>
                <td><input type="text" name="Reimbursement[name]" value="<?= $model['name'] ?>" class="form-control" style="width:65%; float:left" placeholder="请输入用途">
                    <input type="text" class="form-control" value="<?= Yii::$app->request->get('appli_name', '') ?>" id="appli-input" data-choose-url="<?= Url::to(['choose-appli']) ?>" name="Reimbursement[appli_name]" style="width:33%; float:right" placeholder="申请单>" readonly="true"></td>
            </tr>
            <tr>
                <tr>
                    <td>类别</td>
                    <td>
                        <select class="form-control" name="Reimbursement[category_id]">
                            <?php echo Category::getDropDownTree($model['category_id'], 0, true, 'cat_id'); ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>金额</td>
                    <td><input type="text" class="form-control" name="Reimbursement[reim_money]" value="<?= $model['reim_money'] ?>" style="width:45%; float:left" placeholder="请输入金额">
                    <input type="text" class="form-control" name="Reimbursement[bill_amount]" value="<?= !empty($model['bill_amount']) ? $model['bill_amount'] : 1 ?>" style="width:35%; float:right" placeholder="请输入票据">
                        <span style="float:right; position:relative; top:6px; left:-8px;">票据</span></td>
                </tr>
                <tr>
                    <td valign="top">备注</td>
                    <td><textarea class="form-control" name="Reimbursement[remark]" rows="3" placeholder="请输入备注，选填"><?= $model['remark'] ?></textarea></td>
                </tr>
                <tr>
                    <td></td>
                    <td><button type="button" class="btn btn-primary" id="save-btn" style="width:100%">保  存</button></td>
                </tr>
            </table>
            <input name="_csrf" type="hidden" value="<?= Yii::$app->request->getCsrfToken() ?>" />
            <input name="Reimbursement[link_id]" type="hidden" value="<?= $linkId ?>" />
            <input name="Reimbursement[link_type]" type="hidden" value="<?= $linkType ?>" />
            <input name="Reimbursement[reim_people]" type="hidden" value="<?= Yii::$app->user->identity->realname ?>" />
            <input name="Reimbursement[verify_names]" type="hidden" value="<?= Reimbursement::getDeptLeader()['leader_name'] ?>" />
            <input name="Reimbursement[verify_ids]" type="hidden" value="<?= Reimbursement::getDeptLeader()['leader_id'] ?>" />
            <input name="Reimbursement[appli_id]" type="hidden" value="<?= Yii::$app->request->get('appli_id', 0) ?>" />
        </form>
    </div>

    <div class="common-list reimbursement-list already-reimbursement-list green">
        <h3>已报销<i class="icon-angle-down"></i></h3>
        <ul id="scroll-ul" data-scroll-pagination="enabled" data-page-url="<?= Url::to(['get-link-reim', 'link_id' => Yii::$app->request->get('link_id'), 'link_type' => Yii::$app->request->get('link_type')]) ?>">
        </ul>
        <div id="loading" class="load ">
            <p><img src="<?= Yii::getAlias('@web') ?>/static/images/scroll-loading.gif" alt="加载中"></p>
        </div>
        <div id="load-end">
            <p><a href="javascript:;">点击显示更多</a></p>
        </div>
        <div id="load-top"></div>

    </div>


