Pārlūkot izejas kodu

add company chart

3.x
Andrew Wallo 2 gadus atpakaļ
vecāks
revīzija
181a3f4d18

+ 7
- 0
app/Filament/Pages/Companies.php Parādīt failu

@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
4 4
 
5 5
 use Filament\Pages\Page;
6 6
 use Illuminate\Support\Facades\Auth;
7
+use Wallo\FilamentCompanies\FilamentCompanies;
7 8
 
8 9
 class Companies extends Page
9 10
 {
@@ -24,7 +25,13 @@ class Companies extends Page
24 25
     protected function getHeaderWidgets(): array
25 26
     {
26 27
         return [
28
+            Widgets\CumulativeCompanyData::class,
27 29
             Widgets\Companies::class,
28 30
         ];
29 31
     }
32
+
33
+    protected static function getNavigationBadge(): ?string
34
+    {
35
+        return FilamentCompanies::companyModel()::count();
36
+    }
30 37
 }

+ 6
- 0
app/Filament/Pages/Employees.php Parādīt failu

@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
4 4
 
5 5
 use Filament\Pages\Page;
6 6
 use Illuminate\Support\Facades\Auth;
7
+use Wallo\FilamentCompanies\FilamentCompanies;
7 8
 
8 9
 class Employees extends Page
9 10
 {
@@ -27,4 +28,9 @@ class Employees extends Page
27 28
             Widgets\Employees::class,
28 29
         ];
29 30
     }
31
+
32
+    protected static function getNavigationBadge(): ?string
33
+    {
34
+        return FilamentCompanies::employeeshipModel()::count();
35
+    }
30 36
 }

+ 6
- 0
app/Filament/Pages/Users.php Parādīt failu

@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
4 4
 
5 5
 use Filament\Pages\Page;
6 6
 use Illuminate\Support\Facades\Auth;
7
+use Wallo\FilamentCompanies\FilamentCompanies;
7 8
 
8 9
 class Users extends Page
9 10
 {
@@ -27,4 +28,9 @@ class Users extends Page
27 28
             Widgets\Users::class,
28 29
         ];
29 30
     }
31
+
32
+    protected static function getNavigationBadge(): ?string
33
+    {
34
+        return FilamentCompanies::userModel()::count();
35
+    }
30 36
 }

+ 177
- 0
app/Filament/Pages/Widgets/CumulativeCompanyData.php Parādīt failu

@@ -0,0 +1,177 @@
1
+<?php
2
+
3
+namespace App\Filament\Pages\Widgets;
4
+
5
+use App\Models\Company;
6
+use Leandrocfe\FilamentApexCharts\Widgets\ApexChartWidget;
7
+
8
+class CumulativeCompanyData extends ApexChartWidget
9
+{
10
+    protected int|string|array $columnSpan = [
11
+        'md' => 2,
12
+        'xl' => 3,
13
+    ];
14
+
15
+    /**
16
+     * Chart Id
17
+     *
18
+     * @var string
19
+     */
20
+    protected static string $chartId = 'cumulative-company-data';
21
+
22
+    /**
23
+     * Widget Title
24
+     *
25
+     * @var string|null
26
+     */
27
+    protected static ?string $heading = 'Cumulative Company Data';
28
+
29
+    protected function getOptions(): array
30
+    {
31
+        $startOfYear = today()->startOfYear();
32
+        $today = today();
33
+
34
+        // Company data
35
+        $companyData = Company::selectRaw("COUNT(*) as aggregate, YEARWEEK(created_at, 3) as week")
36
+            ->whereBetween('created_at', [$startOfYear, $today])
37
+            ->groupByRaw('week')
38
+            ->get();
39
+
40
+        $weeks = [];
41
+        for ($week = $startOfYear->copy(); $week->lte($today); $week->addWeek()) {
42
+            $weeks[$week->format('oW')] = 0;
43
+        }
44
+
45
+        $weeklyData = collect($weeks)->mapWithKeys(static function ($value, $week) use ($companyData) {
46
+            $matchingData = $companyData->firstWhere('week', $week);
47
+            return [$week => $matchingData ? $matchingData->aggregate : 0];
48
+        });
49
+
50
+        $totalCompanies = $weeklyData->reduce(static function ($carry, $value) {
51
+            $carry[] = ($carry ? end($carry) : 0) + $value;
52
+            return $carry;
53
+        }, []);
54
+
55
+        // Calculate percentage increase and increase in companies per week
56
+        $newCompanies = [0];
57
+        $weeklyGrowthRate = [0];
58
+
59
+        $cumulativeDataLength = count($totalCompanies);
60
+        for ($key = 1; $key < $cumulativeDataLength; $key++) {
61
+            $value = $totalCompanies[$key];
62
+            $previousWeekValue = $totalCompanies[$key - 1];
63
+            $newCompanies[] = $value - $previousWeekValue;
64
+            $weeklyGrowthRate[] = round((($value - $previousWeekValue) / $previousWeekValue) * 100, 2);
65
+        }
66
+
67
+        $labels = collect($weeks)->keys()->map(static function ($week) {
68
+            $year = substr($week, 0, 4);
69
+            $weekNumber = substr($week, 4);
70
+
71
+            return now()->setISODate($year, $weekNumber)->format('Y-m-d');
72
+        });
73
+
74
+        return [
75
+            'chart' => [
76
+                'type' => 'line',
77
+                'height' => 350,
78
+                'stacked' => false,
79
+                'toolbar' => [
80
+                    'show' => false,
81
+                ],
82
+            ],
83
+            'series' => [
84
+                [
85
+                    'name' => 'Weekly Growth Rate',
86
+                    'type' => 'area',
87
+                    'data' => $weeklyGrowthRate,
88
+                ],
89
+                [
90
+                    'name' => 'New Companies',
91
+                    'type' => 'line',
92
+                    'data' => $newCompanies,
93
+                ],
94
+                [
95
+                    'name' => 'Total Companies',
96
+                    'type' => 'column',
97
+                    'data' => $totalCompanies,
98
+                ],
99
+            ],
100
+            'xaxis' => [
101
+                'type' => 'datetime',
102
+                'categories' => $labels,
103
+                'labels' => [
104
+                    'style' => [
105
+                        'colors' => '#9ca3af',
106
+                        'fontWeight' => 600,
107
+                    ],
108
+                ],
109
+            ],
110
+            'yaxis' => [
111
+                [
112
+                    'seriesName' => 'Weekly Growth Rate',
113
+                    'labels' => [
114
+                        'style' => [
115
+                            'colors' => '#9ca3af',
116
+                            'fontWeight' => 600,
117
+                        ],
118
+                    ],
119
+                ],
120
+                [
121
+                    'seriesName' => 'New Companies',
122
+                    'opposite' => true,
123
+                    'labels' => [
124
+                        'style' => [
125
+                            'colors' => '#9ca3af',
126
+                            'fontWeight' => 600,
127
+                        ],
128
+                    ],
129
+                ],
130
+                [
131
+                    'seriesName' => 'Total Companies',
132
+                    'opposite' => true,
133
+                    'labels' => [
134
+                        'style' => [
135
+                            'colors' => '#9ca3af',
136
+                            'fontWeight' => 600,
137
+                        ],
138
+                    ],
139
+                ],
140
+            ],
141
+            'legend' => [
142
+                'labels' => [
143
+                    'colors' => '#9ca3af',
144
+                    'fontWeight' => 600,
145
+                ],
146
+            ],
147
+            'markers' => [
148
+                'size' => 0,
149
+            ],
150
+            'colors' => ['#d946ef', '#6d28d9', '#3b82f6'],
151
+            'fill' => [
152
+                'type' => 'gradient',
153
+                'gradient' => [
154
+                    'shade' => 'dark',
155
+                    'type' => 'vertical',
156
+                    'shadeIntensity' => 0.5,
157
+                    'gradientToColors' => ['#d946ef', '#6d28d9', '#0ea5e9'],
158
+                    'inverseColors' => false,
159
+                    'opacityFrom' => [0.85, 1, 0.75],
160
+                    'opacityTo' => [0.4, 0.85, 1],
161
+                    'stops' => [0, 20, 80, 100],
162
+                ],
163
+            ],
164
+            'stroke' => [
165
+                'width' => [2, 5, 0],
166
+                'curve' => 'smooth',
167
+            ],
168
+            'plotOptions' => [
169
+                'bar' => [
170
+                    'borderRadius' => 5,
171
+                    'borderRadiusApplication' => 'end',
172
+                    'columnWidth' => '60%',
173
+                ],
174
+            ],
175
+        ];
176
+    }
177
+}

+ 4
- 0
app/Filament/Pages/Widgets/Employees.php Parādīt failu

@@ -56,6 +56,10 @@ class Employees extends PageWidget
56 56
                 ->weight('semibold'),
57 57
             Tables\Columns\BadgeColumn::make('employeeships.role')
58 58
                 ->label('Role')
59
+                ->enum([
60
+                    'admin' => 'Administrator',
61
+                    'editor' => 'Editor',
62
+                ])
59 63
                 ->icons([
60 64
                     'heroicon-o-shield-check' => 'admin',
61 65
                     'heroicon-o-pencil' => 'editor',

+ 3
- 2
app/Filament/Pages/Widgets/Users.php Parādīt failu

@@ -36,10 +36,11 @@ class Users extends PageWidget
36 36
                 ->sortable()
37 37
                 ->searchable()
38 38
                 ->grow(false),
39
-            Tables\Columns\TextColumn::make('owned_companies')
39
+            Tables\Columns\TextColumn::make('owned_companies_count')
40
+                ->counts('ownedCompanies')
40 41
                 ->label('Companies')
41 42
                 ->weight('semibold')
42
-                ->getStateUsing(static fn ($record) => $record->ownedCompanies->count()),
43
+                ->sortable(),
43 44
         ];
44 45
     }
45 46
 }

+ 3
- 1
composer.json Parādīt failu

@@ -8,10 +8,12 @@
8 8
         "php": "^8.1",
9 9
         "andrewdwallo/filament-companies": "^2.0",
10 10
         "filament/filament": "^2.17",
11
+        "flowframe/laravel-trend": "^0.1.5",
11 12
         "guzzlehttp/guzzle": "^7.2",
12 13
         "laravel/framework": "^10.8",
13 14
         "laravel/sanctum": "^3.2",
14
-        "laravel/tinker": "^2.8"
15
+        "laravel/tinker": "^2.8",
16
+        "leandrocfe/filament-apex-charts": "^1.0"
15 17
     },
16 18
     "require-dev": {
17 19
         "doctrine/dbal": "^3.6",

+ 262
- 53
composer.lock Parādīt failu

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "32e2f0040dca607c8fb1baa663b1e38a",
7
+    "content-hash": "dabf47be9fbc6a33cc67ae9123c6f5d2",
8 8
     "packages": [
9 9
         {
10 10
             "name": "akaunting/laravel-money",
@@ -934,16 +934,16 @@
934 934
         },
935 935
         {
936 936
             "name": "filament/filament",
937
-            "version": "v2.17.32",
937
+            "version": "v2.17.36",
938 938
             "source": {
939 939
                 "type": "git",
940 940
                 "url": "https://github.com/filamentphp/app.git",
941
-                "reference": "40c85b5a45456e6802edf99714e8baa8dbde7f27"
941
+                "reference": "c62290398a1d6b03351dbab8158115efd936deaa"
942 942
             },
943 943
             "dist": {
944 944
                 "type": "zip",
945
-                "url": "https://api.github.com/repos/filamentphp/app/zipball/40c85b5a45456e6802edf99714e8baa8dbde7f27",
946
-                "reference": "40c85b5a45456e6802edf99714e8baa8dbde7f27",
945
+                "url": "https://api.github.com/repos/filamentphp/app/zipball/c62290398a1d6b03351dbab8158115efd936deaa",
946
+                "reference": "c62290398a1d6b03351dbab8158115efd936deaa",
947 947
                 "shasum": ""
948 948
             },
949 949
             "require": {
@@ -993,20 +993,20 @@
993 993
                 "issues": "https://github.com/filamentphp/filament/issues",
994 994
                 "source": "https://github.com/filamentphp/filament"
995 995
             },
996
-            "time": "2023-04-30T16:44:29+00:00"
996
+            "time": "2023-05-05T08:37:23+00:00"
997 997
         },
998 998
         {
999 999
             "name": "filament/forms",
1000
-            "version": "v2.17.32",
1000
+            "version": "v2.17.36",
1001 1001
             "source": {
1002 1002
                 "type": "git",
1003 1003
                 "url": "https://github.com/filamentphp/forms.git",
1004
-                "reference": "b486221ba0d9b23e36ccdcb3ca3b18e8f81cb6bb"
1004
+                "reference": "b29e2f817ad63913ae1b339910726ede6696de9a"
1005 1005
             },
1006 1006
             "dist": {
1007 1007
                 "type": "zip",
1008
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/b486221ba0d9b23e36ccdcb3ca3b18e8f81cb6bb",
1009
-                "reference": "b486221ba0d9b23e36ccdcb3ca3b18e8f81cb6bb",
1008
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/b29e2f817ad63913ae1b339910726ede6696de9a",
1009
+                "reference": "b29e2f817ad63913ae1b339910726ede6696de9a",
1010 1010
                 "shasum": ""
1011 1011
             },
1012 1012
             "require": {
@@ -1051,20 +1051,20 @@
1051 1051
                 "issues": "https://github.com/filamentphp/filament/issues",
1052 1052
                 "source": "https://github.com/filamentphp/filament"
1053 1053
             },
1054
-            "time": "2023-04-30T16:44:24+00:00"
1054
+            "time": "2023-05-04T23:08:13+00:00"
1055 1055
         },
1056 1056
         {
1057 1057
             "name": "filament/notifications",
1058
-            "version": "v2.17.32",
1058
+            "version": "v2.17.36",
1059 1059
             "source": {
1060 1060
                 "type": "git",
1061 1061
                 "url": "https://github.com/filamentphp/notifications.git",
1062
-                "reference": "42c18bf35a634f17c61ee1f8694ec3ac440903f9"
1062
+                "reference": "0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252"
1063 1063
             },
1064 1064
             "dist": {
1065 1065
                 "type": "zip",
1066
-                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/42c18bf35a634f17c61ee1f8694ec3ac440903f9",
1067
-                "reference": "42c18bf35a634f17c61ee1f8694ec3ac440903f9",
1066
+                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252",
1067
+                "reference": "0ef9f1f3481a08f357b8e78bcb4bbcd8111a1252",
1068 1068
                 "shasum": ""
1069 1069
             },
1070 1070
             "require": {
@@ -1104,20 +1104,20 @@
1104 1104
                 "issues": "https://github.com/filamentphp/filament/issues",
1105 1105
                 "source": "https://github.com/filamentphp/filament"
1106 1106
             },
1107
-            "time": "2023-04-21T08:32:52+00:00"
1107
+            "time": "2023-05-04T23:08:09+00:00"
1108 1108
         },
1109 1109
         {
1110 1110
             "name": "filament/support",
1111
-            "version": "v2.17.32",
1111
+            "version": "v2.17.36",
1112 1112
             "source": {
1113 1113
                 "type": "git",
1114 1114
                 "url": "https://github.com/filamentphp/support.git",
1115
-                "reference": "2e02ece5a722ddc95facd3a37f3b3a4fd3d355d1"
1115
+                "reference": "1a411197122524886c81a74c7044258d64d56308"
1116 1116
             },
1117 1117
             "dist": {
1118 1118
                 "type": "zip",
1119
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/2e02ece5a722ddc95facd3a37f3b3a4fd3d355d1",
1120
-                "reference": "2e02ece5a722ddc95facd3a37f3b3a4fd3d355d1",
1119
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/1a411197122524886c81a74c7044258d64d56308",
1120
+                "reference": "1a411197122524886c81a74c7044258d64d56308",
1121 1121
                 "shasum": ""
1122 1122
             },
1123 1123
             "require": {
@@ -1154,20 +1154,20 @@
1154 1154
                 "issues": "https://github.com/filamentphp/filament/issues",
1155 1155
                 "source": "https://github.com/filamentphp/filament"
1156 1156
             },
1157
-            "time": "2023-05-01T16:59:19+00:00"
1157
+            "time": "2023-05-04T23:08:15+00:00"
1158 1158
         },
1159 1159
         {
1160 1160
             "name": "filament/tables",
1161
-            "version": "v2.17.32",
1161
+            "version": "v2.17.36",
1162 1162
             "source": {
1163 1163
                 "type": "git",
1164 1164
                 "url": "https://github.com/filamentphp/tables.git",
1165
-                "reference": "c05ca1a1b48039c68e7a3247acb7c56ec8bee085"
1165
+                "reference": "f9862eb6d9af85c98512924e9f0d84d6eb1ff4f5"
1166 1166
             },
1167 1167
             "dist": {
1168 1168
                 "type": "zip",
1169
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/c05ca1a1b48039c68e7a3247acb7c56ec8bee085",
1170
-                "reference": "c05ca1a1b48039c68e7a3247acb7c56ec8bee085",
1169
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/f9862eb6d9af85c98512924e9f0d84d6eb1ff4f5",
1170
+                "reference": "f9862eb6d9af85c98512924e9f0d84d6eb1ff4f5",
1171 1171
                 "shasum": ""
1172 1172
             },
1173 1173
             "require": {
@@ -1210,7 +1210,81 @@
1210 1210
                 "issues": "https://github.com/filamentphp/filament/issues",
1211 1211
                 "source": "https://github.com/filamentphp/filament"
1212 1212
             },
1213
-            "time": "2023-05-01T16:59:27+00:00"
1213
+            "time": "2023-05-04T23:08:16+00:00"
1214
+        },
1215
+        {
1216
+            "name": "flowframe/laravel-trend",
1217
+            "version": "v0.1.5",
1218
+            "source": {
1219
+                "type": "git",
1220
+                "url": "https://github.com/Flowframe/laravel-trend.git",
1221
+                "reference": "bc43bf7840ff60aca39e856ad96f5e990fac83d7"
1222
+            },
1223
+            "dist": {
1224
+                "type": "zip",
1225
+                "url": "https://api.github.com/repos/Flowframe/laravel-trend/zipball/bc43bf7840ff60aca39e856ad96f5e990fac83d7",
1226
+                "reference": "bc43bf7840ff60aca39e856ad96f5e990fac83d7",
1227
+                "shasum": ""
1228
+            },
1229
+            "require": {
1230
+                "illuminate/contracts": "^8.37|^9|^10.0",
1231
+                "php": "^8.0",
1232
+                "spatie/laravel-package-tools": "^1.4.3"
1233
+            },
1234
+            "require-dev": {
1235
+                "nunomaduro/collision": "^5.3|^6.1",
1236
+                "orchestra/testbench": "^6.15|^7.0|^8.0",
1237
+                "pestphp/pest": "^1.18",
1238
+                "pestphp/pest-plugin-laravel": "^1.1",
1239
+                "spatie/laravel-ray": "^1.23",
1240
+                "vimeo/psalm": "^4.8|^5.6"
1241
+            },
1242
+            "type": "library",
1243
+            "extra": {
1244
+                "laravel": {
1245
+                    "providers": [
1246
+                        "Flowframe\\Trend\\TrendServiceProvider"
1247
+                    ],
1248
+                    "aliases": {
1249
+                        "Trend": "Flowframe\\Trend\\TrendFacade"
1250
+                    }
1251
+                }
1252
+            },
1253
+            "autoload": {
1254
+                "psr-4": {
1255
+                    "Flowframe\\Trend\\": "src",
1256
+                    "Flowframe\\Trend\\Database\\Factories\\": "database/factories"
1257
+                }
1258
+            },
1259
+            "notification-url": "https://packagist.org/downloads/",
1260
+            "license": [
1261
+                "MIT"
1262
+            ],
1263
+            "authors": [
1264
+                {
1265
+                    "name": "Lars Klopstra",
1266
+                    "email": "lars@flowframe.nl",
1267
+                    "role": "Developer"
1268
+                }
1269
+            ],
1270
+            "description": "Easily generate model trends",
1271
+            "homepage": "https://github.com/flowframe/laravel-trend",
1272
+            "keywords": [
1273
+                "Flowframe",
1274
+                "laravel",
1275
+                "laravel-trend"
1276
+            ],
1277
+            "support": {
1278
+                "issues": "https://github.com/Flowframe/laravel-trend/issues",
1279
+                "source": "https://github.com/Flowframe/laravel-trend/tree/v0.1.5"
1280
+            },
1281
+            "funding": [
1282
+                {
1283
+                    "url": "https://github.com/larsklopstra",
1284
+                    "type": "github"
1285
+                }
1286
+            ],
1287
+            "time": "2023-03-22T20:51:43+00:00"
1214 1288
         },
1215 1289
         {
1216 1290
             "name": "fruitcake/php-cors",
@@ -2474,19 +2548,20 @@
2474 2548
         },
2475 2549
         {
2476 2550
             "name": "league/flysystem",
2477
-            "version": "3.14.0",
2551
+            "version": "3.15.1",
2478 2552
             "source": {
2479 2553
                 "type": "git",
2480 2554
                 "url": "https://github.com/thephpleague/flysystem.git",
2481
-                "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158"
2555
+                "reference": "a141d430414fcb8bf797a18716b09f759a385bed"
2482 2556
             },
2483 2557
             "dist": {
2484 2558
                 "type": "zip",
2485
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e2a279d7f47d9098e479e8b21f7fb8b8de230158",
2486
-                "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158",
2559
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a141d430414fcb8bf797a18716b09f759a385bed",
2560
+                "reference": "a141d430414fcb8bf797a18716b09f759a385bed",
2487 2561
                 "shasum": ""
2488 2562
             },
2489 2563
             "require": {
2564
+                "league/flysystem-local": "^3.0.0",
2490 2565
                 "league/mime-type-detection": "^1.0.0",
2491 2566
                 "php": "^8.0.2"
2492 2567
             },
@@ -2545,7 +2620,7 @@
2545 2620
             ],
2546 2621
             "support": {
2547 2622
                 "issues": "https://github.com/thephpleague/flysystem/issues",
2548
-                "source": "https://github.com/thephpleague/flysystem/tree/3.14.0"
2623
+                "source": "https://github.com/thephpleague/flysystem/tree/3.15.1"
2549 2624
             },
2550 2625
             "funding": [
2551 2626
                 {
@@ -2557,7 +2632,67 @@
2557 2632
                     "type": "github"
2558 2633
                 }
2559 2634
             ],
2560
-            "time": "2023-04-11T18:11:47+00:00"
2635
+            "time": "2023-05-04T09:04:26+00:00"
2636
+        },
2637
+        {
2638
+            "name": "league/flysystem-local",
2639
+            "version": "3.15.0",
2640
+            "source": {
2641
+                "type": "git",
2642
+                "url": "https://github.com/thephpleague/flysystem-local.git",
2643
+                "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3"
2644
+            },
2645
+            "dist": {
2646
+                "type": "zip",
2647
+                "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/543f64c397fefdf9cfeac443ffb6beff602796b3",
2648
+                "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3",
2649
+                "shasum": ""
2650
+            },
2651
+            "require": {
2652
+                "ext-fileinfo": "*",
2653
+                "league/flysystem": "^3.0.0",
2654
+                "league/mime-type-detection": "^1.0.0",
2655
+                "php": "^8.0.2"
2656
+            },
2657
+            "type": "library",
2658
+            "autoload": {
2659
+                "psr-4": {
2660
+                    "League\\Flysystem\\Local\\": ""
2661
+                }
2662
+            },
2663
+            "notification-url": "https://packagist.org/downloads/",
2664
+            "license": [
2665
+                "MIT"
2666
+            ],
2667
+            "authors": [
2668
+                {
2669
+                    "name": "Frank de Jonge",
2670
+                    "email": "info@frankdejonge.nl"
2671
+                }
2672
+            ],
2673
+            "description": "Local filesystem adapter for Flysystem.",
2674
+            "keywords": [
2675
+                "Flysystem",
2676
+                "file",
2677
+                "files",
2678
+                "filesystem",
2679
+                "local"
2680
+            ],
2681
+            "support": {
2682
+                "issues": "https://github.com/thephpleague/flysystem-local/issues",
2683
+                "source": "https://github.com/thephpleague/flysystem-local/tree/3.15.0"
2684
+            },
2685
+            "funding": [
2686
+                {
2687
+                    "url": "https://ecologi.com/frankdejonge",
2688
+                    "type": "custom"
2689
+                },
2690
+                {
2691
+                    "url": "https://github.com/frankdejonge",
2692
+                    "type": "github"
2693
+                }
2694
+            ],
2695
+            "time": "2023-05-02T20:02:14+00:00"
2561 2696
         },
2562 2697
         {
2563 2698
             "name": "league/mime-type-detection",
@@ -2761,6 +2896,80 @@
2761 2896
             "abandoned": true,
2762 2897
             "time": "2018-11-22T07:55:51+00:00"
2763 2898
         },
2899
+        {
2900
+            "name": "leandrocfe/filament-apex-charts",
2901
+            "version": "1.0.2",
2902
+            "source": {
2903
+                "type": "git",
2904
+                "url": "https://github.com/leandrocfe/filament-apex-charts.git",
2905
+                "reference": "26118c0c3f81465b418ecc630c7e1a63693a7f7b"
2906
+            },
2907
+            "dist": {
2908
+                "type": "zip",
2909
+                "url": "https://api.github.com/repos/leandrocfe/filament-apex-charts/zipball/26118c0c3f81465b418ecc630c7e1a63693a7f7b",
2910
+                "reference": "26118c0c3f81465b418ecc630c7e1a63693a7f7b",
2911
+                "shasum": ""
2912
+            },
2913
+            "require": {
2914
+                "filament/filament": "^2.16",
2915
+                "illuminate/contracts": "^9.0|^10.0",
2916
+                "livewire/livewire": "^2.11",
2917
+                "php": "^8.1",
2918
+                "spatie/laravel-package-tools": "^1.13.0"
2919
+            },
2920
+            "require-dev": {
2921
+                "laravel/pint": "^1.0",
2922
+                "nunomaduro/collision": "^6.0|^7.0",
2923
+                "nunomaduro/larastan": "^2.0.1",
2924
+                "orchestra/testbench": "^7.0|^8.0",
2925
+                "pestphp/pest": "^1.21",
2926
+                "pestphp/pest-plugin-laravel": "^1.1",
2927
+                "phpstan/extension-installer": "^1.1",
2928
+                "phpstan/phpstan-deprecation-rules": "^1.0",
2929
+                "phpstan/phpstan-phpunit": "^1.0",
2930
+                "phpunit/phpunit": "^9.5|^10.0"
2931
+            },
2932
+            "type": "library",
2933
+            "extra": {
2934
+                "laravel": {
2935
+                    "providers": [
2936
+                        "Leandrocfe\\FilamentApexCharts\\FilamentApexChartsServiceProvider"
2937
+                    ],
2938
+                    "aliases": {
2939
+                        "FilamentApexCharts": "Leandrocfe\\FilamentApexCharts\\Facades\\FilamentApexCharts"
2940
+                    }
2941
+                }
2942
+            },
2943
+            "autoload": {
2944
+                "psr-4": {
2945
+                    "Leandrocfe\\FilamentApexCharts\\": "src"
2946
+                }
2947
+            },
2948
+            "notification-url": "https://packagist.org/downloads/",
2949
+            "license": [
2950
+                "MIT"
2951
+            ],
2952
+            "authors": [
2953
+                {
2954
+                    "name": "Leandro Costa Ferreira",
2955
+                    "email": "leandrocfe@gmail.com",
2956
+                    "role": "Developer"
2957
+                }
2958
+            ],
2959
+            "description": "Apex Charts integration for Filament PHP.",
2960
+            "homepage": "https://github.com/leandrocfe/filament-apex-charts",
2961
+            "keywords": [
2962
+                "apexcharts",
2963
+                "filament-apex-charts",
2964
+                "laravel",
2965
+                "leandrocfe"
2966
+            ],
2967
+            "support": {
2968
+                "issues": "https://github.com/leandrocfe/filament-apex-charts/issues",
2969
+                "source": "https://github.com/leandrocfe/filament-apex-charts/tree/1.0.2"
2970
+            },
2971
+            "time": "2023-03-14T01:34:14+00:00"
2972
+        },
2764 2973
         {
2765 2974
             "name": "livewire/livewire",
2766 2975
             "version": "v2.12.3",
@@ -2903,16 +3112,16 @@
2903 3112
         },
2904 3113
         {
2905 3114
             "name": "matomo/device-detector",
2906
-            "version": "6.1.1",
3115
+            "version": "6.1.2",
2907 3116
             "source": {
2908 3117
                 "type": "git",
2909 3118
                 "url": "https://github.com/matomo-org/device-detector.git",
2910
-                "reference": "a549e24350ff63e15dc691b6b21b73909b4fa9bd"
3119
+                "reference": "7d0760e84f0b41302792a0c764fa52d3dff186f8"
2911 3120
             },
2912 3121
             "dist": {
2913 3122
                 "type": "zip",
2914
-                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/a549e24350ff63e15dc691b6b21b73909b4fa9bd",
2915
-                "reference": "a549e24350ff63e15dc691b6b21b73909b4fa9bd",
3123
+                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/7d0760e84f0b41302792a0c764fa52d3dff186f8",
3124
+                "reference": "7d0760e84f0b41302792a0c764fa52d3dff186f8",
2916 3125
                 "shasum": ""
2917 3126
             },
2918 3127
             "require": {
@@ -2968,7 +3177,7 @@
2968 3177
                 "source": "https://github.com/matomo-org/matomo",
2969 3178
                 "wiki": "https://dev.matomo.org/"
2970 3179
             },
2971
-            "time": "2023-03-16T08:19:16+00:00"
3180
+            "time": "2023-05-04T09:30:54+00:00"
2972 3181
         },
2973 3182
         {
2974 3183
             "name": "monolog/monolog",
@@ -4074,16 +4283,16 @@
4074 4283
         },
4075 4284
         {
4076 4285
             "name": "psy/psysh",
4077
-            "version": "v0.11.16",
4286
+            "version": "v0.11.17",
4078 4287
             "source": {
4079 4288
                 "type": "git",
4080 4289
                 "url": "https://github.com/bobthecow/psysh.git",
4081
-                "reference": "151b145906804eea8e5d71fea23bfb470c904bfb"
4290
+                "reference": "3dc5d4018dabd80bceb8fe1e3191ba8460569f0a"
4082 4291
             },
4083 4292
             "dist": {
4084 4293
                 "type": "zip",
4085
-                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/151b145906804eea8e5d71fea23bfb470c904bfb",
4086
-                "reference": "151b145906804eea8e5d71fea23bfb470c904bfb",
4294
+                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/3dc5d4018dabd80bceb8fe1e3191ba8460569f0a",
4295
+                "reference": "3dc5d4018dabd80bceb8fe1e3191ba8460569f0a",
4087 4296
                 "shasum": ""
4088 4297
             },
4089 4298
             "require": {
@@ -4144,9 +4353,9 @@
4144 4353
             ],
4145 4354
             "support": {
4146 4355
                 "issues": "https://github.com/bobthecow/psysh/issues",
4147
-                "source": "https://github.com/bobthecow/psysh/tree/v0.11.16"
4356
+                "source": "https://github.com/bobthecow/psysh/tree/v0.11.17"
4148 4357
             },
4149
-            "time": "2023-04-26T12:53:57+00:00"
4358
+            "time": "2023-05-05T20:02:42+00:00"
4150 4359
         },
4151 4360
         {
4152 4361
             "name": "ralouphie/getallheaders",
@@ -9602,16 +9811,16 @@
9602 9811
         },
9603 9812
         {
9604 9813
             "name": "spatie/ignition",
9605
-            "version": "1.6.0",
9814
+            "version": "1.7.0",
9606 9815
             "source": {
9607 9816
                 "type": "git",
9608 9817
                 "url": "https://github.com/spatie/ignition.git",
9609
-                "reference": "fbcfcabc44e506e40c4d72fd4ddf465e272a600e"
9818
+                "reference": "f747d83c6d7cb6229b462f3ddbb3a82dc0db0f78"
9610 9819
             },
9611 9820
             "dist": {
9612 9821
                 "type": "zip",
9613
-                "url": "https://api.github.com/repos/spatie/ignition/zipball/fbcfcabc44e506e40c4d72fd4ddf465e272a600e",
9614
-                "reference": "fbcfcabc44e506e40c4d72fd4ddf465e272a600e",
9822
+                "url": "https://api.github.com/repos/spatie/ignition/zipball/f747d83c6d7cb6229b462f3ddbb3a82dc0db0f78",
9823
+                "reference": "f747d83c6d7cb6229b462f3ddbb3a82dc0db0f78",
9615 9824
                 "shasum": ""
9616 9825
             },
9617 9826
             "require": {
@@ -9681,20 +9890,20 @@
9681 9890
                     "type": "github"
9682 9891
                 }
9683 9892
             ],
9684
-            "time": "2023-04-27T08:40:07+00:00"
9893
+            "time": "2023-05-04T13:20:26+00:00"
9685 9894
         },
9686 9895
         {
9687 9896
             "name": "spatie/laravel-ignition",
9688
-            "version": "2.1.0",
9897
+            "version": "2.1.1",
9689 9898
             "source": {
9690 9899
                 "type": "git",
9691 9900
                 "url": "https://github.com/spatie/laravel-ignition.git",
9692
-                "reference": "3718dfb91bc5aff340af26507a61f0f9605f81e8"
9901
+                "reference": "802c7e27754456e45134f1a9d29ab7df4b6cb9e4"
9693 9902
             },
9694 9903
             "dist": {
9695 9904
                 "type": "zip",
9696
-                "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/3718dfb91bc5aff340af26507a61f0f9605f81e8",
9697
-                "reference": "3718dfb91bc5aff340af26507a61f0f9605f81e8",
9905
+                "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/802c7e27754456e45134f1a9d29ab7df4b6cb9e4",
9906
+                "reference": "802c7e27754456e45134f1a9d29ab7df4b6cb9e4",
9698 9907
                 "shasum": ""
9699 9908
             },
9700 9909
             "require": {
@@ -9773,7 +9982,7 @@
9773 9982
                     "type": "github"
9774 9983
                 }
9775 9984
             ],
9776
-            "time": "2023-04-12T09:26:00+00:00"
9985
+            "time": "2023-05-04T13:54:49+00:00"
9777 9986
         },
9778 9987
         {
9779 9988
             "name": "symfony/yaml",

+ 5
- 1
database/factories/UserFactory.php Parādīt failu

@@ -61,7 +61,11 @@ class UserFactory extends Factory
61 61
         return $this->has(
62 62
             Company::factory()
63 63
                 ->state(function (array $attributes, User $user) {
64
-                    return ['name' => $user->name.'\'s Company', 'user_id' => $user->id, 'personal_company' => true];
64
+                    return [
65
+                        'name' => $user->name.'\'s Company',
66
+                        'user_id' => $user->id,
67
+                        'personal_company' => true,
68
+                    ];
65 69
                 }),
66 70
             'ownedCompanies'
67 71
         );

+ 24
- 24
package-lock.json Parādīt failu

@@ -698,9 +698,9 @@
698 698
             }
699 699
         },
700 700
         "node_modules/caniuse-lite": {
701
-            "version": "1.0.30001481",
702
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz",
703
-            "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==",
701
+            "version": "1.0.30001482",
702
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz",
703
+            "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==",
704 704
             "dev": true,
705 705
             "funding": [
706 706
                 {
@@ -817,9 +817,9 @@
817 817
             "dev": true
818 818
         },
819 819
         "node_modules/electron-to-chromium": {
820
-            "version": "1.4.377",
821
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.377.tgz",
822
-            "integrity": "sha512-H3BYG6DW5Z+l0xcfXaicJGxrpA4kMlCxnN71+iNX+dBLkRMOdVJqFJiAmbNZZKA1zISpRg17JR03qGifXNsJtw==",
820
+            "version": "1.4.383",
821
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.383.tgz",
822
+            "integrity": "sha512-BQyvFauIMzCJqILViJNs0kIBEAlx1bYLS5CRLyJtlun1KAnZlhNSgyfyWifPWagQ5s8KYPY6BpNHZsEMkxZAQQ==",
823 823
             "dev": true
824 824
         },
825 825
         "node_modules/esbuild": {
@@ -1585,9 +1585,9 @@
1585 1585
             }
1586 1586
         },
1587 1587
         "node_modules/rollup": {
1588
-            "version": "3.21.2",
1589
-            "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.2.tgz",
1590
-            "integrity": "sha512-c4vC+JZ3bbF4Kqq2TtM7zSKtSyMybFOjqmomFax3xpfYaPZDZ4iz8NMIuBRMjnXOcKYozw7bC6vhJjiWD6JpzQ==",
1588
+            "version": "3.21.5",
1589
+            "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.5.tgz",
1590
+            "integrity": "sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==",
1591 1591
             "dev": true,
1592 1592
             "bin": {
1593 1593
                 "rollup": "dist/bin/rollup"
@@ -1808,9 +1808,9 @@
1808 1808
             "dev": true
1809 1809
         },
1810 1810
         "node_modules/vite": {
1811
-            "version": "4.3.3",
1812
-            "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.3.tgz",
1813
-            "integrity": "sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==",
1811
+            "version": "4.3.4",
1812
+            "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.4.tgz",
1813
+            "integrity": "sha512-f90aqGBoxSFxWph2b39ae2uHAxm5jFBBdnfueNxZAT1FTpM13ccFQExCaKbR2xFW5atowjleRniQ7onjJ22QEg==",
1814 1814
             "dev": true,
1815 1815
             "dependencies": {
1816 1816
                 "esbuild": "^0.17.5",
@@ -2287,9 +2287,9 @@
2287 2287
             "dev": true
2288 2288
         },
2289 2289
         "caniuse-lite": {
2290
-            "version": "1.0.30001481",
2291
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz",
2292
-            "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==",
2290
+            "version": "1.0.30001482",
2291
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz",
2292
+            "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==",
2293 2293
             "dev": true
2294 2294
         },
2295 2295
         "chokidar": {
@@ -2365,9 +2365,9 @@
2365 2365
             "dev": true
2366 2366
         },
2367 2367
         "electron-to-chromium": {
2368
-            "version": "1.4.377",
2369
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.377.tgz",
2370
-            "integrity": "sha512-H3BYG6DW5Z+l0xcfXaicJGxrpA4kMlCxnN71+iNX+dBLkRMOdVJqFJiAmbNZZKA1zISpRg17JR03qGifXNsJtw==",
2368
+            "version": "1.4.383",
2369
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.383.tgz",
2370
+            "integrity": "sha512-BQyvFauIMzCJqILViJNs0kIBEAlx1bYLS5CRLyJtlun1KAnZlhNSgyfyWifPWagQ5s8KYPY6BpNHZsEMkxZAQQ==",
2371 2371
             "dev": true
2372 2372
         },
2373 2373
         "esbuild": {
@@ -2896,9 +2896,9 @@
2896 2896
             "dev": true
2897 2897
         },
2898 2898
         "rollup": {
2899
-            "version": "3.21.2",
2900
-            "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.2.tgz",
2901
-            "integrity": "sha512-c4vC+JZ3bbF4Kqq2TtM7zSKtSyMybFOjqmomFax3xpfYaPZDZ4iz8NMIuBRMjnXOcKYozw7bC6vhJjiWD6JpzQ==",
2899
+            "version": "3.21.5",
2900
+            "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.5.tgz",
2901
+            "integrity": "sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==",
2902 2902
             "dev": true,
2903 2903
             "requires": {
2904 2904
                 "fsevents": "~2.3.2"
@@ -3048,9 +3048,9 @@
3048 3048
             "dev": true
3049 3049
         },
3050 3050
         "vite": {
3051
-            "version": "4.3.3",
3052
-            "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.3.tgz",
3053
-            "integrity": "sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==",
3051
+            "version": "4.3.4",
3052
+            "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.4.tgz",
3053
+            "integrity": "sha512-f90aqGBoxSFxWph2b39ae2uHAxm5jFBBdnfueNxZAT1FTpM13ccFQExCaKbR2xFW5atowjleRniQ7onjJ22QEg==",
3054 3054
             "dev": true,
3055 3055
             "requires": {
3056 3056
                 "esbuild": "^0.17.5",

+ 290
- 0
resources/views/vendor/filament-companies/companies/company-employee-manager.blade.php Parādīt failu

@@ -0,0 +1,290 @@
1
+<div>
2
+    @if (Gate::check('addCompanyEmployee', $company))
3
+        <x-filament-companies::section-border />
4
+
5
+        <!-- Add Company Employee -->
6
+        <x-filament-companies::grid-section>
7
+            <x-slot name="title">
8
+                {{ __('filament-companies::default.grid_section_titles.add_company_employee') }}
9
+            </x-slot>
10
+
11
+            <x-slot name="description">
12
+                {{ __('filament-companies::default.grid_section_descriptions.add_company_employee') }}
13
+            </x-slot>
14
+
15
+            <form wire:submit.prevent="addCompanyEmployee" class="col-span-2 sm:col-span-1 mt-5 md:mt-0">
16
+                <x-filament::card>
17
+                    <p class="text-sm text-gray-600 dark:text-gray-400">
18
+                        {{ __('filament-companies::default.subheadings.companies.company_employee_manager') }}
19
+                    </p>
20
+
21
+                    <!-- Employee Email -->
22
+                    <x-forms::field-wrapper id="email" statePath="email" required label="{{ __('filament-companies::default.fields.email') }}">
23
+                        <x-filament-companies::input id="email" type="email" wire:model.defer="addCompanyEmployeeForm.email" />
24
+                    </x-forms::field-wrapper>
25
+
26
+                    <!-- Role -->
27
+                    @if (count($this->roles) > 0)
28
+                        <x-forms::field-wrapper id="role" statePath="role" required label="{{ __('filament-companies::default.labels.role') }}">
29
+                            <div x-data="{ role: @entangle('addCompanyEmployeeForm.role').defer }" class="relative z-0 mt-1 cursor-pointer rounded-lg border border-gray-200 dark:border-gray-700">
30
+                                @foreach ($this->roles as $index => $role)
31
+                                    <button type="button"
32
+                                            @click="role = '{{ $role->key }}'"
33
+                                            @class([
34
+                                                'relative inline-flex w-full rounded-lg px-4 py-3 transition focus:z-10 focus:outline-none focus:ring-2 focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-600 dark:focus:ring-primary-600',
35
+                                                'border-t border-gray-200 dark:border-gray-700 rounded-t-none' => ($index > 0),
36
+                                                'rounded-b-none' => (! $loop->last),
37
+                                            ])
38
+                                    >
39
+                                        <div :class="role === '{{ $role->key }}' || 'opacity-50'">
40
+                                            <!-- Role Name -->
41
+                                            <div class="flex items-center">
42
+                                                <div class="text-sm text-gray-600 dark:text-gray-400" :class="{'font-semibold': role === '{{ $role->key }}'}">
43
+                                                    {{ $role->name }}
44
+                                                </div>
45
+
46
+                                                <svg class="text-primary-500 ml-2 h-5 w-5" x-cloak :class="{ 'hidden': role !== '{{ $role->key }}' }"
47
+                                                     xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
48
+                                                    <path fill-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" />
49
+                                                </svg>
50
+                                            </div>
51
+
52
+                                            <!-- Role Description -->
53
+                                            <div class="mt-2 text-left text-sm text-gray-600 dark:text-gray-400">
54
+                                                {{ $role->description }}
55
+                                            </div>
56
+                                        </div>
57
+                                    </button>
58
+                                @endforeach
59
+                            </div>
60
+                        </x-forms::field-wrapper>
61
+                    @endif
62
+
63
+                    <x-slot name="footer">
64
+                        <div class="text-left">
65
+                            <x-filament::button type="submit">
66
+                                {{ __('filament-companies::default.buttons.add') }}
67
+                            </x-filament::button>
68
+                        </div>
69
+                    </x-slot>
70
+                </x-filament::card>
71
+            </form>
72
+        </x-filament-companies::grid-section>
73
+    @endif
74
+
75
+    @if ($company->companyInvitations->isNotEmpty() && Gate::check('addCompanyEmployee', $company))
76
+        <x-filament-companies::section-border />
77
+
78
+        <!-- Pending Employee Invitations -->
79
+        <x-filament-companies::grid-section class="mt-4">
80
+            <x-slot name="title">
81
+                {{ __('filament-companies::default.action_section_titles.pending_company_invitations') }}
82
+            </x-slot>
83
+
84
+            <x-slot name="description">
85
+                {{ __('filament-companies::default.action_section_descriptions.pending_company_invitations') }}
86
+            </x-slot>
87
+
88
+            <div class="overflow-x-auto space-y-2 bg-white rounded-xl shadow dark:border-gray-600 dark:bg-gray-800 col-span-2 mt-5 sm:col-span-1 md:col-start-2 md:mt-0">
89
+                <table class="w-full divide-y divide-gray-200 dark:divide-gray-700">
90
+                    <thead class="bg-gray-100 dark:bg-gray-800">
91
+                    <tr>
92
+                        <th colspan="3" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
93
+                            {{ __('filament-companies::default.fields.email') }}
94
+                        </th>
95
+                    </tr>
96
+                    </thead>
97
+                    <tbody class="divide-y divide-gray-200 dark:divide-gray-700">
98
+                    @foreach ($company->companyInvitations as $invitation)
99
+                        <tr>
100
+                            <td class="px-6 py-4 whitespace-nowrap">
101
+                                <div class="flex items-center">
102
+                                    <div class="text-gray-500 dark:text-gray-400">
103
+                                        {{ $invitation->email }}
104
+                                    </div>
105
+                                </div>
106
+                            </td>
107
+                            <td class="px-6 py-4 whitespace-nowrap">
108
+                                <div class="text-right">
109
+                                    <!-- Manage Company Employee Role -->
110
+                                    @if (Gate::check('removeCompanyEmployee', $company))
111
+                                        <x-filament::button size="sm" color="danger" outlined="true" wire:click="cancelCompanyInvitation({{ $invitation->id }})">
112
+                                            {{ __('filament-companies::default.buttons.cancel') }}
113
+                                        </x-filament::button>
114
+                                    @endif
115
+                                </div>
116
+                            </td>
117
+                        </tr>
118
+                    @endforeach
119
+                    </tbody>
120
+                </table>
121
+            </div>
122
+        </x-filament-companies::grid-section>
123
+    @endif
124
+
125
+    @if ($company->users->isNotEmpty())
126
+        <x-filament-companies::section-border />
127
+
128
+        <!-- Manage Company Employees -->
129
+        <x-filament-companies::grid-section class="mt-4">
130
+            <x-slot name="title">
131
+                {{ __('filament-companies::default.action_section_titles.company_employees') }}
132
+            </x-slot>
133
+
134
+            <x-slot name="description">
135
+                {{ __('filament-companies::default.action_section_descriptions.company_employees') }}
136
+            </x-slot>
137
+
138
+            <!-- Company Employee List -->
139
+            <div class="overflow-x-auto space-y-2 bg-white rounded-xl shadow dark:border-gray-600 dark:bg-gray-800 col-span-2 mt-5 sm:col-span-1 md:col-start-2 md:mt-0">
140
+                <table class="w-full divide-y divide-gray-200 dark:divide-gray-700">
141
+                    <thead class="bg-white dark:bg-gray-800">
142
+                    <tr>
143
+                        <th scope="col" colspan="3" class="px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-400 uppercase tracking-wider">
144
+                            {{ __('filament-companies::default.fields.name') }}
145
+                        </th>
146
+                    </tr>
147
+                    </thead>
148
+                    <tbody class="divide-y divide-gray-200 dark:divide-gray-700">
149
+                    @foreach ($company->users->sortBy('name') as $user)
150
+                        <tr>
151
+                            <td colspan="2" class="px-6 py-4 text-left whitespace-nowrap">
152
+                                <div class="flex items-center text-sm">
153
+                                    <div class="flex-shrink-0">
154
+                                        <img class="h-10 w-10 rounded-full object-cover" src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}">
155
+                                    </div>
156
+                                    <div class="ml-4">
157
+                                        <div class="font-medium text-gray-900 dark:text-gray-200">{{ $user->name }}</div>
158
+                                        <div class="text-gray-600 dark:text-gray-400 hidden sm:block">{{ $user->email }}</div>
159
+                                    </div>
160
+                                </div>
161
+                            </td>
162
+                            <td colspan="1" class="px-6 py-4 whitespace-nowrap">
163
+                                <div class="space-x-2 text-right">
164
+                                    <!-- Manage Company Employee Role -->
165
+                                    @if (Gate::check('addCompanyEmployee', $company) && Wallo\FilamentCompanies\FilamentCompanies::hasRoles())
166
+                                        <x-filament::button size="sm" outlined="true" :icon="(Wallo\FilamentCompanies\FilamentCompanies::findRole($user->employeeship->role)->key == 'admin') ? 'heroicon-o-shield-check' : 'heroicon-o-pencil'" :color="(Wallo\FilamentCompanies\FilamentCompanies::findRole($user->employeeship->role)->key == 'admin') ? 'primary' : 'warning'" wire:click="manageRole('{{ $user->id }}')">
167
+                                            {{ Wallo\FilamentCompanies\FilamentCompanies::findRole($user->employeeship->role)->name }}
168
+                                        </x-filament::button>
169
+                                    @elseif (Wallo\FilamentCompanies\FilamentCompanies::hasRoles())
170
+                                        <x-filament::button size="sm" disabled="true" outlined="true" :icon="(Wallo\FilamentCompanies\FilamentCompanies::findRole($user->employeeship->role)->key == 'admin') ? 'heroicon-o-shield-check' : 'heroicon-o-pencil'" color="secondary">
171
+                                            {{ Wallo\FilamentCompanies\FilamentCompanies::findRole($user->employeeship->role)->name }}
172
+                                        </x-filament::button>
173
+                                    @endif
174
+
175
+                                    <!-- Leave Company -->
176
+                                    @if ($this->user->id === $user->id)
177
+                                        <x-filament::button size="sm" color="danger" wire:click="$toggle('confirmingLeavingCompany')">
178
+                                            {{ __('filament-companies::default.buttons.leave') }}
179
+                                        </x-filament::button>
180
+
181
+                                        <!-- Remove Company Employee -->
182
+                                    @elseif (Gate::check('removeCompanyEmployee', $company))
183
+                                        <x-filament::button size="sm" color="danger" wire:click="confirmCompanyEmployeeRemoval('{{ $user->id }}')">
184
+                                            {{ __('filament-companies::default.buttons.remove') }}
185
+                                        </x-filament::button>
186
+                                    @endif
187
+                                </div>
188
+                            </td>
189
+                        </tr>
190
+                    @endforeach
191
+                    </tbody>
192
+                </table>
193
+            </div>
194
+        </x-filament-companies::grid-section>
195
+    @endif
196
+
197
+    <!-- Role Management Modal -->
198
+    <x-filament-companies::dialog-modal wire:model="currentlyManagingRole">
199
+        <x-slot name="title">
200
+            {{ __('filament-companies::default.modal_titles.manage_role') }}
201
+        </x-slot>
202
+
203
+        <x-slot name="content">
204
+            <div x-data="{ role: @entangle('currentRole').defer }"
205
+                 class="relative z-0 mt-1 cursor-pointer rounded-lg border border-gray-200 dark:border-gray-700">
206
+                @foreach ($this->roles as $index => $role)
207
+                    <button type="button"
208
+                            @click="role = '{{ $role->key }}'"
209
+                            @class([
210
+                                'relative inline-flex w-full rounded-lg px-4 py-3 transition focus:z-10 focus:outline-none focus:ring-2 focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-600 dark:focus:ring-primary-600',
211
+                                'border-t border-gray-200 dark:border-gray-700 rounded-t-none' => ($index > 0),
212
+                                'rounded-b-none' => (! $loop->last),
213
+                            ])
214
+                    >
215
+                        <div :class="role === '{{ $role->key }}' || 'opacity-50'">
216
+                            <!-- Role Name -->
217
+                            <div class="flex items-center">
218
+                                <div class="text-sm text-gray-600 dark:text-gray-100" :class="role === '{{ $role->key }}' ? 'font-semibold' : ''">
219
+                                    {{ $role->name }}
220
+                                </div>
221
+
222
+                                <svg class="text-primary-500 ml-2 h-5 w-5" x-cloak :class="{ 'hidden': role !== '{{ $role->key }}' }"
223
+                                     xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
224
+                                    <path fill-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" />
225
+                                </svg>
226
+                            </div>
227
+
228
+                            <!-- Role Description -->
229
+                            <div class="mt-2 text-xs text-gray-600 dark:text-gray-400">
230
+                                {{ $role->description }}
231
+                            </div>
232
+                        </div>
233
+                    </button>
234
+                @endforeach
235
+            </div>
236
+        </x-slot>
237
+
238
+        <x-slot name="footer">
239
+            <x-filament::button color="secondary" wire:click="stopManagingRole" wire:loading.attr="disabled">
240
+                {{ __('filament-companies::default.buttons.cancel') }}
241
+            </x-filament::button>
242
+
243
+            <x-filament::button wire:click="updateRole" wire:loading.attr="disabled">
244
+                {{ __('filament-companies::default.buttons.save') }}
245
+            </x-filament::button>
246
+        </x-slot>
247
+    </x-filament-companies::dialog-modal>
248
+
249
+    <!-- Leave Company Confirmation Modal -->
250
+    <x-filament-companies::dialog-modal wire:model="confirmingLeavingCompany">
251
+        <x-slot name="title">
252
+            {{ __('filament-companies::default.modal_titles.leave_company') }}
253
+        </x-slot>
254
+
255
+        <x-slot name="content">
256
+            {{ __('filament-companies::default.modal_descriptions.leave_company') }}
257
+        </x-slot>
258
+
259
+        <x-slot name="footer">
260
+            <x-filament::button color="secondary" wire:click="$toggle('confirmingLeavingCompany')" wire:loading.attr="disabled">
261
+                {{ __('filament-companies::default.buttons.cancel') }}
262
+            </x-filament::button>
263
+
264
+            <x-filament::button color="danger" wire:click="leaveCompany" wire:loading.attr="disabled">
265
+                {{ __('filament-companies::default.buttons.leave') }}
266
+            </x-filament::button>
267
+        </x-slot>
268
+    </x-filament-companies::dialog-modal>
269
+
270
+    <!-- Remove Company Employee Confirmation Modal -->
271
+    <x-filament-companies::dialog-modal wire:model="confirmingCompanyEmployeeRemoval">
272
+        <x-slot name="title">
273
+            {{ __('filament-companies::default.modal_titles.remove_company_employee') }}
274
+        </x-slot>
275
+
276
+        <x-slot name="content">
277
+            {{ __('filament-companies::default.modal_descriptions.remove_company_employee') }}
278
+        </x-slot>
279
+
280
+        <x-slot name="footer">
281
+            <x-filament::button color="secondary" wire:click="$toggle('confirmingCompanyEmployeeRemoval')" wire:loading.attr="disabled">
282
+                {{ __('filament-companies::default.buttons.cancel') }}
283
+            </x-filament::button>
284
+
285
+            <x-filament::button color="danger" wire:click="removeCompanyEmployee" wire:loading.attr="disabled">
286
+                {{ __('filament-companies::default.buttons.remove') }}
287
+            </x-filament::button>
288
+        </x-slot>
289
+    </x-filament-companies::dialog-modal>
290
+</div>

+ 1
- 0
tailwind.config.js Parādīt failu

@@ -5,6 +5,7 @@ module.exports = {
5 5
   content: [
6 6
       './resources/**/*.blade.php',
7 7
       './vendor/filament/**/*.blade.php',
8
+      './vendor/andrewdwallo/**/*.blade.php'
8 9
   ],
9 10
   darkMode: 'class',
10 11
   theme: {

Notiek ielāde…
Atcelt
Saglabāt