571 lines
16 KiB
HTML
571 lines
16 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Homepage Editor - Sky Art Shop</title>
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
|
<link
|
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
|
|
rel="stylesheet"
|
|
/>
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
|
|
/>
|
|
<link rel="stylesheet" href="/admin/css/admin-style.css" />
|
|
<link rel="stylesheet" href="/admin/css/media-library.css" />
|
|
<!-- Quill Rich Text Editor -->
|
|
<link
|
|
href="https://cdn.quilljs.com/1.3.7/quill.snow.css"
|
|
rel="stylesheet"
|
|
/>
|
|
<style>
|
|
.section-builder {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 25px;
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
border: 2px solid #e9ecef;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.section-builder:hover {
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.section-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
padding-bottom: 15px;
|
|
border-bottom: 2px solid #e9ecef;
|
|
}
|
|
|
|
.section-header h5 {
|
|
margin: 0;
|
|
color: #2c3e50;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.section-controls {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
}
|
|
|
|
/* Slide Management */
|
|
.slides-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
|
|
.slide-card {
|
|
background: #f8f9fa;
|
|
border: 2px solid #e9ecef;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
position: relative;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.slide-card:hover {
|
|
border-color: #667eea;
|
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
|
|
}
|
|
|
|
.slide-card.active {
|
|
border-color: #28a745;
|
|
background: #f8fff9;
|
|
}
|
|
|
|
.slide-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 15px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px solid #e9ecef;
|
|
}
|
|
|
|
.slide-number {
|
|
font-weight: 700;
|
|
color: #667eea;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.slide-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.slide-actions .btn {
|
|
padding: 5px 10px;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.image-preview {
|
|
width: 100%;
|
|
height: 150px;
|
|
border: 2px dashed #ccc;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-top: 10px;
|
|
overflow: hidden;
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.image-preview img {
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.image-preview.empty {
|
|
color: #6c757d;
|
|
}
|
|
|
|
.add-slide-btn {
|
|
border: 2px dashed #667eea;
|
|
background: transparent;
|
|
color: #667eea;
|
|
padding: 20px;
|
|
border-radius: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 10px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.add-slide-btn:hover {
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.save-button {
|
|
position: fixed;
|
|
bottom: 30px;
|
|
right: 30px;
|
|
z-index: 999;
|
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
.drag-handle {
|
|
cursor: grab;
|
|
color: #adb5bd;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.drag-handle:hover {
|
|
color: #667eea;
|
|
}
|
|
|
|
/* Featured Products Section */
|
|
.count-selector {
|
|
display: flex;
|
|
gap: 10px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.count-btn {
|
|
padding: 8px 16px;
|
|
border: 2px solid #e9ecef;
|
|
background: white;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.count-btn:hover {
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.count-btn.active {
|
|
border-color: #667eea;
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
/* Info box */
|
|
.info-box {
|
|
background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
|
|
border-left: 4px solid #2196f3;
|
|
padding: 15px;
|
|
border-radius: 0 8px 8px 0;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.info-box i {
|
|
color: #2196f3;
|
|
}
|
|
|
|
/* Quill Editor Styles */
|
|
.quill-container {
|
|
background: white;
|
|
border-radius: 8px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.quill-container .ql-toolbar {
|
|
border-top-left-radius: 8px;
|
|
border-top-right-radius: 8px;
|
|
background: #f8f9fa;
|
|
border-color: #ced4da;
|
|
}
|
|
|
|
.quill-container .ql-container {
|
|
border-bottom-left-radius: 8px;
|
|
border-bottom-right-radius: 8px;
|
|
border-color: #ced4da;
|
|
min-height: 120px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.quill-container .ql-editor {
|
|
min-height: 100px;
|
|
}
|
|
|
|
.quill-container .ql-editor.ql-blank::before {
|
|
font-style: normal;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.slide-card .quill-container .ql-container {
|
|
min-height: 80px;
|
|
}
|
|
|
|
.slide-card .quill-container .ql-editor {
|
|
min-height: 60px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="sidebar">
|
|
<div class="sidebar-brand">Sky Art Shop</div>
|
|
<ul class="sidebar-menu">
|
|
<li>
|
|
<a href="/admin/dashboard"
|
|
><i class="bi bi-speedometer2"></i> Dashboard</a
|
|
>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/homepage" class="active"
|
|
><i class="bi bi-house"></i> Homepage Editor</a
|
|
>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/products"><i class="bi bi-box"></i> Products</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/portfolio"><i class="bi bi-easel"></i> Portfolio</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/blog"><i class="bi bi-newspaper"></i> Blog</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/pages"
|
|
><i class="bi bi-file-text"></i> Custom Pages</a
|
|
>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/media-library"
|
|
><i class="bi bi-images"></i> Media Library</a
|
|
>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/menu"><i class="bi bi-list"></i> Menu</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/settings"><i class="bi bi-gear"></i> Settings</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/users"><i class="bi bi-people"></i> Users</a>
|
|
</li>
|
|
<li>
|
|
<a href="/admin/customers"
|
|
><i class="bi bi-person-hearts"></i> Customers</a
|
|
>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="main-content">
|
|
<div class="top-bar">
|
|
<div>
|
|
<h3>Homepage Editor</h3>
|
|
<p class="mb-0 text-muted">Customize your homepage sections</p>
|
|
</div>
|
|
<div>
|
|
<a href="/home" target="_blank" class="btn btn-info me-2">
|
|
<i class="bi bi-eye"></i> Preview
|
|
</a>
|
|
<button class="btn-logout" onclick="logout()">
|
|
<i class="bi bi-box-arrow-right"></i> Logout
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="sectionsContainer">
|
|
<!-- Hero Slider Section -->
|
|
<div class="section-builder" id="heroSliderSection">
|
|
<div class="section-header">
|
|
<h5><i class="bi bi-collection-play"></i> Hero Slider</h5>
|
|
<div class="section-controls">
|
|
<span class="badge bg-primary" id="slideCount">0 slides</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="info-box">
|
|
<p class="mb-2">
|
|
<i class="bi bi-info-circle me-2"></i>
|
|
<strong>Hero Slider:</strong> Create multiple slides with
|
|
background images, titles, descriptions, and call-to-action
|
|
buttons. Slides will auto-rotate every 10 seconds on the frontend.
|
|
</p>
|
|
<p
|
|
class="mb-0"
|
|
style="
|
|
background: #fff3cd;
|
|
padding: 10px;
|
|
border-radius: 6px;
|
|
border-left: 4px solid #ffc107;
|
|
"
|
|
>
|
|
<i class="bi bi-image me-2" style="color: #856404"></i>
|
|
<strong style="color: #856404">Recommended Image Size:</strong>
|
|
<code
|
|
style="
|
|
background: #ffeeba;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
"
|
|
>1920 x 600 pixels</code
|
|
>
|
|
(width x height). Use landscape images for best results. The image
|
|
will cover the entire slider area as a background.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="section-content">
|
|
<div class="slides-container" id="slidesContainer">
|
|
<!-- Slides will be rendered here -->
|
|
</div>
|
|
|
|
<button
|
|
type="button"
|
|
class="add-slide-btn w-100 mt-3"
|
|
onclick="addNewSlide()"
|
|
>
|
|
<i class="bi bi-plus-circle"></i> Add New Slide
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Featured Products Section -->
|
|
<div class="section-builder" id="featuredProductsSection">
|
|
<div class="section-header">
|
|
<h5><i class="bi bi-star"></i> Featured Products</h5>
|
|
<div class="section-controls">
|
|
<div class="form-check form-switch">
|
|
<input
|
|
class="form-check-input"
|
|
type="checkbox"
|
|
id="featuredEnabled"
|
|
checked
|
|
/>
|
|
<label class="form-check-label" for="featuredEnabled"
|
|
>Show on Homepage</label
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="info-box">
|
|
<p class="mb-0">
|
|
<i class="bi bi-info-circle me-2"></i>
|
|
Products marked as "Featured" in the Products section will appear
|
|
here automatically.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="section-content">
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label">Section Title</label>
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
id="featuredTitle"
|
|
value="Featured Products"
|
|
/>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label">Number of Products to Display</label>
|
|
<div class="count-selector">
|
|
<button
|
|
class="count-btn"
|
|
data-count="4"
|
|
onclick="setFeaturedCount(4)"
|
|
>
|
|
4
|
|
</button>
|
|
<button
|
|
class="count-btn active"
|
|
data-count="8"
|
|
onclick="setFeaturedCount(8)"
|
|
>
|
|
8
|
|
</button>
|
|
<button
|
|
class="count-btn"
|
|
data-count="12"
|
|
onclick="setFeaturedCount(12)"
|
|
>
|
|
12
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Get Inspired / Blog Section -->
|
|
<div class="section-builder" id="blogSection">
|
|
<div class="section-header">
|
|
<h5><i class="bi bi-lightbulb"></i> Get Inspired (Blog Posts)</h5>
|
|
<div class="section-controls">
|
|
<div class="form-check form-switch">
|
|
<input
|
|
class="form-check-input"
|
|
type="checkbox"
|
|
id="blogEnabled"
|
|
checked
|
|
/>
|
|
<label class="form-check-label" for="blogEnabled"
|
|
>Show on Homepage</label
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="info-box">
|
|
<p class="mb-0">
|
|
<i class="bi bi-info-circle me-2"></i>
|
|
Latest blog posts will be displayed automatically from the Blog
|
|
section.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="section-content">
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label">Section Title</label>
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
id="blogTitle"
|
|
value="Get Inspired"
|
|
/>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label">Number of Posts to Display</label>
|
|
<div class="count-selector">
|
|
<button
|
|
class="count-btn active"
|
|
data-count="3"
|
|
onclick="setBlogCount(3)"
|
|
>
|
|
3
|
|
</button>
|
|
<button
|
|
class="count-btn"
|
|
data-count="6"
|
|
onclick="setBlogCount(6)"
|
|
>
|
|
6
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- About Preview Section -->
|
|
<div class="section-builder" id="aboutSection">
|
|
<div class="section-header">
|
|
<h5><i class="bi bi-info-square"></i> About Preview</h5>
|
|
<div class="section-controls">
|
|
<div class="form-check form-switch">
|
|
<input
|
|
class="form-check-input"
|
|
type="checkbox"
|
|
id="aboutEnabled"
|
|
checked
|
|
/>
|
|
<label class="form-check-label" for="aboutEnabled"
|
|
>Show on Homepage</label
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-content">
|
|
<div class="mb-3">
|
|
<label class="form-label">About Title</label>
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
id="aboutTitle"
|
|
value="About Sky Art Shop"
|
|
/>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">About Description</label>
|
|
<div class="quill-container">
|
|
<div id="aboutDescriptionEditor"></div>
|
|
</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">About Image</label>
|
|
<input type="hidden" id="aboutImageUrl" />
|
|
<button
|
|
type="button"
|
|
class="btn btn-outline-primary w-100"
|
|
onclick="openMediaLibrary('about')"
|
|
>
|
|
<i class="bi bi-folder2-open"></i> Choose from Media Library
|
|
</button>
|
|
<div class="image-preview empty" id="aboutPreview">
|
|
<i class="bi bi-image" style="font-size: 2rem"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button
|
|
class="btn btn-lg btn-primary save-button"
|
|
onclick="saveHomepage()"
|
|
>
|
|
<i class="bi bi-save"></i> Save All Changes
|
|
</button>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://cdn.quilljs.com/1.3.7/quill.min.js"></script>
|
|
<script src="/admin/js/auth.js"></script>
|
|
<script src="/admin/js/admin-utils.js"></script>
|
|
<script src="/admin/js/media-library.js"></script>
|
|
<script src="/admin/js/homepage.js"></script>
|
|
</body>
|
|
</html>
|