import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; const FinancialOpsAdmin = ({ onBack }) => { const [profitData, setProfitData] = useState(null); useEffect(() => { fetch('http://localhost:8000/api/v1/profitability/store_01') .then(res => res.json()) .then(data => setProfitData(data)) .catch(err => console.error(err)); }, []); return ( <> {/* BEGIN: Sidebar */} {/* END: Sidebar */} {/* BEGIN: MainContent */}
{/* BEGIN: Header */}

Financial Operations

{/* Date Range Filter */}
Oct 1, 2023 - Oct 31, 2023
{/* Action Button */}
{/* END: Header */}
{/* BEGIN: FinancialOverview */} {/* Overview Card 1: Months to Profit */}

Time To Profitability

{profitData ? `${profitData.profitability_projection.months_to_profit_median.toFixed(1)} mo` : "Loading..."}
Cox PH Median Estimate
{/* Overview Card 2: Density */}

Population Density

{profitData ? profitData.metrics.population_density : "--"}
Active users / sq km
{/* Overview Card 3: Non-Grocery */}

Non-Grocery Share

{profitData ? `${(profitData.metrics.non_grocery_share * 100).toFixed(0)}%` : "--"}
High margin category
{/* Overview Card 4: Recommendation */}

Allocation Strategy

{profitData ? profitData.profitability_projection.allocation_recommendation : "Loading..."}
AI generated action plan
{/* END: FinancialOverview */} {/* BEGIN: Main Content Grid */}
{/* BEGIN: Survival Curve Chart */}

Recent Transactions

View All →
Transaction ID Date & Time Amount Destination Status
TXN-0982-A Oct 24, 14:32:01 $1,250.00 Acme Corp Completed
TXN-0981-B Oct 24, 14:28:44 $8,400.00 Stark Ind. Pending
TXN-0980-C Oct 24, 13:15:20 $345.50 Wayne Ent. Completed
TXN-0979-D Oct 24, 11:05:12 $12,000.00 LexCorp Failed
TXN-0978-E Oct 24, 09:45:00 $2,100.00 Globex Completed
{/* END: Survival Curve Chart */} {/* BEGIN: PayoutControls */}

Manual Payout

{/* Amount Input */}
$
USD
{/* Destination Select */}
{/* Priority Toggle */}
Priority Processing Incurs additional $15 fee {/* Custom Toggle Switch */}
{/* Submit Button */}
{/* System Status Widget */}
Payment Gateway API
Operational
{/* END: PayoutControls */}
{/* END: Main Content Grid */}
{/* END: MainContent */} ); }; export default FinancialOpsAdmin;