1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JeroenNoten\LaravelAdminLte\Components; |
4
|
|
|
|
5
|
|
|
class InputDate extends InputGroupComponent |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The default set of icons for the Tempus Dominus plugin configuration. |
9
|
|
|
* |
10
|
|
|
* @var array |
11
|
|
|
*/ |
12
|
|
|
protected $icons = [ |
13
|
|
|
'time' => 'fas fa-clock', |
14
|
|
|
'date' => 'fas fa-calendar-alt', |
15
|
|
|
'up' => 'fas fa-arrow-up', |
16
|
|
|
'down' => 'fas fa-arrow-down', |
17
|
|
|
'previous' => 'fas fa-chevron-left', |
18
|
|
|
'next' => 'fas fa-chevron-right', |
19
|
|
|
'today' => 'fas fa-calendar-check-o', |
20
|
|
|
'clear' => 'fas fa-trash', |
21
|
|
|
'close' => 'fas fa-times', |
22
|
|
|
]; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* The default set of buttons for the Tempus Dominus plugin configuration. |
26
|
|
|
* |
27
|
|
|
* @var array |
28
|
|
|
*/ |
29
|
|
|
protected $buttons = [ |
30
|
|
|
'showClose' => true, |
31
|
|
|
]; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The Tempus Dominus plugin configuration parameters. Array with |
35
|
|
|
* key => value pairs, where the key should be an existing configuration |
36
|
|
|
* property of the plugin. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
public $config; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Create a new component instance. |
44
|
|
|
* Note this component requires the 'Tempus Dominus' plugin. |
45
|
|
|
* |
46
|
|
|
* @return void |
47
|
|
|
*/ |
48
|
2 |
|
public function __construct( |
49
|
|
|
$name, $label = null, $size = null, $labelClass = null, |
50
|
|
|
$topClass = null, $disableFeedback = null, $config = [] |
51
|
|
|
) { |
52
|
2 |
|
parent::__construct( |
53
|
2 |
|
$name, $label, $size, $labelClass, $topClass, $disableFeedback |
54
|
|
|
); |
55
|
|
|
|
56
|
2 |
|
$this->config = is_array($config) ? $config : []; |
57
|
|
|
|
58
|
|
|
// Setup the default plugin icons option. |
59
|
|
|
|
60
|
2 |
|
$this->config['icons'] = $this->config['icons'] ?? $this->icons; |
61
|
|
|
|
62
|
|
|
// Setup the default plugin buttons option. |
63
|
|
|
|
64
|
2 |
|
$this->config['buttons'] = $this->config['buttons'] ?? $this->buttons; |
65
|
2 |
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Make the class attribute for the input group item. |
69
|
|
|
* |
70
|
|
|
* @param string $invalid |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
1 |
|
public function makeItemClass($invalid) |
74
|
|
|
{ |
75
|
1 |
|
$classes = ['form-control', 'datetimepicker']; |
76
|
|
|
|
77
|
1 |
|
if (! empty($invalid) && ! isset($this->disableFeedback)) { |
78
|
1 |
|
$classes[] = 'is-invalid'; |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
return implode(' ', $classes); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Get the view / contents that represent the component. |
86
|
|
|
* |
87
|
|
|
* @return \Illuminate\View\View|string |
88
|
|
|
*/ |
89
|
1 |
|
public function render() |
90
|
|
|
{ |
91
|
1 |
|
return view('adminlte::components.input-date'); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|