%PDF- %PDF-
| Direktori : /home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/ |
| Current File : //home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/LayananView.tsx |
import React, { useState, useEffect } from 'react';
import {
Search, Plus, ChevronDown, Filter, Bookmark, Copy, MoreVertical,
Edit, ArrowUp, ArrowDown, Layers, Sparkles, Calendar,
Clock, Users, Box, Tag, Eye, RotateCcw, X, LayoutGrid, List,
Star, Wallet, Share2, RefreshCw, SlidersHorizontal, Check,
ChevronLeft, ChevronRight, Image as ImageIcon, Info, FileText,
UploadCloud, Trash2, Pencil, Folder, Shield, User, ChevronRight as ChevronRightSmall,
Sparkles as SparklesIcon, CheckCircle2, AlertCircle
} from 'lucide-react';
interface LayananViewProps {
initialSubView?: 'katalog' | 'tambah';
triggerToast: (msg: string) => void;
}
interface TagBadge {
label: string;
bg: string;
}
interface ServiceItem {
id: string;
title: string;
categoryKey: string;
topBadge: 'Paket' | 'Layanan' | 'Add-On' | 'Hairdo' | 'Attire';
topBadgeBg: string;
isBestSeller?: boolean;
tags: TagBadge[];
description: string;
priceText: string;
numericPrice: number;
duration?: string;
capacity?: string;
itemsCount?: string;
usedInBookingsText?: string;
bookingCount?: number;
rating?: number;
reviewCount?: number;
revenueText?: string;
status: 'Aktif' | 'Nonaktif';
isBookmarked?: boolean;
image: string;
}
const mockServicesData: ServiceItem[] = [
{
id: '1',
title: 'Wedding Gold Package',
categoryKey: 'Paket Wedding',
topBadge: 'Paket',
topBadgeBg: 'bg-amber-100/90 text-amber-800',
isBestSeller: true,
tags: [
{ label: 'Wedding', bg: 'bg-[#F3E8FF] text-[#7E22CE]' },
{ label: 'Paket', bg: 'bg-[#FCE7F3] text-[#BE185D]' }
],
description: 'Paket lengkap akad & resepsi dengan fasilitas premium.',
priceText: 'Rp7.800.000',
numericPrice: 7800000,
duration: '10 Jam',
capacity: '6 Orang',
itemsCount: '11 Item',
bookingCount: 128,
rating: 4.9,
reviewCount: 86,
revenueText: 'Rp126.000.000',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&q=80&w=400',
},
{
id: '2',
title: 'Akad / Pemberkatan',
categoryKey: 'Paket Wedding',
topBadge: 'Paket',
topBadgeBg: 'bg-amber-100/90 text-amber-800',
tags: [
{ label: 'Wedding', bg: 'bg-[#F3E8FF] text-[#7E22CE]' },
{ label: 'Paket', bg: 'bg-[#FCE7F3] text-[#BE185D]' }
],
description: 'Paket makeup dan busana untuk akad / pemberkatan.',
priceText: 'Rp3.800.000',
numericPrice: 3800000,
duration: '5 Jam',
capacity: '2-4 Orang',
itemsCount: '6 Item',
bookingCount: 45,
rating: 4.8,
reviewCount: 32,
revenueText: 'Rp54.150.000',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?auto=format&fit=crop&q=80&w=400',
},
{
id: '3',
title: 'Resepsi / Unduh Mantu',
categoryKey: 'Paket Wedding',
topBadge: 'Paket',
topBadgeBg: 'bg-amber-100/90 text-amber-800',
tags: [
{ label: 'Wedding', bg: 'bg-[#F3E8FF] text-[#7E22CE]' },
{ label: 'Paket', bg: 'bg-[#FCE7F3] text-[#BE185D]' }
],
description: 'Paket resepsi / unduh mantu lengkap untuk keluarga.',
priceText: 'Rp6.000.000',
numericPrice: 6000000,
duration: '8 Jam',
capacity: '6-8 Orang',
itemsCount: '10 Item',
bookingCount: 38,
rating: 4.7,
reviewCount: 21,
revenueText: 'Rp45.600.000',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1517841905240-472988babdf9?auto=format&fit=crop&q=80&w=400',
},
{
id: '4',
title: 'Makeup Wisuda',
categoryKey: 'Makeup Only',
topBadge: 'Layanan',
topBadgeBg: 'bg-emerald-100/90 text-emerald-800',
tags: [
{ label: 'Makeup Only', bg: 'bg-[#F3E8FF] text-[#7E22CE]' },
{ label: 'Graduation', bg: 'bg-[#F3E8FF] text-[#7E22CE]' }
],
description: 'Makeup wisuda natural & flawless.',
priceText: 'Rp350.000',
numericPrice: 350000,
duration: '90 Menit',
capacity: '1 Orang',
bookingCount: 89,
rating: 4.9,
reviewCount: 64,
revenueText: 'Rp31.150.000',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1522337360788-8b13dee7a37e?auto=format&fit=crop&q=80&w=400',
},
{
id: '5',
title: 'Softlens',
categoryKey: 'Add-On',
topBadge: 'Add-On',
topBadgeBg: 'bg-orange-100/90 text-orange-800',
tags: [
{ label: 'Add-On', bg: 'bg-[#FFEDD5] text-[#C2410C]' },
{ label: 'Aksesoris', bg: 'bg-[#FCE7F3] text-[#BE185D]' }
],
description: 'Softlens premium untuk hasil yang lebih sempurna.',
priceText: 'Rp75.000',
numericPrice: 75000,
usedInBookingsText: '286 Booking',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1512496015851-a90fb38ba796?auto=format&fit=crop&q=80&w=400',
},
{
id: '6',
title: 'Modern Hairdo',
categoryKey: 'Hairdo',
topBadge: 'Hairdo',
topBadgeBg: 'bg-emerald-100/90 text-emerald-800',
tags: [
{ label: 'Hairdo', bg: 'bg-[#DCFCE7] text-[#15803D]' },
{ label: 'Styling', bg: 'bg-[#F3E8FF] text-[#7E22CE]' }
],
description: 'Hairdo modern untuk berbagai acara spesial.',
priceText: 'Rp500.000',
numericPrice: 500000,
duration: '45 Menit',
capacity: '1 Orang',
bookingCount: 72,
rating: 4.8,
reviewCount: 41,
revenueText: 'Rp36.000.000',
status: 'Aktif',
isBookmarked: false,
image: 'https://images.unsplash.com/photo-1560066984-138dadb4c035?auto=format&fit=crop&q=80&w=400',
}
];
export const LayananView: React.FC<LayananViewProps> = ({
initialSubView = 'katalog',
triggerToast
}) => {
const [subView, setSubView] = useState<'katalog' | 'tambah'>(initialSubView);
useEffect(() => {
setSubView(initialSubView);
}, [initialSubView]);
const [services, setServices] = useState<ServiceItem[]>(mockServicesData);
const [activeCategoryTab, setActiveCategoryTab] = useState<string>('Semua');
const [searchQuery, setSearchQuery] = useState('');
const [selectedCategory, setSelectedCategory] = useState('Semua Kategori');
const [selectedType, setSelectedType] = useState('Semua Tipe');
const [selectedStatus, setSelectedStatus] = useState('Semua Status');
const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid');
// Filter Lanjutan State
const [minPrice, setMinPrice] = useState('');
const [maxPrice, setMaxPrice] = useState('');
// Form Tambah Layanan Form State
const [formName, setFormName] = useState('');
const [formCategory, setFormCategory] = useState('Paket Wedding');
const [formType, setFormType] = useState('Paket');
const [formPrice, setFormPrice] = useState('');
const [formDuration, setFormDuration] = useState('10 Jam');
const [formStatus, setFormStatus] = useState<'Aktif' | 'Nonaktif'>('Aktif');
const [formShortDesc, setFormShortDesc] = useState('');
const [formFullDesc, setFormFullDesc] = useState('');
const [formItems, setFormItems] = useState<string[]>([
'Makeup Pengantin',
'Busana Akad',
'Busana Resepsi',
'Softlens'
]);
const [newItemText, setNewItemText] = useState('');
const [showAddItemInput, setShowAddItemInput] = useState(false);
// Form Extra Info State
const [formTags, setFormTags] = useState('');
const [formMinBooking, setFormMinBooking] = useState('1');
const [formInternalNotes, setFormInternalNotes] = useState('');
const [selectedMainPhoto, setSelectedMainPhoto] = useState<string | null>(null);
const toggleBookmark = (id: string) => {
const item = services.find(s => s.id === id);
if (item) {
const updated = !item.isBookmarked;
triggerToast(updated ? `Disimpan ke bookmark: ${item.title}` : `Dihapus dari bookmark`);
}
setServices(prev => prev.map(s => s.id === id ? { ...s, isBookmarked: !s.isBookmarked } : s));
};
const toggleStatus = (id: string) => {
const item = services.find(s => s.id === id);
if (item) {
const nextStatus = item.status === 'Aktif' ? 'Nonaktif' : 'Aktif';
triggerToast(`Status ${item.title} diubah menjadi ${nextStatus}`);
}
setServices(prev => prev.map(s => s.id === id ? { ...s, status: s.status === 'Aktif' ? 'Nonaktif' : 'Aktif' } : s));
};
const handleAddItem = () => {
if (newItemText.trim()) {
setFormItems([...formItems, newItemText.trim()]);
setNewItemText('');
setShowAddItemInput(false);
triggerToast('Item fasilitas berhasil ditambahkan!');
}
};
const handleRemoveItem = (index: number) => {
setFormItems(formItems.filter((_, i) => i !== index));
};
const handleSaveNewService = (e: React.FormEvent) => {
e.preventDefault();
if (!formName.trim()) {
triggerToast('Mohon isi nama layanan terlebih dahulu!');
return;
}
const priceNum = parseInt(formPrice) || 0;
const newServiceObj: ServiceItem = {
id: Date.now().toString(),
title: formName,
categoryKey: formCategory,
topBadge: (formType as any) || 'Layanan',
topBadgeBg: 'bg-amber-100/90 text-amber-800',
tags: [
{ label: formCategory, bg: 'bg-[#F3E8FF] text-[#7E22CE]' },
{ label: formType, bg: 'bg-[#FCE7F3] text-[#BE185D]' }
],
description: formShortDesc || 'Layanan tata rias dan paket pernikahan berkualitas tinggi.',
priceText: `Rp${priceNum.toLocaleString('id-ID')}`,
numericPrice: priceNum,
duration: formDuration || '2 Jam',
capacity: `${formMinBooking || '1'} Orang`,
itemsCount: `${formItems.length} Item`,
bookingCount: 0,
rating: 5.0,
reviewCount: 0,
revenueText: 'Rp0',
status: formStatus,
isBookmarked: false,
image: selectedMainPhoto || 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&q=80&w=400',
};
setServices([newServiceObj, ...services]);
setSubView('katalog');
triggerToast(`Layanan ${formName} berhasil disimpan!`);
};
// Filtered List calculation for Katalog
const filteredServices = services.filter(item => {
if (activeCategoryTab !== 'Semua') {
if (activeCategoryTab === 'Tidak Aktif' && item.status !== 'Nonaktif') return false;
if (activeCategoryTab !== 'Tidak Aktif' && item.categoryKey !== activeCategoryTab) return false;
}
const matchesSearch =
item.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
item.description.toLowerCase().includes(searchQuery.toLowerCase()) ||
item.categoryKey.toLowerCase().includes(searchQuery.toLowerCase());
if (!matchesSearch) return false;
if (selectedCategory !== 'Semua Kategori' && item.categoryKey !== selectedCategory) return false;
if (selectedType !== 'Semua Tipe' && item.topBadge !== selectedType) return false;
if (selectedStatus !== 'Semua Status' && item.status !== selectedStatus) return false;
if (minPrice && item.numericPrice < parseInt(minPrice)) return false;
if (maxPrice && item.numericPrice > parseInt(maxPrice)) return false;
return true;
});
/* =========================================================
VIEW MODE 1: FORM TAMBAH LAYANAN (MATCHES USER SCREENSHOT)
========================================================= */
if (subView === 'tambah') {
return (
<div className="space-y-5 animate-in fade-in duration-300 text-slate-800 pb-12">
{/* BREADCRUMB & PAGE HEADER */}
<div className="space-y-1">
<div className="flex items-center gap-1.5 text-xs text-slate-500 font-medium">
<span className="hover:text-slate-800 cursor-pointer">Layanan</span>
<ChevronRightSmall className="w-3.5 h-3.5 text-slate-400" />
<button onClick={() => setSubView('katalog')} className="hover:text-slate-800 cursor-pointer">Katalog Layanan</button>
<ChevronRightSmall className="w-3.5 h-3.5 text-slate-400" />
<span className="text-[#EC167F] font-bold">Tambah Layanan</span>
</div>
<div className="pt-2">
<h1 className="text-xl font-extrabold text-slate-900 tracking-tight">Tambah Layanan</h1>
<p className="text-xs text-slate-500 font-medium mt-0.5">
Lengkapi informasi layanan yang akan ditampilkan untuk pelanggan Anda.
</p>
</div>
</div>
<form onSubmit={handleSaveNewService}>
{/* MAIN 2-COLUMN GRID (LEFT 8 COLS, RIGHT 4 COLS) */}
<div className="grid grid-cols-1 lg:grid-cols-12 gap-5 items-start">
{/* LEFT COLUMN (8 COLS) */}
<div className="lg:col-span-8 space-y-5">
{/* CARD 1: INFORMASI DASAR */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-slate-100">
<div className="w-7 h-7 rounded-full bg-pink-50 text-[#EC167F] flex items-center justify-center font-bold">
<Info className="w-4 h-4" />
</div>
<h2 className="text-sm font-extrabold text-slate-900">Informasi Dasar</h2>
</div>
<div className="space-y-3.5 text-xs">
{/* Row 1: Nama, Kategori, Tipe */}
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
<div>
<label className="block text-slate-700 font-bold mb-1">Nama Layanan *</label>
<input
type="text"
placeholder="Contoh: Wedding Gold Package"
value={formName}
onChange={(e) => setFormName(e.target.value)}
required
className="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F]"
/>
</div>
<div>
<label className="block text-slate-700 font-bold mb-1">Kategori Layanan *</label>
<select
value={formCategory}
onChange={(e) => setFormCategory(e.target.value)}
className="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option value="Paket Wedding">Paket Wedding</option>
<option value="Makeup Only">Makeup Only</option>
<option value="Attire">Attire / Busana</option>
<option value="Hairdo">Hairdo</option>
<option value="Adat">Adat</option>
<option value="Add-On">Add-On</option>
<option value="Produk">Produk</option>
</select>
</div>
<div>
<label className="block text-slate-700 font-bold mb-1">Tipe Layanan *</label>
<select
value={formType}
onChange={(e) => setFormType(e.target.value)}
className="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option value="Paket">Paket</option>
<option value="Layanan">Layanan</option>
<option value="Add-On">Add-On</option>
</select>
</div>
</div>
{/* Row 2: Harga, Durasi, Status */}
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3 items-start">
<div>
<label className="block text-slate-700 font-bold mb-1">Harga *</label>
<div className="flex items-center rounded-xl overflow-hidden border border-slate-200 bg-slate-50 focus-within:border-[#EC167F] focus-within:bg-white">
<span className="px-3 text-slate-500 font-extrabold text-xs border-r border-slate-200">Rp</span>
<input
type="number"
placeholder="Contoh: 7800000"
value={formPrice}
onChange={(e) => setFormPrice(e.target.value)}
required
className="w-full px-3 py-2 font-bold text-slate-800 bg-transparent focus:outline-none"
/>
</div>
</div>
<div>
<label className="block text-slate-700 font-bold mb-1">Durasi</label>
<div className="relative">
<input
type="text"
placeholder="Contoh: 10 Jam"
value={formDuration}
onChange={(e) => setFormDuration(e.target.value)}
className="w-full pl-8 pr-3 py-2 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F]"
/>
<Clock className="w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-3" />
</div>
</div>
<div>
<label className="block text-slate-700 font-bold mb-1">Status</label>
<div className="flex items-center gap-2 pt-1">
<button
type="button"
onClick={() => setFormStatus(formStatus === 'Aktif' ? 'Nonaktif' : 'Aktif')}
className={`w-10 h-5.5 rounded-full transition-colors relative flex items-center px-0.5 cursor-pointer ${
formStatus === 'Aktif' ? 'bg-[#EC167F]' : 'bg-slate-300'
}`}
>
<div className={`w-4 h-4 rounded-full bg-white shadow-2xs transition-transform ${
formStatus === 'Aktif' ? 'translate-x-4.5' : 'translate-x-0'
}`} />
</button>
<span className="font-extrabold text-slate-800 text-xs">
{formStatus}
</span>
</div>
<span className="text-[10px] text-slate-400 block mt-1">Layanan akan tampil untuk pelanggan</span>
</div>
</div>
{/* Deskripsi Singkat */}
<div>
<div className="flex items-center justify-between mb-1">
<label className="block text-slate-700 font-bold">Deskripsi Singkat *</label>
<span className="text-[10px] text-slate-400 font-bold">{formShortDesc.length}/160</span>
</div>
<textarea
rows={2}
maxLength={160}
placeholder="Tulis deskripsi singkat layanan untuk ditampilkan di katalog..."
value={formShortDesc}
onChange={(e) => setFormShortDesc(e.target.value)}
className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-medium text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F]"
/>
</div>
</div>
</div>
{/* CARD 2: DETAIL LAYANAN */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-slate-100">
<div className="w-7 h-7 rounded-full bg-pink-50 text-[#EC167F] flex items-center justify-center font-bold">
<FileText className="w-4 h-4" />
</div>
<h2 className="text-sm font-extrabold text-slate-900">Detail Layanan</h2>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs">
{/* Left: Deskripsi Lengkap */}
<div>
<div className="flex items-center justify-between mb-1">
<label className="block text-slate-700 font-bold">Deskripsi Lengkap *</label>
<span className="text-[10px] text-slate-400 font-bold">{formFullDesc.length}/1000</span>
</div>
<textarea
rows={6}
maxLength={1000}
placeholder="Jelaskan layanan ini secara detail. Termasuk apa saja yang didapatkan, proses, keunggulan, dll."
value={formFullDesc}
onChange={(e) => setFormFullDesc(e.target.value)}
className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-medium text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F] h-44 resize-none"
/>
</div>
{/* Right: Termasuk dalam Layanan */}
<div className="space-y-2">
<div className="flex items-center justify-between">
<label className="block text-slate-700 font-bold">Termasuk dalam Layanan *</label>
<button
type="button"
onClick={() => setShowAddItemInput(true)}
className="px-2.5 py-1 text-[11px] bg-pink-50 border border-pink-200 text-[#EC167F] font-extrabold rounded-lg hover:bg-pink-100 transition-colors cursor-pointer flex items-center gap-1"
>
<Plus className="w-3 h-3" />
<span>Tambah Item</span>
</button>
</div>
{showAddItemInput && (
<div className="flex items-center gap-1.5 p-2 bg-pink-50/50 border border-pink-200 rounded-xl animate-in fade-in duration-200">
<input
type="text"
placeholder="Nama fasilitas baru..."
value={newItemText}
onChange={(e) => setNewItemText(e.target.value)}
className="w-full px-2 py-1 text-xs bg-white border border-slate-200 rounded-lg focus:outline-none focus:border-[#EC167F]"
/>
<button
type="button"
onClick={handleAddItem}
className="px-3 py-1 bg-[#EC167F] text-white font-extrabold text-xs rounded-lg cursor-pointer"
>
OK
</button>
<button
type="button"
onClick={() => setShowAddItemInput(false)}
className="p-1 text-slate-400 hover:text-slate-600"
>
<X className="w-3.5 h-3.5" />
</button>
</div>
)}
<div className="p-3 bg-slate-50/60 border border-slate-200 rounded-xl space-y-2 min-h-36">
{formItems.map((item, idx) => (
<div key={idx} className="flex items-center justify-between p-2 bg-white rounded-lg border border-slate-100 shadow-2xs text-xs font-semibold text-slate-800">
<div className="flex items-center gap-2">
<CheckCircle2 className="w-4 h-4 text-emerald-500 shrink-0" />
<span>{item}</span>
</div>
<div className="flex items-center gap-1">
<button
type="button"
onClick={() => triggerToast(`Edit item ${item}`)}
className="p-1 text-slate-400 hover:text-slate-600 rounded-md cursor-pointer"
>
<Pencil className="w-3 h-3" />
</button>
<button
type="button"
onClick={() => handleRemoveItem(idx)}
className="p-1 text-slate-400 hover:text-rose-500 rounded-md cursor-pointer"
>
<Trash2 className="w-3 h-3" />
</button>
</div>
</div>
))}
<div className="pt-1 text-center">
<span className="text-[11px] font-bold text-[#EC167F] cursor-pointer hover:underline">
+ 7 lainnya
</span>
</div>
</div>
</div>
</div>
</div>
{/* CARD 3: MEDIA LAYANAN */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-slate-100">
<div className="w-7 h-7 rounded-full bg-pink-50 text-[#EC167F] flex items-center justify-center font-bold">
<ImageIcon className="w-4 h-4" />
</div>
<h2 className="text-sm font-extrabold text-slate-900">Media Layanan</h2>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs">
{/* Foto Utama */}
<div>
<label className="block text-slate-700 font-bold mb-1.5">Foto Utama *</label>
<div className="border-2 border-dashed border-pink-200 bg-pink-50/20 rounded-2xl p-6 text-center space-y-2 flex flex-col items-center justify-center min-h-[160px]">
<div className="w-10 h-10 rounded-full bg-pink-100 text-[#EC167F] flex items-center justify-center">
<UploadCloud className="w-5 h-5" />
</div>
<div>
<span className="font-extrabold text-slate-800 block text-xs">Upload foto utama layanan</span>
<span className="text-[10px] text-slate-400 font-medium block">PNG, JPG, JPEG (maks. 5MB)</span>
</div>
<button
type="button"
onClick={() => {
setSelectedMainPhoto("https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&q=80&w=400");
triggerToast("Foto utama berhasil dipilih!");
}}
className="mt-1 px-4 py-1.5 bg-white border border-pink-200 text-[#EC167F] font-extrabold rounded-xl hover:bg-pink-50 shadow-2xs transition-colors cursor-pointer"
>
Pilih Foto
</button>
</div>
</div>
{/* Galeri Foto */}
<div>
<label className="block text-slate-700 font-bold mb-1.5">Galeri Foto (Opsional)</label>
<div className="grid grid-cols-4 gap-2">
{[1, 2, 3, 4].map((num) => (
<button
key={num}
type="button"
onClick={() => triggerToast(`Upload galeri foto #${num}`)}
className="aspect-square rounded-xl border-2 border-dashed border-slate-200 bg-slate-50 hover:border-pink-300 hover:bg-pink-50/30 flex items-center justify-center text-slate-400 transition-colors cursor-pointer"
>
<Plus className="w-5 h-5" />
</button>
))}
</div>
<span className="text-[10px] text-slate-400 font-medium block mt-2">
Tambahkan hingga 6 foto pendukung
</span>
</div>
</div>
</div>
</div>
{/* RIGHT COLUMN (4 COLS) */}
<div className="lg:col-span-4 space-y-5">
{/* CARD 1: KATEGORI LAYANAN */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-slate-100">
<div className="w-7 h-7 rounded-full bg-pink-50 text-[#EC167F] flex items-center justify-center font-bold">
<Folder className="w-4 h-4" />
</div>
<div>
<h2 className="text-sm font-extrabold text-slate-900">Kategori Layanan</h2>
<p className="text-[10px] text-slate-400 font-medium">Pilih kategori layanan dari daftar yang tersedia</p>
</div>
</div>
<div className="space-y-3 text-xs">
<div>
<label className="block text-slate-700 font-bold mb-1">Kategori *</label>
<select
value={formCategory}
onChange={(e) => setFormCategory(e.target.value)}
className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option value="Paket Wedding">Paket Wedding</option>
<option value="Makeup Only">Makeup Only</option>
<option value="Attire">Attire / Busana</option>
<option value="Hairdo">Hairdo</option>
<option value="Adat">Adat</option>
<option value="Add-On">Add-On</option>
<option value="Produk">Produk</option>
</select>
</div>
{/* CATEGORY SELECT PREVIEW LIST */}
<div className="space-y-2 pt-1 max-h-[360px] overflow-y-auto pr-1">
{[
{ key: 'Paket Wedding', label: 'Paket Wedding', desc: 'Paket lengkap untuk acara pernikahan', icon: Users, color: 'bg-purple-100 text-purple-700' },
{ key: 'Makeup Only', label: 'Makeup Only', desc: 'Layanan makeup tanpa busana', icon: SparklesIcon, color: 'bg-blue-100 text-blue-700' },
{ key: 'Attire', label: 'Attire / Busana', desc: 'Penyewaan & jasa busana', icon: Box, color: 'bg-amber-100 text-amber-700' },
{ key: 'Hairdo', label: 'Hairdo', desc: 'Tata rambut untuk berbagai acara', icon: Sparkles, color: 'bg-emerald-100 text-emerald-700' },
{ key: 'Adat', label: 'Adat', desc: 'Layanan makeup & busana adat', icon: Tag, color: 'bg-rose-100 text-rose-700' },
{ key: 'Add-On', label: 'Add-On', desc: 'Tambahan layanan pendukung', icon: Layers, color: 'bg-orange-100 text-orange-700' },
{ key: 'Produk', label: 'Produk', desc: 'Produk kecantikan & aksesoris', icon: Box, color: 'bg-[#FCE7F3] text-[#BE185D]' }
].map(cat => {
const isSelected = formCategory === cat.key;
const IconComp = cat.icon;
return (
<div
key={cat.key}
onClick={() => setFormCategory(cat.key)}
className={`p-3 rounded-xl border transition-all cursor-pointer flex items-start gap-2.5 ${
isSelected
? 'bg-pink-50/70 border-pink-300 shadow-2xs ring-1 ring-pink-200'
: 'bg-white hover:bg-slate-50 border-slate-200/80'
}`}
>
<div className={`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${cat.color}`}>
<IconComp className="w-3.5 h-3.5" />
</div>
<div>
<span className="font-extrabold text-slate-900 block text-xs leading-tight">{cat.label}</span>
<span className="text-[10px] text-slate-500 font-medium block mt-0.5">{cat.desc}</span>
</div>
</div>
);
})}
</div>
</div>
</div>
{/* CARD 2: INFORMASI TAMBAHAN */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center gap-2 pb-2 border-b border-slate-100">
<div className="w-7 h-7 rounded-full bg-blue-50 text-blue-600 flex items-center justify-center font-bold">
<Tag className="w-4 h-4" />
</div>
<h2 className="text-sm font-extrabold text-slate-900">Informasi Tambahan</h2>
</div>
<div className="space-y-3.5 text-xs">
{/* Tag / Label */}
<div>
<div className="flex items-center justify-between mb-1">
<label className="block text-slate-700 font-bold">Tag / Label</label>
<span className="text-[10px] text-slate-400 font-bold">{formTags.length}/10</span>
</div>
<input
type="text"
placeholder="Tambah tag..."
value={formTags}
onChange={(e) => setFormTags(e.target.value)}
className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-medium text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F]"
/>
<span className="text-[10px] text-slate-400 block mt-1">Tekan Enter untuk menambahkan tag</span>
</div>
{/* Minimal Booking */}
<div>
<label className="block text-slate-700 font-bold mb-1">Minimal Booking (Opsional)</label>
<div className="flex items-center rounded-xl overflow-hidden border border-slate-200 bg-slate-50 focus-within:border-[#EC167F] focus-within:bg-white">
<div className="pl-3 text-slate-400">
<User className="w-4 h-4" />
</div>
<input
type="number"
placeholder="Contoh: 1"
value={formMinBooking}
onChange={(e) => setFormMinBooking(e.target.value)}
className="w-full px-2.5 py-2 font-bold text-slate-800 bg-transparent focus:outline-none text-xs"
/>
<span className="pr-3 text-slate-400 font-bold text-xs">orang</span>
</div>
</div>
{/* Catatan Internal */}
<div>
<div className="flex items-center justify-between mb-1">
<label className="block text-slate-700 font-bold">Catatan Internal (Opsional)</label>
<span className="text-[10px] text-slate-400 font-bold">{formInternalNotes.length}/300</span>
</div>
<textarea
rows={3}
maxLength={300}
placeholder="Catatan hanya untuk keperluan internal..."
value={formInternalNotes}
onChange={(e) => setFormInternalNotes(e.target.value)}
className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-medium text-slate-800 focus:bg-white focus:outline-none focus:border-[#EC167F] resize-none"
/>
</div>
</div>
</div>
</div>
</div>
{/* BOTTOM FIXED / STICKY ACTION BUTTONS BAR */}
<div className="mt-6 pt-4 border-t border-slate-200 flex items-center justify-end gap-3">
<button
type="button"
onClick={() => setSubView('katalog')}
className="px-6 py-2.5 bg-white border border-slate-200 hover:bg-slate-50 text-slate-700 font-bold text-xs rounded-xl transition-colors cursor-pointer shadow-2xs"
>
Batal
</button>
<button
type="submit"
className="px-7 py-2.5 bg-[#EC167F] hover:bg-[#D41270] text-white font-black text-xs rounded-xl shadow-xs transition-colors flex items-center gap-2 cursor-pointer"
>
<span>Simpan Layanan</span>
<ChevronDown className="w-4 h-4" />
</button>
</div>
</form>
</div>
);
}
/* =========================================================
VIEW MODE 2: KATALOG DAFTAR LAYANAN (KATALOG VIEW)
========================================================= */
return (
<div className="space-y-5 animate-in fade-in duration-300 text-slate-800">
{/* 1. HEADER TITLE & SUBTITLE */}
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-3">
<div>
<h1 className="text-xl font-extrabold text-slate-900 tracking-tight">Daftar Layanan</h1>
<p className="text-xs text-slate-500 font-medium mt-0.5">
Kelola semua layanan, paket, dan add-on yang tersedia untuk pelanggan Anda.
</p>
</div>
<button
onClick={() => setSubView('tambah')}
className="px-4 py-2 bg-[#EC167F] hover:bg-[#D41270] text-white rounded-xl text-xs font-extrabold shadow-xs transition-all flex items-center justify-center gap-1.5 cursor-pointer shrink-0"
>
<Plus className="w-4 h-4" />
<span>Tambah Layanan</span>
</button>
</div>
{/* 2. TOP METRIC SUMMARY CARDS ROW (6 CARDS IN A ROW) */}
<div className="grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-6 gap-3">
{/* Card 1: Total Layanan */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Total Layanan</span>
<div className="w-8 h-8 rounded-xl bg-pink-50 text-[#EC167F] flex items-center justify-center font-bold">
<Calendar className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-2xl font-black text-slate-900 leading-tight">32</h3>
<p className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-1">
<ArrowUp className="w-2.5 h-2.5" /> 12% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
{/* Card 2: Paket Wedding */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Paket Wedding</span>
<div className="w-8 h-8 rounded-xl bg-purple-50 text-purple-600 flex items-center justify-center font-bold">
<Users className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-2xl font-black text-slate-900 leading-tight">6</h3>
<p className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-1">
<ArrowUp className="w-2.5 h-2.5" /> 8% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
{/* Card 3: Add-On */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Add-On</span>
<div className="w-8 h-8 rounded-xl bg-amber-50 text-amber-600 flex items-center justify-center font-bold">
<Layers className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-2xl font-black text-slate-900 leading-tight">14</h3>
<p className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-1">
<ArrowUp className="w-2.5 h-2.5" /> 15% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
{/* Card 4: Layanan Nonaktif */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Layanan Nonaktif</span>
<div className="w-8 h-8 rounded-xl bg-rose-50 text-rose-500 flex items-center justify-center font-bold">
<Tag className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-2xl font-black text-slate-900 leading-tight">2</h3>
<p className="text-[10px] font-bold text-rose-500 flex items-center gap-0.5 mt-1">
<ArrowDown className="w-2.5 h-2.5" /> 2% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
{/* Card 5: Booking Bulan Ini */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Booking Bulan Ini</span>
<div className="w-8 h-8 rounded-xl bg-blue-50 text-blue-600 flex items-center justify-center font-bold">
<Share2 className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-2xl font-black text-slate-900 leading-tight">128</h3>
<p className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-1">
<ArrowUp className="w-2.5 h-2.5" /> 18% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
{/* Card 6: Pendapatan Bulan Ini */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-[11px] font-bold text-slate-500">Pendapatan Bulan Ini</span>
<div className="w-8 h-8 rounded-xl bg-emerald-50 text-emerald-600 flex items-center justify-center font-bold">
<Wallet className="w-4 h-4" />
</div>
</div>
<div className="mt-2">
<h3 className="text-lg font-black text-slate-900 leading-tight truncate">Rp126.500.000</h3>
<p className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-1">
<ArrowUp className="w-2.5 h-2.5" /> 22% <span className="font-normal text-slate-400">dari bulan lalu</span>
</p>
</div>
</div>
</div>
{/* 3. SUB CATEGORY TABS (FILTER PILL BUTTONS) */}
<div className="flex items-center gap-2 overflow-x-auto pb-1 text-xs font-bold scrollbar-none">
{[
{ key: 'Semua', label: 'Semua', count: null },
{ key: 'Paket Wedding', label: 'Paket Wedding', count: 6 },
{ key: 'Makeup Only', label: 'Makeup Only', count: 8 },
{ key: 'Attire', label: 'Attire', count: 5 },
{ key: 'Hairdo', label: 'Hairdo', count: 6 },
{ key: 'Adat', label: 'Adat', count: 7 },
{ key: 'Add-On', label: 'Add-On', count: 14 },
{ key: 'Produk', label: 'Produk', count: 3 },
{ key: 'Tidak Aktif', label: 'Tidak Aktif', count: 2 }
].map(tab => {
const isActive = activeCategoryTab === tab.key;
return (
<button
key={tab.key}
onClick={() => setActiveCategoryTab(tab.key)}
className={`px-3.5 py-1.5 rounded-full font-bold transition-all flex items-center gap-1.5 whitespace-nowrap cursor-pointer ${
isActive
? 'bg-[#EC167F] text-white shadow-2xs'
: 'bg-white hover:bg-slate-50 text-slate-600 border border-slate-200/80'
}`}
>
<span>{tab.label}</span>
{tab.count !== null && (
<span className={`text-[10px] px-1.5 py-0.2 rounded-full font-extrabold ${
isActive ? 'bg-white/20 text-white' : 'bg-slate-100 text-slate-500'
}`}>
{tab.count}
</span>
)}
</button>
);
})}
</div>
{/* 4. SEARCH & QUICK DROPDOWN FILTER BAR */}
<div className="bg-white p-3 rounded-2xl border border-slate-200/80 shadow-2xs">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-12 gap-2.5 items-center">
{/* Search Bar */}
<div className="lg:col-span-4 relative">
<input
type="text"
placeholder="Cari layanan..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full pl-8 pr-3 py-2 bg-slate-50 border border-slate-200/80 rounded-xl text-xs font-semibold focus:bg-white focus:outline-none focus:border-[#EC167F] text-slate-800 placeholder:text-slate-400"
/>
<Search className="w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-3" />
</div>
{/* Select 1: Semua Kategori */}
<div className="lg:col-span-3 relative">
<select
value={selectedCategory}
onChange={(e) => setSelectedCategory(e.target.value)}
className="w-full appearance-none pl-3 pr-8 py-2 bg-slate-50 border border-slate-200/80 rounded-xl text-xs font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option>Semua Kategori</option>
<option value="Paket Wedding">Paket Wedding</option>
<option value="Makeup Only">Makeup Only</option>
<option value="Attire">Attire</option>
<option value="Hairdo">Hairdo</option>
<option value="Adat">Adat</option>
<option value="Add-On">Add-On</option>
<option value="Produk">Produk</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-3 pointer-events-none" />
</div>
{/* Select 2: Semua Tipe */}
<div className="lg:col-span-2 relative">
<select
value={selectedType}
onChange={(e) => setSelectedType(e.target.value)}
className="w-full appearance-none pl-3 pr-8 py-2 bg-slate-50 border border-slate-200/80 rounded-xl text-xs font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option>Semua Tipe</option>
<option value="Paket">Paket</option>
<option value="Layanan">Layanan</option>
<option value="Add-On">Add-On</option>
<option value="Hairdo">Hairdo</option>
<option value="Attire">Attire</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-3 pointer-events-none" />
</div>
{/* Select 3: Semua Status */}
<div className="lg:col-span-2 relative">
<select
value={selectedStatus}
onChange={(e) => setSelectedStatus(e.target.value)}
className="w-full appearance-none pl-3 pr-8 py-2 bg-slate-50 border border-slate-200/80 rounded-xl text-xs font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer"
>
<option>Semua Status</option>
<option value="Aktif">Aktif</option>
<option value="Nonaktif">Nonaktif</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-3 pointer-events-none" />
</div>
{/* Filter Button & View Mode Toggle */}
<div className="lg:col-span-1 flex items-center justify-end gap-1.5">
<button
onClick={() => triggerToast('Buka opsi filter')}
className="px-3 py-2 bg-white hover:bg-slate-50 text-slate-700 border border-slate-200/80 rounded-xl text-xs font-bold transition-all flex items-center gap-1 cursor-pointer shadow-2xs"
>
<SlidersHorizontal className="w-3.5 h-3.5 text-slate-500" />
<span>Filter</span>
</button>
{/* View Mode Buttons */}
<div className="flex items-center p-0.5 bg-slate-100/80 rounded-xl border border-slate-200/60">
<button
onClick={() => setViewMode('grid')}
className={`p-1.5 rounded-lg transition-all cursor-pointer ${
viewMode === 'grid'
? 'bg-[#EC167F] text-white shadow-2xs'
: 'text-slate-400 hover:text-slate-600'
}`}
title="Tampilan Grid"
>
<LayoutGrid className="w-3.5 h-3.5" />
</button>
<button
onClick={() => setViewMode('list')}
className={`p-1.5 rounded-lg transition-all cursor-pointer ${
viewMode === 'list'
? 'bg-[#EC167F] text-white shadow-2xs'
: 'text-slate-400 hover:text-slate-600'
}`}
title="Tampilan List"
>
<List className="w-3.5 h-3.5" />
</button>
</div>
</div>
</div>
</div>
{/* 5. MAIN CONTENT AREA: GRID (LEFT 8/9 COLS) + SIDEBAR (RIGHT 3/4 COLS) */}
<div className="grid grid-cols-1 lg:grid-cols-12 gap-5 items-start">
{/* LEFT MAIN SERVICE CARDS LIST (Cols 8/9) */}
<div className="lg:col-span-8 xl:col-span-9 space-y-5">
<div className={viewMode === 'grid' ? "grid grid-cols-1 xl:grid-cols-2 gap-4" : "space-y-3"}>
{filteredServices.map(item => (
<div
key={item.id}
className="bg-white rounded-2xl border border-slate-200/80 shadow-2xs hover:shadow-xs transition-all overflow-hidden flex flex-col justify-between"
>
{/* Main Card Content */}
<div className="p-4 flex items-start gap-3.5 relative">
{/* Service Image */}
<div className="relative shrink-0">
<img
src={item.image}
alt={item.title}
referrerPolicy="no-referrer"
onError={(e) => {
e.currentTarget.src = "https://images.unsplash.com/photo-1487412720507-e7ab37603c6f?auto=format&fit=crop&q=80&w=200";
}}
className="w-24 h-28 sm:w-28 sm:h-32 rounded-2xl object-cover border border-slate-100 shadow-2xs"
/>
{item.isBestSeller && (
<span className="absolute top-1.5 left-1.5 bg-[#EC167F] text-white text-[9px] font-black px-1.5 py-0.5 rounded-md tracking-wider shadow-2xs">
BEST SELLER
</span>
)}
</div>
{/* Service Info & Stats */}
<div className="flex-1 min-w-0 pr-6 space-y-1.5">
{/* Top Badge (Paket / Layanan / Add-On) */}
<div>
<span className={`text-[10px] font-black px-2 py-0.5 rounded-md ${item.topBadgeBg}`}>
{item.topBadge}
</span>
</div>
{/* Title */}
<h3 className="text-sm font-extrabold text-slate-900 leading-tight truncate">
{item.title}
</h3>
{/* Tags Row */}
<div className="flex items-center gap-1.5 flex-wrap">
{item.tags.map((t, idx) => (
<span key={idx} className={`text-[10px] font-extrabold px-2 py-0.5 rounded-md ${t.bg}`}>
{t.label}
</span>
))}
</div>
{/* Description */}
<p className="text-[11px] text-slate-500 font-medium line-clamp-2 leading-tight">
{item.description}
</p>
{/* Price */}
<div className="pt-0.5">
<span className="text-sm font-black text-[#EC167F]">
{item.priceText}
</span>
</div>
{/* Info Metadata Icons (Clock, Capacity, Items) */}
{(item.duration || item.capacity || item.itemsCount) && (
<div className="flex items-center gap-3 text-[10px] text-slate-500 font-bold pt-1 flex-wrap">
{item.duration && (
<div className="flex items-center gap-1">
<Clock className="w-3 h-3 text-slate-400" />
<span>{item.duration}</span>
</div>
)}
{item.capacity && (
<div className="flex items-center gap-1">
<Users className="w-3 h-3 text-slate-400" />
<span>{item.capacity}</span>
</div>
)}
{item.itemsCount && (
<div className="flex items-center gap-1">
<Box className="w-3 h-3 text-slate-400" />
<span>{item.itemsCount}</span>
</div>
)}
</div>
)}
</div>
{/* Right Side Card Stats & Bookmark Icon */}
<div className="shrink-0 flex flex-col justify-between items-end self-stretch text-right min-w-[85px] border-l border-slate-100 pl-3">
{/* Bookmark Toggle */}
<button
onClick={() => toggleBookmark(item.id)}
className="text-slate-300 hover:text-slate-500 transition-colors cursor-pointer"
>
<Bookmark className={`w-4 h-4 ${item.isBookmarked ? 'fill-pink-500 text-pink-500' : ''}`} />
</button>
{/* Performance Stats */}
<div className="space-y-1.5 text-[10px]">
{item.usedInBookingsText ? (
<div>
<span className="text-slate-400 block font-medium">Dipakai di</span>
<span className="font-extrabold text-slate-900 block text-xs">{item.usedInBookingsText}</span>
</div>
) : (
<>
{item.bookingCount !== undefined && (
<div>
<span className="text-slate-400 block font-medium">Booking</span>
<span className="font-extrabold text-slate-900 block text-xs">{item.bookingCount}</span>
</div>
)}
{item.rating !== undefined && (
<div>
<span className="text-slate-400 block font-medium">Rating</span>
<div className="flex items-center justify-end gap-1 font-extrabold text-slate-900">
<Star className="w-3 h-3 fill-amber-400 text-amber-400" />
<span>{item.rating} ({item.reviewCount})</span>
</div>
</div>
)}
{item.revenueText && (
<div>
<span className="text-slate-400 block font-medium">Pendapatan</span>
<span className="font-extrabold text-slate-900 block text-[11px]">{item.revenueText}</span>
</div>
)}
</>
)}
</div>
</div>
</div>
{/* Bottom Action Footer */}
<div className="px-4 py-2.5 bg-slate-50/70 border-t border-slate-100 flex items-center justify-between">
{/* Status Toggle */}
<button
type="button"
onClick={() => toggleStatus(item.id)}
className="flex items-center gap-2 cursor-pointer"
>
<div className={`w-8 h-4.5 rounded-full transition-colors relative flex items-center px-0.5 ${
item.status === 'Aktif' ? 'bg-[#EC167F]' : 'bg-slate-300'
}`}>
<div className={`w-3.5 h-3.5 rounded-full bg-white shadow-2xs transition-transform ${
item.status === 'Aktif' ? 'translate-x-3.5' : 'translate-x-0'
}`} />
</div>
<span className={`text-[11px] font-bold ${
item.status === 'Aktif' ? 'text-slate-800' : 'text-slate-400'
}`}>
{item.status}
</span>
</button>
{/* Actions Group */}
<div className="flex items-center gap-1">
<button
onClick={() => {
setFormName(item.title);
setFormCategory(item.categoryKey);
setFormPrice(item.numericPrice.toString());
setFormShortDesc(item.description);
setSubView('tambah');
triggerToast(`Edit ${item.title}`);
}}
className="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer"
title="Edit"
>
<Edit className="w-3.5 h-3.5" />
</button>
<button
onClick={() => {
const copyItem = { ...item, id: `copy_${Date.now()}`, title: `${item.title} (Copy)` };
setServices([copyItem, ...services]);
triggerToast(`Duplikasi ${item.title} berhasil!`);
}}
className="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer"
title="Duplikasi"
>
<Copy className="w-3.5 h-3.5" />
</button>
<button
onClick={() => triggerToast(`Preview ${item.title}`)}
className="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer"
title="Lihat Detail"
>
<Eye className="w-3.5 h-3.5" />
</button>
<button
onClick={() => triggerToast(`Menu pilihan untuk ${item.title}`)}
className="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer"
title="Lainnya"
>
<MoreVertical className="w-3.5 h-3.5" />
</button>
</div>
</div>
</div>
))}
</div>
{/* PAGINATION BAR */}
<div className="bg-white p-3.5 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col sm:flex-row items-center justify-between gap-3 text-xs text-slate-500 font-medium">
<div>
Menampilkan <span className="font-bold text-slate-900">1 - {filteredServices.length}</span> dari <span className="font-bold text-slate-900">32</span> data
</div>
<div className="flex items-center gap-3">
<div className="flex items-center gap-1 font-bold">
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
<ChevronLeft className="w-3.5 h-3.5" />
</button>
<button type="button" className="w-7 h-7 rounded-lg bg-[#EC167F] text-white flex items-center justify-center font-extrabold shadow-2xs">
1
</button>
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
2
</button>
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
3
</button>
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
4
</button>
<span className="px-1 text-slate-400">...</span>
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
11
</button>
<button type="button" className="w-7 h-7 rounded-lg border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 cursor-pointer">
<ChevronRight className="w-3.5 h-3.5" />
</button>
</div>
<div className="relative">
<select className="appearance-none pl-2.5 pr-6 py-1 bg-white border border-slate-200 rounded-lg text-xs font-bold text-slate-700 cursor-pointer focus:outline-none">
<option>9 / halaman</option>
<option>18 / halaman</option>
<option>36 / halaman</option>
</select>
<ChevronDown className="w-3 h-3 text-slate-400 absolute right-2 top-2 pointer-events-none" />
</div>
</div>
</div>
</div>
{/* RIGHT SIDEBAR (Cols 4 / 3) */}
<div className="lg:col-span-4 xl:col-span-3 space-y-5">
{/* Card 1: Ringkasan Performa */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<div className="flex items-center justify-between">
<h2 className="text-sm font-extrabold text-slate-900">Ringkasan Performa</h2>
<select className="text-xs font-bold text-slate-600 bg-slate-50 border border-slate-200 rounded-lg px-2 py-1 cursor-pointer focus:outline-none">
<option>Mei 2025</option>
<option>April 2025</option>
<option>Maret 2025</option>
</select>
</div>
<div className="grid grid-cols-2 gap-4 text-xs pt-1">
<div>
<span className="text-slate-400 font-medium block">Total Booking</span>
<span className="text-lg font-black text-slate-900 block mt-0.5">128</span>
<span className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-0.5">
<ArrowUp className="w-2.5 h-2.5" /> 18%
</span>
</div>
<div>
<span className="text-slate-400 font-medium block">Pendapatan</span>
<span className="text-sm font-black text-slate-900 block mt-0.5 truncate">Rp126.500.000</span>
<span className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-0.5">
<ArrowUp className="w-2.5 h-2.5" /> 22%
</span>
</div>
<div>
<span className="text-slate-400 font-medium block">Rata-rata Harga</span>
<span className="text-sm font-black text-slate-900 block mt-0.5">Rp987.000</span>
<span className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-0.5">
<ArrowUp className="w-2.5 h-2.5" /> 10%
</span>
</div>
<div>
<span className="text-slate-400 font-medium block">Repeat Booking</span>
<span className="text-lg font-black text-slate-900 block mt-0.5">68%</span>
<span className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-0.5">
<ArrowUp className="w-2.5 h-2.5" /> 6%
</span>
</div>
</div>
</div>
{/* Card 2: Filter Lanjutan */}
<div className="bg-white p-5 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
<h2 className="text-sm font-extrabold text-slate-900">Filter Lanjutan</h2>
<div className="space-y-3 text-xs">
<div>
<label className="block font-bold text-slate-700 mb-1.5">Rentang Harga</label>
<div className="flex items-center gap-2">
<input
type="number"
placeholder="Min harga"
value={minPrice}
onChange={(e) => setMinPrice(e.target.value)}
className="w-full p-2 bg-slate-50 border border-slate-200 rounded-xl font-semibold focus:bg-white focus:outline-none text-slate-800 placeholder:text-slate-400"
/>
<span className="text-slate-400 font-bold">-</span>
<input
type="number"
placeholder="Maks harga"
value={maxPrice}
onChange={(e) => setMaxPrice(e.target.value)}
className="w-full p-2 bg-slate-50 border border-slate-200 rounded-xl font-semibold focus:bg-white focus:outline-none text-slate-800 placeholder:text-slate-400"
/>
</div>
</div>
<div>
<label className="block font-bold text-slate-700 mb-1.5">Durasi</label>
<div className="relative">
<select className="w-full appearance-none p-2 pr-7 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer">
<option>Semua Durasi</option>
<option>< 1 Jam</option>
<option>1 - 4 Jam</option>
<option>Full Day (> 5 Jam)</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-2.5 pointer-events-none" />
</div>
</div>
<div>
<label className="block font-bold text-slate-700 mb-1.5">Best Seller</label>
<div className="relative">
<select className="w-full appearance-none p-2 pr-7 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer">
<option>Semua</option>
<option>Ya (Best Seller Saja)</option>
<option>Biasa</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-2.5 pointer-events-none" />
</div>
</div>
<div>
<label className="block font-bold text-slate-700 mb-1.5">Status</label>
<div className="relative">
<select className="w-full appearance-none p-2 pr-7 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-700 focus:bg-white focus:outline-none cursor-pointer">
<option>Semua Status</option>
<option>Aktif</option>
<option>Nonaktif</option>
</select>
<ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-2.5 pointer-events-none" />
</div>
</div>
<div className="pt-2 space-y-2">
<button
onClick={() => triggerToast('Filter diterapkan')}
className="w-full py-2 bg-[#EC167F] hover:bg-[#D41270] text-white font-black rounded-xl transition-colors cursor-pointer shadow-xs"
>
Terapkan Filter
</button>
<button
onClick={() => {
setMinPrice('');
setMaxPrice('');
triggerToast('Filter direset');
}}
className="w-full py-2 bg-white hover:bg-slate-50 text-slate-600 font-bold border border-slate-200 rounded-xl transition-colors cursor-pointer"
>
Reset Filter
</button>
</div>
</div>
</div>
</div>
</div>
</div>
);
};