| @@ 11-44 (lines=34) @@ | ||
| 8 | use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Prefixable; |
|
| 9 | use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Suffixable; |
|
| 10 | ||
| 11 | class DatePickerField extends CrudFieldAbstract |
|
| 12 | { |
|
| 13 | use Hintable, Defaultable; |
|
| 14 | ||
| 15 | protected $type = 'date_picker'; |
|
| 16 | ||
| 17 | public function __construct(string $name) |
|
| 18 | { |
|
| 19 | parent::__construct($name); |
|
| 20 | ||
| 21 | $this->format('dd.mm.yyyy'); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function todayButton(bool $button = true) |
|
| 25 | { |
|
| 26 | $this->options['date_picker_options']['todayBtn'] = $button; |
|
| 27 | ||
| 28 | return $this; |
|
| 29 | } |
|
| 30 | ||
| 31 | public function format(string $format) |
|
| 32 | { |
|
| 33 | $this->options['date_picker_options']['format'] = $format; |
|
| 34 | ||
| 35 | return $this; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function language(string $language) |
|
| 39 | { |
|
| 40 | $this->options['date_picker_options']['language'] = $language; |
|
| 41 | ||
| 42 | return $this; |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 11-44 (lines=34) @@ | ||
| 8 | use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Prefixable; |
|
| 9 | use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Suffixable; |
|
| 10 | ||
| 11 | class DateTimePickerField extends CrudFieldAbstract |
|
| 12 | { |
|
| 13 | use Hintable, Defaultable; |
|
| 14 | ||
| 15 | protected $type = 'datetime_picker'; |
|
| 16 | ||
| 17 | public function __construct(string $name) |
|
| 18 | { |
|
| 19 | parent::__construct($name); |
|
| 20 | ||
| 21 | $this->format('DD.MM.YYYY HH:mm'); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function nullable(bool $nullable = true) |
|
| 25 | { |
|
| 26 | $this->options['allows_null'] = $nullable; |
|
| 27 | ||
| 28 | return $this; |
|
| 29 | } |
|
| 30 | ||
| 31 | public function format(string $format) |
|
| 32 | { |
|
| 33 | $this->options['datetime_picker_options']['format'] = $format; |
|
| 34 | ||
| 35 | return $this; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function language(string $language) |
|
| 39 | { |
|
| 40 | $this->options['datetime_picker_options']['language'] = $language; |
|
| 41 | ||
| 42 | return $this; |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||