<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Filter; use Encore\Admin\Admin; class Between extends AbstractFilter { protected $view = null; public function formatId($JNXBz) { $UFOLC = str_replace('.', '_', $JNXBz); return array('start' => "{$UFOLC}_start", 'end' => "{$UFOLC}_end"); } protected function formatName($JNXBz) { goto aXRoa; neROO: if (count($aNyiQ) == 1) { $TUuqF = $aNyiQ[0]; } else { $TUuqF = array_shift($aNyiQ); foreach ($aNyiQ as $JNXBz) { $TUuqF .= "[{$JNXBz}]"; } } goto eJuq6; aXRoa: $aNyiQ = explode('.', $JNXBz); goto neROO; eJuq6: return array('start' => "{$TUuqF}[start]", 'end' => "{$TUuqF}[end]"); goto C9XH_; C9XH_: } public function condition() { goto zETmM; sFVOM: return $this->buildCondition($this->column, $this->value); goto GnmO9; wJtsB: $tzAUI = array_filter($this->value, function ($dmQF0) { return $dmQF0 !== ''; }); goto Gvtu3; fB1JL: $this->query = 'whereBetween'; goto sFVOM; ewZew: if (!isset($tzAUI['start'])) { return $this->buildCondition($this->column, '<=', $tzAUI['end']); } goto oVf6v; zETmM: if (!array_has($hXd8h, $this->column)) { return; } goto HHSyQ; Gvtu3: if (empty($tzAUI)) { return; } goto ewZew; HHSyQ: $this->value = array_get($hXd8h, $this->column); goto wJtsB; oVf6v: if (!isset($tzAUI['end'])) { return $this->buildCondition($this->column, '>=', $tzAUI['start']); } goto fB1JL; GnmO9: } public function datetime($H02oa = array()) { $this->view = 'admin::filter.betweenDatetime'; $this->prepareForDatetime($H02oa); } protected function prepareForDatetime($H02oa = array()) { goto cGgyO; ygzVr: $li24p = "            \$('#{$this->id['start']}').datetimepicker({$qQBcZ});\n            \$('#{$this->id['end']}').datetimepicker({$RF2Vt});\n            \$(\"#{$this->id['start']}\").on(\"dp.change\", function (e) {\n                \$('#{$this->id['end']}').data(\"DateTimePicker\").minDate(e.date);\n            });\n            \$(\"#{$this->id['end']}\").on(\"dp.change\", function (e) {\n                \$('#{$this->id['start']}').data(\"DateTimePicker\").maxDate(e.date);\n            });"; goto nLT1W; nLT1W: Admin::script($li24p); goto JRjQA; wE1Ls: $qQBcZ = json_encode($H02oa); goto AO0bT; cGgyO: $H02oa['format'] = array_get($H02oa, 'format', 'YYYY-MM-DD HH:mm:ss'); goto j4UTm; AO0bT: $RF2Vt = json_encode($H02oa + array('useCurrent' => false)); goto ygzVr; j4UTm: $H02oa['locale'] = array_get($H02oa, 'locale', config('app.locale')); goto wE1Ls; JRjQA: } public function render() { if (isset($this->view)) { return view($this->view, $this->variables()); } return parent::render(); } }