'use client'; import { useState, useEffect, useRef, useCallback } from 'react'; import { formatDisplayDate, formatDisplayDateTime } from '@/lib/date'; type Image = { id: number; filename: string; data: string; category: string; room_id: number | null; location_target: string; uploaded_at: string }; type Slide = { id: number; title: string; subtitle: string; image_url: string | null; image_id: number | null; active: boolean; sort_order: number }; type Room = { id: number; name: string; description: string; price: string; photos: string[]; featured_photo: string | null; active: boolean; sort_order: number; amenity_ids?: number[] }; type CalendarEvent = { id: number; date: string; title: string; type: string; color: string; description: string | null; active: boolean }; type SocialEvent = { id: number; name: string; description: string; price: string | null; date: string | null; photos: string[]; featured_photo: string | null; active: boolean; is_private: boolean; max_guests: number | null; sort_order: number }; type MenuItem = { id: number; category: string; name: string; description: string; price: string; is_daily_special: boolean; active: boolean; sort_order: number; photos: string[]; featured_photo: string | null }; type Place = { id: number; name: string; description: string; photos: string[]; featured_photo: string | null; distance_km: string; visit_time: string; suggestion: string; active: boolean; sort_order: number }; type Review = { id: number; author_name: string; author_email: string | null; rating: number; text: string; approved: boolean }; type FooterConfig = { logo: string; favicon: string; tagline: string; facebook_url: string; instagram_url: string; whatsapp_url: string; address: string; phone: string; email: string }; type SocialRes = { id: number; event_id: number; username: string; event_name: string; guests: number; notes: string; status: string; created_at: string }; type Amenity = { id: number; name: string; icon_svg: string; sort_order: number }; type RestaurantReservation = { id: number; user_id: number | null; date: string; time: string; guests: number; table_name: string; created_at: string; username?: string; first_name?: string; last_name?: string }; type RoomReservation = { id: number; room_id: number; user_id: number | null; check_in: string; check_out: string; status: string; total_price: string; guest_name: string | null; guest_contact_method: string | null; guest_contact: string | null; created_at: string; room_name?: string; username?: string; first_name?: string; last_name?: string }; type Order = { id: number; user_id: number | null; order_type: string; room_id: number | null; subtotal: string; service_fee: string; total: string; status: string; notes: string | null; created_at: string; room_name?: string; username?: string; first_name?: string; last_name?: string; items: { menu_item_id: number; name: string; quantity: number; unit_price: string; total_price: string }[] }; const C = { gold: '#D4A853', goldLight: 'rgba(212,168,83,0.12)', navy: '#010D1E', warm: '#7A5A3A', bg: '#F7F4EF', card: '#FFFFFF', border: 'rgba(1,13,30,0.08)', text: '#444444', textLight: '#888888', danger: '#D32F2F', success: '#388E3C', shadow: '0 1px 4px rgba(1,13,30,0.06)', shadowHover: '0 6px 20px rgba(1,13,30,0.12)', }; const NAV = [ { id: 'brand', label: 'Brand', icon: '🎨' }, { id: 'gallery', label: 'Images', icon: 'πŸ–ΌοΈ' }, { id: 'slides', label: 'Slideshow', icon: '🎞️' }, { id: 'calendar', label: 'Calendar', icon: 'πŸ“…' }, { id: 'social', label: 'Events', icon: 'πŸŽͺ' }, { id: 'rooms', label: 'Rooms', icon: '🏨' }, { id: 'room-status', label: 'Room Status', icon: '🧹' }, { id: 'room-assignments', label: 'Assignments', icon: 'πŸ”‘' }, { id: 'room-reservations', label: 'Room Bookings', icon: 'πŸ›οΈ' }, { id: 'restaurant-reservations', label: 'Restaurant', icon: '🍽️' }, { id: 'orders', label: 'Food Orders', icon: 'πŸ“¦' }, { id: 'kitchen', label: 'Kitchen', icon: 'πŸ‘¨β€πŸ³' }, { id: 'amenities', label: 'Amenities', icon: '✨' }, { id: 'trips', label: 'Trips', icon: '✈️' }, { id: 'messages', label: 'Messages', icon: 'πŸ’¬' }, { id: 'menu', label: 'Menu', icon: 'πŸ“‹' }, { id: 'places', label: 'Places', icon: 'πŸ—ΊοΈ' }, { id: 'reviews', label: 'Reviews', icon: '⭐' }, { id: 'users', label: 'Users', icon: 'πŸ‘₯' }, { id: 'terms', label: 'Terms', icon: 'πŸ“œ' }, { id: 'weather', label: 'Weather', icon: '🌀️' }, ]; function I({ label, value, onChange, type = 'text', placeholder, style }: any) { return (
{label && } onChange(e.target.value)} placeholder={placeholder} style={{ padding: '8px 12px', borderRadius: 8, border: `1px solid ${C.border}`, fontSize: '14px', outline: 'none', background: '#FAFAFA', ...style }} onFocus={e => { (e.target.style as any).borderColor = C.gold; (e.target.style as any).background = '#FFFFFF'; }} onBlur={e => { (e.target.style as any).borderColor = C.border; (e.target.style as any).background = '#FAFAFA'; }} />
); } function TA({ label, value, onChange, rows = 3 }: any) { return (
{label && }