Merge branch 'main' of https://git.abbauf.com/Magang-2025/Undangan
This commit is contained in:
commit
c72c80bbd1
@ -63,7 +63,7 @@ class TemplateApiController extends Controller
|
|||||||
try {
|
try {
|
||||||
// Coba tanpa relationship dulu untuk debug
|
// Coba tanpa relationship dulu untuk debug
|
||||||
$templates = Template::inRandomOrder()
|
$templates = Template::inRandomOrder()
|
||||||
->take(6)
|
->take(8)
|
||||||
->get()
|
->get()
|
||||||
->map(function($t){
|
->map(function($t){
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -83,10 +83,11 @@
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.site-footer {
|
.site-footer {
|
||||||
background-color: #f0f2f5; /* Warna abu-abu muda */
|
width: 100%;
|
||||||
|
background-color: #f0f2f5;
|
||||||
color: #333;
|
color: #333;
|
||||||
padding: 50px 0 20px 0;
|
padding: 50px 0 20px 0;
|
||||||
font-family: 'Inter', sans-serif; /* Menggunakan font yang terlihat modern */
|
font-family: 'Inter', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="flex flex-col min-h-screen">
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main class="flex-1">
|
||||||
<div class="max-w-7xl mx-auto px-4 py-8">
|
<div class="max-w-7xl mx-auto px-4 py-8">
|
||||||
<!-- Back button -->
|
<!-- Back button -->
|
||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
@ -15,7 +18,7 @@
|
|||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<h1 class="text-3xl md:text-4xl font-bold text-center text-gray-800">
|
<h1 class="text-3xl md:text-4xl font-bold text-center text-gray-800">
|
||||||
Pilih Template Favoritmu
|
Pilih Kategori Favoritmu
|
||||||
</h1>
|
</h1>
|
||||||
<p class="mt-2 text-center text-gray-500">
|
<p class="mt-2 text-center text-gray-500">
|
||||||
Tersedia berbagai desain undangan pernikahan, khitan, ulang tahun, dan lainnya.
|
Tersedia berbagai desain undangan pernikahan, khitan, ulang tahun, dan lainnya.
|
||||||
@ -30,26 +33,31 @@
|
|||||||
<!-- Kategori Grid -->
|
<!-- Kategori Grid -->
|
||||||
<div
|
<div
|
||||||
v-else-if="categories.length > 0"
|
v-else-if="categories.length > 0"
|
||||||
class="mt-12 flex flex-wrap justify-center gap-6"
|
class="mt-12 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="category in categories"
|
v-for="category in categories"
|
||||||
:key="category.id + '-' + category.foto"
|
:key="category.id + '-' + category.foto"
|
||||||
@click="onCategoryClick(category)"
|
@click="onCategoryClick(category)"
|
||||||
class="group cursor-pointer relative overflow-hidden rounded-lg shadow-lg hover:shadow-2xl transition-all duration-300 w-72"
|
class="group cursor-pointer bg-white rounded-xl overflow-hidden shadow-md hover:shadow-xl transition-all duration-300"
|
||||||
>
|
>
|
||||||
|
<!-- Image -->
|
||||||
|
<div class="relative w-full aspect-[4/5] overflow-hidden">
|
||||||
<img
|
<img
|
||||||
v-if="category.foto"
|
v-if="category.foto"
|
||||||
:src="`http://localhost:8000${category.foto}`"
|
:src="`http://localhost:8000${category.foto}`"
|
||||||
:alt="category.nama"
|
:alt="category.nama"
|
||||||
class="w-full h-96 object-cover transition-transform duration-300 group-hover:scale-110"
|
class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||||
>
|
>
|
||||||
<div class="absolute inset-0 bg-gradient-to-t from-black/70 via-black/40 to-transparent"></div>
|
<div class="absolute inset-0 bg-gradient-to-t from-black/60 via-black/30 to-transparent"></div>
|
||||||
<div class="absolute inset-0 flex flex-col justify-center items-start px-4 text-white">
|
<h3 class="absolute bottom-3 left-3 text-xl font-semibold text-white drop-shadow-lg">
|
||||||
<h3 class="text-xl font-semibold mb-2">
|
|
||||||
{{ category.nama }}
|
{{ category.nama }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-lg font-normal leading-snug whitespace-normal break-words max-w-[90%]">
|
</div>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<div class="p-4">
|
||||||
|
<p class="text-gray-600 text-sm leading-snug line-clamp-3">
|
||||||
{{ category.deskripsi }}
|
{{ category.deskripsi }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -60,22 +68,32 @@
|
|||||||
Belum ada kategori.
|
Belum ada kategori.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Header Templates -->
|
||||||
|
<div class="mt-20 text-center">
|
||||||
|
<h2 class="text-2xl md:text-3xl font-bold text-gray-800">
|
||||||
|
Semua Template yang Ada
|
||||||
|
</h2>
|
||||||
|
<p class="mt-2 text-gray-500">
|
||||||
|
Pilih template terbaik sesuai kebutuhan undanganmu.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Templates Grid -->
|
<!-- Templates Grid -->
|
||||||
<div v-if="!isLoadingRandom" class="mt-25">
|
<div v-if="!isLoadingRandom" class="mt-12">
|
||||||
<!-- Kalau kosong -->
|
<!-- Kalau kosong -->
|
||||||
<div v-if="randomTemplates.length === 0" class="text-center text-gray-500">
|
<div v-if="randomTemplates.length === 0" class="text-center text-gray-500 ">
|
||||||
Belum ada template tersedia.
|
Belum ada template tersedia.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Kalau ada -->
|
<!-- Kalau ada -->
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"
|
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6 items-start"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="t in randomTemplates"
|
v-for="t in randomTemplates"
|
||||||
:key="t.id"
|
:key="t.id"
|
||||||
class="bg-white border rounded-lg overflow-hidden shadow-md hover:shadow-xl transition-shadow duration-300"
|
class="bg-white border rounded-lg overflow-hidden shadow-md hover:shadow-xl transition-shadow duration-300 items-start"
|
||||||
>
|
>
|
||||||
<!-- Image -->
|
<!-- Image -->
|
||||||
<img
|
<img
|
||||||
@ -136,7 +154,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<LandingPageFooter />
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<LandingPageFooter class="w-full" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -178,7 +200,6 @@ const fetchRandomTemplates = async () => {
|
|||||||
try {
|
try {
|
||||||
const res = await $fetch('http://localhost:8000/api/templates/random')
|
const res = await $fetch('http://localhost:8000/api/templates/random')
|
||||||
randomTemplates.value = res
|
randomTemplates.value = res
|
||||||
console.log('Random templates:', res) // debug
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Gagal fetch random templates', err)
|
console.error('Gagal fetch random templates', err)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user