AAMIIN
This commit is contained in:
parent
b43ba8a0c3
commit
29613da448
|
@ -14,7 +14,7 @@ public function index()
|
|||
|
||||
// Pastikan ada data sebelum mencoba mengambil item acak
|
||||
$randomLandingPage = $allLandingPages->isEmpty() ? null : $allLandingPages->random();
|
||||
$randomLandingPages = $allLandingPages->isEmpty() ? collect() : $allLandingPages->random(min($allLandingPages->count(), 5));
|
||||
$randomLandingPages = $allLandingPages->isEmpty() ? collect() : $allLandingPages->random(min($allLandingPages->count(), 6));
|
||||
|
||||
return view('admin.dashboard', [ // Pastikan nama view sesuai dengan yang Anda gunakan
|
||||
'randomLandingPage' => $randomLandingPage,
|
||||
|
|
|
@ -19,7 +19,7 @@ class AdminDataKursusController extends Controller
|
|||
public function dataKursus()
|
||||
{
|
||||
// Mengambil semua data kursus dari model DataKursus
|
||||
$courses = DataKursus::paginate(5);
|
||||
$courses = DataKursus::paginate(10);
|
||||
|
||||
// Mengambil gambar untuk setiap course, jika ada
|
||||
foreach ($courses as $course) {
|
||||
|
@ -40,7 +40,6 @@ public function create()
|
|||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
// Perbarui aturan validasi
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama_kursus' => 'required',
|
||||
'img' => 'required|file|mimes:jpeg,png,jpg|max:2048',
|
||||
|
@ -49,12 +48,29 @@ public function store(Request $request)
|
|||
'metode' => 'required',
|
||||
'fasilitas' => 'required',
|
||||
'lokasi' => 'required',
|
||||
'latitude' => 'nullable', // Ubah aturan validasi
|
||||
'longitude' => 'nullable', // Ubah aturan validasi
|
||||
'popular' => 'required', // Ubah aturan validasi
|
||||
'img_konten.*' => 'required|file|mimes:jpeg,png,jpg|max:2048',
|
||||
'latitude' => 'required', // Ubah menjadi wajib diisi
|
||||
'longitude' => 'required', // Ubah menjadi wajib diisi
|
||||
'popular' => 'required',
|
||||
'img_konten.*' => 'nullable|file', // Gambar konten tetap opsional
|
||||
], [
|
||||
'nama_kursus.required' => 'Nama kursus wajib diisi.',
|
||||
'img.required' => 'Gambar utama wajib di-upload.',
|
||||
'img.file' => 'File yang di-upload harus berupa gambar.',
|
||||
'img.mimes' => 'Gambar harus berekstensi jpeg, png, atau jpg.',
|
||||
'img.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
||||
'deskripsi.required' => 'Deskripsi wajib diisi.',
|
||||
'paket.required' => 'Paket wajib diisi.',
|
||||
'metode.required' => 'Metode wajib diisi.',
|
||||
'fasilitas.required' => 'Fasilitas wajib diisi.',
|
||||
'lokasi.required' => 'Lokasi wajib diisi.',
|
||||
'latitude.required' => 'Latitude wajib diisi.', // Pesan error custom
|
||||
'longitude.required' => 'Longitude wajib diisi.', // Pesan error custom
|
||||
'popular.required' => 'Status popular wajib diisi.',
|
||||
'img_konten.*.nullable' => 'Gambar konten bersifat opsional.',
|
||||
'img_konten.*.file' => 'File yang di-upload harus berupa gambar.',
|
||||
]);
|
||||
|
||||
|
||||
// Cek apakah validasi gagal
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
|
@ -109,21 +125,38 @@ public function edit($id)
|
|||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$request->validate([
|
||||
'nama_kursus' => 'required|string|max:255',
|
||||
'deskripsi' => 'required|string',
|
||||
'img' => 'nullable|image|max:2048',
|
||||
'img_konten.*' => 'nullable|image|max:2048',
|
||||
'latitude' => 'required|numeric',
|
||||
'longitude' => 'nullable|numeric',
|
||||
'popular' => 'required|string',
|
||||
'paket' => 'nullable|string',
|
||||
'metode' => 'nullable|string',
|
||||
'fasilitas' => 'nullable|string',
|
||||
'lokasi' => 'nullable|string',
|
||||
]);
|
||||
// Validasi request
|
||||
$request->validate([
|
||||
'nama_kursus' => 'required|string|max:255',
|
||||
'deskripsi' => 'required|string',
|
||||
'img' => 'nullable|image|max:2048',
|
||||
'img_konten.*' => 'nullable|image|max:2048',
|
||||
'latitude' => 'required|numeric',
|
||||
'longitude' => 'required|numeric',
|
||||
'popular' => 'required|string',
|
||||
'paket' => 'required|string',
|
||||
'metode' => 'required|string',
|
||||
'fasilitas' => 'required|string',
|
||||
'lokasi' => 'required|string',
|
||||
], [
|
||||
'nama_kursus.required' => 'Nama kursus wajib diisi.',
|
||||
'nama_kursus.max' => 'Nama kursus tidak boleh lebih dari 255 karakter.',
|
||||
'deskripsi.required' => 'Deskripsi wajib diisi.',
|
||||
'img.image' => 'File yang di-upload harus berupa gambar.',
|
||||
'img.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
||||
'latitude.required' => 'Latitude wajib diisi.',
|
||||
'latitude.numeric' => 'Latitude harus berupa angka.',
|
||||
'longitude.required' => 'Longitude wajib diisi.',
|
||||
'longitude.numeric' => 'Longitude harus berupa angka.',
|
||||
'popular.required' => 'Status popular wajib diisi.',
|
||||
'paket.required' => 'Paket wajib diisi.',
|
||||
'metode.required' => 'Metode wajib diisi.',
|
||||
'fasilitas.required' => 'Fasilitas wajib diisi.',
|
||||
'lokasi.required' => 'Lokasi wajib diisi.',
|
||||
]);
|
||||
|
||||
|
||||
try {
|
||||
// Ambil record DataKursus berdasarkan ID-nya
|
||||
$dataKursus = DataKursus::findOrFail($id);
|
||||
|
||||
|
@ -138,57 +171,48 @@ public function update(Request $request, $id)
|
|||
$dataKursus->fasilitas = $request->input('fasilitas');
|
||||
$dataKursus->lokasi = $request->input('lokasi');
|
||||
|
||||
|
||||
// Update gambar utama jika ada file baru
|
||||
if ($request->hasFile('img')) {
|
||||
// Hapus gambar lama jika ada
|
||||
if ($dataKursus->img) {
|
||||
// Hapus file lama
|
||||
Storage::delete('public/' . $dataKursus->img);
|
||||
}
|
||||
|
||||
|
||||
// Simpan gambar baru
|
||||
$imgPath = $request->file('img')->store('konten', 'public');
|
||||
$dataKursus->img = $imgPath;
|
||||
}
|
||||
|
||||
|
||||
// Update multiple file upload jika ada file baru
|
||||
if ($request->hasFile('img_konten')) {
|
||||
// Hapus gambar menu lama jika ada
|
||||
if ($dataKursus->img_konten) {
|
||||
// Decode JSON untuk mendapatkan array path dari gambar lama
|
||||
$oldImages = json_decode($dataKursus->img_konten, true);
|
||||
foreach ($oldImages as $oldImage) {
|
||||
// Hapus setiap file lama dari penyimpanan
|
||||
Storage::delete('public/' . $oldImage);
|
||||
}
|
||||
}
|
||||
|
||||
// Proses setiap file yang di-upload untuk gambar menu baru
|
||||
$menuImages = [];
|
||||
foreach ($request->file('img_konten') as $file) {
|
||||
// Simpan file di folder 'images/kuliner/detail' dalam disk 'public'
|
||||
$imgKontenPaths = $file->store('logo', 'public');
|
||||
// Menambahkan path ke array baru
|
||||
$menuImages[] = $imgKontenPaths;
|
||||
}
|
||||
|
||||
// Simpan array path gambar menu baru ke database
|
||||
$dataKursus->img_konten = json_encode($menuImages);
|
||||
}
|
||||
|
||||
// Save updated record
|
||||
// Simpan perubahan
|
||||
$dataKursus->save();
|
||||
|
||||
// Redirect with success message
|
||||
// Redirect dengan pesan sukses
|
||||
return redirect()->route('admin.dataKursus')->with('success', 'Data berhasil diperbarui.');
|
||||
} catch (\Exception $e) {
|
||||
dd($e->getMessage());
|
||||
// Tangani error dan kirimkan pesan error
|
||||
return redirect()->back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
|
||||
}
|
||||
// Validasi request
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$dataKursus = DataKursus::findOrFail($id);
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
<!-- Bagian bawah menampilkan maksimal 6 gambar secara acak -->
|
||||
<div class="py-2">
|
||||
<div class="grid grid-cols-5 gap-2">
|
||||
<div class="grid grid-cols-3 lg:grid-cols-6 gap-2">
|
||||
@if ($randomLandingPages->isNotEmpty())
|
||||
@foreach ($randomLandingPages as $page)
|
||||
<div
|
||||
class="relative group rounded-lg overflow-hidden shadow-md transition-transform transform hover:scale-105">
|
||||
<img src="{{ asset('storage/' . $page->img) }}" class="object-cover w-full h-full"
|
||||
<img src="{{ asset('storage/' . $page->img) }}" class="object-contain w-full h-24 lg:h-56"
|
||||
alt="">
|
||||
<div
|
||||
class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<a class="bg-[#4F7F81] py-2 px-4 rounded-xl shadow-md shadow-gray-600 hover:bg-[#3F6A6B] text-white font-bold"
|
||||
href="{{ route('admin.create') }}">Tambah Data</a>
|
||||
</div>
|
||||
|
||||
{{ $courses->links() }}
|
||||
<div class="relative overflow-x-auto sm:rounded-lg">
|
||||
<table class="w-full text-sm text-left rtl:text-right shadow-gray-600 text-gray-500">
|
||||
<thead class="text-xs text-gray-700 uppercase shadow-gray-600 bg-gray-50">
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
w
|
|
@ -3,7 +3,7 @@
|
|||
<div class="container">
|
||||
<div class="py-10">
|
||||
|
||||
<div class="pb-4 flex">
|
||||
<div class="pb-4 px-4 flex">
|
||||
<a class="px-4 flex text-white text-lg justify-center shadow-md shadow-gray-600 items-center py-2 rounded-xl bg-[#4F7F81]"
|
||||
href="{{ route('admin.dataKursus') }}"><svg class="w-5 h-5 text-white " aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
|
||||
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
<form id="my-form" action="{{ route('kursus.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="grid gap-6 mb-6 md:grid-cols-2">
|
||||
<div class="grid gap-6 mb-6 md:grid-cols-2 px-4">
|
||||
<!-- Nama Kursus -->
|
||||
<div class="grid gap-6 md:grid-cols-2">
|
||||
<div>
|
||||
|
@ -21,45 +21,43 @@
|
|||
Kursus</label>
|
||||
<input type="text" id="nama_kursus" name="nama_kursus"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||
placeholder="Kampung Inggris LC - Language Center" required />
|
||||
placeholder="Kampung Inggris LC - Language Center" value="{{ old('nama_kursus') }}"
|
||||
required />
|
||||
</div>
|
||||
<div>
|
||||
<form class="max-w-sm mx-auto">
|
||||
<label for="countries"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Pilih
|
||||
Popular</label>
|
||||
<select id="popular" name="popular"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option value="Tidak">Tidak</option>
|
||||
<option value="Popular">Popular</option>
|
||||
</select>
|
||||
</form>
|
||||
<label for="popular" class="block mb-2 text-sm font-medium text-gray-900">Pilih
|
||||
Popular</label>
|
||||
<select id="popular" name="popular"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
||||
<option value="Tidak" {{ old('popular') == 'Tidak' ? 'selected' : '' }}>Tidak</option>
|
||||
<option value="Popular" {{ old('popular') == 'Popular' ? 'selected' : '' }}>Popular
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- File Upload -->
|
||||
<div>
|
||||
<label for="file_input" class="block mb-2 text-sm font-medium text-gray-900">Upload File</label>
|
||||
<label for="file_input" class="block mb-2 text-sm font-medium text-gray-900">Upload
|
||||
Gambar</label>
|
||||
<input
|
||||
class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50"
|
||||
id="file_input" type="file" name="img">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Deskripsi -->
|
||||
<div>
|
||||
<label for="deskripsi" class="block mb-2 text-sm font-medium text-gray-900">Deskripsi</label>
|
||||
<input type="text" id="deskripsi" name="deskripsi"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||
placeholder="KAMPUNG INGGRIS LC – LANGUAGE CENTER Adalah . . . ." required />
|
||||
placeholder="KAMPUNG INGGRIS LC – LANGUAGE CENTER Adalah . . . ."
|
||||
value="{{ old('deskripsi') }}" required />
|
||||
</div>
|
||||
|
||||
<!-- Multiple File Upload -->
|
||||
<div>
|
||||
<label for="multiple_files" class="block mb-2 text-sm font-medium text-gray-900">Upload Multiple
|
||||
Files</label>
|
||||
<label for="multiple_files" class="block mb-2 text-sm font-medium text-gray-900">Upload Detail
|
||||
Gambar</label>
|
||||
<input
|
||||
class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50"
|
||||
id="multiple_files" type="file" name="img_konten[]" multiple>
|
||||
|
@ -71,7 +69,7 @@ class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg curs
|
|||
<input type="text" id="latitude" name="latitude" pattern="-?\d*\.?\d+"
|
||||
title="Latitude can include numbers, a dot (.) for decimal, and a minus (-) for negative values."
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||
placeholder="Latitude" required />
|
||||
placeholder="Latitude" value="{{ old('latitude') }}" required />
|
||||
</div>
|
||||
|
||||
<!-- Longitude -->
|
||||
|
@ -80,14 +78,13 @@ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:
|
|||
<input type="text" id="longitude" name="longitude" pattern="-?\d*\.?\d+"
|
||||
title="Longitude can include numbers, a dot (.) for decimal, and a minus (-) for negative values."
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"
|
||||
placeholder="Longitude" />
|
||||
placeholder="Longitude" value="{{ old('longitude') }}" />
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Paket -->
|
||||
<div>
|
||||
<label for="paket" class="block mb-2 text-sm font-medium text-gray-900">Paket</label>
|
||||
<input id="paket" name="paket" type="hidden" />
|
||||
<input id="paket" name="paket" type="hidden" value="{{ old('paket') }}" />
|
||||
<trix-editor input="paket"
|
||||
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500"
|
||||
placeholder="Write your thoughts here..."></trix-editor>
|
||||
|
@ -96,7 +93,7 @@ class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border bor
|
|||
<!-- Metode -->
|
||||
<div>
|
||||
<label for="metode" class="block mb-2 text-sm font-medium text-gray-900">Metode</label>
|
||||
<input id="metode" name="metode" type="hidden" />
|
||||
<input id="metode" name="metode" type="hidden" value="{{ old('metode') }}" />
|
||||
<trix-editor input="metode"
|
||||
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500"
|
||||
placeholder="Write your thoughts here..."></trix-editor>
|
||||
|
@ -105,7 +102,7 @@ class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border bor
|
|||
<!-- Fasilitas -->
|
||||
<div>
|
||||
<label for="fasilitas" class="block mb-2 text-sm font-medium text-gray-900">Fasilitas</label>
|
||||
<input id="fasilitas" name="fasilitas" type="hidden" />
|
||||
<input id="fasilitas" name="fasilitas" type="hidden" value="{{ old('fasilitas') }}" />
|
||||
<trix-editor input="fasilitas"
|
||||
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500"
|
||||
placeholder="Write your thoughts here..."></trix-editor>
|
||||
|
@ -114,87 +111,95 @@ class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border bor
|
|||
<!-- Lokasi -->
|
||||
<div>
|
||||
<label for="lokasi" class="block mb-2 text-sm font-medium text-gray-900">Lokasi</label>
|
||||
<input id="lokasi" name="lokasi" type="hidden" />
|
||||
<input id="lokasi" name="lokasi" type="hidden" value="{{ old('lokasi') }}" />
|
||||
<trix-editor input="lokasi"
|
||||
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500"
|
||||
placeholder="Write your thoughts here..."></trix-editor>
|
||||
</div>
|
||||
</div>
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4"
|
||||
role="alert">
|
||||
<strong class="font-bold">Error:</strong>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<button type="button" data-modal-target="popup-modal-tambah" data-modal-toggle="popup-modal-tambah"
|
||||
class="shadow-md shadow-gray-600 text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center">
|
||||
Submit
|
||||
</button>
|
||||
<!-- Modal Konfirmasi -->
|
||||
<div id="popup-modal-tambah" tabindex="-1"
|
||||
class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
||||
<div class="relative p-4 w-full max-w-md max-h-full">
|
||||
<div class="relative bg-white rounded-lg shadow ">
|
||||
<button type="button"
|
||||
class="absolute top-3 end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center "
|
||||
data-modal-hide="popup-modal-tambah">
|
||||
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none" viewBox="0 0 14 14">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
|
||||
</svg>
|
||||
<span class="sr-only">Close modal</span>
|
||||
<div class="px-4 space-y-4">
|
||||
|
||||
<button type="button" data-modal-target="popup-modal-tambah"
|
||||
data-modal-toggle="popup-modal-tambah"
|
||||
class="shadow-md shadow-gray-600 text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center">
|
||||
Submit
|
||||
</button>
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4"
|
||||
role="alert">
|
||||
<strong class="font-bold">Error:</strong>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- Modal Konfirmasi -->
|
||||
<div id="popup-modal-tambah" tabindex="-1"
|
||||
class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
||||
<div class="relative p-4 w-full max-w-md max-h-full">
|
||||
<div class="relative bg-white rounded-lg shadow ">
|
||||
<button type="button"
|
||||
class="absolute top-3 end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center "
|
||||
data-modal-hide="popup-modal-tambah">
|
||||
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none" viewBox="0 0 14 14">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
|
||||
</svg>
|
||||
<span class="sr-only">Close modal</span>
|
||||
</button>
|
||||
<div class="p-4 md:p-5 text-center">
|
||||
<svg class="mx-auto mb-4 text-[#3F6A6B] w-12 h-12 " aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||
</svg>
|
||||
<h3 class="mb-5 text-lg font-normal text-black">
|
||||
Apakah Anda yakin ingin menambah kursus?
|
||||
</h3>
|
||||
|
||||
<button id="confirm-submit"
|
||||
class="text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center">
|
||||
Ya, Kirim
|
||||
</button>
|
||||
<div class="p-4 md:p-5 text-center">
|
||||
<svg class="mx-auto mb-4 text-[#3F6A6B] w-12 h-12 " aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||
</svg>
|
||||
<h3 class="mb-5 text-lg font-normal text-black ">
|
||||
Apakah Anda yakin ingin mengirimkan formulir ini?</h3>
|
||||
<button id="confirm-submit"
|
||||
class="text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center">
|
||||
Ya, Kirim
|
||||
</button>
|
||||
<button type="button"
|
||||
class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-[#3F6A6B] focus:z-10 focus:ring-4 focus:ring-gray-100 "
|
||||
data-modal-hide="popup-modal-tambah">Tidak, Batal</button>
|
||||
</div>
|
||||
<button type="button"
|
||||
class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-[#3F6A6B] focus:z-10 focus:ring-4 focus:ring-gray-100 "
|
||||
data-modal-hide="popup-modal-tambah">Tidak, Batal</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Show modal
|
||||
document.querySelectorAll('[data-modal-toggle]').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = button.getAttribute('data-modal-target');
|
||||
document.getElementById(targetId).classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
// Hide modal
|
||||
document.querySelectorAll('[data-modal-hide]').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = button.getAttribute('data-modal-hide');
|
||||
document.getElementById(targetId).classList.add('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
// Handle form submission
|
||||
document.getElementById('confirm-submit').addEventListener('click', () => {
|
||||
document.getElementById('my-form').submit();
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Show modal
|
||||
document.querySelectorAll('[data-modal-toggle]').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = button.getAttribute('data-modal-target');
|
||||
document.getElementById(targetId).classList.remove('hidden');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</form>
|
||||
// Hide modal
|
||||
document.querySelectorAll('[data-modal-hide]').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const targetId = button.getAttribute('data-modal-hide');
|
||||
document.getElementById(targetId).classList.add('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
// Handle form submission
|
||||
document.getElementById('confirm-submit').addEventListener('click', () => {
|
||||
document.getElementById('my-form').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<x-adminlayout>
|
||||
<div class="container">
|
||||
<div class="py-10">
|
||||
<div class="pb-4 flex">
|
||||
<div class="pb-4 px-4 flex">
|
||||
<a class="px-4 flex text-white text-lg justify-center items-center py-2 rounded-xl bg-[#4F7F81]"
|
||||
href="{{ route('admin.dataKursus') }}">
|
||||
<svg class="w-5 h-5 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
||||
|
@ -14,7 +14,7 @@
|
|||
<form action="{{ route('admin.update', $dataKursus->id) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT') <!-- Add this if you are updating an existing resource -->
|
||||
<div class="grid gap-6 mb-6 md:grid-cols-2">
|
||||
<div class="grid gap-6 mb-6 md:grid-cols-2 px-4">
|
||||
|
||||
<!-- Nama Kursus -->
|
||||
<div class="grid gap-6 md:grid-cols-2">
|
||||
|
@ -28,18 +28,18 @@ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:
|
|||
placeholder="Kampung Inggris LC - Language Center" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="countries"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Pilih
|
||||
Popular</label>
|
||||
<select id="countries" name="popular"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option selected>{{ $dataKursus->popular }}</option>
|
||||
@if ($dataKursus->popular === 'popular')
|
||||
<option value="Tidak">Tidak</option>
|
||||
@else
|
||||
<option value="popular">Popular</option>
|
||||
@endif
|
||||
</select>
|
||||
<label for="countries"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Pilih
|
||||
Popular</label>
|
||||
<select id="countries" name="popular"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
<option selected>{{ $dataKursus->popular }}</option>
|
||||
@if ($dataKursus->popular === 'popular')
|
||||
<option value="Tidak">Tidak</option>
|
||||
@else
|
||||
<option value="popular">Popular</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -184,8 +184,24 @@ class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border bor
|
|||
placeholder="Write your thoughts here..."></trix-editor>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center">Submit</button>
|
||||
<div class="px-4 space-y-4">
|
||||
|
||||
<button type="submit"
|
||||
class="text-white bg-[#4F7F81] hover:bg-[#3F6A6B] focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center">Submit</button>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4 mt-4">
|
||||
<strong>Oops! Ada beberapa kesalahan:</strong>
|
||||
<ul class="mt-2">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<div class="container flex justify-center items-center pb-16">
|
||||
<section id="gambarutama">
|
||||
<div class="h-auto w-full ">
|
||||
<img src=" {{ asset('storage/' . $data->img) }}" alt="" class="h-auto w-full">
|
||||
<img src=" {{ asset('storage/' . $data->img) }}" alt="" class="h-[350px] sm:h-[400px] md:h-[450px] lg:h-[500px] xl:h-[ ] w-full">
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<a href="/kursus/{{ $data->id }}/rute" target="_blank"
|
||||
class="poppins-regular py-2 px-4 bg-[#4F7F81] text-white rounded-xl text-xl shadow-xl">Rute Terdekat</a>
|
||||
<button data-modal-target="default-modal-detail-gambar" data-modal-toggle="default-modal-detail-gambar"
|
||||
class="poppins-regular py-2 px-4 bg-[#4F7F81] text-white rounded-xl text-xl shadow-xl">Detail</button>
|
||||
class="poppins-regular py-2 px-4 bg-[#4F7F81] text-white rounded-xl text-xl shadow-xl">Foto Detail</button>
|
||||
|
||||
|
||||
<!-- Main modal -->
|
||||
|
|
|
@ -27,7 +27,8 @@ class="w-full h-56 sm:h-64 md:h-96 lg:h-[500px] xl:h-[650px] max-w-4xl rounded-l
|
|||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Inisialisasi peta dengan koordinat dan tingkat zoom
|
||||
const map = L.map('map1').setView([-7.7517397,112.1780461], 13); // Gunakan 'map1' untuk ID peta yang sesuai
|
||||
const map = L.map('map1').setView([-7.7517397, 112.1780461],
|
||||
13); // Gunakan 'map1' untuk ID peta yang sesuai
|
||||
|
||||
// Tambahkan lapisan ubin dari OpenStreetMap
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
|
@ -38,9 +39,19 @@ class="w-full h-56 sm:h-64 md:h-96 lg:h-[500px] xl:h-[650px] max-w-4xl rounded-l
|
|||
@foreach ($latilongti as $latilongti)
|
||||
L.marker([{{ $latilongti->latitude }}, {{ $latilongti->longitude }}])
|
||||
.addTo(map)
|
||||
.bindPopup('<a href="/kursus/{{ $latilongti->id }}/detail"><b>{{ $latilongti->nama_kursus }}</b><br>Location: {{ $latilongti->latitude }}, {{ $latilongti->longitude }}')
|
||||
.bindPopup(
|
||||
'<div class="h-auto w-full">' +
|
||||
'<img src="{{ asset('storage/' . $latilongti->img) }}" alt="" class="w-full h-20 object-contain">' +
|
||||
'</div>' +
|
||||
'<p>' +
|
||||
'{{ $latilongti->nama_kursus }} <br>' +
|
||||
|
||||
'<a href="/kursus/{{ $latilongti->id }}/detail">Selengkapnya</a>'
|
||||
)
|
||||
.openPopup();
|
||||
@endforeach
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</x-layout>
|
|
@ -5,7 +5,7 @@ export default {
|
|||
"./resources/**/*.js",
|
||||
"./resources/**/*.vue",
|
||||
"./node_modules/flowbite/**/*.js",
|
||||
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
|
||||
"./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php",
|
||||
],
|
||||
theme: {
|
||||
container: {
|
||||
|
|
Loading…
Reference in New Issue