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 () {
});
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::get('list_data', 'Detail@list_data')->name('kpi.saya.detail.list-data');
Route::post('save', 'Detail@save')->name('kpi.saya.detail.save');
......@@ -1971,7 +1971,7 @@ Route::group('', ['middleware' => ['Otentikasi_login']], function () {
Route::get('list_data', 'Home@list_data')->name('kpi.saya.list-data');
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('list_data', 'Home@list_data')->name('kpi.team.list.data');
Route::group('detail', function () {
......
......@@ -65,7 +65,9 @@
<?= $this->lang->line('laporan') ?>
</a>
</li>
<?php else : ?>
<?php endif; ?>
<?php if($this->level_user_prev != '1') : ?>
<?php if($sebagaiApprover) : ?>
<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">
......@@ -78,12 +80,14 @@
</a>
</li>
<?php endif; ?>
<li class="nav-item">
<a id="tab_kpi_saya" class="nav-link" onclick="load_tab_content('kpi_saya')" aria-expanded="false">
<?= $this->lang->line('kpi_saya') ?>
</a>
</li>
<?php endif; ?>
</ul>
</div>
<div class="col-md-10" style="padding: 20px;">
......@@ -102,6 +106,7 @@ $(function() {
$('.border-kanan').hide();
$('#myTabContent').parent().removeClass('col-md-10').addClass('col-md-12');
<?php endif; ?>
tab_content_init();
});
......@@ -119,8 +124,10 @@ function tab_content_init() {
load_tab_content("kpi_saya");
<?php endif; ?>
<?php endif; ?>
} else {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
<?php if($this->level_user != '1') : ?>
<?php if($sebagaiApprover) : ?>
if(['kpi_saya', 'kpi_team', 'approval'].includes(menu_kpi.active) == false) {
......@@ -135,6 +142,7 @@ function tab_content_init() {
load_tab_content(menu_kpi.active);
}
<?php endif; ?>
<?php else : ?>
if(['pengaturan', 'master', 'periode', 'laporan'].includes(menu_kpi.active)) {
load_tab_content(menu_kpi.active);
......@@ -179,7 +187,9 @@ function load_tab_content(tab) {
$('#myTabContent').show();
});
}
<?php else : ?>
<?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() {
......@@ -187,12 +197,14 @@ function load_tab_content(tab) {
$('#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();
......@@ -201,6 +213,7 @@ function load_tab_content(tab) {
});
});
}
<?php else : ?>
if(tab == "kpi_saya") {
restore_tab_detail("kpi_saya", function() { $("#myTabContent").load("<?= route('kpi.saya') ?>", function() {
......@@ -219,6 +232,7 @@ function restore_tab_detail(menu, callback) {
const menuSession = menu_kpi.detail.map(function(item) { return item.menu; });
if(menuSession.includes(menu)) {
const id = menu_kpi.detail[menuSession.indexOf(menu)].id;
<?php if($sebagaiApprover) : ?>
if(menu == "kpi_team") {
$('#myTabContent').load('<?= route("kpi.team.detail", ["id" => "'+id+'"]) ?>', function() {
......@@ -233,6 +247,7 @@ function restore_tab_detail(menu, callback) {
$('#loading_tab_content').hide();
});
}
<?php else : ?>
if(menu == "kpi_saya") {
$('#myTabContent').load('<?= route("kpi.saya.detail", ["id" => "'+id+'"]) ?>', function() {
......@@ -240,9 +255,11 @@ function restore_tab_detail(menu, callback) {
});
}
<?php endif; ?>
} else {
callback();
}
} else {
callback();
}
......@@ -259,6 +276,7 @@ function load_tab_sub_content_init(storage, tab) {
} else if(tab == "approval") {
load_tab_sub_content("apv_pengajuan");
}
} else {
if(storage.tab['tab_' + tab] === undefined) {
if(tab == "pengaturan") {
......@@ -270,6 +288,7 @@ function load_tab_sub_content_init(storage, tab) {
} else if(tab == "approval") {
load_tab_sub_content("apv_pengajuan");
}
} else {
load_tab_sub_content(storage.tab['tab_' + tab]);
}
......@@ -341,12 +360,11 @@ function load_tab_sub_content(tab) {
$('#loading_tab_sub_content').hide();
});
}
}
function restore_detail(menu, callback) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.active == menu) {
if(menu_kpi.detail === undefined) {
callback("home");
......@@ -369,6 +387,7 @@ function set_tab_sub_active(storage, tab, active) {
} else {
storage.tab['tab_' + tab] = active;
}
localStorage.setItem("menu_kpi", JSON.stringify(storage));
}
......@@ -385,6 +404,7 @@ function set_tab_active(storage, active) {
function set_detail_active(menu, id) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.detail === undefined) {
menu_kpi.detail = [{ menu : menu, id : id}];
localStorage.setItem("menu_kpi", JSON.stringify(menu_kpi));
......@@ -411,6 +431,7 @@ function set_detail_active(menu, id) {
function unset_detail(menu) {
const menu_kpi = JSON.parse(localStorage.getItem("menu_kpi"));
if(menu_kpi.detail !== undefined) {
const detail = menu_kpi.detail;
const menuSession = detail.map(function(item) { return item.menu; });
......@@ -421,6 +442,7 @@ function unset_detail(menu) {
}
}
</script>
<?php include('user/team/js.php') ?>
<?php include('user/approval/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