Compare commits
2 Commits
024c9b243f
...
29de22c0d0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29de22c0d0 | ||
|
|
6eaa82f652 |
@ -1,37 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-6 text-center max-w-2xl mx-auto relative">
|
<div class="p-6 text-center max-w-2xl mx-auto relative">
|
||||||
<h2 class="text-4xl font-bold bg-gradient-to-r from-orange-600 to-yellow-600 bg-clip-text text-transparent mb-8">
|
<h2 class="text-4xl font-bold bg-gradient-to-r from-orange-600 to-yellow-600 bg-clip-text text-transparent mb-8">
|
||||||
💌 Buku Tamu 💌
|
💌 Guest Book 💌
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<!-- 🎈 Balon Kiri -->
|
<!-- 🎈 Balon Kiri -->
|
||||||
<img src="/balloon2.png" alt="Balloons Left"
|
<img
|
||||||
class="absolute w-32 md:w-40 -top-12 -left-7.5 animate-swing-top pointer-events-none select-none" />
|
src="/balloon2.png"
|
||||||
|
alt="Balloons Left"
|
||||||
|
class="absolute w-32 md:w-40 -top-12 -left-7.5 animate-swing-top pointer-events-none select-none"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 🎈 Balon Kanan -->
|
<!-- 🎈 Balon Kanan -->
|
||||||
<img src="/balloon2.png" alt="Balloons Right"
|
<img
|
||||||
class="absolute w-32 md:w-40 -top-12 -right-10.5 animate-swing-top pointer-events-none select-none" />
|
src="/balloon2.png"
|
||||||
|
alt="Balloons Right"
|
||||||
|
class="absolute w-32 md:w-40 -top-12 -right-10.5 animate-swing-top pointer-events-none select-none"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 💌 Form RSVP -->
|
<!-- 💌 Form RSVP -->
|
||||||
<div class="bg-white/80 backdrop-blur-lg rounded-2xl p-8 shadow-xl border border-yellow-100 mb-8 relative z-10">
|
<div
|
||||||
|
class="bg-white/80 backdrop-blur-lg rounded-2xl p-8 shadow-xl border border-yellow-100 mb-8 relative z-10"
|
||||||
|
>
|
||||||
<form @submit.prevent="submitMessage" class="space-y-4">
|
<form @submit.prevent="submitMessage" class="space-y-4">
|
||||||
<!-- Nama Tamu -->
|
<!-- Nama Tamu -->
|
||||||
<div>
|
<div>
|
||||||
<input v-model="form.name" type="text" :placeholder="guest || 'Nama Lengkap Tamu'"
|
<input
|
||||||
|
v-model="form.name"
|
||||||
|
type="text"
|
||||||
|
:placeholder="guest || 'Nama Lengkap Tamu'"
|
||||||
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300"
|
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300"
|
||||||
:disabled="!!guest" />
|
:disabled="!!guest"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Pesan/Ucapan -->
|
<!-- Pesan/Ucapan -->
|
||||||
<div>
|
<div>
|
||||||
<textarea v-model="form.message" rows="4" placeholder="Tulis ucapan dan harapan terbaik..."
|
<textarea
|
||||||
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300 resize-none"></textarea>
|
v-model="form.message"
|
||||||
|
rows="4"
|
||||||
|
placeholder="Tulis ucapan dan harapan terbaik..."
|
||||||
|
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300 resize-none"
|
||||||
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Status Kehadiran -->
|
<!-- Status Kehadiran -->
|
||||||
<div>
|
<div>
|
||||||
<select v-model="form.attendance"
|
<select
|
||||||
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300 appearance-none bg-white">
|
v-model="form.attendance"
|
||||||
|
class="w-full p-4 border-2 border-yellow-300 rounded-2xl focus:ring-2 focus:ring-orange-400 focus:border-orange-400 transition-all duration-300 appearance-none bg-white"
|
||||||
|
>
|
||||||
<option value="hadir">✅ Saya Hadir</option>
|
<option value="hadir">✅ Saya Hadir</option>
|
||||||
<option value="tidak_hadir">❌ Tidak Hadir</option>
|
<option value="tidak_hadir">❌ Tidak Hadir</option>
|
||||||
<option value="mungkin">🤔 Mungkin Hadir</option>
|
<option value="mungkin">🤔 Mungkin Hadir</option>
|
||||||
@ -39,13 +57,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Error Message -->
|
<!-- Error Message -->
|
||||||
<div v-if="errorMessage" class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-xl">
|
<div
|
||||||
|
v-if="errorMessage"
|
||||||
|
class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-xl"
|
||||||
|
>
|
||||||
{{ errorMessage }}
|
{{ errorMessage }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Submit Button -->
|
<!-- Submit Button -->
|
||||||
<button type="submit" :disabled="!form.name.trim() || !form.message.trim() || submitLoading"
|
<button
|
||||||
class="bg-gradient-to-r from-orange-500 to-yellow-500 hover:from-orange-600 hover:to-yellow-600 text-white px-8 py-4 rounded-full font-semibold shadow-lg transition-all duration-300 transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed w-full text-lg">
|
type="submit"
|
||||||
|
:disabled="!form.name.trim() || !form.message.trim() || submitLoading"
|
||||||
|
class="bg-gradient-to-r from-orange-500 to-yellow-500 hover:from-orange-600 hover:to-yellow-600 text-white px-8 py-4 rounded-full font-semibold shadow-lg transition-all duration-300 transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed w-full text-lg"
|
||||||
|
>
|
||||||
✨ {{ submitLoading ? 'Mengirim...' : 'Kirim RSVP' }}
|
✨ {{ submitLoading ? 'Mengirim...' : 'Kirim RSVP' }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@ -58,16 +82,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="space-y-4 max-h-96 overflow-y-auto px-2 relative z-10">
|
<div v-else class="space-y-4 max-h-96 overflow-y-auto px-2 relative z-10">
|
||||||
<div v-for="(msg, i) in messages" :key="msg.id || i"
|
<div class="space-y-4">
|
||||||
class="bg-white/80 backdrop-blur-md p-6 rounded-2xl shadow-lg border-l-4 border-orange-400 transform hover:scale-105 transition-all duration-300">
|
<div v-for="msg in messages" :key="msg.id" class="bg-white rounded-xl shadow-md p-4 text-left">
|
||||||
<div class="flex items-start justify-between mb-2">
|
<div class="flex items-center justify-between mb-2">
|
||||||
<span class="font-bold text-orange-800 text-lg">{{ msg.nama }}</span>
|
<span class="font-bold text-orange-800">{{ msg.nama }}</span>
|
||||||
<span :class="getAttendanceClass(msg.status_kehadiran)" class="px-3 py-1 rounded-full text-sm font-semibold">
|
<span :class="getAttendanceClass(msg.status_kehadiran)" class="text-sm px-2 py-1 rounded-lg">
|
||||||
{{ formatAttendance(msg.status_kehadiran) }}
|
{{ formatAttendance(msg.status_kehadiran) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-gray-700 text-left">{{ msg.pesan }}</p>
|
<p class="text-gray-700">{{ msg.pesan }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="messages.length === 0" class="bg-white/60 p-8 rounded-2xl">
|
<div v-if="messages.length === 0" class="bg-white/60 p-8 rounded-2xl">
|
||||||
<p class="text-gray-600 text-lg">
|
<p class="text-gray-600 text-lg">
|
||||||
@ -86,27 +111,20 @@ const route = useRoute();
|
|||||||
const config = useRuntimeConfig();
|
const config = useRuntimeConfig();
|
||||||
const backendUrl = config.public.apiBaseUrl;
|
const backendUrl = config.public.apiBaseUrl;
|
||||||
const invitationCode = route.params.code || '';
|
const invitationCode = route.params.code || '';
|
||||||
const guest = route.query.guest
|
const guest = route.query.code
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
const messages = ref([]);
|
messages: {
|
||||||
const form = ref({ name: '', message: '', attendance: 'hadir' });
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default: () => []
|
||||||
// Fungsi untuk mengambil daftar RSVP dari backend
|
|
||||||
const fetchMessages = async () => {
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${backendUrl}/api/rsvp/${invitationCode}`);
|
|
||||||
if (!response.ok) throw new Error('Gagal mengambil data RSVP');
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
messages.value = data.data || [];
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error mengambil RSVP:', error);
|
|
||||||
alert('Terjadi kesalahan saat mengambil data RSVP.');
|
|
||||||
}
|
}
|
||||||
};
|
})
|
||||||
|
|
||||||
|
const messages = ref([...props.messages])
|
||||||
|
|
||||||
|
|
||||||
|
const form = ref({ name: '', message: '', attendance: 'hadir' });
|
||||||
|
|
||||||
// Fungsi untuk mengirim data RSVP ke backend
|
// Fungsi untuk mengirim data RSVP ke backend
|
||||||
const submitMessage = async () => {
|
const submitMessage = async () => {
|
||||||
@ -123,6 +141,7 @@ const submitMessage = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
console.log('POST to:', `${backendUrl}/api/rsvp/${invitationCode}`, payload)
|
||||||
const response = await fetch(`${backendUrl}/api/rsvp/${invitationCode}`, {
|
const response = await fetch(`${backendUrl}/api/rsvp/${invitationCode}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -137,12 +156,13 @@ const submitMessage = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Gagal menyimpan RSVP');
|
console.log(response)
|
||||||
|
throw new Error(`Gagal menyimpan RSVP,${response.errors}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
messages.value.push(result.data); // Tambahkan RSVP baru ke daftar
|
messages.value.push(result.data); // Tambahkan RSVP baru ke daftar
|
||||||
form.value = { name: '', message: '', attendance: 'yes' }; // Reset form
|
form.value = { name: '', message: '', attendance: 'hadir' };
|
||||||
alert(result.message); // Tampilkan pesan sukses dari backend
|
alert(result.message); // Tampilkan pesan sukses dari backend
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error menyimpan RSVP:', error);
|
console.error('Error menyimpan RSVP:', error);
|
||||||
@ -153,11 +173,11 @@ const submitMessage = async () => {
|
|||||||
// Fungsi untuk mengatur kelas CSS berdasarkan status kehadiran
|
// Fungsi untuk mengatur kelas CSS berdasarkan status kehadiran
|
||||||
const getAttendanceClass = (attendance) => {
|
const getAttendanceClass = (attendance) => {
|
||||||
switch (attendance) {
|
switch (attendance) {
|
||||||
case 'yes':
|
case 'iya':
|
||||||
return 'bg-green-100 text-green-700';
|
return 'bg-green-100 text-green-700';
|
||||||
case 'no':
|
case 'tidak':
|
||||||
return 'bg-red-100 text-red-700';
|
return 'bg-red-100 text-red-700';
|
||||||
case 'maybe':
|
case 'mungkin':
|
||||||
return 'bg-yellow-100 text-yellow-700';
|
return 'bg-yellow-100 text-yellow-700';
|
||||||
default:
|
default:
|
||||||
return 'bg-gray-100 text-gray-700';
|
return 'bg-gray-100 text-gray-700';
|
||||||
@ -167,33 +187,25 @@ const getAttendanceClass = (attendance) => {
|
|||||||
// Fungsi untuk memformat teks kehadiran
|
// Fungsi untuk memformat teks kehadiran
|
||||||
const formatAttendance = (attendance) => {
|
const formatAttendance = (attendance) => {
|
||||||
switch (attendance) {
|
switch (attendance) {
|
||||||
case 'yes':
|
case 'iya':
|
||||||
return 'Hadir';
|
return 'Hadir';
|
||||||
case 'no':
|
case 'tidak':
|
||||||
return 'Tidak Hadir';
|
return 'Tidak Hadir';
|
||||||
case 'maybe':
|
case 'mungkin':
|
||||||
return 'Mungkin';
|
return 'Mungkin';
|
||||||
default:
|
default:
|
||||||
return attendance;
|
return attendance;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Panggil fetchMessages saat komponen dimuat
|
|
||||||
onMounted(() => {
|
|
||||||
fetchMessages();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@keyframes swing-top {
|
@keyframes swing-top {
|
||||||
0% {
|
0% {
|
||||||
transform: rotate(2deg);
|
transform: rotate(2deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
transform: rotate(-2deg);
|
transform: rotate(-2deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
transform: rotate(2deg);
|
transform: rotate(2deg);
|
||||||
}
|
}
|
||||||
@ -202,6 +214,5 @@ onMounted(() => {
|
|||||||
.animate-swing-top {
|
.animate-swing-top {
|
||||||
animation: swing-top 4s ease-in-out infinite;
|
animation: swing-top 4s ease-in-out infinite;
|
||||||
transform-origin: bottom center;
|
transform-origin: bottom center;
|
||||||
/* ✅ Balon berayun dari bawah (tali diam) */
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -9,81 +9,58 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
<nav
|
<nav v-if="currentSection !== 'landing'"
|
||||||
v-if="currentSection !== 'landing'"
|
class="fixed top-6 left-1/2 transform -translate-x-1/2 z-20 animate-fade-in">
|
||||||
class="fixed top-6 left-1/2 transform -translate-x-1/2 z-20 animate-fade-in"
|
|
||||||
>
|
|
||||||
<ul
|
<ul
|
||||||
class="flex space-x-2 bg-white/70 backdrop-blur-lg px-6 py-3 rounded-full shadow-lg text-sm font-semibold text-gray-800 border border-yellow-200"
|
class="flex space-x-2 bg-white/70 backdrop-blur-lg px-6 py-3 rounded-full shadow-lg text-sm font-semibold text-gray-800 border border-yellow-200">
|
||||||
>
|
<li><button @click="switchSection('introduction')" :class="navClass('introduction')"
|
||||||
<li><button @click="switchSection('introduction')" :class="navClass('introduction')" class="px-3 py-1 rounded-full transition-all duration-300">Intro</button></li>
|
class="px-3 py-1 rounded-full transition-all duration-300">Intro</button></li>
|
||||||
<li><button @click="switchSection('event')" :class="navClass('event')" class="px-3 py-1 rounded-full transition-all duration-300">Event</button></li>
|
<li><button @click="switchSection('event')" :class="navClass('event')"
|
||||||
<li><button @click="switchSection('gallery')" :class="navClass('gallery')" class="px-3 py-1 rounded-full transition-all duration-300">Galeri</button></li>
|
class="px-3 py-1 rounded-full transition-all duration-300">Event</button></li>
|
||||||
<li><button @click="switchSection('guestbook')" :class="navClass('guestbook')" class="px-3 py-1 rounded-full transition-all duration-300">Buku Tamu</button></li>
|
<li><button @click="switchSection('gallery')" :class="navClass('gallery')"
|
||||||
<li><button @click="switchSection('thanks')" :class="navClass('thanks')" class="px-3 py-1 rounded-full transition-all duration-300">Terima Kasih</button></li>
|
class="px-3 py-1 rounded-full transition-all duration-300">Galeri</button></li>
|
||||||
|
<li><button @click="switchSection('guestbook')" :class="navClass('guestbook')"
|
||||||
|
class="px-3 py-1 rounded-full transition-all duration-300">Guest Book</button></li>
|
||||||
|
<li><button @click="switchSection('thanks')" :class="navClass('thanks')"
|
||||||
|
class="px-3 py-1 rounded-full transition-all duration-300">Terima Kasih</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- Tombol Musik -->
|
<!-- Tombol Musik -->
|
||||||
<div class="fixed bottom-6 left-6 z-30" v-if="currentSection !== 'landing'">
|
<div class="fixed bottom-6 left-6 z-30" v-if="currentSection !== 'landing'">
|
||||||
<button
|
<button @click="toggleMusic"
|
||||||
@click="toggleMusic"
|
class="bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-yellow-600 hover:to-orange-600 p-4 rounded-full text-white shadow-xl transition-all duration-300 hover:scale-110 hover:shadow-2xl">
|
||||||
class="bg-gradient-to-r from-yellow-500 to-orange-500 hover:from-yellow-600 hover:to-orange-600 p-4 rounded-full text-white shadow-xl transition-all duration-300 hover:scale-110 hover:shadow-2xl"
|
|
||||||
>
|
|
||||||
<span class="text-lg">{{ isPlaying ? '⏸️' : '▶️' }}</span>
|
<span class="text-lg">{{ isPlaying ? '⏸️' : '▶️' }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Main Section -->
|
<!-- Main Section -->
|
||||||
<main
|
<main
|
||||||
class="relative z-10 min-h-screen flex items-center justify-center p-4 transition-all duration-700 ease-in-out"
|
class="relative z-10 min-h-screen flex items-center justify-center p-4 transition-all duration-700 ease-in-out">
|
||||||
>
|
|
||||||
<!-- Landing -->
|
<!-- Landing -->
|
||||||
<Landing
|
<Landing v-if="currentSection === 'landing' && tamu" :childName="formData.nama_panggilan"
|
||||||
v-if="currentSection === 'landing' && tamu"
|
|
||||||
:childName="formData.nama_panggilan"
|
|
||||||
:guestName="route.query.guest || tamu.nama_tamu || 'Tamu Undangan'"
|
:guestName="route.query.guest || tamu.nama_tamu || 'Tamu Undangan'"
|
||||||
@open-invitation="switchSection('introduction')"
|
@open-invitation="switchSection('introduction')" @toggle-music="toggleMusic" />
|
||||||
@toggle-music="toggleMusic"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Introduction -->
|
<!-- Introduction -->
|
||||||
<Introduction
|
<Introduction v-if="currentSection === 'introduction'" :age="formData.umur_yang_dirayakan"
|
||||||
v-if="currentSection === 'introduction'"
|
:childName="formData.nama_lengkap" :childOrder="formData.anak_ke"
|
||||||
:age="formData.umur_yang_dirayakan"
|
|
||||||
:childName="formData.nama_lengkap"
|
|
||||||
:childOrder="formData.anak_ke"
|
|
||||||
:parentsName="`${formData.nama_bapak} & ${formData.nama_ibu}`"
|
:parentsName="`${formData.nama_bapak} & ${formData.nama_ibu}`"
|
||||||
:childPhoto="formData.foto && formData.foto.length ? `${backendUrl}/storage/${formData.foto[0]}` : null"
|
:childPhoto="formData.foto && formData.foto.length ? `${backendUrl}/storage/${formData.foto[0]}` : null" />
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Event -->
|
<!-- Event -->
|
||||||
<Event
|
<Event v-if="currentSection === 'event'" :hari_tanggal_acara="formData.hari_tanggal_acara" :waktu="formData.waktu"
|
||||||
v-if="currentSection === 'event'"
|
:alamat="formData.alamat" :link_gmaps="formData.link_gmaps" :hitung_mundur="formData.hitung_mundur" />
|
||||||
:hari_tanggal_acara="formData.hari_tanggal_acara"
|
|
||||||
:waktu="formData.waktu"
|
|
||||||
:alamat="formData.alamat"
|
|
||||||
:link_gmaps="formData.link_gmaps"
|
|
||||||
:hitung_mundur="formData.hitung_mundur"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Gallery -->
|
<!-- Gallery -->
|
||||||
<Gallery v-if="currentSection === 'gallery'" :images="galleryImages" />
|
<Gallery v-if="currentSection === 'gallery'" :images="galleryImages" />
|
||||||
|
|
||||||
<!-- Guest Book -->
|
<!-- Guest Book -->
|
||||||
<GuestBook
|
<GuestBook v-if="currentSection === 'guestbook'" :guestName="tamu.nama_tamu || 'Tamu Undangan'" :messages="messages"
|
||||||
v-if="currentSection === 'guestbook'"
|
@addMessage="addMessage" />
|
||||||
:guestName="route.query.guest || tamu.nama_tamu || 'Tamu Undangan'"
|
|
||||||
:messages="messages"
|
|
||||||
@addMessage="addMessage"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Thank You -->
|
<!-- Thank You -->
|
||||||
<ThankYou
|
<ThankYou v-if="currentSection === 'thanks'" :childName="formData.nama_panggilan" :jsonData="formData" />
|
||||||
v-if="currentSection === 'thanks'"
|
|
||||||
:childName="formData.nama_panggilan"
|
|
||||||
:jsonData="formData"
|
|
||||||
/>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -113,7 +90,7 @@ const route = useRoute()
|
|||||||
|
|
||||||
// Data dari backend
|
// Data dari backend
|
||||||
const formData = computed(() => props.data.form || {})
|
const formData = computed(() => props.data.form || {})
|
||||||
const messages = computed(() => props.data.rsvp || [])
|
const messages = ref(props.data.rsvp || [])
|
||||||
|
|
||||||
// Galeri gambar (support foto array atau field lama)
|
// Galeri gambar (support foto array atau field lama)
|
||||||
const galleryImages = computed(() => {
|
const galleryImages = computed(() => {
|
||||||
@ -167,8 +144,15 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fade-in {
|
@keyframes fade-in {
|
||||||
from { opacity: 0; transform: translateY(-10px); }
|
from {
|
||||||
to { opacity: 1; transform: translateY(0); }
|
opacity: 0;
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-fade-in {
|
.animate-fade-in {
|
||||||
|
|||||||
@ -12,12 +12,41 @@
|
|||||||
<section class="mb-8">
|
<section class="mb-8">
|
||||||
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">📋 Data Pemesan</h2>
|
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">📋 Data Pemesan</h2>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
<input v-model="form.nama_pemesan" type="text" placeholder="Nama Pemesan"
|
<!-- Nama Pemesan -->
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<div class="relative">
|
||||||
<input v-model="form.email" type="email" placeholder="Email"
|
<input v-model="form.nama_pemesan" type="text" placeholder=" " required
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
<input v-model="form.no_tlpn" type="text" placeholder="No Telepon"
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Nama Pemesan
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Email -->
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.email" type="email" placeholder=" " required
|
||||||
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Email
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- No Telepon -->
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.no_tlpn" type="text" placeholder=" " required
|
||||||
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
No Telepon
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -25,19 +54,25 @@
|
|||||||
<section class="mb-8">
|
<section class="mb-8">
|
||||||
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">🎉 Data Anak</h2>
|
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">🎉 Data Anak</h2>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
<div>
|
<div class="grid gap-4">
|
||||||
<div class="grid gap-2">
|
<template v-for="(field, i) in [
|
||||||
<input v-model="form.form.nama_lengkap" placeholder="Nama Lengkap"
|
{ key: 'nama_lengkap', label: 'Nama Lengkap' },
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
{ key: 'nama_panggilan', label: 'Nama Panggilan' },
|
||||||
<input v-model="form.form.nama_panggilan" placeholder="Nama Panggilan"
|
{ key: 'nama_bapak', label: 'Nama Bapak' },
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
{ key: 'nama_ibu', label: 'Nama Ibu' },
|
||||||
<input v-model="form.form.nama_bapak" placeholder="Nama Bapak"
|
{ key: 'umur_yang_dirayakan', label: 'Umur Yang Dirayakan', type: 'number' }
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
]" :key="i">
|
||||||
<input v-model="form.form.nama_ibu" placeholder="Nama Ibu"
|
<div class="relative">
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<input v-model="form.form[field.key]" :type="field.type || 'text'" required placeholder=" "
|
||||||
<input v-model="form.form.umur_yang_dirayakan" type="number" placeholder="Umur Yang Dirayakan"
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
</div>
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
{{ field.label }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -46,29 +81,108 @@
|
|||||||
<section class="mb-8">
|
<section class="mb-8">
|
||||||
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">📅 Detail Acara</h2>
|
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">📅 Detail Acara</h2>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<input v-model="form.form.hari_tanggal_acara" type="date" placeholder="Hari & Tanggal Acara"
|
<div class="relative">
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<input v-model="form.form.hari_tanggal_acara" type="date" required placeholder=" " class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm
|
||||||
<input v-model="form.form.waktu" type="text" placeholder="Waktu"
|
focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<label class="absolute left-2 text-gray-400 transition-all
|
||||||
<textarea v-model="form.form.alamat" rows="4" placeholder="Alamat"
|
peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition resize-none"></textarea>
|
peer-focus:top-0 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
<input v-model="form.form.link_gmaps" type="text" placeholder="Link Gmaps"
|
peer-valid:top-0 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
Hari & Tanggal Acara
|
||||||
<input v-model="form.form.hitung_mundur" type="datetime-local" placeholder="Hitung Mundur Waktu Acara"
|
</label>
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
</div>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.form.waktu" type="time" required placeholder=" " class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm
|
||||||
|
focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-2 text-gray-400 transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Waktu Acara
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative md:col-span-2">
|
||||||
|
<textarea v-model="form.form.alamat" rows="4" required placeholder=" "
|
||||||
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Alamat
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative md:col-span-2">
|
||||||
|
<input v-model="form.form.link_gmaps" type="text" required placeholder=" "
|
||||||
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Link Gmaps
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.form.hitung_mundur_mulai" type="datetime-local" required placeholder=" " class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm
|
||||||
|
focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Hitung Mundur Mulai
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.form.hitung_mundur_selesai" type="datetime-local" required placeholder=" " class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm
|
||||||
|
focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Hitung Mundur Selesai
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Pesan & Rekening -->
|
<!-- Pesan & Rekening -->
|
||||||
<section class="mb-8">
|
<section class="mb-8">
|
||||||
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">💌 Pesan & Rekening</h2>
|
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">💌 Pesan & Rekening</h2>
|
||||||
<textarea v-model="form.form.say_something" rows="4" placeholder="Say Something..."
|
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition resize-none"></textarea>
|
<!-- Say Something -->
|
||||||
|
<section class="mb-8">
|
||||||
|
<textarea v-model="form.form.say_something" rows="4" placeholder="Kata-kata spesial atau pesan untuk tamu..."
|
||||||
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition resize-none"></textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div class="grid md:grid-cols-1 gap-4 mt-4">
|
<div class="grid md:grid-cols-1 gap-4 mt-4">
|
||||||
<input v-model="form.form.rekening_1" placeholder="Rekening 1"
|
<div class="relative">
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<input v-model="form.form.rekening_1" placeholder=" " required
|
||||||
<input v-model="form.form.link_music" placeholder="Link Music (opsional)"
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
|
||||||
|
Rekening 1
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="grid md:grid-cols-1 gap-4 mt-4">
|
||||||
|
<div class="relative">
|
||||||
|
<input v-model="form.form.link_music" placeholder=" " required
|
||||||
|
class="peer w-full border border-gray-300 rounded-lg px-2.5 pt-4 pb-1.5 text-sm focus:ring-2 focus:ring-blue-400 focus:border-blue-400 outline-none transition" />
|
||||||
|
<label class="absolute left-1 top-0 text-gray-400 text-xs transition-all
|
||||||
|
peer-placeholder-shown:top-4 peer-placeholder-shown:left-2 peer-placeholder-shown:text-gray-400 peer-placeholder-shown:text-sm
|
||||||
|
peer-focus:top-0 peer-focus:left-1 peer-focus:text-[10px] peer-focus:text-blue-500
|
||||||
|
peer-valid:top-0 peer-valid:left-1 peer-valid:text-[10px] peer-valid:text-gray-500">
|
||||||
|
Link Music (opsional)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -76,43 +190,23 @@
|
|||||||
<section class="mb-8">
|
<section class="mb-8">
|
||||||
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">🖼️ Galeri Foto</h2>
|
<h2 class="font-semibold text-blue-600 mb-3 border-b pb-1">🖼️ Galeri Foto</h2>
|
||||||
<div
|
<div
|
||||||
class="border-2 border-dashed border-gray-300 rounded-xl p-8 flex flex-col justify-center items-center text-gray-400 hover:border-blue-400 hover:text-blue-500 transition"
|
class="border-2 border-dashed border-gray-300 rounded-xl p-8 flex flex-col justify-center items-center text-gray-400 hover:border-blue-400 hover:text-blue-500 transition">
|
||||||
>
|
<input id="gallery" type="file" multiple accept="image/*" class="hidden" @change="handleFileChange" />
|
||||||
<input
|
|
||||||
id="gallery"
|
|
||||||
type="file"
|
|
||||||
multiple
|
|
||||||
accept="image/*"
|
|
||||||
class="hidden"
|
|
||||||
@change="handleFileChange"
|
|
||||||
/>
|
|
||||||
<label v-if="!previews.length" for="gallery" class="cursor-pointer flex flex-col items-center">
|
<label v-if="!previews.length" for="gallery" class="cursor-pointer flex flex-col items-center">
|
||||||
<span class="text-4xl font-bold">+</span>
|
<span class="text-4xl font-bold">+</span>
|
||||||
<span class="text-sm mt-2">Pilih Foto (maks. 4, JPEG/PNG, maks. 2MB)</span>
|
<span class="text-sm mt-2">Pilih Foto (maks. 4, JPEG/PNG, maks. 2MB)</span>
|
||||||
</label>
|
</label>
|
||||||
<div v-else class="grid grid-cols-2 sm:grid-cols-4 gap-4">
|
<div v-else class="grid grid-cols-3 sm:grid-cols-4 gap-4">
|
||||||
<div
|
<div v-for="(src, i) in previews" :key="i" class="relative group">
|
||||||
v-for="(src, i) in previews"
|
<img :src="src" class="w-24 h-24 object-cover rounded-lg border shadow" />
|
||||||
:key="i"
|
<button @click="removeFile(i)"
|
||||||
class="relative group"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
:src="src"
|
|
||||||
class="w-24 h-24 object-cover rounded-lg border shadow"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
@click="removeFile(i)"
|
|
||||||
class="absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs opacity-0 group-hover:opacity-100 transition"
|
class="absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs opacity-0 group-hover:opacity-100 transition"
|
||||||
title="Hapus foto"
|
title="Hapus foto">
|
||||||
>
|
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<label
|
<label v-if="previews.length < 4" for="gallery"
|
||||||
v-if="previews.length < 4"
|
class="cursor-pointer flex flex-col items-center justify-center w-24 h-24 border-2 border-dashed border-gray-300 rounded-lg text-gray-400 hover:border-blue-400 hover:text-blue-500 transition">
|
||||||
for="gallery"
|
|
||||||
class="cursor-pointer flex flex-col items-center justify-center w-24 h-24 border-2 border-dashed border-gray-300 rounded-lg text-gray-400 hover:border-blue-400 hover:text-blue-500 transition"
|
|
||||||
>
|
|
||||||
<span class="text-3xl font-bold">+</span>
|
<span class="text-3xl font-bold">+</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@ -121,12 +215,10 @@
|
|||||||
|
|
||||||
<!-- Tombol -->
|
<!-- Tombol -->
|
||||||
<div class="text-end mt-6">
|
<div class="text-end mt-6">
|
||||||
<button @click="batal"
|
<button @click="batal" class="bg-gray-600 text-white font-semibold px-6 py-2 rounded-lg transition mr-2">
|
||||||
class="bg-gray-600 text-white font-semibold px-6 py-2 rounded-lg transition mr-2">
|
|
||||||
Batal
|
Batal
|
||||||
</button>
|
</button>
|
||||||
<button @click="konfirmasi"
|
<button @click="konfirmasi" class="bg-blue-700 text-white font-semibold px-6 py-2 rounded-lg transition">
|
||||||
class="bg-blue-700 text-white font-semibold px-6 py-2 rounded-lg transition">
|
|
||||||
Konfirmasi
|
Konfirmasi
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -137,8 +229,10 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import Swal from 'sweetalert2'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const ADMIN_WA = '62895333053398'
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
nama_pemesan: '',
|
nama_pemesan: '',
|
||||||
@ -154,7 +248,8 @@ const form = ref({
|
|||||||
waktu: '',
|
waktu: '',
|
||||||
alamat: '',
|
alamat: '',
|
||||||
link_gmaps: '',
|
link_gmaps: '',
|
||||||
hitung_mundur: '',
|
hitung_mundur_mulai: '',
|
||||||
|
hitung_mundur_selesai: '',
|
||||||
say_something: '',
|
say_something: '',
|
||||||
rekening_1: '',
|
rekening_1: '',
|
||||||
link_music: ''
|
link_music: ''
|
||||||
@ -175,7 +270,6 @@ const handleFileChange = (e) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
// Validate file size (2MB) and type
|
|
||||||
if (file.size > 2 * 1024 * 1024) {
|
if (file.size > 2 * 1024 * 1024) {
|
||||||
alert(`File ${file.name} terlalu besar! Maksimal 2MB.`)
|
alert(`File ${file.name} terlalu besar! Maksimal 2MB.`)
|
||||||
return
|
return
|
||||||
@ -187,7 +281,6 @@ const handleFileChange = (e) => {
|
|||||||
form.value.foto.push(file)
|
form.value.foto.push(file)
|
||||||
previews.value.push(URL.createObjectURL(file))
|
previews.value.push(URL.createObjectURL(file))
|
||||||
})
|
})
|
||||||
|
|
||||||
e.target.value = ''
|
e.target.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +291,6 @@ const removeFile = (index) => {
|
|||||||
|
|
||||||
const konfirmasi = async () => {
|
const konfirmasi = async () => {
|
||||||
try {
|
try {
|
||||||
// Basic client-side validation
|
|
||||||
if (!form.value.nama_pemesan || !form.value.email) {
|
if (!form.value.nama_pemesan || !form.value.email) {
|
||||||
alert('Harap isi kolom wajib (Nama Pemesan, Email)!')
|
alert('Harap isi kolom wajib (Nama Pemesan, Email)!')
|
||||||
return
|
return
|
||||||
@ -207,10 +299,9 @@ const konfirmasi = async () => {
|
|||||||
const data = new FormData()
|
const data = new FormData()
|
||||||
data.append('nama_pemesan', form.value.nama_pemesan)
|
data.append('nama_pemesan', form.value.nama_pemesan)
|
||||||
data.append('email', form.value.email)
|
data.append('email', form.value.email)
|
||||||
data.append('no_tlpn', form.value.no_telepon)
|
data.append('no_tlpn', form.value.no_tlpn)
|
||||||
data.append('template_slug', 'undangan-ulang-tahun-basic')
|
data.append('template_slug', 'undangan-ulang-tahun-basic')
|
||||||
|
|
||||||
// Append form fields individually to ensure Laravel receives them as an array
|
|
||||||
for (const [key, value] of Object.entries(form.value.form)) {
|
for (const [key, value] of Object.entries(form.value.form)) {
|
||||||
data.append(`form[${key}]`, value)
|
data.append(`form[${key}]`, value)
|
||||||
}
|
}
|
||||||
@ -240,11 +331,70 @@ const konfirmasi = async () => {
|
|||||||
throw new Error(result.message || 'Gagal mengirim data')
|
throw new Error(result.message || 'Gagal mengirim data')
|
||||||
}
|
}
|
||||||
|
|
||||||
alert(result.message || 'Data berhasil disimpan!')
|
await Swal.fire({
|
||||||
router.push('/')
|
title: '🎉 Berhasil!',
|
||||||
|
text: result.message || 'Data undangan kamu berhasil disimpan.',
|
||||||
|
icon: 'success',
|
||||||
|
confirmButtonText: 'Lanjut ke WhatsApp',
|
||||||
|
confirmButtonColor: '#2563eb',
|
||||||
|
background: '#f9fafb',
|
||||||
|
color: '#111827',
|
||||||
|
showClass: {
|
||||||
|
popup: 'animate__animated animate__fadeInDown'
|
||||||
|
},
|
||||||
|
hideClass: {
|
||||||
|
popup: 'animate__animated animate__fadeOutUp'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const f = form.value
|
||||||
|
const child = f.form
|
||||||
|
|
||||||
|
const message = `
|
||||||
|
Halo Admin 👋,
|
||||||
|
Saya ingin membuat *Undangan Ulang Tahun Basic* 🎂
|
||||||
|
|
||||||
|
📋 *Data Pemesan*
|
||||||
|
- Nama: ${f.nama_pemesan}
|
||||||
|
- Email: ${f.email}
|
||||||
|
- No. Telepon: ${f.no_tlpn}
|
||||||
|
|
||||||
|
🎉 *Data Anak*
|
||||||
|
- Nama Lengkap: ${child.nama_lengkap}
|
||||||
|
- Nama Panggilan: ${child.nama_panggilan}
|
||||||
|
- Umur: ${child.umur_yang_dirayakan} tahun
|
||||||
|
- Bapak: ${child.nama_bapak}
|
||||||
|
- Ibu: ${child.nama_ibu}
|
||||||
|
|
||||||
|
📅 *Detail Acara*
|
||||||
|
- Tanggal: ${child.hari_tanggal_acara}
|
||||||
|
- Waktu: ${child.waktu}
|
||||||
|
- Alamat: ${child.alamat}
|
||||||
|
- Link Gmaps: ${child.link_gmaps || '-'}
|
||||||
|
|
||||||
|
💌 *Pesan Tambahan*
|
||||||
|
${child.say_something || '-'}
|
||||||
|
|
||||||
|
Terima kasih 🙏
|
||||||
|
`
|
||||||
|
|
||||||
|
const encodedMsg = encodeURIComponent(message)
|
||||||
|
const waUrl = `https://wa.me/${ADMIN_WA}?text=${encodedMsg}`
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Membuka WhatsApp...',
|
||||||
|
text: 'Mohon tunggu sebentar ⏳',
|
||||||
|
timer: 1500,
|
||||||
|
timerProgressBar: true,
|
||||||
|
showConfirmButton: false,
|
||||||
|
willClose: () => {
|
||||||
|
window.open(waUrl, '_blank')
|
||||||
|
router.push('/')
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
alert('Terjadi kesalahan: ' + err.message)
|
Swal.fire('❌ Gagal', err.message, 'error')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user