- v1.1.0 - Redesign
This commit is contained in:
+42
-2
@@ -5,7 +5,7 @@ $slug = gs('slug');
|
||||
$b = qone("
|
||||
SELECT
|
||||
b.id, b.name, b.slug, b.subcategory, b.description,
|
||||
b.address, b.phone, b.email, b.website,
|
||||
b.address, b.phone, b.email, b.website, COALESCE(b.video_url,'') AS video_url,
|
||||
COALESCE(b.hours,'{}') AS hours,
|
||||
b.lat, b.lng, b.is_active, b.is_featured, b.created_at,
|
||||
b.category_id,
|
||||
@@ -30,7 +30,7 @@ if (isPost()) {
|
||||
// Owner submits edit request
|
||||
if ($act === 'owner_edit' && owns($b['id']) && !isAdmin()) {
|
||||
$days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
|
||||
$allowedFields = ['description','address','phone','email','is_active'];
|
||||
$allowedFields = ['description','address','phone','email','website','video_url','is_active'];
|
||||
$submitted = 0;
|
||||
|
||||
// Simple text fields
|
||||
@@ -42,6 +42,10 @@ if (isPost()) {
|
||||
$new = (string)(int)p('is_active', $b['is_active']);
|
||||
$old = (string)(int)$b['is_active'];
|
||||
}
|
||||
if ($field === 'video_url' && !validBusinessVideoUrl($new)) {
|
||||
flash('Business videos must be a YouTube or Vimeo URL.', 'error');
|
||||
go("/business.php?slug=$slug");
|
||||
}
|
||||
if ($new !== $old) {
|
||||
// Remove any existing pending request for this field
|
||||
qrun("DELETE FROM business_edit_requests WHERE business_id=? AND field=? AND status='pending'",
|
||||
@@ -299,6 +303,28 @@ include __DIR__.'/includes/header.php';
|
||||
value="<?=e(isset($pendingByField['email']) ? $pendingByField['email']['new_value'] : $b['email'])?>">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="fg">
|
||||
<label class="flabel">
|
||||
WEBSITE
|
||||
<?php if (isset($pendingByField['website'])): ?><span class="badge badge-gold" style="margin-left:.4rem">PENDING</span><?php endif; ?>
|
||||
</label>
|
||||
<input type="text" name="website" class="finput"
|
||||
value="<?=e(isset($pendingByField['website']) ? $pendingByField['website']['new_value'] : $b['website'])?>"
|
||||
placeholder="example.com">
|
||||
</div>
|
||||
<div class="fg">
|
||||
<label class="flabel">
|
||||
VIDEO URL
|
||||
<?php if (isset($pendingByField['video_url'])): ?><span class="badge badge-gold" style="margin-left:.4rem">PENDING</span><?php endif; ?>
|
||||
</label>
|
||||
<input type="url" name="video_url" class="finput"
|
||||
value="<?=e(isset($pendingByField['video_url']) ? $pendingByField['video_url']['new_value'] : $b['video_url'])?>"
|
||||
placeholder="YouTube or Vimeo URL">
|
||||
<div class="fhint">Optional. Business owners may use YouTube or Vimeo.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fg">
|
||||
<label class="flabel">
|
||||
HOURS OF OPERATION
|
||||
@@ -352,6 +378,20 @@ include __DIR__.'/includes/header.php';
|
||||
<p style="color:var(--text-m);line-height:1.85"><?=e($b['description'] ?? '')?></p>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($b['video_url']) && validBusinessVideoUrl($b['video_url'])): ?>
|
||||
<div class="ibox business-video-box" style="margin-bottom:1.75rem">
|
||||
<div class="ibox-title">VIDEO FEATURE</div>
|
||||
<div class="embed-shell">
|
||||
<iframe
|
||||
src="/lone-embed.php?video=<?=rawurlencode($b['video_url'])?>&title=<?=rawurlencode($b['name'])?>"
|
||||
title="<?=e($b['name'])?> video"
|
||||
loading="lazy"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($sects): ?>
|
||||
<div class="ibox" style="margin-bottom:1.75rem">
|
||||
<div class="ibox-title">🍽️ MENU</div>
|
||||
|
||||
Reference in New Issue
Block a user