/**
 * Sample Data for POS Front-End Theme
 * This file contains dummy data to populate the dashboard and other pages
 */

// Dashboard Statistics
const dashboardStats = {
  purchase_due: 12450.75,
  sales_due: 8935.50,
  total_sales: 145230.00,
  total_expense: 23450.80,
  todays_purchase: 5430.00,
  todays_payment_received: 8750.25,
  todays_sales: 12340.50,
  todays_expense: 1250.00,
  total_customers: 248,
  total_suppliers: 89,
  total_purchase_invoices: 456,
  total_sales_invoices: 1234
};

// Chart Data
const chartData = {
  purchase: {
    jan: 45000, feb: 52000, mar: 48000, apr: 55000, may: 50000, jun: 58000,
    jul: 54000, aug: 60000, sep: 57000, oct: 62000, nov: 59000, dec: 65000
  },
  sales: {
    jan: 55000, feb: 62000, mar: 58000, apr: 65000, may: 60000, jun: 68000,
    jul: 64000, aug: 70000, sep: 67000, oct: 72000, nov: 69000, dec: 75000
  }
};

// Recently Added Items
const recentItems = [
  { id: 1, name: "Dell Laptop", price: 850.00 },
  { id: 2, name: "HP Printer", price: 320.50 },
  { id: 3, name: "Logitech Mouse", price: 25.99 },
  { id: 4, name: "Samsung Monitor", price: 425.00 },
  { id: 5, name: "Keyboard Mechanical", price: 89.99 }
];

// Expired Items
const expiredItems = [
  { code: "ITM001", name: "Product A", category: "Electronics", expireDate: "2024-11-15" },
  { code: "ITM002", name: "Product B", category: "Food Items", expireDate: "2024-10-20" },
  { code: "ITM003", name: "Product C", category: "Medicines", expireDate: "2024-09-30" },
  { code: "ITM004", name: "Product D", category: "Cosmetics", expireDate: "2024-08-25" }
];

// Stock Alert Items
const stockAlertItems = [
  { name: "Product X", category: "Electronics", stock: 5 },
  { name: "Product Y", category: "Stationery", stock: 3 },
  { name: "Product Z", category: "Office Supplies", stock: 2 },
  { name: "Product W", category: "Hardware", stock: 4 }
];

// Top Trending Items (Pie Chart)
const trendingItems = [
  { name: "Laptop Dell XPS", qty: 45 },
  { name: "iPhone 13 Pro", qty: 38 },
  { name: "Samsung Galaxy S21", qty: 32 },
  { name: "iPad Air", qty: 28 },
  { name: "MacBook Air M1", qty: 25 },
  { name: "Sony Headphones", qty: 22 },
  { name: "LG Monitor 27\"", qty: 18 },
  { name: "Logitech Keyboard", qty: 15 },
  { name: "HP Deskjet Printer", qty: 12 },
  { name: "Canon Camera", qty: 10 }
];

// Sample Customers
const sampleCustomers = [
  { id: 1, name: "John Doe", phone: "123-456-7890", email: "john@example.com", address: "123 Main St", status: "Active" },
  { id: 2, name: "Jane Smith", phone: "987-654-3210", email: "jane@example.com", address: "456 Oak Ave", status: "Active" },
  { id: 3, name: "Bob Johnson", phone: "555-123-4567", email: "bob@example.com", address: "789 Pine Rd", status: "Active" },
  { id: 4, name: "Alice Williams", phone: "444-555-6666", email: "alice@example.com", address: "321 Elm St", status: "Inactive" },
  { id: 5, name: "Charlie Brown", phone: "777-888-9999", email: "charlie@example.com", address: "654 Maple Dr", status: "Active" }
];

// Sample Suppliers
const sampleSuppliers = [
  { id: 1, company: "ABC Electronics", contact: "Mike Davis", phone: "111-222-3333", email: "mike@abc.com", status: "Active" },
  { id: 2, company: "XYZ Wholesale", contact: "Sarah Connor", phone: "444-555-6666", email: "sarah@xyz.com", status: "Active" },
  { id: 3, company: "Tech Supply Co", contact: "James Bond", phone: "777-888-9999", email: "james@techsupply.com", status: "Active" }
];

// Sample Items/Products
const sampleItems = [
  { id: 1, code: "ITM001", name: "Dell Laptop", category: "Electronics", brand: "Dell", unit: "Piece", price: 850.00, stock: 25, status: "Active" },
  { id: 2, code: "ITM002", name: "HP Printer", category: "Electronics", brand: "HP", unit: "Piece", price: 320.50, stock: 15, status: "Active" },
  { id: 3, code: "ITM003", name: "Logitech Mouse", category: "Accessories", brand: "Logitech", unit: "Piece", price: 25.99, stock: 150, status: "Active" },
  { id: 4, code: "ITM004", name: "Samsung Monitor", category: "Electronics", brand: "Samsung", unit: "Piece", price: 425.00, stock: 30, status: "Active" },
  { id: 5, code: "ITM005", name: "Mechanical Keyboard", category: "Accessories", brand: "Corsair", unit: "Piece", price: 89.99, stock: 45, status: "Active" }
];

// Sample Sales Invoices
const sampleSales = [
  { invoice: "SAL-2024-001", date: "2024-12-20", customer: "John Doe", amount: 1250.00, paid: 1000.00, due: 250.00, status: "Partial" },
  { invoice: "SAL-2024-002", date: "2024-12-21", customer: "Jane Smith", amount: 850.50, paid: 850.50, due: 0.00, status: "Paid" },
  { invoice: "SAL-2024-003", date: "2024-12-22", customer: "Bob Johnson", amount: 2340.75, paid: 0.00, due: 2340.75, status: "Unpaid" },
  { invoice: "SAL-2024-004", date: "2024-12-23", customer: "Alice Williams", amount: 450.00, paid: 450.00, due: 0.00, status: "Paid" },
  { invoice: "SAL-2024-005", date: "2024-12-24", customer: "Charlie Brown", amount: 1890.25, paid: 1890.25, due: 0.00, status: "Paid" }
];

// Sample Purchase Orders
const samplePurchases = [
  { invoice: "PUR-2024-001", date: "2024-12-15", supplier: "ABC Electronics", amount: 5430.00, paid: 5000.00, due: 430.00, status: "Received" },
  { invoice: "PUR-2024-002", date: "2024-12-16", supplier: "XYZ Wholesale", amount: 3250.75, paid: 3250.75, due: 0.00, status: "Received" },
  { invoice: "PUR-2024-003", date: "2024-12-18", supplier: "Tech Supply Co", amount: 7890.50, paid: 5000.00, due: 2890.50, status: "Partial" }
];

// Helper function to format currency
function formatCurrency(amount) {
  return '$' + parseFloat(amount).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}

// Helper function to format date
function formatDate(dateStr) {
  const date = new Date(dateStr);
  const options = { year: 'numeric', month: 'short', day: 'numeric' };
  return date.toLocaleDateString('en-US', options);
}
