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