<?php

use yii\widgets\ActiveForm;
use yii\helpers\Html;
use home\modules\contract\models\Category;
use home\modules\contract\models\Contract;
use home\modules\customer\models\District;

$action = isset($action) ? $action : $this->context->id . '/index-iframe';
$searchForm = ActiveForm::begin([ 'id' => 'search-form', 'action' => [$action], 'method' => 'get']);
$search = $model->search();
$district_id = isset($get['district_id']) ? $get['district_id'] : '';
?>
<div class="task-title-date" >
  
        <input class="form-control fl date-form-control" value="<?= (isset($get['keywords'])) ? Html::encode($get['keywords']) : '' ?>" name="keywords" style="width:14% " placeholder="关键字"/>
        <?php if (isset($search['keywords'])) : ?>
            <select class="form-control fl date-form-control " name="search_field"  style="width:8% ">
                <?php foreach ($search['keywords'] as $field => $name) : ?>
                    <option <?= (isset($get['search_field']) && ($get['search_field'] == $field)) ? 'selected="selected"' : ''; ?> value="<?= $field ?>" ><?= $name ?></option>
                <?php endforeach; ?>
            </select>
        <?php endif; ?>

        <?php if (isset($search['status'])) : ?>
            <select class="form-control fl date-form-control" name="status_id"  style="width:8% ">
                <option value="">状态</option>
                <?php foreach ($search['status'] as $name) : ?>
                    <option <?= (isset($get['status_id']) && $get['status_id'] != '' && ($get['status_id'] == $name['status_id'])) ? 'selected="selected"' : ''; ?> value="<?= $name['status_id'] ?>" ><?= $name['name'] ?></option>
                <?php endforeach; ?>
            </select>
        <?php endif; ?>

        <select class="form-control fl date-form-control" name="collate_status"  style="width:8% ">
            <option value="">核对</option>
            <option  <?= (isset($get['collate_status']) && $get['collate_status'] != '' && ($get['collate_status'] == 1)) ? 'selected="selected"' : ''; ?> value="1">已核</option>
            <option  <?= (isset($get['collate_status']) && $get['collate_status'] != '' && ($get['collate_status'] == 0)) ? 'selected="selected"' : ''; ?> value="0">未核</option>
        </select>
        <select class="form-control fl date-form-control" name="bill_collate_status"  style="width:8% ">
            <option value="">开票</option>
            <option  <?= (isset($get['bill_collate_status']) && $get['bill_collate_status'] != '' && ($get['bill_collate_status'] == 1)) ? 'selected="selected"' : ''; ?> value="1">已核</option>
            <option  <?= (isset($get['bill_collate_status']) && $get['bill_collate_status'] != '' && ($get['bill_collate_status'] == 0)) ? 'selected="selected"' : ''; ?> value="0">未核</option>
        </select>
        <select class="form-control fl date-form-control" name="money_collate_status"  style="width:8% ">
            <option value="">回款</option>
            <option  <?= (isset($get['money_collate_status']) && $get['money_collate_status'] != '' && ($get['money_collate_status'] == 1)) ? 'selected="selected"' : ''; ?> value="1">已核</option>
            <option  <?= (isset($get['money_collate_status']) && $get['money_collate_status'] != '' && ($get['money_collate_status'] == 0)) ? 'selected="selected"' : ''; ?> value="0">未核</option>
        </select>
        <input type="text" id="plan_begin_time" value="<?= isset($get['begin_time']) ? $get['begin_time'] : '' ?>" class="form-control fl date-form-control " name="begin_time" onfocus="WdatePicker({'readOnly': true, 'dateFmt': 'yyyy-MM-dd', 'maxDate': '#F{$dp.$D(\'plan_end_time\')}'})" style="width:9% " placeholder="签约时间"/>
        <span class="fl">&nbsp;至</span>
        <input type="text" id="plan_end_time" value="<?= isset($get['end_time']) ? $get['end_time'] : '' ?>" class="form-control fl date-form-control search-form-mini" name="end_time" onfocus="WdatePicker({'readOnly': true, 'dateFmt': 'yyyy-MM-dd', 'minDate': '#F{$dp.$D(\'plan_begin_time\')}'})" style="width:9% " placeholder="签约时间"/>
        &nbsp;
        <input type="hidden" name="child_ids" value="<?= isset($get['child_ids']) ? $get['child_ids'] : '' ?>">
        
        <button type="submit" title="搜索"class="btn btn-primary fl btn-serch task-sou">
        <i class="icon-search"></i>
        </button>

        <button type="button" title="重置" class="btn btn-default fl btn-reset reset_search">
         <i class="icon-undo"></i>
        </button>

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