| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/self-hosted/ |
Upload File : |
<?php
include 'protect.php';
include 'db.php';
include 'store_settings.php';
require_once __DIR__ . '/brand_header.php';
$message = '';
$error = '';
try {
$taxRate = getStoreTaxRate($conn);
} catch (Throwable $e) {
$taxRate = 0.082;
$error = $e->getMessage();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$percentInput = trim($_POST['tax_rate_percent'] ?? '');
if ($percentInput === '' || !is_numeric($percentInput)) {
$error = 'Please enter a valid tax rate percentage.';
} else {
$taxRate = ((float) $percentInput) / 100;
try {
setStoreTaxRate($conn, $taxRate);
$message = 'Sales tax rate updated successfully.';
} catch (Throwable $e) {
$error = $e->getMessage();
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sales Tax Settings</title>
<style>
body { font-family: Arial, sans-serif; background: #f4f4f4; padding: 40px; }
.box { background: white; padding: 30px; max-width: 580px; margin: auto; box-shadow: 0 0 10px rgba(0,0,0,0.1); border-radius: 10px; }
h1 { margin-top: 0; }
label { display: block; margin: 16px 0 8px; font-weight: bold; }
input[type="number"] { width: 100%; padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 6px; }
.btn { display: inline-block; margin-top: 18px; padding: 10px 18px; background: #4CAF50; color: white; text-decoration: none; border: none; border-radius: 6px; cursor: pointer; }
.btn:hover { background: #45a049; }
.msg { margin: 0 0 16px; padding: 12px; border-radius: 8px; }
.ok { background: #ecfdf5; border: 1px solid #86efac; color: #166534; }
.err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.help { color: #667085; line-height: 1.5; }
</style>
<?php echo appBrandStyles(); ?>
</head>
<body>
<div class="box">
<?php renderAppBrandHeader(); ?>
<h1>Sales Tax Settings</h1>
<p class="help">
Set the tax rate for this store as a percentage.
Examples: <strong>8.20</strong> for 8.2% or <strong>7.50</strong> for 7.5%.
</p>
<?php if ($message): ?>
<div class="msg ok"><?php echo htmlspecialchars($message, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
<?php if ($error): ?>
<div class="msg err"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
<?php endif; ?>
<form method="post">
<label for="tax_rate_percent">Sales Tax Rate (%)</label>
<input
id="tax_rate_percent"
name="tax_rate_percent"
type="number"
min="0"
max="100"
step="0.01"
value="<?php echo htmlspecialchars(formatTaxRatePercent($taxRate), ENT_QUOTES, 'UTF-8'); ?>"
required
>
<button class="btn" type="submit">Save Tax Rate</button>
</form>
<p style="margin-top:20px;"><a href="index.php">← Back to Dashboard</a></p>
</div>
</body>
</html>