| @@ 34-46 (lines=13) @@ | ||
| 31 | return $value; |
|
| 32 | } |
|
| 33 | ||
| 34 | public function render() |
|
| 35 | { |
|
| 36 | $this->options['format'] = $this->format; |
|
| 37 | $this->options['locale'] = array_key_exists('locale', $this->options) ? $this->options['locale'] : config('app.locale'); |
|
| 38 | $this->options['allowInputToggle'] = true; |
|
| 39 | ||
| 40 | $this->script = "$('{$this->getElementClassSelector()}').parent().datetimepicker(".json_encode($this->options).');'; |
|
| 41 | ||
| 42 | $this->prepend('<i class="fa fa-calendar fa-fw"></i>') |
|
| 43 | ->defaultAttribute('style', 'width: 110px'); |
|
| 44 | ||
| 45 | return parent::render(); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 39-61 (lines=23) @@ | ||
| 36 | return $value; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function render() |
|
| 40 | { |
|
| 41 | $this->options['format'] = $this->format; |
|
| 42 | $this->options['locale'] = array_key_exists('locale', $this->options) ? $this->options['locale'] : config('app.locale'); |
|
| 43 | $this->options['allowInputToggle'] = true; |
|
| 44 | ||
| 45 | $this->script = "$('{$this->getElementClassSelector()}').flatpickr({mode: 'multiple',dateFormat: 'Y-m-d', locale: 'zh', plugins: [ |
|
| 46 | ShortcutButtonsPlugin({ |
|
| 47 | button: { |
|
| 48 | label: 'Clear', |
|
| 49 | }, |
|
| 50 | onClick: (index, fp) => { |
|
| 51 | fp.clear(); |
|
| 52 | fp.close(); |
|
| 53 | } |
|
| 54 | }) |
|
| 55 | ]});"; |
|
| 56 | ||
| 57 | $this->prepend('<i class="fa fa-calendar fa-fw"></i>') |
|
| 58 | ->defaultAttribute('style', 'width: 100%'); |
|
| 59 | ||
| 60 | return parent::render(); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||