Commit c0187884 by Rezha Setyo Atmojo Committed by nurchamim

modul: KPI

status: selesai
keterangan:
- jika atasan/user dijadikan admin absensi, menu default user tsb tetap muncul
parent 56465a6d
...@@ -1957,7 +1957,7 @@ Route::group('', ['middleware' => ['Otentikasi_login']], function () { ...@@ -1957,7 +1957,7 @@ Route::group('', ['middleware' => ['Otentikasi_login']], function () {
}); });
Route::group('', ['namespace' => 'user'], function () { Route::group('', ['namespace' => 'user'], function () {
Route::group('saya', ['middleware' => 'Auth_menu:2,3,4,5,6,7', 'namespace' => 'saya'], function () { Route::group('saya', ['middleware' => 'Auth_menu:1,2,3,4,5,6,7', 'namespace' => 'saya'], function () {
Route::group('detail', function () { Route::group('detail', function () {
Route::get('list_data', 'Detail@list_data')->name('kpi.saya.detail.list-data'); Route::get('list_data', 'Detail@list_data')->name('kpi.saya.detail.list-data');
Route::post('save', 'Detail@save')->name('kpi.saya.detail.save'); Route::post('save', 'Detail@save')->name('kpi.saya.detail.save');
...@@ -1971,7 +1971,7 @@ Route::group('', ['middleware' => ['Otentikasi_login']], function () { ...@@ -1971,7 +1971,7 @@ Route::group('', ['middleware' => ['Otentikasi_login']], function () {
Route::get('list_data', 'Home@list_data')->name('kpi.saya.list-data'); Route::get('list_data', 'Home@list_data')->name('kpi.saya.list-data');
Route::get('', 'Home@index')->name('kpi.saya'); Route::get('', 'Home@index')->name('kpi.saya');
}); });
Route::group('team', ['middleware' => 'Auth_menu:2,3,4,5,6,7', 'namespace' => 'team'], function () { Route::group('team', ['middleware' => 'Auth_menu:1,2,3,4,5,6,7', 'namespace' => 'team'], function () {
Route::get('', 'Home@index')->name('kpi.team'); Route::get('', 'Home@index')->name('kpi.team');
Route::get('list_data', 'Home@list_data')->name('kpi.team.list.data'); Route::get('list_data', 'Home@list_data')->name('kpi.team.list.data');
Route::group('detail', function () { Route::group('detail', function () {
......
...@@ -45,45 +45,49 @@ ...@@ -45,45 +45,49 @@
<div class="col-md-2 border-kanan"> <div class="col-md-2 border-kanan">
<ul class="tab_menu nav nav-tabs nav-left flex-column"> <ul class="tab_menu nav nav-tabs nav-left flex-column">
<?php if($this->level_user == '1') : ?> <?php if($this->level_user == '1') : ?>
<li class="nav-item"> <li class="nav-item">
<a id="tab_pengaturan" class="nav-link" onclick="load_tab_content('pengaturan')" aria-expanded="false"> <a id="tab_pengaturan" class="nav-link" onclick="load_tab_content('pengaturan')" aria-expanded="false">
<?= $this->lang->line('menu_pengaturan') ?> <?= $this->lang->line('menu_pengaturan') ?>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a id="tab_master" class="nav-link" onclick="unset_detail('master');load_tab_content('master');" aria-expanded="false"> <a id="tab_master" class="nav-link" onclick="unset_detail('master');load_tab_content('master');" aria-expanded="false">
Master Master
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a id="tab_periode" class="nav-link" onclick="load_tab_content('periode')" aria-expanded="false"> <a id="tab_periode" class="nav-link" onclick="load_tab_content('periode')" aria-expanded="false">
<?= $this->lang->line('periode') ?> <?= $this->lang->line('periode') ?>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a id="tab_laporan" class="nav-link" onclick="unset_detail('laporan');load_tab_content('laporan');" aria-expanded="false"> <a id="tab_laporan" class="nav-link" onclick="unset_detail('laporan');load_tab_content('laporan');" aria-expanded="false">
<?= $this->lang->line('laporan') ?> <?= $this->lang->line('laporan') ?>
</a> </a>
</li> </li>
<?php else : ?> <?php endif; ?>
<?php if($this->level_user_prev != '1') : ?>
<?php if($sebagaiApprover) : ?> <?php if($sebagaiApprover) : ?>
<li class="nav-item"> <li class="nav-item">
<a id="tab_kpi_team" class="nav-link" onclick="unset_detail('kpi_team');load_tab_content('kpi_team');" aria-expanded="false"> <a id="tab_kpi_team" class="nav-link" onclick="unset_detail('kpi_team');load_tab_content('kpi_team');" aria-expanded="false">
KPI Team KPI Team
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a id="tab_approval" class="nav-link" onclick="unset_detail('approval');load_tab_content('approval');" aria-expanded="false"> <a id="tab_approval" class="nav-link" onclick="unset_detail('approval');load_tab_content('approval');" aria-expanded="false">
Approval Approval
</a> </a>
</li> </li>
<?php endif; ?> <?php endif; ?>
<li class="nav-item">
<a id="tab_kpi_saya" class="nav-link" onclick="load_tab_content('kpi_saya')" aria-expanded="false"> <li class="nav-item">
<?= $this->lang->line('kpi_saya') ?> <a id="tab_kpi_saya" class="nav-link" onclick="load_tab_content('kpi_saya')" aria-expanded="false">
</a> <?= $this->lang->line('kpi_saya') ?>
</li> </a>
</li>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
</div> </div>
<div class="col-md-10" style="padding: 20px;"> <div class="col-md-10" style="padding: 20px;">
...@@ -102,39 +106,43 @@ $(function() { ...@@ -102,39 +106,43 @@ $(function() {
$('.border-kanan').hide(); $('.border-kanan').hide();
$('#myTabContent').parent().removeClass('col-md-10').addClass('col-md-12'); $('#myTabContent').parent().removeClass('col-md-10').addClass('col-md-12');
<?php endif; ?> <?php endif; ?>
tab_content_init(); tab_content_init();
}); });
function tab_content_init() { function tab_content_init() {
if(localStorage.getItem("menu_kpi") == null) { if(localStorage.getItem("menu_kpi") == null) {
<?php if($this->level_user == '1') : ?> <?php if($this->level_user == '1') : ?>
$("#tab_pengaturan").addClass("active"); $("#tab_pengaturan").addClass("active");
load_tab_content("pengaturan"); load_tab_content("pengaturan");
<?php else : ?> <?php else : ?>
<?php if($sebagaiApprover) : ?> <?php if($sebagaiApprover) : ?>
$("#tab_kpi_team").addClass("active"); $("#tab_kpi_team").addClass("active");
load_tab_content("kpi_team"); load_tab_content("kpi_team");
<?php else : ?> <?php else : ?>
$("#tab_kpi_saya").addClass("active"); $("#tab_kpi_saya").addClass("active");
load_tab_content("kpi_saya"); load_tab_content("kpi_saya");
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
} else { } else {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi")); const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
<?php if($this->level_user != '1') : ?> <?php if($this->level_user != '1') : ?>
<?php if($sebagaiApprover) : ?> <?php if($sebagaiApprover) : ?>
if(['kpi_saya', 'kpi_team', 'approval'].includes(menu_kpi.active) == false) { if(['kpi_saya', 'kpi_team', 'approval'].includes(menu_kpi.active) == false) {
load_tab_content('kpi_team'); load_tab_content('kpi_team');
} else { } else {
load_tab_content(menu_kpi.active); load_tab_content(menu_kpi.active);
} }
<?php else : ?> <?php else : ?>
if(menu_kpi.active != 'kpi_saya') { if(menu_kpi.active != 'kpi_saya') {
load_tab_content('kpi_saya'); load_tab_content('kpi_saya');
} else { } else {
load_tab_content(menu_kpi.active); load_tab_content(menu_kpi.active);
} }
<?php endif; ?> <?php endif; ?>
<?php else : ?> <?php else : ?>
if(['pengaturan', 'master', 'periode', 'laporan'].includes(menu_kpi.active)) { if(['pengaturan', 'master', 'periode', 'laporan'].includes(menu_kpi.active)) {
load_tab_content(menu_kpi.active); load_tab_content(menu_kpi.active);
...@@ -155,60 +163,65 @@ function load_tab_content(tab) { ...@@ -155,60 +163,65 @@ function load_tab_content(tab) {
$('#loading_tab_content').show(); $('#loading_tab_content').show();
<?php if($this->level_user == '1') : ?> <?php if($this->level_user == '1') : ?>
if(tab == "pengaturan") { if(tab == "pengaturan") {
$('#myTabContent').load("<?= route('kpi.pengaturan') ?>", function() { $('#myTabContent').load("<?= route('kpi.pengaturan') ?>", function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
$('#myTabContent').show(); $('#myTabContent').show();
load_tab_sub_content_init(menu_kpi, tab); load_tab_sub_content_init(menu_kpi, tab);
});
} else if(tab == "master") {
$('#myTabContent').load("<?= route('kpi.master') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
load_tab_sub_content_init(menu_kpi, tab);
});
} else if(tab == "periode") {
$('#myTabContent').load("<?= route('kpi.periode') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
load_tab_sub_content_init(menu_kpi, tab);
});
} else if(tab == "laporan") {
$('#myTabContent').load("<?= route('kpi.laporan') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
});
}
<?php else : ?>
<?php if($sebagaiApprover) : ?>
if(tab == "kpi_saya") {
restore_tab_detail("kpi_saya", function() { $("#myTabContent").load("<?= route('kpi.saya') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
});
}); });
} else if(tab == "kpi_team") { } else if(tab == "master") {
restore_tab_detail("kpi_team", function() {$("#myTabContent").load("<?= route('kpi.team') ?>", function() { $('#myTabContent').load("<?= route('kpi.master') ?>", function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
$('#myTabContent').show(); $('#myTabContent').show();
}); load_tab_sub_content_init(menu_kpi, tab);
}); });
} else if(tab == "approval") { } else if(tab == "periode") {
restore_tab_detail("approval", function() { $("#myTabContent").load("<?= route('kpi.approval') ?>", function() { $('#myTabContent').load("<?= route('kpi.periode') ?>", function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
$('#myTabContent').show(); $('#myTabContent').show();
load_tab_sub_content_init(menu_kpi, tab); load_tab_sub_content_init(menu_kpi, tab);
}); });
} else if(tab == "laporan") {
$('#myTabContent').load("<?= route('kpi.laporan') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
}); });
} }
<?php endif; ?>
<?php if($this->level_user_prev != '1') : ?>
<?php if($sebagaiApprover) : ?>
if(tab == "kpi_saya") {
restore_tab_detail("kpi_saya", function() { $("#myTabContent").load("<?= route('kpi.saya') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
});
});
} else if(tab == "kpi_team") {
restore_tab_detail("kpi_team", function() {$("#myTabContent").load("<?= route('kpi.team') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
});
});
} else if(tab == "approval") {
restore_tab_detail("approval", function() { $("#myTabContent").load("<?= route('kpi.approval') ?>", function() {
$('#loading_tab_content').hide();
$('#myTabContent').show();
load_tab_sub_content_init(menu_kpi, tab);
});
});
}
<?php else : ?> <?php else : ?>
if(tab == "kpi_saya") { if(tab == "kpi_saya") {
restore_tab_detail("kpi_saya", function() { $("#myTabContent").load("<?= route('kpi.saya') ?>", function() { restore_tab_detail("kpi_saya", function() { $("#myTabContent").load("<?= route('kpi.saya') ?>", function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
$('#myTabContent').show(); $('#myTabContent').show();
});
}); });
}); }
}
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
} }
...@@ -219,30 +232,34 @@ function restore_tab_detail(menu, callback) { ...@@ -219,30 +232,34 @@ function restore_tab_detail(menu, callback) {
const menuSession = menu_kpi.detail.map(function(item) { return item.menu; }); const menuSession = menu_kpi.detail.map(function(item) { return item.menu; });
if(menuSession.includes(menu)) { if(menuSession.includes(menu)) {
const id = menu_kpi.detail[menuSession.indexOf(menu)].id; const id = menu_kpi.detail[menuSession.indexOf(menu)].id;
<?php if($sebagaiApprover) : ?> <?php if($sebagaiApprover) : ?>
if(menu == "kpi_team") { if(menu == "kpi_team") {
$('#myTabContent').load('<?= route("kpi.team.detail", ["id" => "'+id+'"]) ?>', function() { $('#myTabContent').load('<?= route("kpi.team.detail", ["id" => "'+id+'"]) ?>', function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
}); });
} else if(menu == "approval") { } else if(menu == "approval") {
$('#myTabContent').load('<?= route("kpi.approval.detail", ["id" => "'+id+'"]) ?>', function() { $('#myTabContent').load('<?= route("kpi.approval.detail", ["id" => "'+id+'"]) ?>', function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
}); });
} else if(menu == "kpi_saya") { } else if(menu == "kpi_saya") {
$('#myTabContent').load('<?= route("kpi.saya.detail", ["id" => "'+id+'"]) ?>', function() { $('#myTabContent').load('<?= route("kpi.saya.detail", ["id" => "'+id+'"]) ?>', function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
}); });
} }
<?php else : ?> <?php else : ?>
if(menu == "kpi_saya") { if(menu == "kpi_saya") {
$('#myTabContent').load('<?= route("kpi.saya.detail", ["id" => "'+id+'"]) ?>', function() { $('#myTabContent').load('<?= route("kpi.saya.detail", ["id" => "'+id+'"]) ?>', function() {
$('#loading_tab_content').hide(); $('#loading_tab_content').hide();
}); });
} }
<?php endif; ?> <?php endif; ?>
} else { } else {
callback(); callback();
} }
} else { } else {
callback(); callback();
} }
...@@ -259,6 +276,7 @@ function load_tab_sub_content_init(storage, tab) { ...@@ -259,6 +276,7 @@ function load_tab_sub_content_init(storage, tab) {
} else if(tab == "approval") { } else if(tab == "approval") {
load_tab_sub_content("apv_pengajuan"); load_tab_sub_content("apv_pengajuan");
} }
} else { } else {
if(storage.tab['tab_' + tab] === undefined) { if(storage.tab['tab_' + tab] === undefined) {
if(tab == "pengaturan") { if(tab == "pengaturan") {
...@@ -270,6 +288,7 @@ function load_tab_sub_content_init(storage, tab) { ...@@ -270,6 +288,7 @@ function load_tab_sub_content_init(storage, tab) {
} else if(tab == "approval") { } else if(tab == "approval") {
load_tab_sub_content("apv_pengajuan"); load_tab_sub_content("apv_pengajuan");
} }
} else { } else {
load_tab_sub_content(storage.tab['tab_' + tab]); load_tab_sub_content(storage.tab['tab_' + tab]);
} }
...@@ -341,12 +360,11 @@ function load_tab_sub_content(tab) { ...@@ -341,12 +360,11 @@ function load_tab_sub_content(tab) {
$('#loading_tab_sub_content').hide(); $('#loading_tab_sub_content').hide();
}); });
} }
} }
function restore_detail(menu, callback) { function restore_detail(menu, callback) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi")); const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.active == menu) { if(menu_kpi.active == menu) {
if(menu_kpi.detail === undefined) { if(menu_kpi.detail === undefined) {
callback("home"); callback("home");
...@@ -369,6 +387,7 @@ function set_tab_sub_active(storage, tab, active) { ...@@ -369,6 +387,7 @@ function set_tab_sub_active(storage, tab, active) {
} else { } else {
storage.tab['tab_' + tab] = active; storage.tab['tab_' + tab] = active;
} }
localStorage.setItem("menu_kpi", JSON.stringify(storage)); localStorage.setItem("menu_kpi", JSON.stringify(storage));
} }
...@@ -385,6 +404,7 @@ function set_tab_active(storage, active) { ...@@ -385,6 +404,7 @@ function set_tab_active(storage, active) {
function set_detail_active(menu, id) { function set_detail_active(menu, id) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi")); const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.detail === undefined) { if(menu_kpi.detail === undefined) {
menu_kpi.detail = [{ menu : menu, id : id}]; menu_kpi.detail = [{ menu : menu, id : id}];
localStorage.setItem("menu_kpi", JSON.stringify(menu_kpi)); localStorage.setItem("menu_kpi", JSON.stringify(menu_kpi));
...@@ -411,6 +431,7 @@ function set_detail_active(menu, id) { ...@@ -411,6 +431,7 @@ function set_detail_active(menu, id) {
function unset_detail(menu) { function unset_detail(menu) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi")); const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.detail !== undefined) { if(menu_kpi.detail !== undefined) {
const detail = menu_kpi.detail; const detail = menu_kpi.detail;
const menuSession = detail.map(function(item) { return item.menu; }); const menuSession = detail.map(function(item) { return item.menu; });
...@@ -421,6 +442,7 @@ function unset_detail(menu) { ...@@ -421,6 +442,7 @@ function unset_detail(menu) {
} }
} }
</script> </script>
<?php include('user/team/js.php') ?> <?php include('user/team/js.php') ?>
<?php include('user/approval/js.php') ?> <?php include('user/approval/js.php') ?>
<?php include('user/saya/js.php') ?> <?php include('user/saya/js.php') ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment