Skip to content

Commit

Permalink
(#541) Update Dashboard View
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 authored Nov 20, 2023
1 parent 5701aec commit 9fd2612
Show file tree
Hide file tree
Showing 30 changed files with 1,123 additions and 377 deletions.
14 changes: 11 additions & 3 deletions donjo-app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use App\Controllers\Install;
use App\Controllers\Main;
use App\Controllers\Siteman\Dashboard;
use App\Controllers\Siteman\Login;
use CodeIgniter\Router\RouteCollection;

Expand All @@ -17,7 +18,14 @@
});

// siteman
$routes->group('siteman', ['filter' => 'isLogin'], static function ($routes) {
$routes->get('/', [Login::class, 'index'], ['as' => 'login.view']);
$routes->post('/', [Login::class, 'submit'], ['as' => 'login.submit']);
$routes->group('siteman', static function ($routes) {
// login
$routes->get('/', [Login::class, 'index'], ['as' => 'login.view', 'filter' => 'isLogin']);
$routes->post('/', [Login::class, 'submit'], ['as' => 'login.submit', 'filter' => 'isLogin']);

// dashboard
$routes->get('dashboard', [Dashboard::class, 'index'], ['as' => 'siteman.dashboard.view']);
});

// redirect halaman yang lama
$routes->addRedirect('hom_desa', 'siteman.dashboard.view');
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
<?php

namespace App\Controllers;
namespace App\Controllers\Siteman;

use Kenjis\CI3Compatible\Core\CI_Controller;

class Hom_desa extends CI_Controller
class Dashboard extends CI_Controller
{
public function __construct()
{
parent::__construct();

$this->load->model('user_model');
$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1' && $grup !== '2') {
return redirect()->to('siteman');
}
$this->load->model('header_model');
$this->load->model('config_model');
}
// public function __construct()
// {
// parent::__construct();

// $this->load->model('user_model');
// $grup = $this->user_model->sesi_grup($_SESSION['sesi']);
// if ($grup !== '1' && $grup !== '2') {
// return redirect()->to('siteman');
// }
// $this->load->model('header_model');
// $this->load->model('config_model');
// }

public function index()
{
$_SESSION['delik'] = 0;
$nav['act'] = 0;
$header = $this->header_model->get_data();
$data['main'] = $this->config_model->get_data();
echo view('header', $header);
echo view('home/nav', $nav);
echo view('home/konfigurasi_form', $data);
echo view('footer');
return view('siteman/dashboard');
}

public function about()
Expand Down
2 changes: 1 addition & 1 deletion donjo-app/Controllers/Siteman/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function submit()
return redirect()->to('hom_desa')->with('success', 'Halo, selamat datang kembali');
}

session()->setFlashdata('error', 'Silakan coba kembali.');
session()->setFlashdata('error', 'Kredensial tidak valid, silakan coba lagi.');

return $this->index();
}
Expand Down
25 changes: 25 additions & 0 deletions donjo-app/Models/SettingModul.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Models;

use CodeIgniter\Model;

class SettingModul extends Model
{
protected $table = 'setting_modul';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'id',
'modul',
'url',
'aktif',
'ikon',
'urut',
'level',
'hidden',
];
}
Loading

0 comments on commit 9fd2612

Please sign in to comment.