<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use common\assets\My97DatePickerAsset;

My97DatePickerAsset::register($this);
$year = date("Y");
$month = date("m");
$allday = date("t");
$begin_time = date('Y-m-d', strtotime($year."-".$month."-1"));
$end_time = date('Y-m-d', strtotime($year."-".$month."-".$allday));
$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: 12%" 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>
		<?php endif; ?>
        
        <span class="fl" style="padding-left: 13px;">从</span>
        <input style="width: 14%;" type="text" id="reimbursement-begin_time" value="<?= isset($get['begin_time'])?$get['begin_time']:$begin_time ?>" class="form-control fl date-form-control " name="begin_time" onfocus="WdatePicker({&quot;readOnly&quot;:true,&quot;dateFmt&quot;:&quot;yyyy-MM-dd&quot;})">
        <span class="fl" style="padding-left: 20px;">至</span>
        <input style="width: 14%;" type="text" id="reimbursement-end_time" value="<?= isset($get['end_time'])?$get['end_time']:$end_time ?>" class="form-control fl date-form-control " name="end_time" onfocus="WdatePicker({&quot;readOnly&quot;:true,&quot;dateFmt&quot;:&quot;yyyy-MM-dd&quot;,minDate:'#F{$dp.$D(\'reimbursement-begin_time\');}'})">

        <button title="搜索" type="submit" class="btn btn-primary fl btn-serch  task-sou"><i class="icon-search"></i></button>
        <button title="重置" type="button" class="btn btn-default fl btn-reset  reset_search"><i class="icon-undo"></i></button>

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