%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/KeuanganView.tsx

import React, { useState } from 'react';
import { 
  DollarSign, ArrowUpRight, ArrowDownRight, Plus, Minus, Download, PieChart, 
  FileText, Calendar, ChevronDown, Filter, Wallet, CreditCard, Building2,
  Clock, ArrowUp, ArrowDown, TrendingUp, CheckCircle2, MoreHorizontal,
  ChevronRight, RefreshCw, Landmark, ArrowRightLeft, AlertCircle, Eye,
  Search, SlidersHorizontal, Check, X
} from 'lucide-react';

interface KeuanganViewProps {
  activeTab?: string;
  triggerToast: (msg: string) => void;
}

export const KeuanganView: React.FC<KeuanganViewProps> = ({ 
  activeTab = 'keuangan', 
  triggerToast 
}) => {
  // Navigation & Subtab State
  const [currentViewTab, setCurrentViewTab] = useState<'ringkasan' | 'pemasukan' | 'pengeluaran' | 'arus_kas'>(() => {
    if (activeTab === 'keuangan_pemasukan') return 'pemasukan';
    if (activeTab === 'keuangan_pengeluaran') return 'pengeluaran';
    if (activeTab === 'keuangan_transaksi') return 'arus_kas';
    return 'ringkasan';
  });

  const [dateRange, setDateRange] = useState('21 Mei 2025 - 21 Jun 2025');
  const [comparisonPeriod, setComparisonPeriod] = useState('Bulan Lalu');
  const [txFilter, setTxFilter] = useState<'Semua' | 'Pemasukan' | 'Pengeluaran'>('Semua');
  const [chartInterval, setChartInterval] = useState('Harian');

  // Modal States for Quick Actions
  const [showIncomeModal, setShowIncomeModal] = useState(false);
  const [showExpenseModal, setShowExpenseModal] = useState(false);
  const [showTransferModal, setShowTransferModal] = useState(false);

  // Form States for Income Modal
  const [incDesc, setIncDesc] = useState('');
  const [incAmount, setIncAmount] = useState('');
  const [incCategory, setIncCategory] = useState('Pelunasan');
  const [incMethod, setIncMethod] = useState('Transfer BCA');

  // Form States for Expense Modal
  const [expDesc, setExpDesc] = useState('');
  const [expAmount, setExpAmount] = useState('');
  const [expCategory, setExpCategory] = useState('Operasional');
  const [expMethod, setExpMethod] = useState('Transfer Mandiri');

  // Form States for Transfer Modal
  const [trFrom, setTrFrom] = useState('BCA - 113-108-6321');
  const [trTo, setTrTo] = useState('Kas Tunai Studio');
  const [trAmount, setTrAmount] = useState('');

  // Sample Transactions
  const [transactions, setTransactions] = useState([
    {
      id: '1',
      date: '21 Jun 2025, 14:30',
      type: 'Pemasukan',
      title: 'Pelunasan Wedding - Maya Salsabila',
      code: 'RSV-250621-0130',
      category: 'Pelunasan',
      method: 'Transfer BCA',
      amount: 5000000,
      status: 'Berhasil'
    },
    {
      id: '2',
      date: '21 Jun 2025, 10:15',
      type: 'Pengeluaran',
      title: 'Pembayaran Vendor Dekorasi',
      code: 'INV-250621-0012',
      category: 'Vendor',
      method: 'Transfer Mandiri',
      amount: 2500000,
      status: 'Berhasil'
    },
    {
      id: '3',
      date: '20 Jun 2025, 16:45',
      type: 'Pemasukan',
      title: 'DP Wedding - Anisa Rahma',
      code: 'RSV-250628-0131',
      category: 'DP',
      method: 'Transfer BCA',
      amount: 2000000,
      status: 'Berhasil'
    },
    {
      id: '4',
      date: '20 Jun 2025, 09:20',
      type: 'Pengeluaran',
      title: 'Pembelian Kosmetik',
      code: 'BILL-250620-0099',
      category: 'Operasional',
      method: 'Tunai',
      amount: 850000,
      status: 'Berhasil'
    },
    {
      id: '5',
      date: '19 Jun 2025, 11:10',
      type: 'Pemasukan',
      title: 'Makeup Wisuda - Sifa Nurul',
      code: 'RSV-250619-0088',
      category: 'Pelunasan',
      method: 'Transfer BRI',
      amount: 450000,
      status: 'Berhasil'
    }
  ]);

  const handleAddIncomeSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (!incAmount || !incDesc) {
      triggerToast('Mohon lengkapi nominal dan deskripsi pemasukan!');
      return;
    }
    const amt = parseInt(incAmount) || 0;
    const newTx = {
      id: Date.now().toString(),
      date: 'Hari ini, Baru saja',
      type: 'Pemasukan' as const,
      title: incDesc,
      code: `INC-${Math.floor(1000 + Math.random() * 9000)}`,
      category: incCategory,
      method: incMethod,
      amount: amt,
      status: 'Berhasil'
    };
    setTransactions([newTx, ...transactions]);
    setShowIncomeModal(false);
    setIncDesc('');
    setIncAmount('');
    triggerToast(`Berhasil mencatat pemasukan Rp${amt.toLocaleString('id-ID')}!`);
  };

  const handleAddExpenseSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (!expAmount || !expDesc) {
      triggerToast('Mohon lengkapi nominal dan deskripsi pengeluaran!');
      return;
    }
    const amt = parseInt(expAmount) || 0;
    const newTx = {
      id: Date.now().toString(),
      date: 'Hari ini, Baru saja',
      type: 'Pengeluaran' as const,
      title: expDesc,
      code: `EXP-${Math.floor(1000 + Math.random() * 9000)}`,
      category: expCategory,
      method: expMethod,
      amount: amt,
      status: 'Berhasil'
    };
    setTransactions([newTx, ...transactions]);
    setShowExpenseModal(false);
    setExpDesc('');
    setExpAmount('');
    triggerToast(`Berhasil mencatat pengeluaran Rp${amt.toLocaleString('id-ID')}!`);
  };

  const handleTransferSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (!trAmount) {
      triggerToast('Mohon isi nominal transfer!');
      return;
    }
    const amt = parseInt(trAmount) || 0;
    setShowTransferModal(false);
    setTrAmount('');
    triggerToast(`Transfer saldo Rp${amt.toLocaleString('id-ID')} berhasil diproses!`);
  };

  const filteredTransactions = transactions.filter(t => {
    if (txFilter === 'Pemasukan' && t.type !== 'Pemasukan') return false;
    if (txFilter === 'Pengeluaran' && t.type !== 'Pengeluaran') return false;
    return true;
  });

  return (
    <div className="space-y-4 animate-in fade-in duration-300 text-slate-800 pb-12">
      
      {/* 1. BREADCRUMB & HEADER TOP BAR */}
      <div className="flex flex-col md:flex-row md:items-center justify-between gap-3">
        
        {/* Left Title & Breadcrumb */}
        <div>
          <div className="flex items-center gap-1.5 text-xs text-slate-500 font-medium mb-1">
            <span className="hover:text-slate-800 cursor-pointer">Keuangan</span>
            <ChevronRight className="w-3.5 h-3.5 text-slate-400" />
            <span className="text-[#EC167F] font-bold">
              {currentViewTab === 'ringkasan' ? 'Dashboard Keuangan' : 
               currentViewTab === 'pemasukan' ? 'Laporan Pemasukan' :
               currentViewTab === 'pengeluaran' ? 'Laporan Pengeluaran' : 'Arus Kas & Transaksi'}
            </span>
          </div>
          <h1 className="text-xl font-black text-slate-900 tracking-tight">Dashboard Keuangan</h1>
          <p className="text-xs text-slate-500 font-medium mt-0.5">
            Ringkasan kondisi keuangan bisnis Anda secara real-time.
          </p>
        </div>

        {/* Right Action Controls */}
        <div className="flex flex-wrap items-center gap-2">
          
          {/* Date Range Picker Pill */}
          <div className="flex items-center gap-2 bg-white px-3 py-2 border border-slate-200/80 rounded-xl shadow-2xs text-xs font-bold text-slate-700 hover:border-slate-300 cursor-pointer">
            <Calendar className="w-3.5 h-3.5 text-slate-400" />
            <span>{dateRange}</span>
            <ChevronDown className="w-3.5 h-3.5 text-slate-400 ml-1" />
          </div>

          {/* Comparison Period Pill */}
          <div className="flex items-center gap-2 bg-white px-3 py-2 border border-slate-200/80 rounded-xl shadow-2xs text-xs font-bold text-slate-700 hover:border-slate-300 cursor-pointer">
            <span className="text-slate-400 font-medium">Dibandingkan:</span>
            <span>{comparisonPeriod}</span>
            <ChevronDown className="w-3.5 h-3.5 text-slate-400" />
          </div>

          {/* Export Button */}
          <button 
            onClick={() => triggerToast("Mengunduh laporan keuangan studio (PDF/Excel)...")}
            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 gap-1.5 cursor-pointer shrink-0"
          >
            <span>Export</span>
            <ChevronDown className="w-3.5 h-3.5" />
          </button>
        </div>

      </div>

      {/* 2. TOP METRICS SUMMARY BAR (5 CARDS IN A ROW - MATCHES SCREENSHOT EXACTLY) */}
      <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-3">
        
        {/* Metric 1: Total Pendapatan */}
        <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-start justify-between">
            <div>
              <span className="text-[11px] font-bold text-slate-500 block">Total Pendapatan</span>
              <h3 className="text-lg sm:text-xl font-black text-slate-900 mt-1">Rp126.500.000</h3>
            </div>
            <div className="w-8 h-8 rounded-full bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0">
              <Wallet className="w-4 h-4" />
            </div>
          </div>
          <div className="mt-2 pt-2 border-t border-slate-50">
            <p className="text-[10px] font-bold text-emerald-600 flex items-center gap-1">
              <ArrowUp className="w-3 h-3 stroke-[3]" />
              <span>22%</span>
              <span className="font-normal text-slate-400">dari 21 Apr - 20 Mei 2025</span>
            </p>
            {/* Sparkline mini wave */}
            <div className="h-4 w-full mt-1">
              <svg className="w-full h-full overflow-visible" viewBox="0 0 100 20">
                <path d="M0 15 Q25 18 50 10 T100 5" fill="none" stroke="#10B981" strokeWidth="2" />
              </svg>
            </div>
          </div>
        </div>

        {/* Metric 2: Total Pemasukan */}
        <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-start justify-between">
            <div>
              <span className="text-[11px] font-bold text-slate-500 block">Total Pemasukan</span>
              <h3 className="text-lg sm:text-xl font-black text-slate-900 mt-1">Rp138.750.000</h3>
            </div>
            <div className="w-8 h-8 rounded-full bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0">
              <ArrowDown className="w-4 h-4" />
            </div>
          </div>
          <div className="mt-2 pt-2 border-t border-slate-50">
            <p className="text-[10px] font-bold text-emerald-600 flex items-center gap-1">
              <ArrowUp className="w-3 h-3 stroke-[3]" />
              <span>18%</span>
              <span className="font-normal text-slate-400">dari 21 Apr - 20 Mei 2025</span>
            </p>
            <div className="h-4 w-full mt-1">
              <svg className="w-full h-full overflow-visible" viewBox="0 0 100 20">
                <path d="M0 16 Q20 12 50 14 T100 4" fill="none" stroke="#10B981" strokeWidth="2" />
              </svg>
            </div>
          </div>
        </div>

        {/* Metric 3: Total Pengeluaran */}
        <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-start justify-between">
            <div>
              <span className="text-[11px] font-bold text-slate-500 block">Total Pengeluaran</span>
              <h3 className="text-lg sm:text-xl font-black text-slate-900 mt-1">Rp32.250.000</h3>
            </div>
            <div className="w-8 h-8 rounded-full bg-rose-50 text-rose-500 flex items-center justify-center shrink-0">
              <ArrowUp className="w-4 h-4" />
            </div>
          </div>
          <div className="mt-2 pt-2 border-t border-slate-50">
            <p className="text-[10px] font-bold text-rose-500 flex items-center gap-1">
              <ArrowUp className="w-3 h-3 stroke-[3]" />
              <span>12%</span>
              <span className="font-normal text-slate-400">dari 21 Apr - 20 Mei 2025</span>
            </p>
            <div className="h-4 w-full mt-1">
              <svg className="w-full h-full overflow-visible" viewBox="0 0 100 20">
                <path d="M0 10 Q30 18 60 8 T100 12" fill="none" stroke="#F43F5E" strokeWidth="2" />
              </svg>
            </div>
          </div>
        </div>

        {/* Metric 4: Laba Bersih */}
        <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-start justify-between">
            <div>
              <span className="text-[11px] font-bold text-slate-500 block">Laba Bersih</span>
              <h3 className="text-lg sm:text-xl font-black text-slate-900 mt-1">Rp94.250.000</h3>
            </div>
            <div className="w-8 h-8 rounded-full bg-purple-50 text-purple-600 flex items-center justify-center shrink-0">
              <TrendingUp className="w-4 h-4" />
            </div>
          </div>
          <div className="mt-2 pt-2 border-t border-slate-50">
            <p className="text-[10px] font-bold text-emerald-600 flex items-center gap-1">
              <ArrowUp className="w-3 h-3 stroke-[3]" />
              <span>28%</span>
              <span className="font-normal text-slate-400">dari 21 Apr - 20 Mei 2025</span>
            </p>
            <div className="h-4 w-full mt-1">
              <svg className="w-full h-full overflow-visible" viewBox="0 0 100 20">
                <path d="M0 18 Q20 10 50 12 T100 3" fill="none" stroke="#10B981" strokeWidth="2" />
              </svg>
            </div>
          </div>
        </div>

        {/* Metric 5: Rata-rata Per Hari */}
        <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-start justify-between">
            <div>
              <span className="text-[11px] font-bold text-slate-500 block">Rata-rata Per Hari</span>
              <h3 className="text-lg sm:text-xl font-black text-slate-900 mt-1">Rp4.500.000</h3>
            </div>
            <div className="w-8 h-8 rounded-full bg-amber-50 text-amber-600 flex items-center justify-center shrink-0">
              <Calendar className="w-4 h-4" />
            </div>
          </div>
          <div className="mt-2 pt-2 border-t border-slate-50">
            <p className="text-[10px] font-bold text-emerald-600 flex items-center gap-1">
              <ArrowUp className="w-3 h-3 stroke-[3]" />
              <span>16%</span>
              <span className="font-normal text-slate-400">dari 21 Apr - 20 Mei 2025</span>
            </p>
            <div className="h-4 w-full mt-1">
              <svg className="w-full h-full overflow-visible" viewBox="0 0 100 20">
                <path d="M0 15 Q30 8 60 14 T100 6" fill="none" stroke="#10B981" strokeWidth="2" />
              </svg>
            </div>
          </div>
        </div>

      </div>

      {/* 3. MAIN DASHBOARD CONTENT GRID (LEFT 8 COLS, RIGHT 4 COLS) */}
      <div className="grid grid-cols-1 lg:grid-cols-12 gap-4">
        
        {/* LEFT SECTION (8 COLS) */}
        <div className="lg:col-span-8 space-y-4">
          
          {/* ROW 1: GRAFIK ARUS KAS */}
          <div className="w-full">
            
            {/* GRAFIK ARUS KAS */}
            <div className="w-full bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs flex flex-col justify-between space-y-3">
              
              <div className="flex items-center justify-between">
                <h2 className="text-xs font-extrabold text-slate-900">Grafik Arus Kas</h2>
                
                <div className="flex items-center gap-1.5">
                  <select 
                    value={chartInterval}
                    onChange={(e) => setChartInterval(e.target.value)}
                    className="bg-slate-50 border border-slate-200 rounded-lg text-[11px] font-bold px-2 py-1 text-slate-700 cursor-pointer focus:outline-none"
                  >
                    <option value="Harian">Harian</option>
                    <option value="Mingguan">Mingguan</option>
                    <option value="Bulanan">Bulanan</option>
                  </select>

                  <button className="p-1 text-slate-400 hover:text-slate-600 border border-slate-200 rounded-lg">
                    <SlidersHorizontal className="w-3.5 h-3.5" />
                  </button>
                </div>
              </div>

              {/* Legends */}
              <div className="flex items-center gap-4 text-[11px] font-bold">
                <div className="flex items-center gap-1.5 text-emerald-600">
                  <div className="w-2.5 h-2.5 rounded-full bg-emerald-500" />
                  <span>Pemasukan</span>
                </div>
                <div className="flex items-center gap-1.5 text-rose-500">
                  <div className="w-2.5 h-2.5 rounded-full bg-rose-500" />
                  <span>Pengeluaran</span>
                </div>
                <div className="flex items-center gap-1.5 text-purple-600">
                  <div className="w-2.5 h-2.5 rounded-full bg-purple-500" />
                  <span>Laba Bersih</span>
                </div>
              </div>

              {/* SVG Area Line Chart */}
              <div className="relative w-full h-44 my-1 pt-1">
                
                {/* Background Grid Lines */}
                <div className="absolute inset-0 flex flex-col justify-between text-[9px] text-slate-400 font-bold pointer-events-none pb-5">
                  <div className="flex items-center justify-between border-b border-dashed border-slate-100 pb-0.5">
                    <span>100 jt</span>
                  </div>
                  <div className="flex items-center justify-between border-b border-dashed border-slate-100 pb-0.5">
                    <span>80 jt</span>
                  </div>
                  <div className="flex items-center justify-between border-b border-dashed border-slate-100 pb-0.5">
                    <span>60 jt</span>
                  </div>
                  <div className="flex items-center justify-between border-b border-dashed border-slate-100 pb-0.5">
                    <span>40 jt</span>
                  </div>
                  <div className="flex items-center justify-between border-b border-dashed border-slate-100 pb-0.5">
                    <span>20 jt</span>
                  </div>
                  <div className="flex items-center justify-between">
                    <span>0</span>
                  </div>
                </div>

                {/* SVG Curve Lines */}
                <svg className="w-full h-full overflow-visible relative z-10" viewBox="0 0 500 150" preserveAspectRatio="none">
                  
                  {/* Pemasukan Line (Green) */}
                  <path 
                    d="M 10 100 Q 70 90 120 70 T 210 50 T 290 60 T 380 40 L 480 25" 
                    fill="none" 
                    stroke="#10B981" 
                    strokeWidth="2.5" 
                    strokeLinecap="round"
                  />
                  <circle cx="120" cy="70" r="3.5" fill="#10B981" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="210" cy="50" r="3.5" fill="#10B981" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="290" cy="60" r="3.5" fill="#10B981" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="380" cy="40" r="3.5" fill="#10B981" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="480" cy="25" r="4.5" fill="#10B981" stroke="#ffffff" strokeWidth="2" />

                  {/* Pengeluaran Line (Red) */}
                  <path 
                    d="M 10 125 Q 70 120 120 110 T 210 115 T 290 105 T 380 110 L 480 110" 
                    fill="none" 
                    stroke="#F43F5E" 
                    strokeWidth="2.5" 
                    strokeLinecap="round"
                  />
                  <circle cx="120" cy="110" r="3.5" fill="#F43F5E" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="210" cy="115" r="3.5" fill="#F43F5E" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="290" cy="105" r="3.5" fill="#F43F5E" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="380" cy="110" r="3.5" fill="#F43F5E" stroke="#ffffff" strokeWidth="1.5" />

                  {/* Laba Bersih Line (Purple) */}
                  <path 
                    d="M 10 115 Q 70 110 120 95 T 210 75 T 290 85 T 380 65 L 480 50" 
                    fill="none" 
                    stroke="#A855F7" 
                    strokeWidth="2.5" 
                    strokeLinecap="round"
                  />
                  <circle cx="120" cy="95" r="3.5" fill="#A855F7" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="210" cy="75" r="3.5" fill="#A855F7" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="290" cy="85" r="3.5" fill="#A855F7" stroke="#ffffff" strokeWidth="1.5" />
                  <circle cx="380" cy="65" r="3.5" fill="#A855F7" stroke="#ffffff" strokeWidth="1.5" />
                </svg>

              </div>

              {/* X-Axis Labels */}
              <div className="flex justify-between text-[10px] text-slate-400 font-bold pt-1 border-t border-slate-100">
                <span>21 Mei</span>
                <span>28 Mei</span>
                <span>4 Jun</span>
                <span>11 Jun</span>
                <span>18 Jun</span>
              </div>

            </div>

          </div>

          {/* ROW 2: TRANSAKSI TERBARU TABLE CARD */}
          <div className="bg-white rounded-2xl border border-slate-200/80 shadow-2xs overflow-hidden">
            
            {/* Table Header & Filters */}
            <div className="p-4 border-b border-slate-100 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
              <h3 className="text-xs font-extrabold text-slate-900">Transaksi Terbaru</h3>

              {/* Filter Pills */}
              <div className="flex items-center bg-slate-100/80 p-0.5 rounded-xl text-xs font-bold text-slate-600">
                {(['Semua', 'Pemasukan', 'Pengeluaran'] as const).map(f => (
                  <button
                    key={f}
                    onClick={() => setTxFilter(f)}
                    className={`px-3 py-1 rounded-lg transition-all cursor-pointer ${
                      txFilter === f 
                        ? 'bg-[#EC167F] text-white font-extrabold shadow-2xs' 
                        : 'hover:text-slate-900'
                    }`}
                  >
                    {f}
                  </button>
                ))}
              </div>
            </div>

            {/* Table Rows */}
            <div className="overflow-x-auto">
              <table className="w-full text-left text-xs">
                <thead className="bg-slate-50/70 border-b border-slate-100 text-[10px] font-extrabold uppercase text-slate-400 tracking-wider">
                  <tr>
                    <th className="px-4 py-2.5">Tanggal</th>
                    <th className="px-4 py-2.5">Jenis</th>
                    <th className="px-4 py-2.5">Deskripsi</th>
                    <th className="px-4 py-2.5">Kategori</th>
                    <th className="px-4 py-2.5">Metode</th>
                    <th className="px-4 py-2.5 text-right">Nominal</th>
                    <th className="px-4 py-2.5 text-center">Status</th>
                    <th className="px-4 py-2.5 text-center">Aksi</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-slate-100 font-semibold text-slate-700">
                  {filteredTransactions.map((tx) => (
                    <tr key={tx.id} className="hover:bg-slate-50/60 transition-colors">
                      <td className="px-4 py-3 text-[11px] text-slate-500 font-medium whitespace-nowrap">
                        {tx.date}
                      </td>
                      <td className="px-4 py-3 whitespace-nowrap">
                        <div className={`inline-flex items-center gap-1 text-[11px] font-extrabold ${
                          tx.type === 'Pemasukan' ? 'text-emerald-600' : 'text-rose-500'
                        }`}>
                          {tx.type === 'Pemasukan' ? (
                            <ArrowDown className="w-3.5 h-3.5" />
                          ) : (
                            <ArrowUp className="w-3.5 h-3.5" />
                          )}
                          <span>{tx.type}</span>
                        </div>
                      </td>
                      <td className="px-4 py-3">
                        <span className="font-extrabold text-slate-900 block text-xs">{tx.title}</span>
                        <span className="text-[10px] text-slate-400 font-medium">{tx.code}</span>
                      </td>
                      <td className="px-4 py-3 text-xs font-bold text-slate-600 whitespace-nowrap">
                        {tx.category}
                      </td>
                      <td className="px-4 py-3 text-xs font-bold text-slate-600 whitespace-nowrap">
                        {tx.method}
                      </td>
                      <td className={`px-4 py-3 text-right font-black text-xs whitespace-nowrap ${
                        tx.type === 'Pemasukan' ? 'text-slate-900' : 'text-slate-900'
                      }`}>
                        Rp{tx.amount.toLocaleString('id-ID')}
                      </td>
                      <td className="px-4 py-3 text-center whitespace-nowrap">
                        <span className="px-2.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-extrabold">
                          {tx.status}
                        </span>
                      </td>
                      <td className="px-4 py-3 text-center whitespace-nowrap">
                        <button 
                          onClick={() => triggerToast(`Opsi transaksi ${tx.code}`)}
                          className="p-1 text-slate-400 hover:text-slate-600 rounded-md cursor-pointer"
                        >
                          <MoreHorizontal className="w-4 h-4" />
                        </button>
                      </td>
                    </tr>
                  ))}
                </tbody>
              </table>
            </div>

            {/* Bottom Link */}
            <div className="p-3 text-center border-t border-slate-100 bg-slate-50/30">
              <button 
                onClick={() => setCurrentViewTab('arus_kas')}
                className="text-xs font-bold text-slate-600 hover:text-[#EC167F] transition-colors inline-flex items-center gap-1 cursor-pointer"
              >
                <span>Lihat Semua Transaksi</span>
                <ChevronDown className="w-3.5 h-3.5" />
              </button>
            </div>

          </div>

        </div>

        {/* RIGHT SECTION (4 COLS - MATCHES SCREENSHOT EXACTLY) */}
        <div className="lg:col-span-4 space-y-4">
          
          {/* CARD 1: RINGKASAN KAS & REKENING */}
          <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs space-y-4">
            <h2 className="text-xs font-extrabold text-slate-900">Ringkasan Kas & Rekening</h2>

            {/* Green Saldo Kas Banner */}
            <div className="p-3 bg-emerald-50/80 border border-emerald-200 rounded-2xl flex items-center gap-3">
              <div className="w-9 h-9 rounded-xl bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0">
                <Wallet className="w-5 h-5" />
              </div>
              <div>
                <span className="text-[10px] font-bold text-emerald-700 uppercase tracking-wider block">Saldo Kas</span>
                <span className="text-base font-black text-slate-900 block">Rp8.250.000</span>
              </div>
            </div>

            {/* Rekening Bank Section */}
            <div className="space-y-2.5">
              <div className="flex items-center justify-between">
                <span className="text-xs font-extrabold text-slate-900">Rekening Bank</span>
                <button 
                  onClick={() => triggerToast("Kelola rekening bank studio")}
                  className="text-[11px] font-bold text-[#EC167F] hover:underline cursor-pointer"
                >
                  Lihat Semua
                </button>
              </div>

              {/* Bank 1: BCA */}
              <div className="p-2.5 rounded-xl border border-slate-100 hover:border-slate-200 transition-colors flex items-center justify-between text-xs">
                <div className="flex items-center gap-2.5">
                  <div className="w-8 h-6 rounded bg-blue-600 text-white font-black text-[9px] flex items-center justify-center shrink-0 shadow-2xs">
                    BCA
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">BCA - 113-108-6321</span>
                  </div>
                </div>
                <span className="font-black text-slate-900">Rp45.600.000</span>
              </div>

              {/* Bank 2: Mandiri */}
              <div className="p-2.5 rounded-xl border border-slate-100 hover:border-slate-200 transition-colors flex items-center justify-between text-xs">
                <div className="flex items-center gap-2.5">
                  <div className="w-8 h-6 rounded bg-amber-500 text-white font-black text-[9px] flex items-center justify-center shrink-0 shadow-2xs">
                    MANDIRI
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">Mandiri - 142-00-1234567</span>
                  </div>
                </div>
                <span className="font-black text-slate-900">Rp38.250.000</span>
              </div>

              {/* Bank 3: BRI */}
              <div className="p-2.5 rounded-xl border border-slate-100 hover:border-slate-200 transition-colors flex items-center justify-between text-xs">
                <div className="flex items-center gap-2.5">
                  <div className="w-8 h-6 rounded bg-blue-800 text-white font-black text-[9px] flex items-center justify-center shrink-0 shadow-2xs">
                    BRI
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">BRI - 0123-01-123456-50-2</span>
                  </div>
                </div>
                <span className="font-black text-slate-900">Rp22.150.000</span>
              </div>

            </div>
          </div>

          {/* CARD 2: JATUH TEMPO PEMBAYARAN */}
          <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs space-y-3">
            <div className="flex items-center justify-between">
              <h2 className="text-xs font-extrabold text-slate-900">Jatuh Tempo Pembayaran</h2>
              <button 
                onClick={() => triggerToast("Lihat daftar seluruh piutang & hutang")}
                className="text-[11px] font-bold text-[#EC167F] hover:underline cursor-pointer"
              >
                Lihat Semua
              </button>
            </div>

            <div className="space-y-2 text-xs">
              
              {/* DP Belum Lunas */}
              <div className="p-2.5 rounded-xl bg-pink-50/50 border border-pink-100 flex items-center justify-between">
                <div className="flex items-center gap-2.5">
                  <div className="w-7 h-7 rounded-lg bg-pink-100 text-[#EC167F] flex items-center justify-center font-bold shrink-0">
                    <Clock className="w-3.5 h-3.5" />
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">DP Belum Lunas</span>
                    <span className="text-[10px] text-slate-500 font-medium block">8 transaksi</span>
                  </div>
                </div>
                <span className="font-black text-[#EC167F]">Rp12.500.000</span>
              </div>

              {/* Pelunasan Akan Jatuh Tempo */}
              <div className="p-2.5 rounded-xl bg-amber-50/50 border border-amber-100 flex items-center justify-between">
                <div className="flex items-center gap-2.5">
                  <div className="w-7 h-7 rounded-lg bg-amber-100 text-amber-700 flex items-center justify-center font-bold shrink-0">
                    <AlertCircle className="w-3.5 h-3.5" />
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">Pelunasan Akan Jatuh Tempo</span>
                    <span className="text-[10px] text-slate-500 font-medium block">5 transaksi</span>
                  </div>
                </div>
                <span className="font-black text-amber-600">Rp18.750.000</span>
              </div>

              {/* Tagihan Vendor */}
              <div className="p-2.5 rounded-xl bg-blue-50/50 border border-blue-100 flex items-center justify-between">
                <div className="flex items-center gap-2.5">
                  <div className="w-7 h-7 rounded-lg bg-blue-100 text-blue-700 flex items-center justify-center font-bold shrink-0">
                    <FileText className="w-3.5 h-3.5" />
                  </div>
                  <div>
                    <span className="font-extrabold text-slate-900 block text-[11px]">Tagihan Vendor</span>
                    <span className="text-[10px] text-slate-500 font-medium block">3 tagihan</span>
                  </div>
                </div>
                <span className="font-black text-blue-600">Rp6.250.000</span>
              </div>

            </div>
          </div>

          {/* CARD 3: QUICK ACTION */}
          <div className="bg-white p-4 rounded-2xl border border-slate-200/80 shadow-2xs space-y-3">
            <h2 className="text-xs font-extrabold text-slate-900">Quick Action</h2>

            <div className="grid grid-cols-2 gap-2 text-xs">
              
              {/* Catat Pemasukan */}
              <button 
                onClick={() => setShowIncomeModal(true)}
                className="p-2.5 rounded-xl bg-emerald-50/80 hover:bg-emerald-100/80 border border-emerald-200 text-emerald-700 font-extrabold transition-colors flex items-center justify-center gap-1.5 cursor-pointer shadow-2xs"
              >
                <Plus className="w-4 h-4" />
                <span>Catat Pemasukan</span>
              </button>

              {/* Catat Pengeluaran */}
              <button 
                onClick={() => setShowExpenseModal(true)}
                className="p-2.5 rounded-xl bg-rose-50/80 hover:bg-rose-100/80 border border-rose-200 text-rose-600 font-extrabold transition-colors flex items-center justify-center gap-1.5 cursor-pointer shadow-2xs"
              >
                <Minus className="w-4 h-4" />
                <span>Catat Pengeluaran</span>
              </button>

            </div>

            {/* Transfer Bank Full Width Button */}
            <button 
              onClick={() => setShowTransferModal(true)}
              className="w-full p-2.5 rounded-xl bg-purple-50/80 hover:bg-purple-100/80 border border-purple-200 text-purple-700 font-extrabold transition-colors flex items-center justify-center gap-1.5 cursor-pointer shadow-2xs text-xs"
            >
              <ArrowRightLeft className="w-4 h-4" />
              <span>Transfer</span>
            </button>
          </div>

        </div>

      </div>

      {/* =========================================================
          MODAL 1: CATAT PEMASUKAN
          ========================================================= */}
      {showIncomeModal && (
        <div className="fixed inset-0 z-50 bg-slate-900/40 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200">
          <div className="bg-white w-full max-w-md rounded-2xl border border-slate-200 shadow-xl overflow-hidden p-5 space-y-4">
            
            <div className="flex items-center justify-between pb-2 border-b border-slate-100">
              <div className="flex items-center gap-2">
                <div className="w-8 h-8 rounded-full bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold">
                  <Plus className="w-4 h-4" />
                </div>
                <h3 className="text-sm font-extrabold text-slate-900">Catat Pemasukan Kas Baru</h3>
              </div>
              <button onClick={() => setShowIncomeModal(false)} className="p-1 text-slate-400 hover:text-slate-600 rounded-lg">
                <X className="w-4 h-4" />
              </button>
            </div>

            <form onSubmit={handleAddIncomeSubmit} className="space-y-3 text-xs">
              <div>
                <label className="block text-slate-700 font-bold mb-1">Deskripsi Pemasukan *</label>
                <input 
                  type="text" 
                  placeholder="Contoh: Pelunasan Wedding - Nisa & Aris"
                  value={incDesc}
                  onChange={(e) => setIncDesc(e.target.value)}
                  required
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800 focus:bg-white focus:outline-none focus:border-emerald-500"
                />
              </div>

              <div>
                <label className="block text-slate-700 font-bold mb-1">Nominal (Rp) *</label>
                <input 
                  type="number" 
                  placeholder="5000000"
                  value={incAmount}
                  onChange={(e) => setIncAmount(e.target.value)}
                  required
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-800 focus:bg-white focus:outline-none focus:border-emerald-500"
                />
              </div>

              <div className="grid grid-cols-2 gap-2">
                <div>
                  <label className="block text-slate-700 font-bold mb-1">Kategori</label>
                  <select 
                    value={incCategory}
                    onChange={(e) => setIncCategory(e.target.value)}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-700"
                  >
                    <option value="Pelunasan">Pelunasan</option>
                    <option value="DP">DP / Booking</option>
                    <option value="Non-Reservasi">Lainnya</option>
                  </select>
                </div>

                <div>
                  <label className="block text-slate-700 font-bold mb-1">Metode Bayar</label>
                  <select 
                    value={incMethod}
                    onChange={(e) => setIncMethod(e.target.value)}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-700"
                  >
                    <option value="Transfer BCA">Transfer BCA</option>
                    <option value="Transfer Mandiri">Transfer Mandiri</option>
                    <option value="Transfer BRI">Transfer BRI</option>
                    <option value="Tunai">Kas Tunai</option>
                  </select>
                </div>
              </div>

              <div className="pt-3 flex justify-end gap-2">
                <button 
                  type="button"
                  onClick={() => setShowIncomeModal(false)}
                  className="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl"
                >
                  Batal
                </button>
                <button 
                  type="submit"
                  className="px-5 py-2 bg-emerald-600 hover:bg-emerald-700 text-white font-extrabold rounded-xl shadow-xs"
                >
                  Simpan Pemasukan
                </button>
              </div>
            </form>

          </div>
        </div>
      )}

      {/* =========================================================
          MODAL 2: CATAT PENGELUARAN
          ========================================================= */}
      {showExpenseModal && (
        <div className="fixed inset-0 z-50 bg-slate-900/40 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200">
          <div className="bg-white w-full max-w-md rounded-2xl border border-slate-200 shadow-xl overflow-hidden p-5 space-y-4">
            
            <div className="flex items-center justify-between pb-2 border-b border-slate-100">
              <div className="flex items-center gap-2">
                <div className="w-8 h-8 rounded-full bg-rose-100 text-rose-600 flex items-center justify-center font-bold">
                  <Minus className="w-4 h-4" />
                </div>
                <h3 className="text-sm font-extrabold text-slate-900">Catat Pengeluaran Kas Baru</h3>
              </div>
              <button onClick={() => setShowExpenseModal(false)} className="p-1 text-slate-400 hover:text-slate-600 rounded-lg">
                <X className="w-4 h-4" />
              </button>
            </div>

            <form onSubmit={handleAddExpenseSubmit} className="space-y-3 text-xs">
              <div>
                <label className="block text-slate-700 font-bold mb-1">Deskripsi Pengeluaran *</label>
                <input 
                  type="text" 
                  placeholder="Contoh: Belanja Kosmetik Restock / Sewa Gaun"
                  value={expDesc}
                  onChange={(e) => setExpDesc(e.target.value)}
                  required
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800 focus:bg-white focus:outline-none focus:border-rose-500"
                />
              </div>

              <div>
                <label className="block text-slate-700 font-bold mb-1">Nominal (Rp) *</label>
                <input 
                  type="number" 
                  placeholder="1250000"
                  value={expAmount}
                  onChange={(e) => setExpAmount(e.target.value)}
                  required
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-800 focus:bg-white focus:outline-none focus:border-rose-500"
                />
              </div>

              <div className="grid grid-cols-2 gap-2">
                <div>
                  <label className="block text-slate-700 font-bold mb-1">Kategori</label>
                  <select 
                    value={expCategory}
                    onChange={(e) => setExpCategory(e.target.value)}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-700"
                  >
                    <option value="Operasional">Operasional</option>
                    <option value="Gaji & Honor">Gaji & Honor</option>
                    <option value="Vendor">Vendor</option>
                    <option value="Marketing">Marketing</option>
                    <option value="Peralatan">Peralatan</option>
                  </select>
                </div>

                <div>
                  <label className="block text-slate-700 font-bold mb-1">Metode Pembayaran</label>
                  <select 
                    value={expMethod}
                    onChange={(e) => setExpMethod(e.target.value)}
                    className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-700"
                  >
                    <option value="Transfer Mandiri">Transfer Mandiri</option>
                    <option value="Transfer BCA">Transfer BCA</option>
                    <option value="Tunai">Kas Tunai Studio</option>
                  </select>
                </div>
              </div>

              <div className="pt-3 flex justify-end gap-2">
                <button 
                  type="button"
                  onClick={() => setShowExpenseModal(false)}
                  className="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl"
                >
                  Batal
                </button>
                <button 
                  type="submit"
                  className="px-5 py-2 bg-rose-600 hover:bg-rose-700 text-white font-extrabold rounded-xl shadow-xs"
                >
                  Simpan Pengeluaran
                </button>
              </div>
            </form>

          </div>
        </div>
      )}

      {/* =========================================================
          MODAL 3: TRANSFER SALDO REKENING
          ========================================================= */}
      {showTransferModal && (
        <div className="fixed inset-0 z-50 bg-slate-900/40 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200">
          <div className="bg-white w-full max-w-md rounded-2xl border border-slate-200 shadow-xl overflow-hidden p-5 space-y-4">
            
            <div className="flex items-center justify-between pb-2 border-b border-slate-100">
              <div className="flex items-center gap-2">
                <div className="w-8 h-8 rounded-full bg-purple-100 text-purple-700 flex items-center justify-center font-bold">
                  <ArrowRightLeft className="w-4 h-4" />
                </div>
                <h3 className="text-sm font-extrabold text-slate-900">Transfer Antar Rekening / Kas</h3>
              </div>
              <button onClick={() => setShowTransferModal(false)} className="p-1 text-slate-400 hover:text-slate-600 rounded-lg">
                <X className="w-4 h-4" />
              </button>
            </div>

            <form onSubmit={handleTransferSubmit} className="space-y-3 text-xs">
              <div>
                <label className="block text-slate-700 font-bold mb-1">Dari Rekening *</label>
                <select 
                  value={trFrom}
                  onChange={(e) => setTrFrom(e.target.value)}
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800"
                >
                  <option value="BCA - 113-108-6321">BCA - 113-108-6321 (Rp45.600.000)</option>
                  <option value="Mandiri - 142-00-1234567">Mandiri - 142-00-1234567 (Rp38.250.000)</option>
                  <option value="Kas Tunai Studio">Kas Tunai Studio (Rp8.250.000)</option>
                </select>
              </div>

              <div>
                <label className="block text-slate-700 font-bold mb-1">Tujuan Rekening *</label>
                <select 
                  value={trTo}
                  onChange={(e) => setTrTo(e.target.value)}
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-semibold text-slate-800"
                >
                  <option value="Kas Tunai Studio">Kas Tunai Studio</option>
                  <option value="BRI - 0123-01-123456-50-2">BRI - 0123-01-123456-50-2</option>
                  <option value="Mandiri - 142-00-1234567">Mandiri - 142-00-1234567</option>
                </select>
              </div>

              <div>
                <label className="block text-slate-700 font-bold mb-1">Nominal Transfer (Rp) *</label>
                <input 
                  type="number" 
                  placeholder="2000000"
                  value={trAmount}
                  onChange={(e) => setTrAmount(e.target.value)}
                  required
                  className="w-full p-2.5 bg-slate-50 border border-slate-200 rounded-xl font-bold text-slate-800 focus:bg-white focus:outline-none focus:border-purple-500"
                />
              </div>

              <div className="pt-3 flex justify-end gap-2">
                <button 
                  type="button"
                  onClick={() => setShowTransferModal(false)}
                  className="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 font-bold rounded-xl"
                >
                  Batal
                </button>
                <button 
                  type="submit"
                  className="px-5 py-2 bg-purple-600 hover:bg-purple-700 text-white font-extrabold rounded-xl shadow-xs"
                >
                  Proses Transfer
                </button>
              </div>
            </form>

          </div>
        </div>
      )}

    </div>
  );
};

Zerion Mini Shell 1.0