<?php
$page_title = 'فواتير المبيعات السابقة';
$UA_FORCE_DESIGN_V2 = true;
$uaAndroidSalesHistory = ((string)($_GET['ua_android'] ?? '') === '1')
  || stripos((string)($_SERVER['HTTP_USER_AGENT'] ?? ''), 'NetworkCustomersAndroid/') !== false;
if ($uaAndroidSalesHistory) $UA_PAGE_CSS = ['assets/css/android_sales_history.css'];
include __DIR__ . '/header.php';
include __DIR__ . '/sidebar.php';
require_once __DIR__ . '/auth.php';
require_once __DIR__ . '/helpers.php';
require_once __DIR__ . '/shop_lib.php';

require_login();

$active_tab = 'history';
if ($uaAndroidSalesHistory) {
  ensure_shop_tables($conn);
  $salesHistory = [];
  $historyPhoneColumn = 'NULL AS customer_phone';
  $historyPhoneCheck = @$conn->query("SHOW COLUMNS FROM shop_sales LIKE 'customer_phone'");
  if ($historyPhoneCheck && $historyPhoneCheck->num_rows) $historyPhoneColumn = 'customer_phone';
  $historyResult = $conn->query("SELECT id,customer_name,{$historyPhoneColumn},total,created_at FROM shop_sales ORDER BY id DESC LIMIT 200");
  if ($historyResult) while ($saleRow = $historyResult->fetch_assoc()) $salesHistory[] = $saleRow;
  require __DIR__ . '/android_sales_history.php';
  include __DIR__ . '/footer.php';
  return;
}
?>
<div class="content-wrapper ua-extracted-page">
  <section class="content-header">
    <div class="container-fluid">
      <h1 class="mb-0">حول البرنامج</h1>
    </div>
  </section>

  <section class="content">
    <div class="container-fluid">
      <div class="card">
        <div class="card-body">
          <h5 class="mb-3">معلومات مالك التطبيق</h5>
          <ul class="list-unstyled">
            <li><b>الاسم:</b> عماد خميس</li>
            <li><b>الهاتف:</b> 0938174386</li>
            <li><b>البريد:</b> emaad12200@gmail.com</li>
          </ul>
        </div>
      </div>
    </div>
  </section>
</div>
<?php include __DIR__ . '/footer.php'; ?>
