91 lines
5.2 KiB
PHP
91 lines
5.2 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = $title ?? 'Store Settings';
|
||
|
|
$settings = $settings ?? [];
|
||
|
|
$error = (string)($error ?? '');
|
||
|
|
$saved = (string)($saved ?? '');
|
||
|
|
$privateRootReady = (bool)($private_root_ready ?? false);
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="admin-card">
|
||
|
|
<div class="badge">Store</div>
|
||
|
|
<div style="display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:16px;">
|
||
|
|
<div>
|
||
|
|
<h1 style="font-size:28px; margin:0;">Store Settings</h1>
|
||
|
|
<p style="color: var(--muted); margin-top:6px;">Payment, private downloads, and order defaults.</p>
|
||
|
|
</div>
|
||
|
|
<a href="/admin/store" class="btn outline">Back</a>
|
||
|
|
</div>
|
||
|
|
<div style="display:flex; flex-wrap:wrap; gap:8px; margin-top:12px;">
|
||
|
|
<a href="/admin/store" class="btn outline small">Overview</a>
|
||
|
|
<a href="/admin/store/settings" class="btn outline small">Settings</a>
|
||
|
|
<a href="/admin/store/orders" class="btn outline small">Orders</a>
|
||
|
|
<a href="/admin/store/customers" class="btn outline small">Customers</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if ($error !== ''): ?>
|
||
|
|
<div style="margin-top:12px; color:#f3b0b0; font-size:13px;"><?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($saved !== ''): ?>
|
||
|
|
<div style="margin-top:12px; color:#9be7c6; font-size:13px;">Settings saved.</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<form method="post" action="/admin/store/settings" style="margin-top:16px; display:grid; gap:16px;">
|
||
|
|
<div class="admin-card" style="padding:16px;">
|
||
|
|
<div class="label">Currency</div>
|
||
|
|
<input class="input" name="store_currency" value="<?= htmlspecialchars((string)($settings['store_currency'] ?? 'GBP'), ENT_QUOTES, 'UTF-8') ?>" placeholder="GBP">
|
||
|
|
|
||
|
|
<div class="label" style="margin-top:12px;">Private Download Root (outside public_html)</div>
|
||
|
|
<input class="input" name="store_private_root" value="<?= htmlspecialchars((string)($settings['store_private_root'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="/home/audiocore.site/private_downloads">
|
||
|
|
<div style="margin-top:8px; font-size:12px; color: <?= $privateRootReady ? '#9be7c6' : '#f3b0b0' ?>;">
|
||
|
|
<?= $privateRootReady ? 'Path is writable' : 'Path missing or not writable' ?>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px;">
|
||
|
|
<div>
|
||
|
|
<div class="label">Download Limit</div>
|
||
|
|
<input class="input" name="store_download_limit" value="<?= htmlspecialchars((string)($settings['store_download_limit'] ?? '5'), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<div class="label">Expiry Days</div>
|
||
|
|
<input class="input" name="store_download_expiry_days" value="<?= htmlspecialchars((string)($settings['store_download_expiry_days'] ?? '30'), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="admin-card" style="padding:16px;">
|
||
|
|
<div class="label" style="margin-bottom:10px;">Payment Provider (Stripe)</div>
|
||
|
|
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||
|
|
<input type="checkbox" name="store_test_mode" value="1" <?= ((string)($settings['store_test_mode'] ?? '1') === '1') ? 'checked' : '' ?>>
|
||
|
|
Test mode
|
||
|
|
</label>
|
||
|
|
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em; margin-top:8px;">
|
||
|
|
<input type="checkbox" name="store_stripe_enabled" value="1" <?= ((string)($settings['store_stripe_enabled'] ?? '0') === '1') ? 'checked' : '' ?>>
|
||
|
|
Enable Stripe
|
||
|
|
</label>
|
||
|
|
<div class="label" style="margin-top:10px;">Stripe Public Key</div>
|
||
|
|
<input class="input" name="store_stripe_public_key" value="<?= htmlspecialchars((string)($settings['store_stripe_public_key'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
<div class="label" style="margin-top:10px;">Stripe Secret Key</div>
|
||
|
|
<input class="input" name="store_stripe_secret_key" value="<?= htmlspecialchars((string)($settings['store_stripe_secret_key'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="admin-card" style="padding:16px;">
|
||
|
|
<div class="label" style="margin-bottom:10px;">Payment Provider (PayPal)</div>
|
||
|
|
<label style="display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.2em;">
|
||
|
|
<input type="checkbox" name="store_paypal_enabled" value="1" <?= ((string)($settings['store_paypal_enabled'] ?? '0') === '1') ? 'checked' : '' ?>>
|
||
|
|
Enable PayPal
|
||
|
|
</label>
|
||
|
|
<div class="label" style="margin-top:10px;">PayPal Client ID</div>
|
||
|
|
<input class="input" name="store_paypal_client_id" value="<?= htmlspecialchars((string)($settings['store_paypal_client_id'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
<div class="label" style="margin-top:10px;">PayPal Secret</div>
|
||
|
|
<input class="input" name="store_paypal_secret" value="<?= htmlspecialchars((string)($settings['store_paypal_secret'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div style="display:flex; justify-content:flex-end;">
|
||
|
|
<button class="btn" type="submit">Save Settings</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/../../../../modules/admin/views/layout.php';
|