From 49c40fef45159e4ccc81326c892a70197f30b8ba Mon Sep 17 00:00:00 2001 From: rendygaafk Date: Sat, 26 Apr 2025 02:07:30 +0700 Subject: [PATCH] tampilan ruangan & kelas --- app/Models/Ruangan.php | 7 - .../views/admin/jurusan/create.blade.php | 88 +++++++--- resources/views/admin/jurusan/edit.blade.php | 100 ++++++++--- resources/views/admin/jurusan/index.blade.php | 142 +++++++++++----- resources/views/admin/kelas/create.blade.php | 122 ++++++++++---- resources/views/admin/kelas/index.blade.php | 156 +++++++++++++----- 6 files changed, 450 insertions(+), 165 deletions(-) diff --git a/app/Models/Ruangan.php b/app/Models/Ruangan.php index e195449..47f9616 100644 --- a/app/Models/Ruangan.php +++ b/app/Models/Ruangan.php @@ -33,13 +33,6 @@ public function jurusan() return $this->belongsTo(Jurusan::class, 'id_jurusan'); } - /** - * Relasi ke model Announcement (pengumuman) - */ - public function announcements() - { - return $this->hasMany(Announcement::class, 'ruangan_id'); - } /** * Accessor untuk nama ruangan diff --git a/resources/views/admin/jurusan/create.blade.php b/resources/views/admin/jurusan/create.blade.php index dd28ee0..5678159 100644 --- a/resources/views/admin/jurusan/create.blade.php +++ b/resources/views/admin/jurusan/create.blade.php @@ -3,50 +3,84 @@ @section('title', 'Smart School | Tambah Jurusan') @section('content') -
-
- -
-

+
+ +
+
+

Tambah Jurusan Baru

+
+ + + +

Tambahkan data jurusan baru ke sistem

+
+
+ + + + + + Kembali ke Daftar + +
+ + +
+ +
+

- Tambah Jurusan Baru -

+ Form Tambah Jurusan +

- +
@csrf
- + @error('nama_jurusan') -

{{ $message }}

+

{{ $message }}

+ @enderror +
+ + +
+ + + @error('kode_jurusan') +

{{ $message }}

@enderror
-
- - - +
+
@@ -79,13 +113,18 @@ function confirmCreate() { confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Ya, Simpan!', - cancelButtonText: 'Batal' + cancelButtonText: 'Batal', + backdrop: ` + rgba(0,0,0,0.7) + url("https://sweetalert2.github.io/images/nyan-cat.gif") + left top + no-repeat + ` }).then((result) => { if (result.isConfirmed) { - // Tampilkan loading Swal.fire({ title: 'Menyimpan...', - html: 'Mohon tunggu sebentar', + html: 'Sedang menyimpan data jurusan', allowOutsideClick: false, didOpen: () => { Swal.showLoading(); @@ -95,6 +134,5 @@ function confirmCreate() { } }); } - @endsection \ No newline at end of file diff --git a/resources/views/admin/jurusan/edit.blade.php b/resources/views/admin/jurusan/edit.blade.php index 2c014a1..345b950 100644 --- a/resources/views/admin/jurusan/edit.blade.php +++ b/resources/views/admin/jurusan/edit.blade.php @@ -3,19 +3,41 @@ @section('title', 'Smart School | Edit Jurusan') @section('content') -
-
- -
-

+
+ +
+
+

Edit Jurusan

+
+ + + +

Perbarui data jurusan yang sudah ada

+
+
+ + + + + + Kembali ke Daftar + +
+ + +
+ +
+

- Edit Data Jurusan -

+ Form Edit Jurusan +

- +
@csrf @@ -23,31 +45,43 @@
- + @error('nama_jurusan') -

{{ $message }}

+

{{ $message }}

+ @enderror +
+ + +
+ + + @error('kode_jurusan') +

{{ $message }}

@enderror
-
- - - +
+
@@ -62,22 +96,37 @@ class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition function confirmUpdate() { const form = document.getElementById('editForm'); const namaJurusan = document.getElementById('nama_jurusan').value; + const currentNama = "{{ $jurusan->nama_jurusan }}"; + + if (namaJurusan === currentNama) { + Swal.fire({ + icon: 'info', + title: 'Tidak ada perubahan', + text: 'Anda belum melakukan perubahan pada data jurusan', + }); + return; + } Swal.fire({ title: 'Update Data Jurusan?', - html: `Anda akan mengupdate jurusan menjadi:
${namaJurusan}`, + html: `Anda akan mengubah jurusan dari:
${currentNama}
menjadi:
${namaJurusan}`, icon: 'question', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Ya, Update!', - cancelButtonText: 'Batal' + cancelButtonText: 'Batal', + backdrop: ` + rgba(0,0,0,0.7) + url("https://sweetalert2.github.io/images/nyan-cat.gif") + left top + no-repeat + ` }).then((result) => { if (result.isConfirmed) { - // Tampilkan loading Swal.fire({ title: 'Memperbarui...', - html: 'Mohon tunggu sebentar', + html: 'Sedang menyimpan perubahan', allowOutsideClick: false, didOpen: () => { Swal.showLoading(); @@ -87,6 +136,5 @@ function confirmUpdate() { } }); } - @endsection \ No newline at end of file diff --git a/resources/views/admin/jurusan/index.blade.php b/resources/views/admin/jurusan/index.blade.php index 93d3fd5..811dc52 100644 --- a/resources/views/admin/jurusan/index.blade.php +++ b/resources/views/admin/jurusan/index.blade.php @@ -3,53 +3,78 @@ @section('title', 'Smart School | Manajemen Jurusan') @section('content') -
- -
+
+ + - -
-
+ +
+ +
- - + +

Total Jurusan

-

{{ $jurusan->count() }}

+

{{ $jurusan->count() }}

+
+
+
+ + +
+
+
+ + + +
+
+

Jurusan Aktif

+

{{ $jurusan->count() }}

- -
- -
+ +
+ +
+
+

Daftar Jurusan

+

Manajemen semua jurusan yang terdaftar

+
+
-
+ class="block w-full md:w-64 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 pl-10 pr-4 py-2">
@@ -60,7 +85,7 @@ class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 f @if(request('search'))
- + @@ -77,33 +102,52 @@ class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 f - - - + + + + @forelse($jurusan as $index => $item) - - + + @empty - + @endforelse @@ -123,8 +175,8 @@ class="text-red-600 hover:text-red-900 inline-flex items-center"> @if($jurusan->hasPages()) -
- {{ $jurusan->links() }} +
+ {{ $jurusan->links('vendor.pagination.tailwind') }}
@endif
@@ -136,17 +188,31 @@ class="text-red-600 hover:text-red-900 inline-flex items-center"> @endsection \ No newline at end of file diff --git a/resources/views/admin/kelas/index.blade.php b/resources/views/admin/kelas/index.blade.php index c67001c..447d756 100644 --- a/resources/views/admin/kelas/index.blade.php +++ b/resources/views/admin/kelas/index.blade.php @@ -3,29 +3,35 @@ @section('title', 'Smart School | Manajemen Kelas') @section('content') -
- -
+
+ + - -
-
+ +
+ +
- + @@ -33,25 +39,59 @@ class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-

Total Kelas

-

{{ $kelas->count() }}

+

{{ $kelas->count() }}

+
+
+
+ + +
+
+
+ + + +
+
+

Kelas Aktif

+

{{ $kelas->count() }}

+
+
+
+ + +
+
+
+ + + +
+
+

Jurusan Terdaftar

+

{{ $kelas->unique('jurusan_id')->count() }}

- -
- -
+ +
+ +
+
+

Daftar Kelas

+

Manajemen semua kelas yang terdaftar

+
+
-
+ class="block w-full md:w-64 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 pl-10 pr-4 py-2">
@@ -62,7 +102,7 @@ class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 f @if(request('search'))
NoNama JurusanAksiNoNama JurusanAksi
- {{ $index + 1 }} +
+
{{ $index + 1 }}
-
{{ $item->nama_jurusan }}
+
+
+ + + +
+
+
{{ $item->nama_jurusan }}
+ +
+
-
+
+ class="text-blue-600 hover:text-blue-900 inline-flex items-center transition duration-150 ease-in-out transform hover:scale-110" + title="Edit"> + @csrf @method('DELETE')
Belum ada data jurusan +
+ + + +

Belum ada data jurusan

+

Silakan tambah jurusan baru menggunakan tombol di atas

+
+
- - - - + + + + @forelse($kelas as $index => $item) - - + @empty - + @endforelse @@ -137,8 +198,8 @@ class="text-red-600 hover:text-red-900 inline-flex items-center"> @if($kelas->hasPages()) -
- {{ $kelas->links() }} +
+ {{ $kelas->links('vendor.pagination.tailwind') }}
@endif
@@ -150,20 +211,33 @@ class="text-red-600 hover:text-red-900 inline-flex items-center"> @endsection \ No newline at end of file
NoNama KelasJurusanAksiNoNama KelasJurusanAksi
- {{ $index + 1 }} +
+
{{ $index + 1 }}
-
{{ $item->nama_kelas }}
+
+
+ + + + +
+
+
{{ $item->nama_kelas }}
+
+
@if($item->jurusan) - + {{ $item->jurusan->nama_jurusan }} @else - + - @endif -
+
+ class="text-blue-600 hover:text-blue-900 inline-flex items-center transition duration-150 ease-in-out transform hover:scale-110" + title="Edit"> + @csrf @method('DELETE')
Belum ada data kelas +
+ + + +

Belum ada data kelas

+

Silakan tambah kelas baru menggunakan tombol di atas

+
+