1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JeroenNoten\LaravelAdminLte\Components; |
4
|
|
|
|
5
|
|
|
use Illuminate\View\Component; |
6
|
|
|
|
7
|
|
|
class SmallBox extends Component |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The title/header for the box. |
11
|
|
|
* |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
public $title; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The text/description for the box. |
18
|
|
|
* |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
public $text; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* A Font Awesome icon for the box. |
25
|
|
|
* |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
public $icon; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The box theme (light, dark, primary, secondary, info, success, warning, |
32
|
|
|
* danger or any other AdminLTE color like lighblue or teal). |
33
|
|
|
* |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
public $theme; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* An url for the box. When enabled, a link-styled footer section will be |
40
|
|
|
* visible pointing to that url. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
public $url; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* A text/label associated with the footer url. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
public $urlText; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Indicates if the box is loading. When enabled, an overlay with a loading |
55
|
|
|
* icon will show over the box. |
56
|
|
|
* |
57
|
|
|
* @var mixed |
58
|
|
|
*/ |
59
|
|
|
public $loading; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Create a new component instance. |
63
|
|
|
* |
64
|
|
|
* @return void |
65
|
|
|
*/ |
66
|
2 |
|
public function __construct( |
67
|
|
|
$title = null, $text = null, $icon = null, $theme = null, |
68
|
|
|
$url = null, $urlText = null, $loading = null |
69
|
|
|
) { |
70
|
2 |
|
$this->title = $title; |
71
|
2 |
|
$this->text = $text; |
72
|
2 |
|
$this->icon = $icon; |
73
|
2 |
|
$this->theme = $theme; |
74
|
2 |
|
$this->url = $url; |
75
|
2 |
|
$this->urlText = $urlText; |
76
|
2 |
|
$this->loading = $loading; |
77
|
2 |
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Make the box class. |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
1 |
|
public function makeBoxClass() |
85
|
|
|
{ |
86
|
1 |
|
$classes = ['small-box']; |
87
|
|
|
|
88
|
1 |
|
if (isset($this->theme)) { |
89
|
1 |
|
$classes[] = "bg-{$this->theme}"; |
90
|
|
|
} |
91
|
|
|
|
92
|
1 |
|
return implode(' ', $classes); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Make the loading overlay class. |
97
|
|
|
* |
98
|
|
|
* @return string |
99
|
|
|
*/ |
100
|
1 |
|
public function makeOverlayClass() |
101
|
|
|
{ |
102
|
1 |
|
$classes = ['overlay']; |
103
|
|
|
|
104
|
1 |
|
if (! isset($this->loading)) { |
105
|
1 |
|
$classes[] = 'd-none'; |
106
|
|
|
} |
107
|
|
|
|
108
|
1 |
|
return implode(' ', $classes); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Get the view / contents that represent the component. |
113
|
|
|
* |
114
|
|
|
* @return \Illuminate\View\View|string |
115
|
|
|
*/ |
116
|
1 |
|
public function render() |
117
|
|
|
{ |
118
|
1 |
|
return view('adminlte::components.small-box'); |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|