Init PercoVitrine — app de gestion de fiches produits
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
require __DIR__ . '/includes/db.php';
|
||||
require __DIR__ . '/includes/helpers.php';
|
||||
require __DIR__ . '/includes/layout.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$keys = ['etsy_api_key','etsy_api_secret','etsy_shop_id','currency'];
|
||||
$stmt = $pdo->prepare("INSERT OR REPLACE INTO settings(key,value) VALUES(?,?)");
|
||||
foreach ($keys as $k) {
|
||||
$stmt->execute([$k, trim($_POST[$k] ?? '')]);
|
||||
}
|
||||
header('Location: /settings.php?saved=1');
|
||||
exit;
|
||||
}
|
||||
|
||||
function cfg(PDO $pdo, string $key): string {
|
||||
$v = $pdo->prepare("SELECT value FROM settings WHERE key=?");
|
||||
$v->execute([$key]);
|
||||
return $v->fetchColumn() ?: '';
|
||||
}
|
||||
|
||||
layout_head('Réglages');
|
||||
layout_sidebar('settings');
|
||||
layout_main_open();
|
||||
?>
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-title"><i class="fas fa-gear" style="color:var(--primary);margin-right:.4rem"></i>Réglages</div>
|
||||
</div>
|
||||
|
||||
<?php if ($_GET['saved'] ?? false): ?>
|
||||
<div style="background:rgba(34,197,94,.1);border:1px solid rgba(34,197,94,.3);padding:.75rem 1rem;border-radius:8px;margin-bottom:1rem;color:var(--green)"><i class="fas fa-check-circle"></i> Réglages enregistrés.</div>
|
||||
<?php endif ?>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;align-items:start">
|
||||
|
||||
<div style="display:flex;flex-direction:column;gap:1rem">
|
||||
<!-- Etsy -->
|
||||
<div class="card">
|
||||
<div class="etsy-logo mb-3"><i class="fab fa-etsy"></i> Intégration Etsy</div>
|
||||
<p style="font-size:.83rem;color:var(--muted);margin-bottom:1rem;line-height:1.6">
|
||||
Pour obtenir une clé API Etsy, va sur
|
||||
<strong>etsy.com/developers</strong>, crée une application, et
|
||||
copie la clé et le secret ci-dessous.<br>
|
||||
L'intégration permettra de publier tes fiches directement depuis PercoVitrine.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<label>API Key (Keystring)</label>
|
||||
<input type="text" name="etsy_api_key" value="<?= h(cfg($pdo,'etsy_api_key')) ?>" placeholder="Coller la clé API…" autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>API Secret</label>
|
||||
<input type="password" name="etsy_api_secret" value="<?= h(cfg($pdo,'etsy_api_secret')) ?>" placeholder="Coller le secret…" autocomplete="off">
|
||||
<div class="form-hint">Stocké localement, jamais transmis sauf à Etsy</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0">
|
||||
<label>Shop ID</label>
|
||||
<input type="text" name="etsy_shop_id" value="<?= h(cfg($pdo,'etsy_shop_id')) ?>" placeholder="Nom ou ID de ta boutique Etsy">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;flex-direction:column;gap:1rem">
|
||||
<!-- Général -->
|
||||
<div class="card">
|
||||
<div style="font-size:.85rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:.75rem"><i class="fas fa-sliders" style="margin-right:.4rem"></i>Général</div>
|
||||
<div class="form-group" style="margin-bottom:0">
|
||||
<label>Devise</label>
|
||||
<select name="currency">
|
||||
<?php foreach (['EUR'=>'Euro (€)','USD'=>'Dollar ($)','GBP'=>'Livre sterling (£)','CHF'=>'Franc suisse (CHF)'] as $v=>$l): ?>
|
||||
<option value="<?= $v ?>"<?= cfg($pdo,'currency')===$v?' selected':'' ?>><?= $l ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="background:rgba(45,163,242,.04);border-color:rgba(45,163,242,.15)">
|
||||
<div style="font-size:.85rem;font-weight:700;margin-bottom:.5rem"><i class="fas fa-circle-info" style="color:var(--primary);margin-right:.4rem"></i>Roadmap intégrations</div>
|
||||
<ul style="font-size:.82rem;color:var(--muted);padding-left:1.2rem;line-height:2">
|
||||
<li><span style="color:var(--volt)">●</span> Etsy — en cours d'intégration</li>
|
||||
<li><span style="color:var(--border)">●</span> Vinted — prévu</li>
|
||||
<li><span style="color:var(--border)">●</span> Leboncoin — prévu</li>
|
||||
<li><span style="color:var(--border)">●</span> WooCommerce — prévu</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-save"></i> Enregistrer</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<?php layout_foot(); ?>
|
||||
Reference in New Issue
Block a user