%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/
Upload File :
Create Path :
Current File : //home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/views/PaketView.tsx

import React, { useState } from 'react';
import {
  Store, Calendar, Star, Building2, CreditCard, Search, Filter,
  Download, Eye, Edit, MoreVertical, Crown, Zap, Sprout, CalendarDays,
  XCircle, CheckCircle2, ChevronLeft, ChevronRight, ChevronDown, Check,
  Plus, ArrowUpRight
} from 'lucide-react';
import { PaketFormView } from './PaketFormView';

interface PaketViewProps {
  triggerToast: (msg: string) => void;
}

interface PackageItem {
  id: string;
  name: string;
  description: string;
  type: string;
  typeBadgeBg: string;
  typeBadgeColor: string;
  price: string;
  pricePeriod?: string;
  subPriceText?: string;
  billing: string;
  billingBadgeBg?: string;
  billingBadgeColor?: string;
  tenantCount: number;
  status: 'Aktif' | 'Nonaktif';
  icon: React.ElementType;
  iconBg: string;
  iconColor: string;
  minTenant: string;
  maxTenant: string;
  createdAt: string;
  createdBy: string;
  updatedAt: string;
  detailDescription: string;
  features: string[];
}

export const PaketView: React.FC<PaketViewProps> = ({ triggerToast }) => {
  const [statusFilter, setStatusFilter] = useState('Semua Status');
  const [typeFilter, setTypeFilter] = useState('Semua Tipe');
  const [sortOrder, setSortOrder] = useState('Urutkan');
  const [searchQuery, setSearchQuery] = useState('');
  const [activeMenuId, setActiveMenuId] = useState<string | null>(null);

  // List of packages matching the reference screenshot
  const packageList: PackageItem[] = [
    {
      id: 'enterprise',
      name: 'Enterprise',
      description: 'Semua fitur tanpa batas untuk bisnis besar',
      type: 'Premium',
      typeBadgeBg: 'bg-purple-100',
      typeBadgeColor: 'text-purple-700',
      price: 'Rp599.000',
      pricePeriod: '/bulan',
      billing: 'Bulanan',
      billingBadgeBg: 'bg-emerald-100',
      billingBadgeColor: 'text-emerald-700',
      tenantCount: 58,
      status: 'Aktif',
      icon: Crown,
      iconBg: 'bg-pink-100',
      iconColor: 'text-pink-600',
      minTenant: '-',
      maxTenant: '-',
      createdAt: '10 Jan 2025, 10:24',
      createdBy: 'Reza Setiawan',
      updatedAt: '20 Mei 2025, 14:30',
      detailDescription: 'Paket lengkap dengan semua fitur tanpa batasan. Cocok untuk perusahaan besar dengan banyak tim dan kebutuhan lanjutan.',
      features: [
        'Semua fitur Basic & Pro',
        'User & Admin Tanpa Batas',
        'Penyimpanan 100 GB',
        'Domain Custom',
        'API Access',
        'Priority Support 24/7'
      ]
    },
    {
      id: 'pro',
      name: 'Pro',
      description: 'Fitur lengkap untuk bisnis yang berkembang',
      type: 'Pro',
      typeBadgeBg: 'bg-pink-100',
      typeBadgeColor: 'text-pink-600',
      price: 'Rp299.000',
      pricePeriod: '/bulan',
      billing: 'Bulanan',
      billingBadgeBg: 'bg-emerald-100',
      billingBadgeColor: 'text-emerald-700',
      tenantCount: 96,
      status: 'Aktif',
      icon: Star,
      iconBg: 'bg-amber-100',
      iconColor: 'text-amber-600',
      minTenant: '1',
      maxTenant: '15',
      createdAt: '12 Jan 2025, 09:15',
      createdBy: 'Reza Setiawan',
      updatedAt: '18 Mei 2025, 11:20',
      detailDescription: 'Paket ideal untuk studio kecantikan dan MUA profesional yang membutuhkan manajemen tim dan reservasi terintegrasi.',
      features: [
        'Hingga 15 Pengguna',
        'Reservasi & Jadwal Unlimited',
        'Penyimpanan 25 GB',
        'Integrasi Payment Gateway',
        'Laporan Analitik Lengkap',
        'Support Email & WhatsApp'
      ]
    },
    {
      id: 'basic',
      name: 'Basic',
      description: 'Semua fitur penting untuk memulai',
      type: 'Basic',
      typeBadgeBg: 'bg-blue-100',
      typeBadgeColor: 'text-blue-700',
      price: 'Rp149.000',
      pricePeriod: '/bulan',
      billing: 'Bulanan',
      billingBadgeBg: 'bg-emerald-100',
      billingBadgeColor: 'text-emerald-700',
      tenantCount: 112,
      status: 'Aktif',
      icon: Zap,
      iconBg: 'bg-blue-100',
      iconColor: 'text-blue-600',
      minTenant: '1',
      maxTenant: '5',
      createdAt: '15 Jan 2025, 14:00',
      createdBy: 'Dewi Lestari',
      updatedAt: '10 Mei 2025, 16:45',
      detailDescription: 'Paket dasar dengan fitur esensial untuk mengelola booking harian dan katalog layanan studio Anda.',
      features: [
        'Hingga 5 Pengguna',
        'Subdomain MuaKita',
        'Penyimpanan 5 GB',
        'Kalender Reservasi Standard',
        'Pengingat Pelanggan'
      ]
    },
    {
      id: 'starter',
      name: 'Starter',
      description: 'Paket terjangkau untuk UMKM baru',
      type: 'Basic',
      typeBadgeBg: 'bg-blue-100',
      typeBadgeColor: 'text-blue-700',
      price: 'Rp79.000',
      pricePeriod: '/bulan',
      billing: 'Bulanan',
      billingBadgeBg: 'bg-emerald-100',
      billingBadgeColor: 'text-emerald-700',
      tenantCount: 28,
      status: 'Aktif',
      icon: Sprout,
      iconBg: 'bg-emerald-100',
      iconColor: 'text-emerald-600',
      minTenant: '1',
      maxTenant: '2',
      createdAt: '01 Feb 2025, 08:30',
      createdBy: 'Reza Setiawan',
      updatedAt: '05 Mei 2025, 10:10',
      detailDescription: 'Paket entri ekonomis untuk penata rias perorangan yang baru beralih dari pencatatan manual ke digital.',
      features: [
        '2 Pengguna Admin',
        'Manajemen Layanan & Portfolio',
        'Penyimpanan 2 GB',
        'Notifikasi Email'
      ]
    },
    {
      id: 'custom',
      name: 'Custom',
      description: 'Paket khusus menyesuaikan kebutuhan',
      type: 'Custom',
      typeBadgeBg: 'bg-purple-100',
      typeBadgeColor: 'text-purple-700',
      price: '-',
      subPriceText: 'Hubungi Admin',
      billing: 'Kustom',
      billingBadgeBg: 'bg-amber-100',
      billingBadgeColor: 'text-amber-700',
      tenantCount: 15,
      status: 'Aktif',
      icon: CalendarDays,
      iconBg: 'bg-purple-100',
      iconColor: 'text-purple-600',
      minTenant: 'Sesuaian',
      maxTenant: 'Sesuaian',
      createdAt: '20 Feb 2025, 11:00',
      createdBy: 'Super Admin',
      updatedAt: '12 Mei 2025, 09:30',
      detailDescription: 'Paket fleksibel dengan alokasi modul dan kapasitas khusus sesuai kebutuhan korporat atau jaringan waralaba.',
      features: [
        'Konfigurasi Modul Kustom',
        'SLA Garansi Uptime 99.9%',
        'Dedicated Support Manager',
        'Integrasi ERP / API Khusus'
      ]
    },
    {
      id: 'trial',
      name: 'Trial',
      description: 'Paket percobaan 14 hari',
      type: 'Trial',
      typeBadgeBg: 'bg-slate-100',
      typeBadgeColor: 'text-slate-600',
      price: 'Gratis',
      billing: '-',
      tenantCount: 3,
      status: 'Nonaktif',
      icon: XCircle,
      iconBg: 'bg-slate-100',
      iconColor: 'text-slate-500',
      minTenant: '1',
      maxTenant: '1',
      createdAt: '01 Jan 2025, 00:00',
      createdBy: 'System',
      updatedAt: '01 Apr 2025, 12:00',
      detailDescription: 'Paket evaluasi gratis selama 14 hari untuk calon tenant merasakan kemudahan platform MuaKita.',
      features: [
        'Akses 14 Hari',
        'Semua Fitur Basic Activated',
        'Maksimal 10 Booking Uji Coba'
      ]
    }
  ];

  // Selected package for right detail sidebar
  const [selectedPackage, setSelectedPackage] = useState<PackageItem>(packageList[0]);
  const [isFormOpen, setIsFormOpen] = useState(false);
  const [editingPackage, setEditingPackage] = useState<PackageItem | null>(null);

  // Filter logic
  const filteredPackages = packageList.filter((pkg) => {
    const matchesStatus =
      statusFilter === 'Semua Status' || pkg.status === statusFilter;
    const matchesType =
      typeFilter === 'Semua Tipe' || pkg.type === typeFilter;
    const matchesSearch =
      searchQuery === '' ||
      pkg.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
      pkg.description.toLowerCase().includes(searchQuery.toLowerCase());

    return matchesStatus && matchesType && matchesSearch;
  });

  if (isFormOpen) {
    return (
      <PaketFormView
        initialData={editingPackage}
        onBack={() => setIsFormOpen(false)}
        triggerToast={triggerToast}
      />
    );
  }

  return (
    <div className="space-y-5 animate-in fade-in duration-200 text-slate-800 pb-10">
      
      {/* ========================================================= */}
      {/* 1. TOP METRIC CARDS (5 Cards) */}
      {/* ========================================================= */}
      <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3.5">
        
        {/* Card 1: Total Paket */}
        <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center gap-3">
          <div className="w-10 h-10 rounded-2xl bg-pink-50 text-pink-500 flex items-center justify-center shrink-0 border border-pink-100">
            <Store className="w-5 h-5" />
          </div>
          <div className="min-w-0">
            <span className="text-[11px] font-bold text-slate-400 block">Total Paket</span>
            <span className="text-xl font-black text-slate-900 leading-tight block">6</span>
            <span className="text-[10px] text-slate-400 block truncate">Semua paket terdaftar</span>
          </div>
        </div>

        {/* Card 2: Paket Aktif */}
        <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center gap-3">
          <div className="w-10 h-10 rounded-2xl bg-emerald-50 text-emerald-500 flex items-center justify-center shrink-0 border border-emerald-100">
            <Calendar className="w-5 h-5" />
          </div>
          <div className="min-w-0">
            <span className="text-[11px] font-bold text-slate-400 block">Paket Aktif</span>
            <span className="text-xl font-black text-slate-900 leading-tight block">5</span>
            <span className="text-[10px] text-slate-400 block truncate">Paket dapat digunakan</span>
          </div>
        </div>

        {/* Card 3: Paket Nonaktif */}
        <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center gap-3">
          <div className="w-10 h-10 rounded-2xl bg-amber-50 text-amber-500 flex items-center justify-center shrink-0 border border-amber-100">
            <Star className="w-5 h-5" />
          </div>
          <div className="min-w-0">
            <span className="text-[11px] font-bold text-slate-400 block">Paket Nonaktif</span>
            <span className="text-xl font-black text-slate-900 leading-tight block">1</span>
            <span className="text-[10px] text-slate-400 block truncate">Tidak tersedia untuk dipilih</span>
          </div>
        </div>

        {/* Card 4: Total Tenant */}
        <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center gap-3">
          <div className="w-10 h-10 rounded-2xl bg-purple-50 text-purple-500 flex items-center justify-center shrink-0 border border-purple-100">
            <Building2 className="w-5 h-5" />
          </div>
          <div className="min-w-0">
            <span className="text-[11px] font-bold text-slate-400 block">Total Tenant</span>
            <span className="text-xl font-black text-slate-900 leading-tight block">312</span>
            <span className="text-[10px] text-slate-400 block truncate">Menggunakan paket</span>
          </div>
        </div>

        {/* Card 5: Pendapatan (Bulan Ini) */}
        <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex items-center gap-3">
          <div className="w-10 h-10 rounded-2xl bg-blue-50 text-blue-500 flex items-center justify-center shrink-0 border border-blue-100">
            <CreditCard className="w-5 h-5" />
          </div>
          <div className="min-w-0">
            <span className="text-[11px] font-bold text-slate-400 block truncate">Pendapatan (Bulan Ini)</span>
            <span className="text-base font-black text-slate-900 leading-tight block truncate">Rp358.750.000</span>
            <span className="text-[10px] font-bold text-emerald-600 flex items-center gap-0.5 mt-0.5">
              ↑ 18.6% <span className="text-slate-400 font-normal">vs bulan lalu</span>
            </span>
          </div>
        </div>

      </div>

      {/* ========================================================= */}
      {/* 2. MAIN CONTAINER: TABLE & DETAIL SIDEBAR */}
      {/* ========================================================= */}
      <div className="grid grid-cols-1 lg:grid-cols-12 gap-5 items-start">
        
        {/* LEFT COLUMN: FILTER BAR + TABLE + PAGINATION (Spans 8 columns in lg) */}
        <div className="lg:col-span-8 space-y-4">
          
          {/* FILTER AND ACTION BAR */}
          <div className="bg-white p-3 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-wrap items-center justify-between gap-2.5">
            
            {/* Filter Dropdowns */}
            <div className="flex flex-wrap items-center gap-2 flex-1 min-w-[280px]">
              {/* Status Filter */}
              <div className="relative">
                <select
                  value={statusFilter}
                  onChange={(e) => setStatusFilter(e.target.value)}
                  className="appearance-none bg-slate-50 border border-slate-200 text-slate-700 text-xs font-semibold py-2 pl-3 pr-8 rounded-xl focus:outline-none focus:border-pink-500 cursor-pointer"
                >
                  <option value="Semua Status">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-2.5 pointer-events-none" />
              </div>

              {/* Tipe Paket Filter */}
              <div className="relative">
                <select
                  value={typeFilter}
                  onChange={(e) => setTypeFilter(e.target.value)}
                  className="appearance-none bg-slate-50 border border-slate-200 text-slate-700 text-xs font-semibold py-2 pl-3 pr-8 rounded-xl focus:outline-none focus:border-pink-500 cursor-pointer"
                >
                  <option value="Semua Tipe">Semua Tipe</option>
                  <option value="Premium">Premium</option>
                  <option value="Pro">Pro</option>
                  <option value="Basic">Basic</option>
                  <option value="Custom">Custom</option>
                  <option value="Trial">Trial</option>
                </select>
                <ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-2.5 pointer-events-none" />
              </div>

              {/* Urutan Filter */}
              <div className="relative">
                <select
                  value={sortOrder}
                  onChange={(e) => setSortOrder(e.target.value)}
                  className="appearance-none bg-slate-50 border border-slate-200 text-slate-700 text-xs font-semibold py-2 pl-3 pr-8 rounded-xl focus:outline-none focus:border-pink-500 cursor-pointer"
                >
                  <option value="Urutkan">Urutkan</option>
                  <option value="Harga Termahal">Harga Termahal</option>
                  <option value="Harga Termurah">Harga Termurah</option>
                  <option value="Tenant Terbanyak">Tenant Terbanyak</option>
                </select>
                <ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-2.5 top-2.5 pointer-events-none" />
              </div>

              {/* Search Box */}
              <div className="relative flex-1 min-w-[180px]">
                <Search className="w-3.5 h-3.5 text-slate-400 absolute left-3 top-2.5" />
                <input
                  type="text"
                  placeholder="Cari nama paket atau deskripsi..."
                  value={searchQuery}
                  onChange={(e) => setSearchQuery(e.target.value)}
                  className="w-full bg-slate-50 border border-slate-200 text-slate-800 placeholder-slate-400 text-xs font-medium py-2 pl-8 pr-3 rounded-xl focus:outline-none focus:border-pink-500"
                />
              </div>
            </div>

            {/* Action Buttons: Filter, Export & Tambah Paket */}
            <div className="flex items-center gap-2">
              <button
                onClick={() => triggerToast('Filter diterapkan')}
                className="px-3 py-2 bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 text-xs font-bold rounded-xl flex items-center gap-1.5 transition-colors cursor-pointer shadow-2xs"
              >
                <Filter className="w-3.5 h-3.5 text-slate-500" />
                <span>Filter</span>
              </button>

              <button
                onClick={() => triggerToast('Mengunduh data paket...')}
                className="px-3 py-2 bg-white hover:bg-slate-50 border border-slate-200 text-slate-700 text-xs font-bold rounded-xl flex items-center gap-1.5 transition-colors cursor-pointer shadow-2xs"
              >
                <Download className="w-3.5 h-3.5 text-slate-500" />
                <span>Export</span>
              </button>

              <button
                onClick={() => {
                  setEditingPackage(null);
                  setIsFormOpen(true);
                }}
                className="px-3.5 py-2 bg-[#EC167F] hover:bg-pink-600 text-white text-xs font-extrabold rounded-xl flex items-center gap-1.5 transition-all cursor-pointer shadow-sm active:scale-98"
              >
                <Plus className="w-3.5 h-3.5 stroke-[3]" />
                <span>Tambah Paket</span>
              </button>
            </div>

          </div>

          {/* TABLE AREA */}
          <div className="bg-white rounded-2xl border border-slate-200/80 shadow-2xs overflow-hidden">
            <div className="overflow-x-auto">
              <table className="w-full text-left border-collapse">
                <thead>
                  <tr className="bg-slate-50/70 border-b border-slate-100 text-[11px] font-bold text-slate-500 tracking-wider">
                    <th className="py-3 px-4">Paket</th>
                    <th className="py-3 px-3">Tipe</th>
                    <th className="py-3 px-3">Harga</th>
                    <th className="py-3 px-3">Billing</th>
                    <th className="py-3 px-3">Tenant</th>
                    <th className="py-3 px-3">Status</th>
                    <th className="py-3 px-4 text-center">Aksi</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-slate-100 text-xs font-medium">
                  {filteredPackages.map((pkg) => {
                    const IconComp = pkg.icon;
                    const isSelected = selectedPackage.id === pkg.id;

                    return (
                      <tr
                        key={pkg.id}
                        onClick={() => setSelectedPackage(pkg)}
                        className={`transition-colors cursor-pointer ${
                          isSelected ? 'bg-pink-50/40 hover:bg-pink-50/60' : 'hover:bg-slate-50/80'
                        }`}
                      >
                        {/* Paket Icon + Name + Description */}
                        <td className="py-3.5 px-4 min-w-[200px]">
                          <div className="flex items-center gap-3">
                            <div className={`w-9 h-9 rounded-full ${pkg.iconBg} ${pkg.iconColor} flex items-center justify-center shrink-0`}>
                              <IconComp className="w-4 h-4" />
                            </div>
                            <div className="min-w-0">
                              <span className="font-extrabold text-slate-900 block leading-tight">{pkg.name}</span>
                              <span className="text-[11px] text-slate-400 block truncate">{pkg.description}</span>
                            </div>
                          </div>
                        </td>

                        {/* Tipe Badge */}
                        <td className="py-3.5 px-3 whitespace-nowrap">
                          <span className={`px-2.5 py-0.5 rounded-full text-[10px] font-bold ${pkg.typeBadgeBg} ${pkg.typeBadgeColor}`}>
                            {pkg.type}
                          </span>
                        </td>

                        {/* Harga */}
                        <td className="py-3.5 px-3 whitespace-nowrap">
                          <div>
                            <span className="font-extrabold text-slate-900 text-xs">{pkg.price}</span>
                            {pkg.pricePeriod && (
                              <span className="text-[10px] text-slate-400 font-normal"> {pkg.pricePeriod}</span>
                            )}
                            {pkg.subPriceText && (
                              <span className="text-[10px] text-slate-400 block">{pkg.subPriceText}</span>
                            )}
                          </div>
                        </td>

                        {/* Billing Badge */}
                        <td className="py-3.5 px-3 whitespace-nowrap">
                          {pkg.billing !== '-' ? (
                            <span className={`px-2 py-0.5 rounded-full text-[10px] font-bold ${pkg.billingBadgeBg} ${pkg.billingBadgeColor}`}>
                              {pkg.billing}
                            </span>
                          ) : (
                            <span className="text-slate-400">-</span>
                          )}
                        </td>

                        {/* Tenant Count */}
                        <td className="py-3.5 px-3 whitespace-nowrap">
                          <div>
                            <span className="font-extrabold text-slate-900 block leading-tight">{pkg.tenantCount}</span>
                            <span className="text-[10px] text-slate-400 block">Tenant</span>
                          </div>
                        </td>

                        {/* Status Badge */}
                        <td className="py-3.5 px-3 whitespace-nowrap">
                          <span className={`text-[11px] font-bold flex items-center gap-1 ${
                            pkg.status === 'Aktif' ? 'text-emerald-600' : 'text-rose-600'
                          }`}>
                            <span className={`w-1.5 h-1.5 rounded-full ${
                              pkg.status === 'Aktif' ? 'bg-emerald-500' : 'bg-rose-500'
                            }`}></span>
                            {pkg.status}
                          </span>
                        </td>

                        {/* Aksi Action Buttons */}
                        <td className="py-3.5 px-4 text-center whitespace-nowrap" onClick={(e) => e.stopPropagation()}>
                          <div className="flex items-center justify-center gap-1 relative">
                            {/* Eye View Button */}
                            <button
                              onClick={() => setSelectedPackage(pkg)}
                              className={`p-1.5 rounded-lg border transition-colors cursor-pointer ${
                                isSelected ? 'border-pink-300 bg-pink-100 text-[#EC167F]' : 'border-slate-200 text-blue-600 hover:bg-blue-50'
                              }`}
                              title="Lihat Detail Paket"
                            >
                              <Eye className="w-3.5 h-3.5" />
                            </button>

                            {/* Edit Button */}
                            <button
                              onClick={() => {
                                setEditingPackage(pkg);
                                setIsFormOpen(true);
                              }}
                              className="p-1.5 rounded-lg border border-slate-200 text-slate-600 hover:bg-slate-100 transition-colors cursor-pointer"
                              title="Edit Paket"
                            >
                              <Edit className="w-3.5 h-3.5" />
                            </button>

                            {/* Menu Dropdown Button */}
                            <button
                              onClick={() => setActiveMenuId(activeMenuId === pkg.id ? null : pkg.id)}
                              className="p-1.5 rounded-lg border border-slate-200 text-slate-400 hover:bg-slate-100 transition-colors cursor-pointer"
                            >
                              <MoreVertical className="w-3.5 h-3.5" />
                            </button>

                            {/* Dropdown Menu Popup */}
                            {activeMenuId === pkg.id && (
                              <div className="absolute right-0 top-full mt-1 w-36 bg-white rounded-xl shadow-xl border border-slate-200 py-1.5 z-20 text-left text-xs animate-in fade-in zoom-in-95">
                                <button
                                  onClick={() => {
                                    setSelectedPackage(pkg);
                                    setActiveMenuId(null);
                                  }}
                                  className="w-full px-3 py-1.5 text-slate-700 hover:bg-slate-50 flex items-center gap-2 font-medium cursor-pointer"
                                >
                                  <Eye className="w-3.5 h-3.5 text-blue-500" />
                                  <span>Detail</span>
                                </button>

                                <button
                                  onClick={() => {
                                    triggerToast(`Ubah status paket ${pkg.name}`);
                                    setActiveMenuId(null);
                                  }}
                                  className="w-full px-3 py-1.5 text-slate-700 hover:bg-slate-50 flex items-center gap-2 font-medium cursor-pointer"
                                >
                                  <CheckCircle2 className="w-3.5 h-3.5 text-emerald-500" />
                                  <span>Toggle Status</span>
                                </button>
                              </div>
                            )}
                          </div>
                        </td>

                      </tr>
                    );
                  })}
                </tbody>
              </table>
            </div>

            {/* TABLE FOOTER / PAGINATION */}
            <div className="p-3 bg-slate-50/50 border-t border-slate-100 flex flex-col sm:flex-row items-center justify-between gap-3 text-xs text-slate-500">
              <span>Menampilkan 1 - 6 dari 6 paket</span>

              <div className="flex items-center gap-4">
                {/* Pagination Controls */}
                <div className="flex items-center gap-1">
                  <button className="w-7 h-7 rounded-lg border border-slate-200 flex items-center justify-center text-slate-400 hover:bg-white transition-colors cursor-not-allowed">
                    <ChevronLeft className="w-4 h-4" />
                  </button>
                  <button className="w-7 h-7 rounded-lg bg-[#EC167F] text-white font-bold flex items-center justify-center shadow-2xs">
                    1
                  </button>
                  <button className="w-7 h-7 rounded-lg border border-slate-200 flex items-center justify-center text-slate-400 hover:bg-white transition-colors cursor-not-allowed">
                    <ChevronRight className="w-4 h-4" />
                  </button>
                </div>

                {/* Per Page Select */}
                <div className="relative">
                  <select className="appearance-none bg-white border border-slate-200 text-slate-700 text-xs font-semibold py-1 pl-2.5 pr-6 rounded-lg focus:outline-none">
                    <option>10 / halaman</option>
                    <option>25 / halaman</option>
                    <option>50 / halaman</option>
                  </select>
                  <ChevronDown className="w-3.5 h-3.5 text-slate-400 absolute right-1.5 top-1.5 pointer-events-none" />
                </div>
              </div>
            </div>

          </div>

        </div>

        {/* RIGHT COLUMN: DETAIL PAKET SIDEBAR (Spans 4 columns in lg) */}
        <div className="lg:col-span-4 bg-white rounded-2xl border border-slate-200/80 shadow-2xs p-5 space-y-5 sticky top-4">
          
          {/* Header Title */}
          <h3 className="text-sm font-black text-slate-900 pb-2 border-b border-slate-100">
            Detail Paket
          </h3>

          {/* Package Top Header Box */}
          <div className="flex items-start gap-3">
            <div className={`w-10 h-10 rounded-full ${selectedPackage.iconBg} ${selectedPackage.iconColor} flex items-center justify-center shrink-0`}>
              <selectedPackage.icon className="w-5 h-5" />
            </div>

            <div className="min-w-0 flex-1">
              <div className="flex items-center justify-between gap-2">
                <h4 className="text-base font-black text-slate-900 leading-tight">{selectedPackage.name}</h4>
                <span className={`px-2 py-0.5 rounded-full text-[10px] font-bold ${
                  selectedPackage.status === 'Aktif' ? 'bg-emerald-100 text-emerald-700' : 'bg-rose-100 text-rose-700'
                }`}>
                  {selectedPackage.status}
                </span>
              </div>
              <p className="text-xs text-slate-500 mt-0.5 leading-snug">{selectedPackage.description}</p>
            </div>
          </div>

          {/* Key-Value Attributes List */}
          <div className="space-y-2.5 text-xs pt-1 border-t border-slate-100">
            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Tipe Paket</span>
              <span className="font-bold text-slate-900">{selectedPackage.type}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Harga</span>
              <span className="font-bold text-slate-900">
                {selectedPackage.price}
                {selectedPackage.pricePeriod && <span className="text-slate-400 font-normal"> {selectedPackage.pricePeriod}</span>}
              </span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Billing</span>
              <span className="font-bold text-slate-900">{selectedPackage.billing}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Minimal Tenant</span>
              <span className="font-bold text-slate-900">{selectedPackage.minTenant}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Maksimal Tenant</span>
              <span className="font-bold text-slate-900">{selectedPackage.maxTenant}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Dibuat Pada</span>
              <span className="font-bold text-slate-900">{selectedPackage.createdAt}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Dibuat Oleh</span>
              <span className="font-bold text-slate-900">{selectedPackage.createdBy}</span>
            </div>

            <div className="flex items-center justify-between py-0.5">
              <span className="text-slate-400 font-medium">Terakhir Diperbarui</span>
              <span className="font-bold text-slate-900">{selectedPackage.updatedAt}</span>
            </div>
          </div>

          {/* Deskripsi Section */}
          <div className="space-y-1.5 pt-2 border-t border-slate-100 text-xs">
            <span className="font-extrabold text-slate-900 block text-[11px]">Deskripsi</span>
            <p className="text-slate-600 leading-relaxed text-[11px]">
              {selectedPackage.detailDescription}
            </p>
          </div>

          {/* Fitur Utama Section */}
          <div className="space-y-2 pt-2 border-t border-slate-100 text-xs">
            <span className="font-extrabold text-slate-900 block text-[11px]">Fitur Utama</span>
            
            <div className="space-y-2">
              {selectedPackage.features.map((feat, index) => (
                <div key={index} className="flex items-start gap-2 text-[11px] text-slate-700 font-medium">
                  <div className="w-4 h-4 rounded-full bg-emerald-100 text-emerald-600 flex items-center justify-center shrink-0 mt-0.5">
                    <Check className="w-2.5 h-2.5" />
                  </div>
                  <span>{feat}</span>
                </div>
              ))}
            </div>
          </div>

          {/* Edit Paket Button */}
          <button
            onClick={() => {
              setEditingPackage(selectedPackage);
              setIsFormOpen(true);
            }}
            className="w-full py-2.5 bg-white hover:bg-pink-50 text-[#EC167F] font-extrabold text-xs rounded-xl border border-pink-200 transition-all cursor-pointer shadow-2xs active:scale-98"
          >
            Edit Paket
          </button>

        </div>

      </div>

    </div>
  );
};

Zerion Mini Shell 1.0