parent
51d502ff57
commit
34788caf83
|
|
@ -4,63 +4,57 @@
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\WaliMurid;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class WaliMuridController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// ambil semua wali murid + user terkait
|
||||
$wali = WaliMurid::with('user')->get();
|
||||
return view('admin.wali.index', compact('wali'));
|
||||
$wali_murids = WaliMurid::orderBy('created_at', 'desc')->get();
|
||||
return view('admin.wali_murid.index', compact('wali_murids'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
// ambil data user untuk dropdown (jika sudah punya akun)
|
||||
$users = User::where('role', 'wali')->get();
|
||||
return view('admin.wali.create', compact('users'));
|
||||
return view('admin.wali_murid.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama' => 'required|string|max:255',
|
||||
'alamat' => 'nullable|string',
|
||||
'lokasi_lat' => 'nullable|numeric',
|
||||
'lokasi_lng' => 'nullable|numeric',
|
||||
'nama_wali' => 'required|string|max:100',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'no_hp' => 'nullable|string|max:20',
|
||||
'alamat' => 'nullable|string|max:255',
|
||||
]);
|
||||
|
||||
WaliMurid::create($request->all());
|
||||
|
||||
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil ditambahkan');
|
||||
|
||||
WaliMurid::create($request->only(['nama_wali', 'email', 'no_hp', 'alamat']));
|
||||
|
||||
return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil ditambahkan.');
|
||||
}
|
||||
|
||||
public function edit(WaliMurid $wali)
|
||||
public function edit(WaliMurid $wali_murid)
|
||||
{
|
||||
$users = User::where('role', 'wali')->get();
|
||||
return view('admin.wali.edit', compact('wali', 'users'));
|
||||
return view('admin.wali_murid.edit', compact('wali_murid'));
|
||||
}
|
||||
|
||||
public function update(Request $request, WaliMurid $wali)
|
||||
public function update(Request $request, WaliMurid $wali_murid)
|
||||
{
|
||||
$request->validate([
|
||||
'nama' => 'required|string|max:255',
|
||||
'alamat' => 'nullable|string',
|
||||
'lokasi_lat' => 'nullable|numeric',
|
||||
'lokasi_lng' => 'nullable|numeric',
|
||||
'nama_wali' => 'required|string|max:100',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'no_hp' => 'nullable|string|max:20',
|
||||
'alamat' => 'nullable|string|max:255',
|
||||
]);
|
||||
|
||||
$wali->update($request->all());
|
||||
$wali_murid->update($request->all());
|
||||
|
||||
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil diperbarui');
|
||||
return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil diperbarui.');
|
||||
}
|
||||
|
||||
public function destroy(WaliMurid $wali)
|
||||
public function destroy(WaliMurid $wali_murid)
|
||||
{
|
||||
$wali->delete();
|
||||
$wali_murid->delete();
|
||||
|
||||
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil dihapus');
|
||||
return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil dihapus.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,21 +2,19 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WaliMurid extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'wali_murids';
|
||||
protected $fillable = ['user_id','alamat','lokasi_lat','lokasi_lng'];
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function siswa()
|
||||
{
|
||||
return $this->hasMany(Siswa::class,'wali_id');
|
||||
}
|
||||
}
|
||||
protected $fillable = [
|
||||
'nama_wali',
|
||||
'email',
|
||||
'no_hp',
|
||||
'alamat',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,40 +6,28 @@
|
|||
|
||||
<form action="{{ route('guru.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Nama</label>
|
||||
<input type="text" name="nama"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
<label class="block text-gray-700">Nama</label>
|
||||
<input type="text" name="nama_guru" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Bidang</label>
|
||||
<input type="text" name="bidang"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">Bidang</label>
|
||||
<input type="text" name="bidang" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Telepon</label>
|
||||
<input type="text" name="telepon"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">No HP</label>
|
||||
<input type="text" name="no_hp" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Alamat</label>
|
||||
<input type="text" name="alamat"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">Email</label>
|
||||
<input type="email" name="email" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex gap-3">
|
||||
<button type="submit"
|
||||
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
|
||||
Simpan
|
||||
</button>
|
||||
<a href="{{ route('guru.index') }}"
|
||||
class="bg-gray-400 text-white px-4 py-2 rounded hover:bg-gray-500 transition">
|
||||
Batal
|
||||
</a>
|
||||
</div>
|
||||
<button type="submit" class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">Simpan</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -9,43 +9,26 @@
|
|||
@method('PUT')
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Nama</label>
|
||||
<input type="text" name="nama"
|
||||
value="{{ $guru->nama }}"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
<label class="block text-gray-700">Nama</label>
|
||||
<input type="text" name="nama_guru" value="{{ $guru->nama_guru }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Bidang</label>
|
||||
<input type="text" name="bidang"
|
||||
value="{{ $guru->bidang }}"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">Bidang</label>
|
||||
<input type="text" name="bidang" value="{{ $guru->bidang }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Telepon</label>
|
||||
<input type="text" name="telepon"
|
||||
value="{{ $guru->telepon }}"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">No HP</label>
|
||||
<input type="text" name="no_hp" value="{{ $guru->no_hp }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-1">Alamat</label>
|
||||
<input type="text" name="alamat"
|
||||
value="{{ $guru->alamat }}"
|
||||
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
<label class="block text-gray-700">Email</label>
|
||||
<input type="email" name="email" value="{{ $guru->email }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex gap-3">
|
||||
<button type="submit"
|
||||
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
|
||||
Update
|
||||
</button>
|
||||
<a href="{{ route('guru.index') }}"
|
||||
class="bg-gray-400 text-white px-4 py-2 rounded hover:bg-gray-500 transition">
|
||||
Batal
|
||||
</a>
|
||||
</div>
|
||||
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Perbarui</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,43 +1,44 @@
|
|||
@extends('layouts.admin')
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h4 class="mb-3">📚 Data Guru</h4>
|
||||
<div class="bg-white shadow-md rounded-lg p-6">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h1 class="text-xl font-semibold text-gray-700">👨🏫 Data Guru</h1>
|
||||
<a href="{{ route('guru.create') }}" class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700">+ Tambah Guru</a>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('guru.create') }}" class="btn btn-success mb-3">+ Tambah Guru</a>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-success">
|
||||
<tr><q></q>
|
||||
<th>No</th>
|
||||
<th>Nama Guru</th>
|
||||
<th>Email</th>
|
||||
<th>No HP</th>
|
||||
<th>Bidang</th>
|
||||
<th>Aksi</th>
|
||||
<table class="w-full border-collapse">
|
||||
<thead>
|
||||
<tr class="bg-green-600 text-white text-left">
|
||||
<th class="p-2">#</th>
|
||||
<th class="p-2">Nama Guru</th>
|
||||
<th class="p-2">Email</th>
|
||||
<th class="p-2">No HP</th>
|
||||
<th class="p-2">Bidang</th>
|
||||
<th class="p-2">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($gurus as $guru)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $guru->nama_guru }}</td>
|
||||
<td>{{ $guru->email }}</td>
|
||||
<td>{{ $guru->no_hp }}</td>
|
||||
<td>{{ $guru->bidang }}</td>
|
||||
<td>
|
||||
<a href="{{ route('guru.edit', $guru->id) }}" class="btn btn-sm btn-warning">Edit</a>
|
||||
<form action="{{ route('guru.destroy', $guru->id) }}" method="POST" class="d-inline">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-sm btn-danger" onclick="return confirm('Yakin?')">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@forelse ($gurus as $i => $guru)
|
||||
<tr class="border-b hover:bg-gray-50">
|
||||
<td class="p-2">{{ $i + 1 }}</td>
|
||||
<td class="p-2">{{ $guru->nama_guru ?? '-' }}</td>
|
||||
<td class="p-2">{{ $guru->email ?? '-' }}</td>
|
||||
<td class="p-2">{{ $guru->no_hp ?? '-' }}</td>
|
||||
<td class="p-2">{{ $guru->bidang ?? '-' }}</td>
|
||||
<td class="p-2 space-x-2">
|
||||
<a href="{{ route('guru.edit', $guru->id) }}" class="text-blue-500 hover:underline">Edit</a>
|
||||
<form action="{{ route('guru.destroy', $guru->id) }}" method="POST" class="inline" onsubmit="return confirm('Yakin hapus data ini?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-500 hover:underline">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">Belum ada data guru</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-gray-500 py-4">Belum ada data guru</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="bg-white p-6 rounded-lg shadow w-1/2 mx-auto">
|
||||
<h2 class="text-xl font-semibold mb-4">Tambah Wali Murid</h2>
|
||||
<div class="bg-white shadow-md rounded-lg p-6 max-w-xl mx-auto">
|
||||
<h1 class="text-xl font-semibold text-gray-700 mb-4">➕ Tambah Wali Murid</h1>
|
||||
|
||||
<form action="{{ route('wali.store') }}" method="POST">
|
||||
<form action="{{ route('wali-murid.store') }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Nama</label>
|
||||
<input type="text" name="nama" class="w-full border rounded p-2" required>
|
||||
<label class="block text-gray-700 mb-1">Nama Wali Murid</label>
|
||||
<input type="text" name="nama_wali" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Alamat</label>
|
||||
<input type="text" name="alamat" class="w-full border rounded p-2">
|
||||
<label class="block text-gray-700 mb-1">Email</label>
|
||||
<input type="email" name="email" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Lokasi Latitude</label>
|
||||
<input type="text" name="lokasi_lat" class="w-full border rounded p-2">
|
||||
<label class="block text-gray-700 mb-1">No HP</label>
|
||||
<input type="text" name="no_hp" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Lokasi Longitude</label>
|
||||
<input type="text" name="lokasi_lng" class="w-full border rounded p-2">
|
||||
<label class="block text-gray-700 mb-1">Alamat</label>
|
||||
<textarea name="alamat" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300"></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Simpan</button>
|
||||
<a href="{{ route('wali.index') }}" class="ml-2 px-4 py-2 bg-gray-300 rounded">Batal</a>
|
||||
<button type="submit" class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">Simpan</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,33 +1,34 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="bg-white p-6 rounded-lg shadow w-1/2 mx-auto">
|
||||
<h2 class="text-xl font-semibold mb-4">Edit Wali Murid</h2>
|
||||
<div class="bg-white shadow-md rounded-lg p-6 max-w-xl mx-auto">
|
||||
<h1 class="text-xl font-semibold text-gray-700 mb-4">✏️ Edit Wali Murid</h1>
|
||||
|
||||
<form action="{{ route('wali-murid.update', $wali_murid->id) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<form action="{{ route('wali.update', $wali->id) }}" method="POST">
|
||||
@csrf @method('PUT')
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Nama</label>
|
||||
<input type="text" name="nama" class="w-full border rounded p-2" value="{{ $wali->nama }}" required>
|
||||
<label class="block text-gray-700 mb-1">Nama Wali Murid</label>
|
||||
<input type="text" name="nama_wali" value="{{ $wali_murid->nama_wali }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Alamat</label>
|
||||
<input type="text" name="alamat" class="w-full border rounded p-2" value="{{ $wali->alamat }}">
|
||||
<label class="block text-gray-700 mb-1">Email</label>
|
||||
<input type="email" name="email" value="{{ $wali_murid->email }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Lokasi Latitude</label>
|
||||
<input type="text" name="lokasi_lat" class="w-full border rounded p-2" value="{{ $wali->lokasi_lat }}">
|
||||
<label class="block text-gray-700 mb-1">No HP</label>
|
||||
<input type="text" name="no_hp" value="{{ $wali_murid->no_hp }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block mb-1">Lokasi Longitude</label>
|
||||
<input type="text" name="lokasi_lng" class="w-full border rounded p-2" value="{{ $wali->lokasi_lng }}">
|
||||
<label class="block text-gray-700 mb-1">Alamat</label>
|
||||
<textarea name="alamat" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">{{ $wali_murid->alamat }}</textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Update</button>
|
||||
<a href="{{ route('wali.index') }}" class="ml-2 px-4 py-2 bg-gray-300 rounded">Batal</a>
|
||||
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Perbarui</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
@section('content')
|
||||
<div class="bg-white shadow-md rounded-lg p-6">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h1 class="text-xl font-semibold text-gray-700">👪 Data Wali Murid</h1>
|
||||
<a href="{{ route('wali.create') }}"
|
||||
<h1 class="text-xl font-semibold text-gray-700">👨👩👧 Data Wali Murid</h1>
|
||||
<a href="{{ route('wali-murid.create') }}"
|
||||
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
|
||||
+ Tambah Wali Murid
|
||||
</a>
|
||||
|
|
@ -14,39 +14,33 @@ class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
|
|||
<thead>
|
||||
<tr class="bg-green-600 text-white text-left">
|
||||
<th class="p-2">#</th>
|
||||
<th class="p-2">Nama</th>
|
||||
<th class="p-2">Nama Wali Murid</th>
|
||||
<th class="p-2">Email</th>
|
||||
<th class="p-2">No HP</th>
|
||||
<th class="p-2">Alamat</th>
|
||||
<th class="p-2">Lokasi (Lat, Lng)</th>
|
||||
<th class="p-2">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($wali as $i => $item)
|
||||
@forelse($wali_murids as $i => $wali)
|
||||
<tr class="border-b hover:bg-gray-50">
|
||||
<td class="p-2">{{ $i+1 }}</td>
|
||||
<td class="p-2">{{ $item->nama ?? '-' }}</td>
|
||||
<td class="p-2">{{ $item->alamat ?? '-' }}</td>
|
||||
<td class="p-2">
|
||||
{{ $item->lokasi_lat ?? '-' }}, {{ $item->lokasi_lng ?? '-' }}
|
||||
</td>
|
||||
<td class="p-2 flex gap-2">
|
||||
<a href="{{ route('wali.edit', $item->id) }}"
|
||||
class="bg-blue-500 text-white px-3 py-1 rounded hover:bg-blue-600">
|
||||
Edit
|
||||
</a>
|
||||
<form action="{{ route('wali.destroy', $item->id) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus data ini?')">
|
||||
<td class="p-2">{{ $i + 1 }}</td>
|
||||
<td class="p-2">{{ $wali->nama_wali ?? '-' }}</td>
|
||||
<td class="p-2">{{ $wali->email ?? '-' }}</td>
|
||||
<td class="p-2">{{ $wali->no_hp ?? '-' }}</td>
|
||||
<td class="p-2">{{ $wali->alamat ?? '-' }}</td>
|
||||
<td class="p-2 space-x-2">
|
||||
<a href="{{ route('wali-murid.edit', $wali->id) }}" class="text-blue-500 hover:underline">Edit</a>
|
||||
<form action="{{ route('wali-murid.destroy', $wali->id) }}" method="POST" class="inline" onsubmit="return confirm('Yakin hapus data ini?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit"
|
||||
class="bg-red-500 text-white px-3 py-1 rounded hover:bg-red-600">
|
||||
Hapus
|
||||
</button>
|
||||
<button type="submit" class="text-red-500 hover:underline">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-gray-500 p-4">Belum ada data wali murid</td>
|
||||
<td colspan="6" class="text-center text-gray-500 py-4">Belum ada data wali murid.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="bg-white shadow-md rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Tambah Data Wali Murid</h2>
|
||||
|
||||
<form action="{{ route('wali-murid.store') }}" method="POST" class="space-y-4">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Nama Wali</label>
|
||||
<input type="text" name="nama_wali" class="w-full border rounded p-2" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Email</label>
|
||||
<input type="email" name="email" class="w-full border rounded p-2">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">No HP</label>
|
||||
<input type="text" name="no_hp" class="w-full border rounded p-2">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Alamat</label>
|
||||
<textarea name="alamat" rows="3" class="w-full border rounded p-2"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2">
|
||||
<a href="{{ route('wali-murid.index') }}" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Batal</a>
|
||||
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="bg-white shadow-md rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Edit Data Wali Murid</h2>
|
||||
|
||||
<form action="{{ route('wali-murid.update', $wali_murid->id) }}" method="POST" class="space-y-4">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Nama Wali</label>
|
||||
<input type="text" name="nama_wali" class="w-full border rounded p-2" value="{{ $wali_murid->nama_wali }}" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Email</label>
|
||||
<input type="email" name="email" class="w-full border rounded p-2" value="{{ $wali_murid->email }}">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">No HP</label>
|
||||
<input type="text" name="no_hp" class="w-full border rounded p-2" value="{{ $wali_murid->no_hp }}">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 font-medium">Alamat</label>
|
||||
<textarea name="alamat" rows="3" class="w-full border rounded p-2">{{ $wali_murid->alamat }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2">
|
||||
<a href="{{ route('wali-murid.index') }}" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Batal</a>
|
||||
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="bg-white shadow-md rounded-lg p-6">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-xl font-semibold flex items-center gap-2">
|
||||
👨👩👧 Data Wali Murid
|
||||
</h2>
|
||||
<a href="{{ route('wali-murid.create') }}" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg">+ Tambah Wali Murid</a>
|
||||
</div>
|
||||
<table class="w-full border-collapse">
|
||||
<thead class="bg-green-700 text-white">
|
||||
<tr>
|
||||
<th class="p-3 text-left">#</th>
|
||||
<th class="p-3 text-left">Nama Wali</th>
|
||||
<th class="p-3 text-left">Email</th>
|
||||
<th class="p-3 text-left">No HP</th>
|
||||
<th class="p-3 text-left">Alamat</th>
|
||||
<th class="p-3 text-left">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($wali_murids as $wali)
|
||||
<tr class="border-b hover:bg-gray-100">
|
||||
<td class="p-3">{{ $loop->iteration }}</td>
|
||||
<td class="p-3">{{ $wali->nama_wali }}</td>
|
||||
<td class="p-3">{{ $wali->email }}</td>
|
||||
<td class="p-3">{{ $wali->no_hp }}</td>
|
||||
<td class="p-3">{{ $wali->alamat }}</td>
|
||||
<td class="p-3 flex gap-2">
|
||||
<a href="{{ route('wali-murid.edit', $wali->id) }}" class="text-blue-600 hover:underline">Edit</a>
|
||||
<form action="{{ route('wali-murid.destroy', $wali->id) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus data ini?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:underline">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="p-3 text-center text-gray-500">Belum ada data wali murid.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<p class="font-semibold uppercase text-xs mb-2">Data Master</p>
|
||||
<ul class="ml-4 space-y-1">
|
||||
<li><a href="{{ route('guru.index') }}" class="block p-2 hover:bg-green-700 rounded">👨🏫 Guru</a></li>
|
||||
<li><a href="{{ route('wali.index') }}" class="block p-2 hover:bg-green-700 rounded">👪 Wali Murid</a></li>
|
||||
<li><a href="{{ route('wali-murid.index') }}"class="block p-2 hover:bg-green-700 rounded">👪 Wali Murid</a></li>
|
||||
<li><a href="{{ route('siswa.index') }}" class="block p-2 hover:bg-green-700 rounded">🧒 Peserta Didik</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -70,6 +70,11 @@ class="px-4 py-2 rounded-lg border focus:ring-2 focus:ring-green-400 w-72 text-s
|
|||
<!-- Content -->
|
||||
<main class="p-6">
|
||||
@yield('content')
|
||||
@if (session('success'))
|
||||
<div class="bg-green-100 text-green-800 p-3 rounded mb-4">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
'destroy' => 'api.guru.destroy',
|
||||
]);
|
||||
Route::apiResource('wali', WaliMuridController::class)->names([
|
||||
'index' => 'api.wali.index',
|
||||
'index' => 'api.wali-murid.index',
|
||||
'show' => 'api.wali.show',
|
||||
'store' => 'api.wali.store',
|
||||
'update' => 'api.wali.update',
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
Route::prefix('admin')->group(function () {
|
||||
Route::resource('guru', GuruController::class);
|
||||
Route::resource('wali', WaliMuridController::class);
|
||||
Route::resource('wali-murid', WaliMuridController::class);
|
||||
Route::resource('siswa', SiswaController::class);
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue