<?php
use yii\helpers\Url;
use qcbase\models\Config;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use home\modules\reimbursement\models\Application;

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

<div class="nav">
    <!--<div class="return"><a href="">返回上一级</a></div>-->
    <ul class="cc">
        <li ><a href="<?= Url::to(['config/basic']) ?>">基本配置</a></li>
        <li ><a href="<?= Url::to(['config/system']) ?>">系统配置</a></li>
        <li ><a href="<?= Url::to(['config/reimbursement']) ?>">报销配置</a></li>
        <li class="current"><a href="<?= Url::to(['config/application']) ?>">申请单配置</a></li>
    </ul>
</div>
<?php $form = ActiveForm::begin([
    'id' => 'main-form',
    'action' => ['config/update'],
    'fieldConfig' => [
        'options' => ['tag' => 'tr'],
        'template' => "<th width='120'>{label}</th><td>{input}{error}</td><td>{hint}</td>",
        'hintOptions' => ['class' => 'fun_tips'],
    ]
]); ?>

<div class="h_a">温馨提示</div>
<div class="prompt_text">
    <p>请在修改完配置后，<a href="javascript:parent.iframeJudge({elem:this, id:'cache', title:'更新缓存', href:'<?= Url::to(['/site/cache']) ?>' });">更新缓存</a>，否则数据将不会同步更新 !</p>
</div>

<div class="h_a">基础配置</div>
<div class="table_full">
    <table width="100%">
        <col class="th" />
        <col width="500" />
        <col />
        <?= $form
            ->field($model, 'application_verify_select')
            ->dropDownList([
                '0' => '不允许',
                '1' => '允许',
                ])
            ->hint('$application_verify_select') 
        ?>
        <?= $form
            ->field($model, 'application_user_select')
            ->dropDownList([
                'leader' => '部门领导',
                'verify' => '部门审核人',
                ])
            ->hint('$application_user_select') 
        ?>
    </table>
</div>

<div class="h_a">报销人角色配置</div>
<div class="table_full">
    <table width="100%">
        <col class="th" />
        <col width="500" />
        <col />
        <?= $form
            ->field($model, 'application_reim_show')
            ->dropDownList([
                Application::ISVERIFY_WAIT => '待审核',
                Application::ISVERIFY_ENABLE => '审核通过',
                Application::ISVERIFY_DISABLE => '审核不通过',
                ], ['multiple' => true, 'style' => 'height:60px;'])
            ->hint('$application_reim_show') 
        ?>

        <tr class="field-config-application_reim_order required has-error">
            <th width="120">
                <label class="control-label" for="config-application_reim_order">列表页排序规则</label>
            </th>
            <td>
                <label class="control-label">1.</label>
                <select id="config-application_reim_order" class="form-control" name="Config[application_reim_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_reim_order'][0] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_reim_order'][0] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_reim_order'][0] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>&nbsp;&nbsp;&nbsp;
                <label class="control-label">2.</label>
                <select id="config-application_reim_order" class="form-control" name="Config[application_reim_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_reim_order'][1] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_reim_order'][1] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_reim_order'][1] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>&nbsp;&nbsp;&nbsp;
                <label class="control-label">3.</label>
                <select id="config-application_reim_order" class="form-control" name="Config[application_reim_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_reim_order'][2] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_reim_order'][2] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_reim_order'][2] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>
            </td>
            <td><div class="fun_tips">$application_reim_order</div></td>
        </tr>
    </table>
</div>

<div class="h_a">审核人角色配置</div>
<div class="table_full">
    <table width="100%">
        <col class="th" />
        <col width="500" />
        <col />
        <?= $form
            ->field($model, 'application_verify_show')
            ->dropDownList([
                Application::ISVERIFY_WAIT => '待审核',
                Application::ISVERIFY_ENABLE => '审核通过',
                Application::ISVERIFY_DISABLE => '审核不通过',
                ], ['multiple' => true, 'style' => 'height:60px;'])
            ->hint('$application_verify_show') 
        ?>

        <tr class="field-config-application_verify_order required has-error">
            <th width="120">
                <label class="control-label" for="config-application_verify_order">列表页排序规则</label>
            </th>
            <td>
                <label class="control-label">1.</label>
                <select id="config-application_verify_order" class="form-control" name="Config[application_verify_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_verify_order'][0] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_verify_order'][0] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_verify_order'][0] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>&nbsp;&nbsp;&nbsp;
                <label class="control-label">2.</label>
                <select id="config-application_verify_order" class="form-control" name="Config[application_verify_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_verify_order'][1] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_verify_order'][1] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_verify_order'][1] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>&nbsp;&nbsp;&nbsp;
                <label class="control-label">3.</label>
                <select id="config-application_verify_order" class="form-control" name="Config[application_verify_order][]">
                    <option value="<?= Application::ISVERIFY_WAIT ?>" <?php if ($model['application_verify_order'][2] == Application::ISVERIFY_WAIT) echo "selected"; ?>>待审核</option>
                    <option value="<?= Application::ISVERIFY_ENABLE ?>" <?php if ($model['application_verify_order'][2] == Application::ISVERIFY_ENABLE) echo "selected"; ?>>审核通过</option>
                    <option value="<?= Application::ISVERIFY_DISABLE ?>" <?php if ($model['application_verify_order'][2] == Application::ISVERIFY_DISABLE) echo "selected"; ?>>审核不通过</option>
                </select>
            </td>
            <td><div class="fun_tips">$application_verify_order</div></td>
        </tr>
    </table>
</div>

<input name="config_name" type="hidden" value="application" />

<div class="btn_wrap">
    <div class="btn_wrap_pd">
        <button class="btn btn_submit mr10" type="submit">提交</button>
    </div>
</div>

<?php ActiveForm::end(); ?>
