diff --git a/app/Helpers/CustomHelper.php b/app/Helpers/CustomHelper.php
index 9673b8b..aab0549 100644
--- a/app/Helpers/CustomHelper.php
+++ b/app/Helpers/CustomHelper.php
@@ -1,4 +1,6 @@
role_id;
+ }
+
+ switch($role) {
+ case '1':
+ return "Administrator";
+ case '2':
+ return "Admin Monitoring";
+ case '3':
+ return "Perusahaan";
+ case '4':
+ return "Admin Konten";
+ default:
+ return "Role Tidak Dikenal";
+ }
+ }
+}
+
+if (!function_exists('shorten_text')) {
+ function shorten_text($text, $maxLength = 100) {
+ if (strlen($text) > $maxLength) {
+ return substr($text, 0, $maxLength) . '...';
+ }
+
+ return $text;
+ }
+}
diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php
index c8c44ef..f37bce1 100644
--- a/app/Http/Controllers/AuthController.php
+++ b/app/Http/Controllers/AuthController.php
@@ -25,8 +25,7 @@ public function loginAction(LoginRequest $request){
if(Auth::attempt($validatedData)){
$request->session()->regenerate();
- // return redirect()->intended('/dashboard/overview');
- return "masuk";
+ return redirect()->intended('/dashboard/overview');
}else{
return redirect()->back();
}
diff --git a/app/Http/Controllers/Dashboard/OverviewController.php b/app/Http/Controllers/Dashboard/OverviewController.php
new file mode 100644
index 0000000..fe86706
--- /dev/null
+++ b/app/Http/Controllers/Dashboard/OverviewController.php
@@ -0,0 +1,16 @@
+ 'Ikhtisar',
+ 'page' => 'overview'
+ ]);
+ }
+}
diff --git a/app/Http/Middleware/AuthenticatedMiddleware.php b/app/Http/Middleware/AuthenticatedMiddleware.php
new file mode 100644
index 0000000..3e9eaac
--- /dev/null
+++ b/app/Http/Middleware/AuthenticatedMiddleware.php
@@ -0,0 +1,26 @@
+route('dashboard.overview');
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/RoleMiddleware.php b/app/Http/Middleware/RoleMiddleware.php
new file mode 100644
index 0000000..055e42d
--- /dev/null
+++ b/app/Http/Middleware/RoleMiddleware.php
@@ -0,0 +1,29 @@
+route('login');
+ }
+
+ if (!in_array(Auth::user()->role_id, $roles)) {
+ return abort(403, 'Anda tidak memiliki akses ke halaman ini.');
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/Models/User.php b/app/Models/User.php
index b2425f8..813a384 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -47,4 +47,8 @@ protected function casts(): array
'password' => 'hashed',
];
}
+
+ public function role(){
+ return $this->belongsTo(Role::class, 'role_id', 'id');
+ }
}
diff --git a/bootstrap/app.php b/bootstrap/app.php
index 7b162da..7a17a35 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -1,5 +1,8 @@
withMiddleware(function (Middleware $middleware) {
- //
+ $middleware->alias([
+ 'role' => RoleMiddleware::class,
+ 'authenticated' => AuthenticatedMiddleware::class
+ ]);
})
->withExceptions(function (Exceptions $exceptions) {
//
diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php
index 721f928..0edb7a2 100644
--- a/database/seeders/RoleSeeder.php
+++ b/database/seeders/RoleSeeder.php
@@ -15,9 +15,9 @@ public function run(): void
{
Role::insert([
['name' => "Administrator", 'description' => null],
- ['name' => "Monitoring Admin", 'description' => null],
- ['name' => "Company", 'description' => null],
- ['name' => "Content Admin", 'description' => null],
+ ['name' => "Admin Monitoring", 'description' => null],
+ ['name' => "Perusahaan", 'description' => null],
+ ['name' => "Admin Konten", 'description' => null],
]);
}
}
diff --git a/public/assets/dashboard/css/custom.css b/public/assets/dashboard/css/custom.css
index c72dbb2..85a05e0 100644
--- a/public/assets/dashboard/css/custom.css
+++ b/public/assets/dashboard/css/custom.css
@@ -10,6 +10,21 @@ .required-input{
font-size: 0.8rem;
}
+.active-page{
+ color: #3572EF !important;
+ background-color: #ebeef2 !important;
+ font-family: "DM Sans", sans-serif;
+ font-weight: 700;
+ font-size: 15px;
+ letter-spacing: 0.01em;
+ text-transform: none;
+ line-height: 1.25rem;
+}
+
+.active-page span{
+ color: #3572EF !important;
+}
+
#password-strength-status {
margin-top: 5px;
font-size: 12px;
diff --git a/public/assets/dashboard/js/scripts.js b/public/assets/dashboard/js/scripts.js
index 71b3b92..7cd3236 100644
--- a/public/assets/dashboard/js/scripts.js
+++ b/public/assets/dashboard/js/scripts.js
@@ -106,14 +106,14 @@
_self_link = self.attr('href');
if (fileName.match(_self_link)) {
- self.closest("li").addClass('active current-page').parents().closest("li").addClass("active current-page");
+ self.closest("li").addClass('').parents().closest("li").addClass("");
self.closest("li").children('.nk-menu-sub').css('display', 'block');
self.parents().closest("li").children('.nk-menu-sub').css('display', 'block');
} else {
- self.closest("li").removeClass('active current-page').parents().closest("li:not(.current-page)").removeClass("active");
+ self.closest("li").removeClass('').parents().closest("li:not(.current-page)").removeClass("active");
}
});
- }; // PasswordSwitch @v1.0
+ };
NioApp.PassSwitch = function () {
diff --git a/resources/views/dashboard/overview/index.blade.php b/resources/views/dashboard/overview/index.blade.php
new file mode 100644
index 0000000..fc9527e
--- /dev/null
+++ b/resources/views/dashboard/overview/index.blade.php
@@ -0,0 +1,488 @@
+@include('partials.dashboard.head')
+@include('partials.dashboard.sidebar')
+@include('partials.dashboard.header')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
4.63% vs. last week
+
+
+
+
+
+
+
+
+
+
+
+
+
2.34% vs. last week
+
+
+
+
+
+
+
+
+
+
+
+
+
4.63% vs. last week
+
+
+
+
+
+
+
+
+
+
+
+
+
2.34% vs. last week
+
+
+
+
+
+
+
+
+
+
+
+
Sales Statistics
+
+
+
+
+ -
+
+
+ Total Order
+
+
+ -
+
+
+ Cancelled Order
+
+
+
+
+
+
+
+
01 Jul, 2020
+
30 Jul, 2020
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Completed
+
+
+ -
+
+
+ Processing
+
+
+ -
+
+
+ Cancelled
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ -
+
+
+
+ -
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
Order No.
+
Customer
+
Date
+
Amount
+
Status
+
+
+
+
+
+
+ AB
+
+
+ Abu Bin Ishtiyak
+
+
+
+
+ 02/11/2020
+
+
+ 4,596.75 USD
+
+
+ Paid
+
+
+
+
+
+
+
+ DE
+
+
+ Desiree Edwards
+
+
+
+
+ 02/02/2020
+
+
+ 596.75 USD
+
+
+ Cancelled
+
+
+
+
+
+
+
+

+
+
+ Blanca Schultz
+
+
+
+
+ 02/01/2020
+
+
+ 199.99 USD
+
+
+ Paid
+
+
+
+
+
+
+
+ NL
+
+
+ Naomi Lawrence
+
+
+
+
+ 01/29/2020
+
+
+ 1099.99 USD
+
+
+ Paid
+
+
+
+
+
+
+
+ CH
+
+
+ Cassandra Hogan
+
+
+
+
+ 01/29/2020
+
+
+ 1099.99 USD
+
+
+ Due
+
+
+
+
+
+
+
+
+
+
+ -
+
+

+
+
+
Pink Fitness Tracker
+
$99.00
+
+
+
+ -
+
+

+
+
+
Purple Smartwatch
+
$99.00
+
+
+
+ -
+
+

+
+
+
Black Smartwatch
+
$99.00
+
+
+
+ -
+
+

+
+
+
Black Headphones
+
$99.00
+
+
+
+ -
+
+

+
+
+
iPhone 7 Headphones
+
$99.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@include('partials.dashboard.footer')
diff --git a/resources/views/partials/dashboard/footer.blade.php b/resources/views/partials/dashboard/footer.blade.php
new file mode 100644
index 0000000..84e066d
--- /dev/null
+++ b/resources/views/partials/dashboard/footer.blade.php
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+