Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simpmw
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alfiro Pratama
simpmw
Commits
6e11c3af
Commit
6e11c3af
authored
Oct 15, 2025
by
Alfiro Pratama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chart PMW per Fakultas
parent
2b7759b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
6 deletions
+139
-6
app/Helpers/InseoHelper.php
+1
-0
app/Http/Controllers/DashboardController.php
+133
-2
app/Models/DaftarProposal.php
+1
-1
app/Models/DaftarProposalMonev.php
+2
-2
resources/views/backend/index.blade.php
+0
-0
routes/web.php
+2
-1
No files found.
app/Helpers/InseoHelper.php
View file @
6e11c3af
...
...
@@ -90,6 +90,7 @@ class InseoHelper
'psikologi'
=>
'FP'
,
'hukum'
=>
'FH'
,
'ilmu hukum'
=>
'FH'
,
'kampus unesa magetan'
=>
'PSDKU Magetan'
,
];
...
...
app/Http/Controllers/DashboardController.php
View file @
6e11c3af
...
...
@@ -2,8 +2,17 @@
namespace
App\Http\Controllers
;
use
App\Models\DaftarProposal
;
use
App\Models\DaftarProposalMonev
;
use
App\Models\Jenis
;
use
App\Models\JenisMonev
;
use
App\Models\MonevInternal
;
use
App\Models\Pengumuman
;
use
App\Models\Periode
;
use
App\Models\Proposal
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
class
DashboardController
extends
Controller
{
...
...
@@ -16,14 +25,136 @@ class DashboardController extends Controller
{
//
$title
=
'Dashboard PMW'
;
// $pengumuman = $pengumuman = Pengumuman::query()->first();
$pengumuman
=
$pengumuman
=
Pengumuman
::
query
()
->
where
(
'status'
,
1
)
->
first
();
$tahun
=
Periode
::
orderBy
(
'nama'
,
'ASC'
)
->
get
();
$jenis
=
Jenis
::
where
(
'status_hapus'
,
0
)
->
whereNotNull
(
'nama'
)
->
orderBy
(
'nama'
,
'ASC'
)
->
get
();
$proposal
=
DaftarProposal
::
all
();
$jenis_monev
=
JenisMonev
::
where
(
'status_hapus'
,
0
)
->
get
();
$monev
=
DaftarProposalMonev
::
where
(
'status_hapus'
,
0
)
->
get
();
$fakultas
=
DB
::
connection
(
'siakadu'
)
->
table
(
'sms'
)
->
whereNull
(
'id_induk_sms'
)
->
whereNull
(
'kode_prodi'
)
->
get
();
$data
=
[
'title'
=>
$title
,
'pengumuman'
=>
null
,
'pengumuman'
=>
$pengumuman
,
'tahun'
=>
$tahun
,
'jenis'
=>
$jenis
,
'proposal'
=>
$proposal
,
'tahap'
=>
$jenis_monev
,
'monev'
=>
$monev
,
'fakultas'
=>
$fakultas
,
];
return
view
(
'backend.index'
,
$data
);
}
public
function
getChartData
(
Request
$request
)
{
try
{
$jenis_id
=
$request
->
get
(
'reqJenisPmw'
);
$tahap
=
$request
->
get
(
'reqStatus'
);
$tahun
=
$request
->
get
(
'tahun'
);
// Debug: log received parameters
Log
::
info
(
'Chart data request parameters:'
,
[
'jenis_id'
=>
$jenis_id
,
'tahap'
=>
$tahap
,
'tahun'
=>
$tahun
]);
// 1️⃣ Ambil semua fakultas (sekali saja)
$fakultas
=
DB
::
connection
(
'siakadu'
)
->
table
(
'sms'
)
->
select
(
'id_sms'
,
'nm_lemb'
)
->
whereNull
(
'id_induk_sms'
)
->
whereNull
(
'kode_prodi'
)
->
where
(
'nm_lemb'
,
'!='
,
'FPS'
)
->
orderBy
(
'nm_lemb'
,
'ASC'
)
->
get
()
->
map
(
function
(
$item
)
{
if
(
strtolower
(
$item
->
nm_lemb
)
===
'vokasi'
)
{
$item
->
nm_lemb
=
'VOKASI'
;
}
if
(
strtolower
(
$item
->
nm_lemb
)
===
'kedokteran'
)
{
$item
->
nm_lemb
=
'FK'
;
}
if
(
strtolower
(
$item
->
nm_lemb
)
===
'fpsi'
)
{
$item
->
nm_lemb
=
'FP'
;
}
if
(
strtolower
(
$item
->
nm_lemb
)
===
'psdku'
)
{
$item
->
nm_lemb
=
"PSDKU
\n
Magetan"
;
}
return
$item
;
})
->
sortBy
(
function
(
$item
)
{
$urutanKhusus
=
[
'VOKASI'
=>
1
,
"PSDKU
\n
Magetan"
=>
2
,
'FK'
=>
3
,
'FKP'
=>
4
,
];
$rank
=
$urutanKhusus
[
$item
->
nm_lemb
]
??
0
;
return
sprintf
(
'%02d_%s'
,
$rank
,
$item
->
nm_lemb
);
})
->
values
();
// 2️⃣ Query proposal per fakultas (1 query saja)
$proposalQuery
=
DaftarProposal
::
select
(
'fakultas_ketua'
,
DB
::
raw
(
'COUNT(*) as total'
))
->
where
(
'status_hapus'
,
0
)
->
when
(
$jenis_id
,
fn
(
$q
)
=>
$q
->
where
(
'jenis_id'
,
$jenis_id
))
->
when
(
$tahun
,
fn
(
$q
)
=>
$q
->
where
(
'periode'
,
$tahun
))
->
when
(
$tahap
===
'proposal'
,
fn
(
$q
)
=>
$q
)
// Only show proposal data when tahap is 'proposal'
->
when
(
$tahap
&&
$tahap
!==
'proposal'
,
fn
(
$q
)
=>
$q
->
whereRaw
(
'1 = 0'
))
// Hide proposal data for other tahap
->
groupBy
(
'fakultas_ketua'
)
->
get
()
->
pluck
(
'total'
,
'fakultas_ketua'
);
// 3️⃣ Query Monev 1 (1 query)
$monev1Query
=
DaftarProposalMonev
::
select
(
'fakultas_ketua'
,
DB
::
raw
(
'COUNT(*) as total'
))
->
where
(
'jenis_monev_desc'
,
'Monev Internal I'
)
->
where
(
'status_hapus'
,
0
)
->
when
(
$jenis_id
,
fn
(
$q
)
=>
$q
->
where
(
'jenis_id'
,
$jenis_id
))
->
when
(
$tahun
,
fn
(
$q
)
=>
$q
->
where
(
'periode'
,
$tahun
))
->
when
(
$tahap
===
'monev1'
,
fn
(
$q
)
=>
$q
)
// Only show monev1 data when tahap is 'monev1'
->
when
(
$tahap
&&
$tahap
!==
'monev1'
,
fn
(
$q
)
=>
$q
->
whereRaw
(
'1 = 0'
))
// Hide monev1 data for other tahap
->
groupBy
(
'fakultas_ketua'
)
->
get
()
->
pluck
(
'total'
,
'fakultas_ketua'
);
// 4️⃣ Query Monev 2 (1 query)
$monev2Query
=
DaftarProposalMonev
::
select
(
'fakultas_ketua'
,
DB
::
raw
(
'COUNT(*) as total'
))
->
where
(
'jenis_monev_desc'
,
'Monev Internal II'
)
->
where
(
'status_hapus'
,
0
)
->
when
(
$jenis_id
,
fn
(
$q
)
=>
$q
->
where
(
'jenis_id'
,
$jenis_id
))
->
when
(
$tahun
,
fn
(
$q
)
=>
$q
->
where
(
'periode'
,
$tahun
))
->
when
(
$tahap
===
'monev2'
,
fn
(
$q
)
=>
$q
)
// Only show monev2 data when tahap is 'monev2'
->
when
(
$tahap
&&
$tahap
!==
'monev2'
,
fn
(
$q
)
=>
$q
->
whereRaw
(
'1 = 0'
))
// Hide monev2 data for other tahap
->
groupBy
(
'fakultas_ketua'
)
->
get
()
->
pluck
(
'total'
,
'fakultas_ketua'
);
// 5️⃣ Gabungkan data
$chartData
=
$fakultas
->
map
(
function
(
$f
)
use
(
$proposalQuery
,
$monev1Query
,
$monev2Query
)
{
$namaFak
=
$f
->
nm_lemb
;
return
[
'fakultas'
=>
$namaFak
,
'proposal'
=>
$proposalQuery
[
$namaFak
]
??
0
,
'monev1'
=>
$monev1Query
[
$namaFak
]
??
0
,
'monev2'
=>
$monev2Query
[
$namaFak
]
??
0
,
];
});
return
response
()
->
json
(
$chartData
);
}
catch
(
\Throwable
$e
)
{
Log
::
error
([
'error'
=>
true
,
'message'
=>
$e
->
getMessage
(),
'line'
=>
$e
->
getLine
(),
'file'
=>
$e
->
getFile
(),
]);
return
response
()
->
json
([
'error'
=>
'Terjadi kesalahan saat mengambil data chart.'
],
500
);
}
}
}
app/Models/DaftarProposal.php
View file @
6e11c3af
...
...
@@ -12,7 +12,7 @@ class DaftarProposal extends Model
protected
$keyType
=
'string'
;
protected
$fillable
=
[
'proposal_id'
,
'jenis_id'
,
'kode'
,
'jenis_pkm'
,
'judul'
,
'status'
,
'status_hapus'
,
'status_administrasi_1'
,
'status_administrasi_2'
,
'reviewer_id_1'
,
'reviewer_id_2'
,
'status_final'
,
'nidn_reviewer_id_1'
,
'nidn_reviewer_id_2'
,
'upload_dokumen'
,
'date_upload'
,
'date_approval'
,
'identitas_ketua'
,
'identitas_dospem'
,
'periode'
,
'url'
'proposal_id'
,
'jenis_id'
,
'kode'
,
'jenis_pkm'
,
'judul'
,
'status'
,
'status_hapus'
,
'status_administrasi_1'
,
'status_administrasi_2'
,
'reviewer_id_1'
,
'reviewer_id_2'
,
'status_final'
,
'nidn_reviewer_id_1'
,
'nidn_reviewer_id_2'
,
'upload_dokumen'
,
'date_upload'
,
'date_approval'
,
'identitas_ketua'
,
'identitas_dospem'
,
'periode'
,
'url'
,
'fakultas'
,
];
public
function
rKelompokDetil
()
...
...
app/Models/DaftarProposalMonev.php
View file @
6e11c3af
...
...
@@ -12,9 +12,9 @@ class DaftarProposalMonev extends Model
protected
$fillable
=
[
'monev_internal_id'
,
'proposal_id'
,
'jenis_monev_id'
,
'kode'
,
'judul'
,
'jenis_pkm'
,
'jenis_monev'
,
'status'
,
'status_administrasi_1'
,
'status_administrasi_2'
,
'jenis_pkm'
,
'jenis_monev'
,
'
jenis_monev_desc'
,
'
status'
,
'status_administrasi_1'
,
'status_administrasi_2'
,
'nilai_1'
,
'nilai_2'
,
'reviewer_komentar_1'
,
'reviewer_komentar_2'
,
'reviewer_monev_id_1'
,
'reviewer_monev_id_2'
,
'reviewer_id_1'
,
'reviewer_id_2'
,
'kelompok_id'
'reviewer_monev_id_2'
,
'reviewer_id_1'
,
'reviewer_id_2'
,
'kelompok_id'
,
'fakultas_ketua'
,
'status_hapus'
,
'status'
,
'periode'
,
// 'proposal_id', 'reviewer_monev_id', 'jenis_id', 'kode', 'jenis_pkm', 'judul', 'status', 'status_administrasi_1', 'status_administrasi_2', 'nilai_1', 'nilai_2', 'reviewer_monev_id_1', 'reviewer_monev_id_1', 'status_final'
];
...
...
resources/views/backend/index.blade.php
View file @
6e11c3af
This diff is collapsed.
Click to expand it.
routes/web.php
View file @
6e11c3af
...
...
@@ -67,7 +67,8 @@ Route::post('login', [Laravel\Fortify\Http\Controllers\AuthenticatedSessionContr
Route
::
group
([
'middleware'
=>
[
'auth:sanctum'
,
'verified'
]],
function
()
{
Route
::
resource
(
'dashboard'
,
DashboardController
::
class
);
Route
::
get
(
'dashboard'
,
[
DashboardController
::
class
,
'index'
])
->
name
(
'dashboard.index'
);
Route
::
get
(
'getChartData'
,
[
DashboardController
::
class
,
'getChartData'
])
->
name
(
'dashboard.chart-data'
);
Route
::
post
(
'selectmahasiswa'
,
[
SelectController
::
class
,
'mahasiswa'
])
->
name
(
'mahasiswa-select'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment