This commit is contained in:
HANIF FEBRIANSYAH 2024-09-05 20:25:17 +07:00
parent f5fcbec137
commit 624d83c309
10 changed files with 78 additions and 89 deletions

View File

@ -4,6 +4,7 @@
use App\Models\DataKursus; // Pastikan model diimport
use Illuminate\Auth\Events\Validated;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use PhpParser\Node\Stmt\TryCatch;
@ -34,7 +35,7 @@ public function store(Request $request)
'metode' => 'required',
'fasilitas' => 'required',
'lokasi' => 'required',
'latitude' => 'required|numeric|between:-90,90',
'latitude' => 'required|numeric|between:-180,180',
'longitude' => 'required|numeric|between:-180,180',
'img_konten.*' => 'file|mimes:jpeg,png,jpg|max:2048',
]);
@ -42,11 +43,11 @@ public function store(Request $request)
// if ($validator->fails()) {
// return redirect()->back()->withInput()->withErrors($validator);
// }
$imgPath = $request->file('img')->store('images', 'public');
$imgPath = $request->file('img')->store('konten', 'public');
$imgKontenPaths = [];
if ($request->hasFile('img_konten')) {
foreach ($request->file('img_konten') as $file) {
$imgKontenPaths[] = $file->store('images', 'public');
$imgKontenPaths[] = $file->store('logo', 'public');
}
}
@ -70,40 +71,11 @@ public function store(Request $request)
}
}
public function w(Request $request)
public function edit()
{
// $validator = Validator::make($request->all(), [
// 'nama' => 'required',
// 'img' => 'required',
// 'deskripsi' => 'required',
// 'paket' => 'required',
// 'metode' => 'required',
// 'fasilitas' => 'required',
// 'lokasi' => 'required',
// 'latitude' => 'required',
// 'longtitude' => 'required',
// 'img_konten' => 'required',
// ]);
// DataKursus::create([
// "nama_kursus" => $request->nama,
// "img" => $request->img,
// "deskripsi" => $request->diskripsi,
// "paket" => $request->paket,
// "metode" => $request->metode,
// "fasilitas" => $request->fasilitas,
// "lokasi" => $request->lokasi,
// "latitude" => $request->latitude,
// "longtitude" => $request->longtitude,
// "img_konten" => $request->img_konten,
// ]);
// if ($validator->fails()) return redirect()->back()->withInput()->withErrors($validator);
return view('admin.ubahDataKursusAdmin');
}
public function destroy(string $id)
{
$data = DataKursus::find($id);

View File

@ -22,7 +22,7 @@ public function up()
$table->string('lokasi');
$table->decimal('latitude', 10, 7);
$table->decimal('longtitude', 10, 7);
$table->decimal('longitude', 10, 7);
$table->json('img_konten')->nullable();
$table->timestamps();
});

View File

@ -51,8 +51,9 @@ class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg curs
<div>
<label for="latitude" class="block mb-2 text-sm font-medium text-gray-900">Latitude</label>
<input type="text" id="latitude" name="latitude"
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 />
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 />
</div>
<!-- Longitude -->

View File

@ -0,0 +1,11 @@
<x-adminlayout>
<div class="container">
<div class="py-10">
</div>
</div>
</x-adminlayout>

View File

@ -1,58 +1,50 @@
<x-layout>
<div class="py-10 bg-white ">
<div class="bg-[#EBFEA1] poppins-extrabold m-auto flex items-center justify-center p-2">
<div class="bg-[#EBFEA1] container poppins-extrabold m-auto flex items-center justify-center p-2">
<p>Halaman ini berisi tentang kursus di Pare! </p>
</div>
</div>
<div class="container flex justify-end items-center pb-16">
<div id="default-carousel" class="relative w-full" data-carousel="slide">
<!-- Carousel wrapper -->
<div class="relative h-48 sm:h-[250px] md:h-[350px] lg:h-[450px] xl:h-[500px] 2xl:h-[600px] overflow-hidden rounded-lg">
@foreach ($imageNames as $index => $imageName)
<!-- Item {{ $index + 1 }} -->
<div class="{{ $index === 0 ? 'block' : 'hidden' }} duration-700 ease-in-out h-full" data-carousel-item>
<img src="{{ asset('storage/logo/' . $imageName) }}"
class="absolute block w-full h-full object-cover -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2"
alt="...">
</div>
@endforeach
</div>
<div class="relative h-48 sm:h-[250px] md:h-[350px] lg:h-[450px] xl:h-[500px] 2xl:h-[600px] overflow-hidden rounded-lg">
@foreach ($imageNames as $index => $imageName)
<div class="hidden duration-1000 ease-in-out" data-carousel-item>
<img src="{{ asset('storage/' . $imageName) }}"
class="absolute block w-full -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2"
alt="...">
</div>
@endforeach
</div>
<!-- Slider indicators -->
<div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">
<button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide 1"
data-carousel-slide-to="0"></button>
<button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 2"
data-carousel-slide-to="1"></button>
<button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 3"
data-carousel-slide-to="2"></button>
<button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 4"
data-carousel-slide-to="3"></button>
<button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 5"
data-carousel-slide-to="4"></button>
</div>
</div>
<!-- Slider indicators -->
<div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">
@for ($i = 0; $i < count($imageNames); $i++)
<button type="button" class="w-3 h-3 rounded-full" aria-current="{{ $i === 0 ? 'true' : 'false' }}" aria-label="Slide {{ $i + 1 }}" data-carousel-slide-to="{{ $i }}"></button>
@endfor  
</div>
<!-- Slider controls -->
<button type="button"
class="absolute top-0 start-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"
data-carousel-prev>
<span
class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
<svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true"
class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 group-hover:bg-white/50 group-focus:ring-4 group-focus:ring-white group-focus:outline-none">
<svg class="w-4 h-4 text-white rtl:rotate-180" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M5 1 1 5l4 4" />
</svg>
<span class="sr-only">Previous</span>
</span>
</button>
<button type="button"
class="absolute top-0 end-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"
data-carousel-next>
<span
class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none">
<svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true"
class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 group-hover:bg-white/50 group-focus:ring-4 group-focus:ring-white group-focus:outline-none">
<svg class="w-4 h-4 text-white rtl:rotate-180" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="m1 9 4-4-4-4" />
@ -71,34 +63,39 @@ class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/3
{{ $data->deskripsi }}
</p>
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-20 py-14">
<div class="max-w-80 space-y-2">
{{-- Page untuk paket --}}
{{ strip_tags($data->paket) }}
<div class="max-w-max space-y-2">
<p class="poppins-semibold text-2xl text-black underline">
Paket
</p>
<h1 class="popins-reguler text-2xl text-black">
{!! $data->paket !!}
</h1>
</div>
<div class="max-w-max space-y-2">
<p class="poppins-semibold text-2xl text-black ">
<p class="poppins-semibold text-2xl text-black underline">
Metode Pembelajaran
</p>
<h1 class="popins-reguler text-2xl text-black ">
{{ $data->metode }}
<h1 class="popins-reguler text-2xl text-black">
{!! $data->metode !!}
</h1>
<p class="poppins-semibold text-2xl text-black pt-6">
<p class="poppins-semibold text-2xl text-black pt-6 underline">
Fasilitas
</p>
<h1 class="popins-reguler text-2xl text-black ">
{{ $data->fasilitas }}
<h1 class="popins-reguler text-2xl text-black">
{!! $data->fasilitas !!}
</h1>
</div>
<div class="max-w-max space-y-2">
<p class="poppins-semibold text-2xl text-black ">
<p class="poppins-semibold text-2xl text-black underline">
Lokasi
</p>
<h1 class="popins-reguler text-2xl text-black ">
{{ $data->lokasi }}
<h1 class="popins-reguler text-2xl text-black">
{!! $data->lokasi !!}
</h1>
</div>
</div>
</div>
</div>
</x-layout>

View File

@ -27,7 +27,7 @@
<div class="max-w-max bg-white border border-gray-200 rounded-lg shadow ">
<a href="#">
<img class="rounded-lg m-auto flex justify-center items-center w-full max-h-64 object-cover"
src="{{ asset('img/Rectangle 288.png') }}" alt="" />
src="{{ asset('storage/'.$landingpage->img ) }}" alt="" />
</a>
<div class="p-5">
<a href="#">
@ -69,7 +69,7 @@ class="mb-2 text-2xl poppins-regular font-extrabold tracking-tight text-gray-90
<p class="ms-1 text-sm text-gray-500 ">5</p>
</div>
<div class="flex justify-end">
<a href="#"
<a href="/kursus/{{ $landingpage->id }}/detail"
class="inline-flex items-center px-6 font-extrabold py-2 text-sm text-center ring-2 text-black ring-black hover:text-white hover:bg-[#4F7F81] hover:ring-[#4F7F81] rounded-full focus:ring-4 focus:outline-none focus:ring-blue-300 -700 ue-800">
Lihat
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true"

View File

@ -72,7 +72,7 @@ class="absolute top-0 end-0 p-2.5 text-sm font-medium h-full text-white bg-[#4F7
<div class="max-w-max shadow-xl bg-white border border-gray-300 rounded-lg ">
<a href="#">
<img class="rounded-lg m-auto flex justify-center items-center w-full max-h-64 object-cover"
src="{{ asset('storage/konten/'.$data_kursus->img ) }}" alt="" />
src="{{ asset('storage/'.$data_kursus->img ) }}" alt="" />
{{-- src="{{ asset($data_kursus->img) }}" alt="{{ $data_kursus->nama_kursus }}" /> --}}
</a>
<div class="p-5">

View File

@ -11,7 +11,7 @@
<div class="bg-[#EBFEA1] poppins-extrabold m-auto flex items-center justify-center p-2">
<p>Halaman ini berisi tentang kursus di Pare!</p>
</div>
</div>
</div>
<div class="pb-10">
<!-- Apply Tailwind CSS classes for responsive width and height -->
<div id="map"
@ -21,7 +21,7 @@ class="w-full h-56 sm:h-64 md:h-96 lg:h-[500px] xl:h-[650px] max-w-4xl rounded-l
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
// Initialize the map with default center and zoom level
const map = L.map('map').setView([-7.750835, 112.1797279], 15); // Latitude and Longitude
const map = L.map('map').setView([-7.7523414, 112.1700522], 15); // Latitude and Longitude
// Add a tile layer from OpenStreetMap
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
@ -32,12 +32,14 @@ class="w-full h-56 sm:h-64 md:h-96 lg:h-[500px] xl:h-[650px] max-w-4xl rounded-l
const markers = [
@foreach ($latilongti as $latilongti)
{
coords: [{{ $latilongti->latitude }}, {{ $latilongti->longtitude }}],
popupText: '{{ $latilongti->nama_kursus }}'
coords: [{{ $latilongti->latitude }}, {{ $latilongti->longitude }}],
popupText: '{{ $latilongti->nama_kursus }}',
href: '{{ route ('admin.dataKursus') }}' // Menambahkan href
},
@endforeach
];
// Add markers to the map
markers.forEach(marker => {
L.marker(marker.coords).addTo(map)
@ -55,7 +57,9 @@ function onLocationFound(e) {
});
// Add a marker for the user's location with the custom red icon
const userMarker = L.marker(e.latlng, { icon: userIcon }).addTo(map);
const userMarker = L.marker(e.latlng, {
icon: userIcon
}).addTo(map);
userMarker.bindPopup("You are here").openPopup();
// Center the map on the user's location

View File

@ -12,9 +12,11 @@
Route::get('/admin/dashboard', [AdminDashboardController::class, 'index'])->name('admin.home');
Route::get('/admin/data-kursus', [AdminDataKursusController::class, 'dataKursus'])->name('admin.dataKursus');
Route::get('/admin/edit-kursus', [AdminDataKursusController::class, 'edit'])->name('admin.edit');
Route::post('/admin/store', [AdminDataKursusController::class, 'store'])->name('kursus.store');
Route::get('/admin/createData', [AdminDataKursusController::class, 'create'])->name('admin.create');
Route::delete('/admin/delete/{id}', [AdminDataKursusController::class, 'destroy'])->name('delete');
// Route::update('/admin/update/{id}', [AdminDataKursusController::class, 'update'])->name('update');
Route::get('/admin/courses', [AdminDataKursusController::class, 'index']);
// LOGIN

2
storage/app/public/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore