| @@ 5-30 (lines=26) @@ | ||
| 2 | ||
| 3 | namespace Encore\Admin\Form\Field; | |
| 4 | ||
| 5 | class Decimal extends Text | |
| 6 | { | |
| 7 | protected static $js = [ | |
| 8 | '/vendor/laravel-admin/AdminLTE/plugins/input-mask/jquery.inputmask.bundle.min.js', | |
| 9 | ]; | |
| 10 | ||
| 11 | /** | |
| 12 | * @see https://github.com/RobinHerbots/Inputmask#options | |
| 13 | * | |
| 14 | * @var array | |
| 15 | */ | |
| 16 | protected $options = [ | |
| 17 | 'alias' => 'decimal', | |
| 18 | 'rightAlign' => true, | |
| 19 | ]; | |
| 20 | ||
| 21 | public function render() | |
| 22 |     { | |
| 23 | $this->inputmask($this->options); | |
| 24 | ||
| 25 |         $this->prepend('<i class="fa fa-terminal fa-fw"></i>') | |
| 26 |             ->defaultAttribute('style', 'width: 130px'); | |
| 27 | ||
| 28 | return parent::render(); | |
| 29 | } | |
| 30 | } | |
| 31 | ||
| @@ 5-30 (lines=26) @@ | ||
| 2 | ||
| 3 | namespace Encore\Admin\Form\Field; | |
| 4 | ||
| 5 | class Icon extends Text | |
| 6 | { | |
| 7 | protected $default = 'fa-pencil'; | |
| 8 | ||
| 9 | protected static $css = [ | |
| 10 | '/vendor/laravel-admin/fontawesome-iconpicker/dist/css/fontawesome-iconpicker.min.css', | |
| 11 | ]; | |
| 12 | ||
| 13 | protected static $js = [ | |
| 14 | '/vendor/laravel-admin/fontawesome-iconpicker/dist/js/fontawesome-iconpicker.min.js', | |
| 15 | ]; | |
| 16 | ||
| 17 | public function render() | |
| 18 |     { | |
| 19 | $this->script = <<<EOT | |
| 20 | ||
| 21 | $('{$this->getElementClassSelector()}').iconpicker({placement:'bottomLeft'}); | |
| 22 | ||
| 23 | EOT; | |
| 24 | ||
| 25 |         $this->prepend('<i class="fa fa-pencil fa-fw"></i>') | |
| 26 |             ->defaultAttribute('style', 'width: 140px'); | |
| 27 | ||
| 28 | return parent::render(); | |
| 29 | } | |
| 30 | } | |
| 31 | ||
| @@ 5-31 (lines=27) @@ | ||
| 2 | ||
| 3 | namespace Encore\Admin\Form\Field; | |
| 4 | ||
| 5 | class Ip extends Text | |
| 6 | { | |
| 7 | protected $rules = 'nullable|ip'; | |
| 8 | ||
| 9 | protected static $js = [ | |
| 10 | '/vendor/laravel-admin/AdminLTE/plugins/input-mask/jquery.inputmask.bundle.min.js', | |
| 11 | ]; | |
| 12 | ||
| 13 | /** | |
| 14 | * @see https://github.com/RobinHerbots/Inputmask#options | |
| 15 | * | |
| 16 | * @var array | |
| 17 | */ | |
| 18 | protected $options = [ | |
| 19 | 'alias' => 'ip', | |
| 20 | ]; | |
| 21 | ||
| 22 | public function render() | |
| 23 |     { | |
| 24 | $this->inputmask($this->options); | |
| 25 | ||
| 26 |         $this->prepend('<i class="fa fa-laptop fa-fw"></i>') | |
| 27 |             ->defaultAttribute('style', 'width: 130px'); | |
| 28 | ||
| 29 | return parent::render(); | |
| 30 | } | |
| 31 | } | |
| 32 | ||
| @@ 5-29 (lines=25) @@ | ||
| 2 | ||
| 3 | namespace Encore\Admin\Form\Field; | |
| 4 | ||
| 5 | class Mobile extends Text | |
| 6 | { | |
| 7 | protected static $js = [ | |
| 8 | '/vendor/laravel-admin/AdminLTE/plugins/input-mask/jquery.inputmask.bundle.min.js', | |
| 9 | ]; | |
| 10 | ||
| 11 | /** | |
| 12 | * @see https://github.com/RobinHerbots/Inputmask#options | |
| 13 | * | |
| 14 | * @var array | |
| 15 | */ | |
| 16 | protected $options = [ | |
| 17 | 'mask' => '99999999999', | |
| 18 | ]; | |
| 19 | ||
| 20 | public function render() | |
| 21 |     { | |
| 22 | $this->inputmask($this->options); | |
| 23 | ||
| 24 |         $this->prepend('<i class="fa fa-phone fa-fw"></i>') | |
| 25 |             ->defaultAttribute('style', 'width: 150px'); | |
| 26 | ||
| 27 | return parent::render(); | |
| 28 | } | |
| 29 | } | |
| 30 | ||