Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sibiling
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syaifur
sibiling
Commits
cfd003e1
Commit
cfd003e1
authored
Mar 13, 2025
by
Syaifur Rohman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add table and chart absensi
parent
a57f7baa
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
249 additions
and
76 deletions
+249
-76
ChartDashboardController.php
app/Http/Controllers/Api/ChartDashboardController.php
+62
-0
index.blade.php
resources/views/admin/dashboard/index.blade.php
+185
-76
web.php
routes/web.php
+2
-0
No files found.
app/Http/Controllers/Api/ChartDashboardController.php
0 → 100644
View file @
cfd003e1
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Http\Request
;
use
App\Models\Akademik\AbsensiModel
;
class
ChartDashboardController
extends
Controller
{
public
function
__construct
()
{
$this
->
mAkAbsensi
=
new
AbsensiModel
();
}
public
function
getStatistikAbsensi
()
{
// Fetch all attendance records for the current school and active period
$absensi
=
$this
->
mAkAbsensi
->
where
(
'idPSekolah'
,
session
()
->
get
(
'idPSekolah'
))
->
where
(
'idPPeriode'
,
session
()
->
get
(
'idPPeriode'
))
->
get
();
// Initialize a status count array with descriptive keys
$statusCount
=
[
'belum_ada_absensi'
=>
0
,
'hadir'
=>
0
,
'tidak_hadir'
=>
0
,
'terlambat'
=>
0
,
'ijin'
=>
0
,
'sakit'
=>
0
,
];
// Count each status across all students
foreach
(
$absensi
as
$record
)
{
switch
(
$record
->
idStatus
)
{
case
0
:
$statusCount
[
'belum_ada_absensi'
]
++
;
break
;
case
1
:
$statusCount
[
'hadir'
]
++
;
break
;
case
2
:
$statusCount
[
'tidak_hadir'
]
++
;
break
;
case
3
:
$statusCount
[
'terlambat'
]
++
;
break
;
case
4
:
$statusCount
[
'ijin'
]
++
;
break
;
case
5
:
$statusCount
[
'sakit'
]
++
;
break
;
}
}
// Return the status count as JSON
return
response
()
->
json
(
$statusCount
);
}
}
\ No newline at end of file
resources/views/admin/dashboard/index.blade.php
View file @
cfd003e1
This diff is collapsed.
Click to expand it.
routes/web.php
View file @
cfd003e1
...
...
@@ -120,6 +120,8 @@ Route::middleware(['login:1'])->group(function () {
Route
::
middleware
([
'login:2'
])
->
group
(
function
()
{
@
include_once
(
'web_sekolah.php'
);
// Chart Dashboard
Route
::
get
(
'chart/dashboard/get-statistik-absensi'
,
'Api\ChartDashboardController@getStatistikAbsensi'
);
});
Route
::
middleware
([
'login:3'
])
->
group
(
function
()
{
...
...
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