Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdianS18 committed Dec 12, 2024
2 parents d4a381a + f83ea9d commit 88602ca
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 96 deletions.
1 change: 1 addition & 0 deletions app/Contracts/Interfaces/ClassroomInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ public function insert(array $data): mixed;
public function duplicate(mixed $query) : mixed;
public function whereLessonSchedule(Request $request): mixed;
public function whereEmployeeId(mixed $employee_id): mixed;
public function getByActiveSchoolYear(): mixed;
}
25 changes: 16 additions & 9 deletions app/Contracts/Repositories/AttendanceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,24 @@ public function getSickAndPermit(Request $request, array $status) : mixed
->when($request->classroom, function($query) use ($request) {
$query->where('model_id', $request->classroom);
})
->get();
->latest()->get();
}

public function whereModelAndNow(mixed $model, Request $request): mixed
{
return $this->model->query()
->where('model_type', $model)
->where('created_at', now()->format('Y-m-d'))
->when($request->start_date, function ($q) use ($request) {
$q->whereBetween('created_at', [$request->start_date . ' 00:00:00', $request->end_date . ' 23:59:59']);
})
->get();
}
$query = $this->model->query()
->where('model_type', $model);

if ($request->has(['start_date', 'end_date'])) {
$startDate = Carbon::parse($request->start_date)->startOfDay();
$endDate = Carbon::parse($request->end_date)->endOfDay();

$query->whereBetween('created_at', [$startDate, $endDate]);
} else {
$query->whereDate('created_at', now()->toDateString());
}

return $query->get();
}

}
5 changes: 5 additions & 0 deletions app/Contracts/Repositories/ClassroomRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ public function whereEmployeeId(mixed $employee_id): mixed
->where('employee_id', $employee_id)
->first();
}

public function getByActiveSchoolYear(): mixed
{
return $this->model->query()->whereRelation('schoolYear', 'active', 1)->get();
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Staff/StaffViolationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public function show_detail_student(Student $student, Request $request)

public function list_student(Request $request)
{
$classrooms = $this->classroom->getByActiveSchoolYear();
$studentViolations = $this->studentViolation->search($request);
$students = $this->student->get();
$violations = $this->regulation->get();
$maxPoint = $this->schoolPoint->getMaxPoint();
return view('staff.pages.violation-student-list.index', compact('studentViolations', 'students', 'violations', 'maxPoint'));
return view('staff.pages.violation-student-list.index', compact('studentViolations', 'violations', 'maxPoint', 'classrooms'));
}

public function download_student()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">No</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Nama</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Kelas</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Jam</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Status</th>
</tr>
</thead>
Expand All @@ -20,7 +19,6 @@
<td>
{{ $item->model ? $item->model->classroom->name : 'Tidak ada' }}
</td>
<td>{{ $item->checkin ? \Carbon\Carbon::parse($item->checkin)->format('H.i') : '-' }}</td>
<td>
<span class="badge bg-light-danger text-danger fw-semibold fs-2">Alpha</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">No</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Nama</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Kelas</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Jam</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Surat</th>
<th class="fs-4 fw-semibold mb-0" style="background-color: #5D87FF; color: white">Status</th>
</tr>
</thead>
<tbody>
@forelse ($sick as $data)
@forelse ($permit as $data)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $data->model->student->user->name }}</td>
<td>{{ $data->model->classroom->name }}</td>
<td>{{ $data->checkin ? \Carbon\Carbon::parse($data->checkin)->format('H.i') : '-' }}</td>
@if ($data->proof)
<td><img src="{{ asset('storage/'.$data->proof) }}" alt="" width="100px"></td>
@else
<td>Tidak ada</td>
@endif
<td>
<span class="badge bg-light-warning text-warning fw-semibold fs-2">Izin</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
</div>
</div>

<a href="#" class="btn waves-effect waves-light btn-outline-primary w-100">Lihat Selengkapnya</a>
{{-- <a href="#" class="btn waves-effect waves-light btn-outline-primary w-100">Lihat Selengkapnya</a> --}}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class="fw-normal">{{ $studentRepair->classroomStudent->student->user->phone_numb
<span class="mx-1"><b>-</b></span>
{{ \Carbon\Carbon::parse($studentRepair->end_date)->translatedFormat('d F Y') }}
</td>
<td>{{ $studentRepair->repair }}</td>
<td>{{ \Illuminate\Support\Str::limit($studentRepair->repair, 30) }}</td>

<td>
<span
class="badge {{ $studentRepair->is_approved == 0 ? 'bg-light-danger text-danger' : 'bg-light-success text-success' }}">{{ $studentRepair->is_approved == 0 ? 'Belum di kerjakan' : 'Sudah di kerjakan' }}</span>
Expand Down
29 changes: 29 additions & 0 deletions resources/views/staff/pages/violation-student-list/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,35 @@ class="btn mb-1 waves-effect waves-light btn-primary btn-detail">Detail</button>
@endsection

@section('script')
<script>
$('#classroom-violation').change(function() {
var id = $(this).val();
console.log(id);
getStudent(id);
})
function getStudent(id) {
$.ajax({
url: "/get-students",
method: "GET",
data: {
classroom_id: id
},
dataType: "JSON",
beforeSend: function() {
$('.select2-siswa').html('')
},
success: function(response) {
console.log(response);
$.each(response.data, function(index, data) {
$('.select2-siswa').append('<option value="' + data.id + '">' + data.student.user.name + '</option>')
});
}
})
}
</script>
@include('staff.pages.violation-student-list.scripts.create-script')
@include('staff.pages.violation-student-list.scripts.detail')
@endsection
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zm-8-5v4m0 4h.01" />
</svg>
</div>
<h6 class="text-warning ms-2" style="font-size: 16">Maksimal point pelanggaran pada sekolah
<h6 class="text-warning ms-2" style="font-size: 16">
<p class="text-warning">Pilih kelas terlebih dahulu</p>
Maksimal point pelanggaran pada sekolah
<br> {{ $maxPoint }} Point
</h6>
</div>
Expand All @@ -45,18 +47,30 @@
</div>
<div class="d-flex align-items-center">
<div class="flex-grow-1 me-3">
<label for="" class="mb-2"><b>Nama Siswa Melakukan
Pelanggaran</b></label>
<select class="form-select select2-siswa" multiple="multiple"
style="width: 100%; height: 36px" name="repeater-group[][student_id][]">
<option value="" disabled>Pilih Nama Siswa</option>
@foreach ($students as $student)
<option value="{{ $student->id }}">{{ $student->user->name }}</option>
@endforeach
</select>
@error('repeater-group.*.student_id')
<span class="text-danger">{{ $message }}</span>
@enderror
<div class="row">
<div class="col-12 col-lg-6">
<label for="" class="mb-2"><b>Nama Siswa Melakukan
Pelanggaran</b></label>
<select class="form-select select2-siswa" multiple="multiple"
style="width: 100%; height: 36px"
name="repeater-group[][student_id][]">
<option value="" disabled>Pilih Nama Siswa</option>
</select>
@error('repeater-group.*.student_id')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>

<div class="col-12 col-lg-6">
<label for="" class="mb-2"><b>Kelas</b></label>
<select class="form-select " id="classroom-violation" style="width: 100%; height: 36px" name="classroom_id">
<option value="" selected>Pilih Kelas Siswa</option>
@foreach ($classrooms as $classroom)
<option value="{{ $classroom->id }}">{{ $classroom->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<button data-repeater-delete="" class="btn btn-danger waves-effect waves-light"
type="button" style="padding: 6px 12px; height: 38px; margin-top: 24px;">
Expand Down Expand Up @@ -85,12 +99,6 @@
</div>
</button>
</div>
{{-- <div class="modal-footer">
<button type="button" class="btn mb-1 waves-effect waves-light"
style="background-color: #C7C7C7; color: white;" data-bs-dismiss="modal">Tutup</button>
<button type="submit" class="btn mb-1 waves-effect waves-light btn-primary">Tambah</button>
</div> --}}

</div>
<div class="modal-footer sticky-footer"
style="border-bottom-left-radius: 20px; border-bottom-right-radius: 20px">
Expand All @@ -101,4 +109,4 @@
</form>
</div>
</div>
</div>
</div>
6 changes: 4 additions & 2 deletions resources/views/student/pages/dashboard/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
<td>{{ $data->checkout == null ? '-' : \Carbon\Carbon::parse($data->checkout)->format('H:i') }}
</td>
<td>
<span
class="mb-1 badge font-medium {{ $data->status == 'present' ? 'bg-light-success text-success' : ($data->status == 'permit' ? 'bg-light-warning text-warning' : 'bg-light-danger text-danger') }}">{{ $data->status->label() }}</span>
<span class="mb-1 badge font-medium {{ $data->status->color() }}">
{{ $data->status->label() }}
</span>
</td>

</tr>
@empty
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
width: 450 // Perbesar chart
},
labels: ['Masuk', 'Izin', 'Alpha'], // Label keterangan
colors: ['#5D87FF', '#FFAE1F', '#FA896B'], // Custom warna chart
colors: ['#13DEB9', '#5D87FF', '#FA896B'], // Custom warna chart
legend: {
position: 'bottom', // Pindahkan keterangan ke bawah chart
horizontalAlign: 'center', // Selaraskan secara horizontal
Expand Down
56 changes: 1 addition & 55 deletions resources/views/student/pages/repair/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
@extends('student.layouts.app')
@section('style')
<style>
.table td {
white-space: nowrap;
}
.table td span {
white-space: normal;
}
.limited-text {
display: block;
max-height: 1.5em;
overflow: hidden;
text-overflow: ellipsis;
}
.full-text {
white-space: normal;
}
</style>
@endsection
@section('content')
<div class="card bg-primary shadow-none position-relative overflow-hidden">
<div class="card-body px-4 py-3">
Expand Down Expand Up @@ -89,19 +67,7 @@ class="img-fluid mb-n3" style="width: 170px; height: 120px; object-fit: cover;">
@forelse ($repairs as $repair)
<tr>
<td>{{ $loop->iteration }}</td>
<td style="max-width: 250px; word-wrap: break-word;">
<span class="limited-text">
{{ \Illuminate\Support\Str::words($repair->repair, 10, '') }}
@if (str_word_count($repair->repair) > 10)
<span class="toggle-text ms-2" style="cursor: pointer; color: blue;">selengkapnya...</span>
@endif
</span>
<span class="full-text" style="display: none;">
{{ $repair->repair }}
<span class="toggle-text ms-2" style="cursor: pointer; color: blue;">lebih sedikit</span>
</span>
</td>

<td>{{ \Illuminate\Support\Str::limit($repair->repair, 30) }}</td>
<td>{{ \Carbon\Carbon::parse($repair->start_date)->translatedFormat('d F Y') }}</td>
<td>{{ \Carbon\Carbon::parse($repair->end_date)->translatedFormat('d F Y') }}</td>
<td>
Expand Down Expand Up @@ -144,24 +110,4 @@ class="btn {{ $repair->is_approved == false ? 'btn-upload' : 'btn-detail' }} btn

@section('script')
@include('student.pages.repair.scripts.btn-script')
<script>
document.addEventListener('DOMContentLoaded', function() {
const toggleTextButtons = document.querySelectorAll('.toggle-text');
toggleTextButtons.forEach(button => {
button.addEventListener('click', function() {
const limitedText = this.closest('td').querySelector('.limited-text');
const fullText = this.closest('td').querySelector('.full-text');
if (limitedText.style.display === 'none') {
limitedText.style.display = 'block';
fullText.style.display = 'none';
} else {
limitedText.style.display = 'none';
fullText.style.display = 'block';
}
});
});
});
</script>
@endsection
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use App\Http\Controllers\ClassroomStudentController;
use App\Http\Controllers\ContactUsController;
use App\Http\Controllers\LandingController;
use Illuminate\Support\Facades\Auth;
Expand Down Expand Up @@ -35,3 +36,4 @@
Route::get('/cek-rfid', [App\Http\Controllers\HomeController::class, 'cek_rfid']);

Route::post('/send-email', [ContactUsController::class, 'sendMail'])->name('store.send.email');
Route::get('get-students', [ClassroomStudentController::class, 'show']);

0 comments on commit 88602ca

Please sign in to comment.