add akses tata usaha
This commit is contained in:
parent
3be01956b3
commit
99a34e8e59
@ -198,7 +198,9 @@ class DashboardController extends Controller
|
|||||||
->where('statusenabled', true)
|
->where('statusenabled', true)
|
||||||
->where('status_action', 'approved');
|
->where('status_action', 'approved');
|
||||||
|
|
||||||
if(in_array(22, $unitIds)){
|
if(in_array(22, $unitIds)){
|
||||||
|
}elseif(auth()->user()->username === "admin.turt"){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$baseQuery = $baseQuery->whereIn('id_unit_kerja', $unitIds);
|
$baseQuery = $baseQuery->whereIn('id_unit_kerja', $unitIds);
|
||||||
}
|
}
|
||||||
@ -627,6 +629,7 @@ class DashboardController extends Controller
|
|||||||
$subIds = $mapping->pluck('objectsubunitkerjapegawaifk')->filter()->unique()->values();
|
$subIds = $mapping->pluck('objectsubunitkerjapegawaifk')->filter()->unique()->values();
|
||||||
$units = UnitKerja::where('statusenabled', true);
|
$units = UnitKerja::where('statusenabled', true);
|
||||||
if($unitIds->contains(22)){
|
if($unitIds->contains(22)){
|
||||||
|
}elseif(auth()->user()->username === "admin.turt"){
|
||||||
}else{
|
}else{
|
||||||
$units->when($unitIds->isNotEmpty(), fn($q2) => $q2->whereIn('id', $unitIds));
|
$units->when($unitIds->isNotEmpty(), fn($q2) => $q2->whereIn('id', $unitIds));
|
||||||
}
|
}
|
||||||
@ -1328,9 +1331,13 @@ class DashboardController extends Controller
|
|||||||
abort(404, 'PDF Tidak ditemukan');
|
abort(404, 'PDF Tidak ditemukan');
|
||||||
}
|
}
|
||||||
$user = auth()->user()->dataUser;
|
$user = auth()->user()->dataUser;
|
||||||
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true)
|
$mapping = null;
|
||||||
|
if($user){
|
||||||
|
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true)
|
||||||
->where('objectpegawaifk', $user->id)->where('isprimary', true)
|
->where('objectpegawaifk', $user->id)->where('isprimary', true)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
$payloadLog = [
|
$payloadLog = [
|
||||||
'file_directory_id' => $fileDirectoryId,
|
'file_directory_id' => $fileDirectoryId,
|
||||||
'pegawai_id_entry' => auth()->user()->dataUser->id,
|
'pegawai_id_entry' => auth()->user()->dataUser->id,
|
||||||
@ -1345,7 +1352,7 @@ class DashboardController extends Controller
|
|||||||
'id_sub_unit_kerja' => $mapping ? $mapping->objectsubunitkerjapegawaifk : null,
|
'id_sub_unit_kerja' => $mapping ? $mapping->objectsubunitkerjapegawaifk : null,
|
||||||
];
|
];
|
||||||
LogActivity::create($payloadLog);
|
LogActivity::create($payloadLog);
|
||||||
|
}
|
||||||
|
|
||||||
$fileInfo = get_file_s3($data->file);
|
$fileInfo = get_file_s3($data->file);
|
||||||
if (!$fileInfo || empty($fileInfo['file'])) {
|
if (!$fileInfo || empty($fileInfo['file'])) {
|
||||||
@ -1523,6 +1530,8 @@ class DashboardController extends Controller
|
|||||||
$keyword = strtolower(request('keyword', ''));
|
$keyword = strtolower(request('keyword', ''));
|
||||||
// $authUnit = auth()->user()->masterPersetujuan->details->pluck('unit_pegawai_id')->unique()->toArray();
|
// $authUnit = auth()->user()->masterPersetujuan->details->pluck('unit_pegawai_id')->unique()->toArray();
|
||||||
$user = auth()->user()->dataUser;
|
$user = auth()->user()->dataUser;
|
||||||
|
$unitIds = [];
|
||||||
|
if($user){
|
||||||
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true)
|
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true)
|
||||||
->where('objectpegawaifk', $user->id)
|
->where('objectpegawaifk', $user->id)
|
||||||
->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']);
|
->get(['objectunitkerjapegawaifk', 'objectsubunitkerjapegawaifk']);
|
||||||
@ -1531,6 +1540,7 @@ class DashboardController extends Controller
|
|||||||
->unique()
|
->unique()
|
||||||
->values()
|
->values()
|
||||||
->all();
|
->all();
|
||||||
|
}
|
||||||
$result = $this->buildRecapData($unitIds, $keyword);
|
$result = $this->buildRecapData($unitIds, $keyword);
|
||||||
// paginate manually
|
// paginate manually
|
||||||
$total = count($result);
|
$total = count($result);
|
||||||
@ -1550,6 +1560,7 @@ class DashboardController extends Controller
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
|
dd($th);
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
'message' => 'Gagal! mendapatkan data'
|
'message' => 'Gagal! mendapatkan data'
|
||||||
@ -1563,10 +1574,11 @@ class DashboardController extends Controller
|
|||||||
->whereNotNull('status_action')->where('status_action', 'approved');
|
->whereNotNull('status_action')->where('status_action', 'approved');
|
||||||
if(in_array(22, $unitIds)){
|
if(in_array(22, $unitIds)){
|
||||||
$rows = $rows->pluck('file');
|
$rows = $rows->pluck('file');
|
||||||
|
}elseif(auth()->user()->username === "admin.turt"){
|
||||||
|
$rows = $rows->pluck('file');
|
||||||
}else{
|
}else{
|
||||||
$rows = $rows->whereIn('id_unit_kerja', $unitIds)->pluck('file');
|
$rows = $rows->whereIn('id_unit_kerja', $unitIds)->pluck('file');
|
||||||
}
|
}
|
||||||
|
|
||||||
$grouped = [];
|
$grouped = [];
|
||||||
foreach ($rows as $path) {
|
foreach ($rows as $path) {
|
||||||
$parts = array_values(array_filter(explode('/', $path)));
|
$parts = array_values(array_filter(explode('/', $path)));
|
||||||
|
|||||||
@ -24,7 +24,8 @@ class LogActivityController extends Controller
|
|||||||
$start = request('start_date');
|
$start = request('start_date');
|
||||||
$end = request('end_date');
|
$end = request('end_date');
|
||||||
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true);
|
$mapping = MappingUnitKerjaPegawai::where('statusenabled', true);
|
||||||
if(auth()->user()){
|
// dd(auth()->user());
|
||||||
|
if(!Auth::guard('admin')){
|
||||||
$mapping->where('objectpegawaifk', auth()->user()->dataUser->id);
|
$mapping->where('objectpegawaifk', auth()->user()->dataUser->id);
|
||||||
}else{
|
}else{
|
||||||
$mapping->where('objectpegawaifk', 937);
|
$mapping->where('objectpegawaifk', 937);
|
||||||
@ -42,7 +43,7 @@ class LogActivityController extends Controller
|
|||||||
}])
|
}])
|
||||||
->where('statusenabled', true)
|
->where('statusenabled', true)
|
||||||
->where('status_action', 'approved');
|
->where('status_action', 'approved');
|
||||||
if(in_array(22, $unitIds)){
|
if(in_array(22, $unitIds) || Auth::guard('admin') && Auth::guard('admin')->user()->id == 300){
|
||||||
}else{
|
}else{
|
||||||
$query = $baseQuery->whereIn('id_unit_kerja', $unitIds);
|
$query = $baseQuery->whereIn('id_unit_kerja', $unitIds);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user