<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use home\modules\schedule\models\Schedule;
use home\modules\schedule\models\Category;

$action = isset($action) ? $action : $this->context->id . '/index';
$searchForm = ActiveForm::begin([ 'id' => 'search-form', 'action' => [$action], 'method' => 'get']);
$search = $model->search();
?>
<div class="task-title-date" >
    <input  placeholder="关键字" class="form-control fl date-form-control search-form" value="<?= (isset($get['keywords'])) ? Html::encode($get['keywords']) : '' ?>" name="keywords" >
	<?php if (isset($search['keywords'])) : ?>
		<select class="form-control fl date-form-control search-form" style="width:9%" name="search_field">
			<?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>
		
		<select class="form-control  fl date-form-control search-form" style="width:9%" name="category_id">
            <option value="">---项目类别---</option>
            <?php echo Category::getDropDownTree(isset($get['category_id']) ? $get['category_id'] : ''); ?>
        </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;
		
		<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>
	<?php endif; ?>
</div>
<?php ActiveForm::end(); ?>
