瀏覽代碼

add new admin view

sark 1 月之前
父節點
當前提交
afead5cda2

二進制
database/database.db


+ 1 - 0
public/index.php

@@ -6,6 +6,7 @@ $requestUri = $_GET['p'] ?? parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
 $page = match (true) {
   ('/' === $requestUri) => 'home.php',
   ('/admin/' === $requestUri) => 'admin/index.php',
+  ('/admin/pages/' === $requestUri) => 'admin/pages.php',
   ('/verstka/' === $requestUri) => 'verstka.php',
   (preg_match('#^/redirect/([\w-]+)/$#', $requestUri, $matches) === 1) => 'redirect.php',
   default => '404.php',

+ 92 - 27
resources/view/admin/index.php

@@ -7,43 +7,108 @@
     <title>Admin Panel</title>
     <script defer src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.15.0/cdn.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2/tinymce.min.js"></script>
+    <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
     <link rel="stylesheet" href="/css/admin/style.css">
 </head>
 
-<body>
-    <div class="container">
-        <div style="margin-bottom: 20px;">
-            <a href="pages.php" style="display: inline-block; padding: 10px 20px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; margin-bottom: 10px;">📄 Manage Dynamic Pages</a>
+<body class="bg-gray-100 font-sans">
+    <div x-data="{ sidebarOpen: false }" class="flex h-screen">
+        <!-- Sidebar -->
+        <div :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'" 
+             class="fixed inset-y-0 left-0 z-50 w-64 bg-white shadow-lg transform transition-transform duration-300 ease-in-out lg:translate-x-0 lg:static lg:inset-0">
+            <div class="flex items-center justify-center h-16 bg-blue-600">
+                <h1 class="text-xl font-semibold text-white">Admin Panel</h1>
+            </div>
+            <nav class="mt-5">
+                <div class="px-2">
+                    <a href="index.php" class="group flex items-center px-2 py-2 text-sm font-medium rounded-md text-blue-600 bg-blue-50">
+                        <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
+                            <path d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z"/>
+                        </svg>
+                        Site Settings
+                    </a>
+                    <a href="pages.php" class="group flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:text-gray-900 hover:bg-gray-50 mt-1">
+                        <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
+                            <path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z" clip-rule="evenodd"/>
+                        </svg>
+                        Dynamic Pages
+                    </a>
+                </div>
+            </nav>
         </div>
 
-        <!-- Navigation Tabs -->
-        <div x-data="{ activeTab: 'content' }" x-cloak class="tabs-container">
-            <div class="tabs">
-                <div class="tab" :class="{ 'active': activeTab === 'content' }" @click="activeTab = 'content'">Content</div>
-                <div class="tab" :class="{ 'active': activeTab === 'options' }" @click="activeTab = 'options'">Options</div>
-                <div class="tab" :class="{ 'active': activeTab === 'styles' }" @click="activeTab = 'styles'">Styles</div>
-                <div class="tab" :class="{ 'active': activeTab === 'seo' }" @click="activeTab = 'seo'">SEO & Meta</div>
+        <!-- Mobile sidebar overlay -->
+        <div x-show="sidebarOpen" 
+             @click="sidebarOpen = false" 
+             class="fixed inset-0 z-40 bg-gray-600 bg-opacity-75 lg:hidden"
+             x-transition:enter="transition-opacity ease-linear duration-300"
+             x-transition:enter-start="opacity-0"
+             x-transition:enter-end="opacity-100"
+             x-transition:leave="transition-opacity ease-linear duration-300"
+             x-transition:leave-start="opacity-100"
+             x-transition:leave-end="opacity-0"></div>
+
+        <!-- Main content -->
+        <div class="flex-1 overflow-hidden">
+            <!-- Top bar -->
+            <div class="bg-white shadow-sm lg:hidden">
+                <div class="px-4 py-2">
+                    <button @click="sidebarOpen = true" class="text-gray-500 hover:text-gray-600">
+                        <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
+                        </svg>
+                    </button>
+                </div>
             </div>
+            
+            <!-- Page content -->
+            <main class="flex-1 overflow-y-auto p-6">
+
+                <div class="bg-white rounded-lg shadow-sm">
+                    <div class="border-b border-gray-200">
+                        <nav class="-mb-px flex space-x-8" x-data="{ activeTab: 'content' }">
+                            <button @click="activeTab = 'content'" 
+                                    :class="activeTab === 'content' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                                    class="py-2 px-1 border-b-2 font-medium text-sm">
+                                Content
+                            </button>
+                            <button @click="activeTab = 'options'" 
+                                    :class="activeTab === 'options' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                                    class="py-2 px-1 border-b-2 font-medium text-sm">
+                                Options
+                            </button>
+                            <button @click="activeTab = 'styles'" 
+                                    :class="activeTab === 'styles' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                                    class="py-2 px-1 border-b-2 font-medium text-sm">
+                                Styles
+                            </button>
+                            <button @click="activeTab = 'seo'" 
+                                    :class="activeTab === 'seo' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                                    class="py-2 px-1 border-b-2 font-medium text-sm">
+                                SEO & Meta
+                            </button>
+                        </nav>
+                    </div>
 
-            <!-- Debug: Active tab is: <span x-text="activeTab"></span> -->
-
-            <form method="POST" action="" enctype="multipart/form-data">
-                <input type="hidden" name="form_submitted" value="1">
+                    <form method="POST" action="" enctype="multipart/form-data">
+                        <input type="hidden" name="form_submitted" value="1">
 
-                <!-- Content Tab -->
-                <div x-show="activeTab === 'content'" x-transition class="tab-content">
-                    <h2>Page Content</h2>
-                    <hr>
+                        <!-- Content Tab -->
+                        <div x-show="activeTab === 'content'" class="p-6">
+                            <h2 class="text-lg font-medium text-gray-900 mb-6">Page Content</h2>
 
-                    <div class="item">
-                        <span>Page Title (H1):</span>
-                        <input type="text" name='content[title]' value="<?= $content['title'] ?? '' ?>">
-                    </div>
+                            <div class="grid grid-cols-1 gap-6">
+                                <div>
+                                    <label class="block text-sm font-medium text-gray-700 mb-2">Page Title (H1)</label>
+                                    <input type="text" name='content[title]' value="<?= $content['title'] ?? '' ?>" 
+                                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
+                                </div>
 
-                    <div class="item">
-                        <h3>Top Text</h3>
-                        <textarea class="secondary-content" name='content[top_text]'><?= urldecode($content['top_text'] ?? '') ?></textarea>
-                    </div>
+                                <div>
+                                    <label class="block text-sm font-medium text-gray-700 mb-2">Top Text</label>
+                                    <textarea name='content[top_text]' rows="6" 
+                                              class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"><?= urldecode($content['top_text'] ?? '') ?></textarea>
+                                </div>
 
                     <div class="item">
                         <h3>Bottom Text</h3>

+ 565 - 0
resources/view/admin/index_new.php

@@ -0,0 +1,565 @@
+<?php 
+$pageTitle = 'Site Settings - Admin Panel';
+$headerTitle = 'Site Settings';
+$activeTab = 'content';
+
+$tabs = [
+    'content' => [
+        'label' => 'Content',
+        'icon' => 'M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z'
+    ],
+    'options' => [
+        'label' => 'Options',
+        'icon' => 'M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z'
+    ],
+    'styles' => [
+        'label' => 'Styles',
+        'icon' => 'M4 2a2 2 0 00-2 2v11a3 3 0 106 0V4a2 2 0 00-2-2H4z'
+    ],
+    'seo' => [
+        'label' => 'SEO & Meta',
+        'icon' => 'M12.316 3.051a1 1 0 01.633 1.265l-4 12a1 1 0 11-1.898-.632l4-12a1 1 0 011.265-.633zM5.707 6.293a1 1 0 010 1.414L3.414 10l2.293 2.293a1 1 0 11-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0zm8.586 0a1 1 0 011.414 0l3 3a1 1 0 010 1.414l-3 3a1 1 0 11-1.414-1.414L16.586 10l-2.293-2.293a1 1 0 010-1.414z'
+    ]
+];
+
+ob_start();
+?>
+<?php include __DIR__ . '/partials/tabs.php'; ?>
+
+<!-- Form -->
+                    <form method="POST" action="" enctype="multipart/form-data">
+                        <input type="hidden" name="form_submitted" value="1">
+
+                        <!-- Content Tab -->
+                        <div x-show="activeTab === 'content'" class="bg-white rounded-lg shadow-sm">
+                            <div class="p-6 space-y-8">
+                                
+                                <!-- Basic Content Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
+                                        </svg>
+                                        Basic Content
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Page Title (H1)</label>
+                                            <input type="text" name='content[title]' value="<?= htmlspecialchars($content['title'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                        
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">FAQ Title</label>
+                                            <input type="text" name='content[faq-title]' value="<?= htmlspecialchars($content['faq-title'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div class="lg:col-span-2">
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Top Text</label>
+                                            <textarea name='content[top_text]' rows="6" 
+                                                      class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><?= htmlspecialchars($content['top_text'] ?? '') ?></textarea>
+                                        </div>
+
+                                        <div class="lg:col-span-2">
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Bottom Text</label>
+                                            <textarea name='content[bottom_text]' rows="6" 
+                                                      class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><?= htmlspecialchars($content['bottom_text'] ?? '') ?></textarea>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Author & Meta Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Author & Meta
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Author Name</label>
+                                            <input type="text" name='content[author-name]' value="<?= htmlspecialchars($content['author-name'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Modified Date</label>
+                                            <input type="date" name='content[modified-date]' value="<?= htmlspecialchars($content['modified-date'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Button Settings -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Button Settings
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Login Button Text</label>
+                                            <input type="text" name='content[login]' value="<?= htmlspecialchars($content['login'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Password Button Text</label>
+                                            <input type="text" name='content[password]' value="<?= htmlspecialchars($content['password'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Content Button Text</label>
+                                            <input type="text" name='content[content_btn]' value="<?= htmlspecialchars($content['content_btn'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Casino Settings -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M3 5a2 2 0 012-2h10a2 2 0 012 2v8a2 2 0 01-2 2h-2.22l.123.489.804.804A1 1 0 0113 18H7a1 1 0 01-.707-1.707l.804-.804L7.22 15H5a2 2 0 01-2-2V5zm5.771 7H5V5h10v7H8.771z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Casino/Review Settings
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Casino Listing Title (H2)</label>
+                                            <input type="text" name='content[listing]' value="<?= htmlspecialchars($content['listing'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Review Count</label>
+                                            <input type="text" name='content[review-count]' value="<?= htmlspecialchars($content['review-count'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                        
+                                        <div class="flex items-center">
+                                            <input type="hidden" name="content[hide-btns]" value="0">
+                                            <input type="checkbox" name="content[hide-btns]" value="1" <?= !empty($content['hide-btns']) ? 'checked' : '' ?>
+                                                   class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
+                                            <label class="ml-2 block text-sm text-gray-900">Hide login/password buttons</label>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Images & Media Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Images & Media
+                                    </h3>
+                                    
+                                    <!-- Header Logo -->
+                                    <div class="bg-gray-50 p-4 rounded-lg mb-6">
+                                        <h4 class="text-md font-medium text-gray-800 mb-4">Header Logo</h4>
+                                        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
+                                            <div>
+                                                <?php 
+                                                $headerLogo = [];
+                                                if (isset($content['header-logo']) && !empty($content['header-logo'])) {
+                                                    $headerLogo = json_decode($content['header-logo'], true) ?: [];
+                                                }
+                                                ?>
+                                                <?php if (!empty($headerLogo['src'])): ?>
+                                                    <img class="w-24 h-24 object-cover rounded-lg border mb-2" src="../<?= $headerLogo['src'] ?>" alt="Header Logo">
+                                                <?php endif; ?>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Upload Header Logo</label>
+                                                <input type="file" name="content[header-logo]" accept="image/*" 
+                                                       class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                            </div>
+                                            <div>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Title</label>
+                                                <input type="text" name='content[header-logo][title]' value="<?= htmlspecialchars($headerLogo['title'] ?? '') ?>" 
+                                                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                            <div>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Alt Text</label>
+                                                <input type="text" name='content[header-logo][alt]' value="<?= htmlspecialchars($headerLogo['alt'] ?? '') ?>" 
+                                                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                    <!-- Banner Logo -->
+                                    <div class="bg-gray-50 p-4 rounded-lg mb-6">
+                                        <h4 class="text-md font-medium text-gray-800 mb-4">Banner Image</h4>
+                                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                            <div>
+                                                <?php 
+                                                $bannerLogo = [];
+                                                if (isset($content['banner-logo']) && !empty($content['banner-logo'])) {
+                                                    $bannerLogo = json_decode($content['banner-logo'], true) ?: [];
+                                                }
+                                                ?>
+                                                <?php if (!empty($bannerLogo['src'])): ?>
+                                                    <img class="w-full h-24 object-cover rounded-lg border mb-2" src="../<?= $bannerLogo['src'] ?>" alt="Banner Image">
+                                                <?php endif; ?>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Upload Banner Image</label>
+                                                <input type="file" name="content[banner-logo]" accept="image/*" 
+                                                       class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                            </div>
+                                            <div class="space-y-4">
+                                                <div>
+                                                    <label class="block text-sm font-medium text-gray-700 mb-2">Title</label>
+                                                    <input type="text" name='content[banner-logo][title]' value="<?= htmlspecialchars($bannerLogo['title'] ?? '') ?>" 
+                                                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                                </div>
+                                                <div>
+                                                    <label class="block text-sm font-medium text-gray-700 mb-2">Alt Text</label>
+                                                    <input type="text" name='content[banner-logo][alt]' value="<?= htmlspecialchars($bannerLogo['alt'] ?? '') ?>" 
+                                                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                                </div>
+                                                <div class="grid grid-cols-2 gap-4">
+                                                    <div>
+                                                        <label class="block text-sm font-medium text-gray-700 mb-2">Width</label>
+                                                        <input type="text" name='content[banner-logo][width]' value="<?= htmlspecialchars($bannerLogo['width'] ?? '') ?>" 
+                                                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                                    </div>
+                                                    <div>
+                                                        <label class="block text-sm font-medium text-gray-700 mb-2">Height</label>
+                                                        <input type="text" name='content[banner-logo][height]' value="<?= htmlspecialchars($bannerLogo['height'] ?? '') ?>" 
+                                                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                    <!-- Footer Logo -->
+                                    <div class="bg-gray-50 p-4 rounded-lg mb-6">
+                                        <h4 class="text-md font-medium text-gray-800 mb-4">Footer Logo</h4>
+                                        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
+                                            <div>
+                                                <?php 
+                                                $footerLogo = [];
+                                                if (isset($content['footer-logo']) && !empty($content['footer-logo'])) {
+                                                    $footerLogo = json_decode($content['footer-logo'], true) ?: [];
+                                                }
+                                                ?>
+                                                <?php if (!empty($footerLogo['src'])): ?>
+                                                    <img class="w-24 h-24 object-cover rounded-lg border mb-2" src="../<?= $footerLogo['src'] ?>" alt="Footer Logo">
+                                                <?php endif; ?>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Upload Footer Logo</label>
+                                                <input type="file" name="content[footer-logo]" accept="image/*" 
+                                                       class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                            </div>
+                                            <div>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Title</label>
+                                                <input type="text" name='content[footer-logo][title]' value="<?= htmlspecialchars($footerLogo['title'] ?? '') ?>" 
+                                                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                            <div>
+                                                <label class="block text-sm font-medium text-gray-700 mb-2">Alt Text</label>
+                                                <input type="text" name='content[footer-logo][alt]' value="<?= htmlspecialchars($footerLogo['alt'] ?? '') ?>" 
+                                                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                    <!-- Other Images -->
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div class="bg-gray-50 p-4 rounded-lg">
+                                            <h4 class="text-md font-medium text-gray-800 mb-4">Favicon</h4>
+                                            <?php if (!empty($content['favicon'])): ?>
+                                                <img class="w-16 h-16 object-cover rounded border mb-2" src="../<?= $content['favicon'] ?>" alt="Favicon">
+                                            <?php endif; ?>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Upload Favicon</label>
+                                            <input type="file" name="content[favicon]" accept="image/*" 
+                                                   class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                        </div>
+
+                                        <div class="bg-gray-50 p-4 rounded-lg">
+                                            <h4 class="text-md font-medium text-gray-800 mb-4">Author Image</h4>
+                                            <?php if (!empty($content['author-img'])): ?>
+                                                <img class="w-16 h-16 object-cover rounded-full border mb-2" src="../<?= $content['author-img'] ?>" alt="Author Image">
+                                            <?php endif; ?>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Upload Author Image</label>
+                                            <input type="file" name="content[author-img]" accept="image/*" 
+                                                   class="w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Footer Settings -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Footer Content
+                                    </h3>
+                                    <div class="grid grid-cols-1 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Footer Text</label>
+                                            <textarea name='content[footer__text]' rows="4" 
+                                                      class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><?= htmlspecialchars($content['footer__text'] ?? '') ?></textarea>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Copyright</label>
+                                            <textarea name='content[copyright]' rows="2" 
+                                                      class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><?= htmlspecialchars($content['copyright'] ?? '') ?></textarea>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Save Button -->
+                                <div class="pt-6 border-t border-gray-200">
+                                    <button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Save Changes
+                                    </button>
+                                </div>
+                            </div>
+                        </div>
+
+                        <!-- Options Tab -->
+                        <div x-show="activeTab === 'options'" class="bg-white rounded-lg shadow-sm">
+                            <div class="p-6 space-y-8">
+                                
+                                <!-- Hash Fields Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M3 6a3 3 0 013-3h10a1 1 0 01.8 1.6L14.25 8l2.55 3.4A1 1 0 0116 13H6a1 1 0 00-1 1v3a1 1 0 11-2 0V6z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Hash Fields
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash</label>
+                                            <input type="text" name='content[hash]' value="<?= htmlspecialchars($content['hash'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash 1</label>
+                                            <input type="text" name='content[hash-1]' value="<?= htmlspecialchars($content['hash-1'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash 2</label>
+                                            <input type="text" name='content[hash-2]' value="<?= htmlspecialchars($content['hash-2'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash 3</label>
+                                            <input type="text" name='content[hash-3]' value="<?= htmlspecialchars($content['hash-3'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash 4</label>
+                                            <input type="text" name='content[hash-4]' value="<?= htmlspecialchars($content['hash-4'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Hash 5</label>
+                                            <input type="text" name='content[hash-5]' value="<?= htmlspecialchars($content['hash-5'] ?? '') ?>" 
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Save Button -->
+                                <div class="pt-6 border-t border-gray-200">
+                                    <button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Save Changes
+                                    </button>
+                                </div>
+                            </div>
+                        </div>
+
+                        <!-- Styles Tab -->
+                        <div x-show="activeTab === 'styles'" class="bg-white rounded-lg shadow-sm">
+                            <div class="p-6 space-y-8">
+                                
+                                <!-- Background Colors Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v11a3 3 0 106 0V4a2 2 0 00-2-2H4z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Background Colors
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Main Color (Body Background)</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['main_color'] ?? '#1a1a2e' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[main_color]' value="<?= htmlspecialchars($styles['main_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Secondary Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['secondary_color'] ?? '#16213e' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[secondary_color]' value="<?= htmlspecialchars($styles['secondary_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Header Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['header_color'] ?? '#2c2c54' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[header_color]' value="<?= htmlspecialchars($styles['header_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Footer Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['footer_color'] ?? '#0f0f23' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[footer_color]' value="<?= htmlspecialchars($styles['footer_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Accent & Text Colors Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
+                                        </svg>
+                                        Accent & Text Colors
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Accent Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['accent_color'] ?? '#e94560' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[accent_color]' value="<?= htmlspecialchars($styles['accent_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Font Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['font_color'] ?? '#ffffff' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[font_color]' value="<?= htmlspecialchars($styles['font_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Link Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['link_color'] ?? '#3498db' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[link_color]' value="<?= htmlspecialchars($styles['link_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Main Font Family</label>
+                                            <input type="text" name='styles[main-fz]' value="<?= htmlspecialchars($styles['main-fz'] ?? '') ?>" 
+                                                   placeholder="Arial, sans-serif"
+                                                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Button Colors Section -->
+                                <div>
+                                    <h3 class="text-lg font-medium text-gray-900 mb-6 flex items-center">
+                                        <svg class="w-5 h-5 mr-2 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Button Colors
+                                    </h3>
+                                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Login Button Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['login_btn_color'] ?? '#27ae60' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[login_btn_color]' value="<?= htmlspecialchars($styles['login_btn_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+
+                                        <div>
+                                            <label class="block text-sm font-medium text-gray-700 mb-2">Password Button Color</label>
+                                            <div class="flex gap-3">
+                                                <input type="color" value="<?= $styles['pass_btn_color'] ?? '#e74c3c' ?>" 
+                                                       class="w-12 h-10 rounded border border-gray-300 cursor-pointer"
+                                                       onchange="this.nextElementSibling.value = this.value">
+                                                <input type="text" name='styles[pass_btn_color]' value="<?= htmlspecialchars($styles['pass_btn_color'] ?? '') ?>" 
+                                                       class="flex-1 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <!-- Save Button -->
+                                <div class="pt-6 border-t border-gray-200">
+                                    <button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Save Changes
+                                    </button>
+                                </div>
+                            </div>
+                        </div>
+
+                        <!-- SEO Tab -->
+                        <div x-show="activeTab === 'seo'" class="bg-white rounded-lg shadow-sm">
+                            <div class="p-6">
+                                <div class="text-center py-12">
+                                    <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
+                                    </svg>
+                                    <h3 class="mt-2 text-sm font-medium text-gray-900">SEO Coming Soon</h3>
+                                    <p class="mt-1 text-sm text-gray-500">SEO settings will be implemented in the next update.</p>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+
+<?php
+$content = ob_get_clean();
+
+include __DIR__ . '/partials/layout.php';
+?>

+ 146 - 0
resources/view/admin/pages/form.php

@@ -0,0 +1,146 @@
+<?php 
+$pageTitle = ($action === 'create' ? 'Create New Page' : 'Edit Page') . ' - Admin Panel';
+$headerTitle = $action === 'create' ? 'Create New Page' : 'Edit Page';
+
+ob_start();
+?>
+
+<?php if (isset($success)): ?>
+    <div class="bg-green-50 border border-green-200 rounded-lg p-4 mb-6">
+        <div class="flex">
+            <svg class="w-5 h-5 text-green-400 mr-3 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
+                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+            </svg>
+            <p class="text-sm text-green-700"><?= htmlspecialchars($success) ?></p>
+        </div>
+    </div>
+<?php endif; ?>
+
+
+<?php if (isset($error)): ?>
+    <div class="bg-red-50 border border-red-200 rounded-lg p-4 mb-6">
+        <div class="flex">
+            <svg class="w-5 h-5 text-red-400 mr-3 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
+                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
+            </svg>
+            <p class="text-sm text-red-700"><?= htmlspecialchars($error) ?></p>
+        </div>
+    </div>
+<?php endif; ?>
+
+<div class="bg-white shadow rounded-lg">
+    <div class="px-6 py-4 border-b border-gray-200">
+        <h3 class="text-lg font-medium text-gray-900">
+            <?= $action === 'create' ? 'Create New Page' : 'Edit Page' ?>
+        </h3>
+    </div>
+
+    <div class="px-6 py-6">
+        <form method="POST" action="/admin/pages/">
+            <input type="hidden" name="action" value="<?= $action ?>">
+            <?php if ($action === 'edit'): ?>
+                <input type="hidden" name="id" value="<?= $page['id'] ?>">
+            <?php endif; ?>
+
+            <div class="space-y-6">
+                <!-- Basic Page Information -->
+                <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
+                    <div>
+                        <label for="name" class="block text-sm font-medium text-gray-700 mb-2">Page Name *</label>
+                        <input type="text" name="name" id="name" required
+                               value="<?= htmlspecialchars($page['name'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                    </div>
+
+                    <div>
+                        <label for="slug" class="block text-sm font-medium text-gray-700 mb-2">Slug</label>
+                        <input type="text" name="slug" id="slug" 
+                               value="<?= htmlspecialchars($page['slug'] ?? '') ?>" 
+                               placeholder="Auto-generated from name if empty"
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                        <p class="text-xs text-gray-500 mt-1">Leave empty to auto-generate from page name</p>
+                    </div>
+
+                    <div>
+                        <label for="layout" class="block text-sm font-medium text-gray-700 mb-2">Layout</label>
+                        <select name="layout" id="layout"
+                                class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                            <?php foreach ($layouts as $layoutValue => $layoutLabel): ?>
+                                <option value="<?= $layoutValue ?>" <?= ($page['layout'] ?? 'default') === $layoutValue ? 'selected' : '' ?>>
+                                    <?= htmlspecialchars($layoutLabel) ?>
+                                </option>
+                            <?php endforeach; ?>
+                        </select>
+                        
+                        <div class="flex items-center mt-3">
+                            <input type="hidden" name="is_homepage" value="0">
+                            <input type="checkbox" name="is_homepage" value="1" id="is_homepage" 
+                                   <?= !empty($page['is_homepage']) ? 'checked' : '' ?>
+                                   class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
+                            <label for="is_homepage" class="ml-2 block text-sm text-gray-900">Set as Homepage</label>
+                        </div>
+                    </div>
+                </div>
+
+                <?php if ($action === 'create'): ?>
+                    <!-- For new pages, show only basic info and a note -->
+                    <div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
+                        <div class="flex">
+                            <svg class="w-5 h-5 text-blue-400 mr-3 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
+                                <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
+                            </svg>
+                            <div>
+                                <h4 class="text-sm font-medium text-blue-800">Create Page First</h4>
+                                <p class="text-sm text-blue-700 mt-1">Save this page to access layout-specific content fields and advanced options.</p>
+                            </div>
+                        </div>
+                    </div>
+                <?php else: ?>
+                    <!-- For existing pages, show title field and layout-specific forms -->
+                    <div>
+                        <label for="title" class="block text-sm font-medium text-gray-700 mb-2">Page Title</label>
+                        <input type="text" name="title" id="title"
+                               value="<?= htmlspecialchars($page['title'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                    </div>
+
+                    <!-- Layout-Specific Forms (only for edit mode) -->
+                    <div>
+                        <?php 
+                        $currentLayout = $page['layout'] ?? 'default';
+                        $layoutFormPath = __DIR__ . "/layouts/{$currentLayout}.php";
+                        if (file_exists($layoutFormPath)) {
+                            include $layoutFormPath;
+                        } else {
+                            // Fallback to default form
+                            include __DIR__ . "/layouts/default.php";
+                        }
+                        ?>
+                    </div>
+                <?php endif; ?>
+
+                <div class="flex justify-between pt-6 border-t border-gray-200">
+                    <a href="/admin/pages/" class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                            <path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0L2.586 11H9a1 1 0 010 2H2.586l3.707 3.707a1 1 0 01-1.414 1.414l-5.414-5.414a1 1 0 010-1.414L4.879 6.879a1 1 0 011.414 1.414L2.586 11H9a1 1 0 010 2H2.586l3.707 3.707z" clip-rule="evenodd"/>
+                        </svg>
+                        Cancel
+                    </a>
+
+                    <button type="submit" class="inline-flex items-center px-6 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                            <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
+                        </svg>
+                        <?= $action === 'create' ? 'Create Page' : 'Update Page' ?>
+                    </button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+
+<?php
+$content = ob_get_clean();
+
+include __DIR__ . '/../partials/layout.php';
+?>

+ 34 - 0
resources/view/admin/pages/layouts/default.php

@@ -0,0 +1,34 @@
+<!-- Default Layout Form -->
+<div class="space-y-6">
+    <div>
+        <label for="content" class="block text-sm font-medium text-gray-700 mb-2">Page Content</label>
+        <textarea name="content" id="content" rows="10"
+                  class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                  placeholder="Enter your page content here..."><?= htmlspecialchars($page['content'] ?? '') ?></textarea>
+    </div>
+
+    <!-- Basic Extra Fields for Default Layout -->
+    <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+        <div>
+            <label for="meta_description" class="block text-sm font-medium text-gray-700 mb-2">Meta Description</label>
+            <textarea name="extra_fields[meta_description]" id="meta_description" rows="3"
+                      class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                      placeholder="Brief description for search engines..."><?= htmlspecialchars($page['extra_fields']['meta_description'] ?? '') ?></textarea>
+        </div>
+
+        <div>
+            <label for="meta_keywords" class="block text-sm font-medium text-gray-700 mb-2">Meta Keywords</label>
+            <input type="text" name="extra_fields[meta_keywords]" id="meta_keywords"
+                   value="<?= htmlspecialchars($page['extra_fields']['meta_keywords'] ?? '') ?>"
+                   class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                   placeholder="keyword1, keyword2, keyword3">
+        </div>
+    </div>
+
+    <div>
+        <label for="custom_css" class="block text-sm font-medium text-gray-700 mb-2">Custom CSS (Optional)</label>
+        <textarea name="extra_fields[custom_css]" id="custom_css" rows="4"
+                  class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm"
+                  placeholder=".custom-style { color: #333; }"><?= htmlspecialchars($page['extra_fields']['custom_css'] ?? '') ?></textarea>
+    </div>
+</div>

+ 92 - 0
resources/view/admin/pages/layouts/front_page.php

@@ -0,0 +1,92 @@
+<!-- Front Page Layout Form -->
+<div class="space-y-6">
+
+    <!-- Hero Section -->
+    <div class="bg-gray-50 rounded-lg p-4">
+        <h4 class="text-md font-medium text-gray-800 mb-4">Hero Section</h4>
+        <div class="space-y-4">
+            <div>
+                <label for="hero_title" class="block text-sm font-medium text-gray-700 mb-2">Hero Title</label>
+                <input type="text" name="extra_fields[hero_title]" id="hero_title"
+                       value="<?= htmlspecialchars($page['extra_fields']['hero_title'] ?? '') ?>"
+                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                       placeholder="Welcome to Our Amazing Site">
+            </div>
+
+            <div>
+                <label for="hero_subtitle" class="block text-sm font-medium text-gray-700 mb-2">Hero Subtitle</label>
+                <textarea name="extra_fields[hero_subtitle]" id="hero_subtitle" rows="2"
+                          class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                          placeholder="Discover amazing content and experiences..."><?= htmlspecialchars($page['extra_fields']['hero_subtitle'] ?? '') ?></textarea>
+            </div>
+
+            <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
+                <div>
+                    <label for="hero_button_text" class="block text-sm font-medium text-gray-700 mb-2">Hero Button Text</label>
+                    <input type="text" name="extra_fields[hero_button_text]" id="hero_button_text"
+                           value="<?= htmlspecialchars($page['extra_fields']['hero_button_text'] ?? '') ?>"
+                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                           placeholder="Get Started">
+                </div>
+
+                <div>
+                    <label for="hero_button_url" class="block text-sm font-medium text-gray-700 mb-2">Hero Button URL</label>
+                    <input type="text" name="extra_fields[hero_button_url]" id="hero_button_url"
+                           value="<?= htmlspecialchars($page['extra_fields']['hero_button_url'] ?? '') ?>"
+                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                           placeholder="/contact">
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <!-- Featured Sections -->
+    <div class="bg-gray-50 rounded-lg p-4">
+        <h4 class="text-md font-medium text-gray-800 mb-4">Featured Sections</h4>
+        <div class="space-y-4">
+            <div>
+                <label for="featured_title" class="block text-sm font-medium text-gray-700 mb-2">Featured Section Title</label>
+                <input type="text" name="extra_fields[featured_title]" id="featured_title"
+                       value="<?= htmlspecialchars($page['extra_fields']['featured_title'] ?? '') ?>"
+                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                       placeholder="Why Choose Us">
+            </div>
+
+            <div>
+                <label for="featured_content" class="block text-sm font-medium text-gray-700 mb-2">Featured Content</label>
+                <textarea name="extra_fields[featured_content]" id="featured_content" rows="6"
+                          class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                          placeholder="Describe your featured content..."><?= htmlspecialchars($page['extra_fields']['featured_content'] ?? '') ?></textarea>
+            </div>
+        </div>
+    </div>
+
+    <!-- Main Content -->
+    <div>
+        <label for="content" class="block text-sm font-medium text-gray-700 mb-2">Main Page Content</label>
+        <textarea name="content" id="content" rows="8"
+                  class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                  placeholder="Enter main content for the homepage..."><?= htmlspecialchars($page['content'] ?? '') ?></textarea>
+    </div>
+
+    <!-- SEO Settings for Homepage -->
+    <div class="bg-gray-50 rounded-lg p-4">
+        <h4 class="text-md font-medium text-gray-800 mb-4">SEO Settings</h4>
+        <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
+            <div>
+                <label for="meta_description" class="block text-sm font-medium text-gray-700 mb-2">Meta Description</label>
+                <textarea name="extra_fields[meta_description]" id="meta_description" rows="3"
+                          class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                          placeholder="Homepage description for search engines..."><?= htmlspecialchars($page['extra_fields']['meta_description'] ?? '') ?></textarea>
+            </div>
+
+            <div>
+                <label for="og_image" class="block text-sm font-medium text-gray-700 mb-2">Social Share Image URL</label>
+                <input type="text" name="extra_fields[og_image]" id="og_image"
+                       value="<?= htmlspecialchars($page['extra_fields']['og_image'] ?? '') ?>"
+                       class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                       placeholder="/uploads/homepage-share.jpg">
+            </div>
+        </div>
+    </div>
+</div>

+ 133 - 0
resources/view/admin/pages/list.php

@@ -0,0 +1,133 @@
+<?php 
+$pageTitle = 'Dynamic Pages - Admin Panel';
+$headerTitle = 'Dynamic Pages';
+
+ob_start();
+?>
+
+<?php if (isset($success)): ?>
+    <div class="bg-green-50 border border-green-200 rounded-lg p-4 mb-6">
+        <div class="flex">
+            <svg class="w-5 h-5 text-green-400 mr-3 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
+                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+            </svg>
+            <p class="text-sm text-green-700"><?= htmlspecialchars($success) ?></p>
+        </div>
+    </div>
+<?php endif; ?>
+
+<?php if (isset($error)): ?>
+    <div class="bg-red-50 border border-red-200 rounded-lg p-4 mb-6">
+        <div class="flex">
+            <svg class="w-5 h-5 text-red-400 mr-3 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
+                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
+            </svg>
+            <p class="text-sm text-red-700"><?= htmlspecialchars($error) ?></p>
+        </div>
+    </div>
+<?php endif; ?>
+
+<div class="bg-white shadow rounded-lg">
+    <div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
+        <h3 class="text-lg font-medium text-gray-900">Pages</h3>
+        <a href="/admin/pages/?action=create" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+            <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
+            </svg>
+            New Page
+        </a>
+    </div>
+
+    <?php if (!empty($pages)): ?>
+        <div class="overflow-x-auto">
+            <table class="min-w-full divide-y divide-gray-200">
+                <thead class="bg-gray-50">
+                    <tr>
+                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
+                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Slug</th>
+                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Layout</th>
+                        <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Homepage</th>
+                        <th scope="col" class="relative px-6 py-3"><span class="sr-only">Actions</span></th>
+                    </tr>
+                </thead>
+                <tbody class="bg-white divide-y divide-gray-200">
+                    <?php foreach ($pages as $page): ?>
+                        <tr class="hover:bg-gray-50">
+                            <td class="px-6 py-4 whitespace-nowrap">
+                                <div class="text-sm font-medium text-gray-900"><?= htmlspecialchars($page['name']) ?></div>
+                                <?php if (!empty($page['title'])): ?>
+                                    <div class="text-sm text-gray-500"><?= htmlspecialchars($page['title']) ?></div>
+                                <?php endif; ?>
+                            </td>
+                            <td class="px-6 py-4 whitespace-nowrap">
+                                <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
+                                    <?= htmlspecialchars($page['slug']) ?>
+                                </span>
+                            </td>
+                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
+                                <?= htmlspecialchars($layouts[$page['layout']] ?? $page['layout']) ?>
+                            </td>
+                            <td class="px-6 py-4 whitespace-nowrap">
+                                <?php if ($page['is_homepage']): ?>
+                                    <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
+                                        <svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Homepage
+                                    </span>
+                                <?php else: ?>
+                                    <span class="text-gray-400">-</span>
+                                <?php endif; ?>
+                            </td>
+                            <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
+                                <div class="flex justify-end space-x-2">
+                                    <a href="/admin/pages/?action=edit&id=<?= $page['id'] ?>" 
+                                       class="inline-flex items-center px-3 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                                        <svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
+                                            <path d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"/>
+                                        </svg>
+                                        Edit
+                                    </a>
+                                    <form method="POST" action="/admin/pages/" class="inline-block" onsubmit="return confirm('Are you sure you want to delete this page?')">
+                                        <input type="hidden" name="action" value="delete">
+                                        <input type="hidden" name="id" value="<?= $page['id'] ?>">
+                                        <button type="submit" 
+                                                class="inline-flex items-center px-3 py-1.5 border border-red-300 shadow-sm text-xs font-medium rounded text-red-700 bg-red-50 hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors">
+                                            <svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
+                                                <path fill-rule="evenodd" d="M9 2a1 1 0 000 2h2a1 1 0 100-2H9z" clip-rule="evenodd"/>
+                                                <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 012 0v4a1 1 0 11-2 0V7zm0 8a1 1 0 012 0v.01a1 1 0 11-2 0V15z" clip-rule="evenodd"/>
+                                            </svg>
+                                            Delete
+                                        </button>
+                                    </form>
+                                </div>
+                            </td>
+                        </tr>
+                    <?php endforeach; ?>
+                </tbody>
+            </table>
+        </div>
+    <?php else: ?>
+        <div class="text-center py-12">
+            <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
+            </svg>
+            <h3 class="mt-2 text-sm font-medium text-gray-900">No pages</h3>
+            <p class="mt-1 text-sm text-gray-500">Get started by creating a new page.</p>
+            <div class="mt-6">
+                <a href="/admin/pages/?action=create" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                    <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                        <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
+                    </svg>
+                    New Page
+                </a>
+            </div>
+        </div>
+    <?php endif; ?>
+</div>
+
+<?php
+$content = ob_get_clean();
+
+include __DIR__ . '/../partials/layout.php';
+?>

+ 17 - 0
resources/view/admin/partials/header.php

@@ -0,0 +1,17 @@
+<!-- Top bar -->
+<div class="bg-white shadow-sm border-b border-gray-200 flex-shrink-0">
+    <div class="px-4 sm:px-6 lg:px-8">
+        <div class="flex justify-between h-16">
+            <div class="flex items-center lg:hidden">
+                <button @click="sidebarOpen = true" class="text-gray-500 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500">
+                    <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
+                    </svg>
+                </button>
+            </div>
+            <div class="flex items-center">
+                <h1 class="text-2xl font-semibold text-gray-900"><?= $headerTitle ?? 'Admin Panel' ?></h1>
+            </div>
+        </div>
+    </div>
+</div>

+ 44 - 0
resources/view/admin/partials/layout.php

@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title><?= $pageTitle ?? 'Admin Panel' ?></title>
+    <script defer src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.15.0/cdn.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2/tinymce.min.js"></script>
+    <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
+</head>
+
+<body class="bg-gray-50 font-sans">
+    <div x-data="{ sidebarOpen: false, activeTab: '<?= $activeTab ?? 'content' ?>' }" class="flex h-screen">
+        <?php include __DIR__ . '/sidebar.php'; ?>
+
+        <!-- Mobile sidebar overlay -->
+        <div x-show="sidebarOpen" 
+             @click="sidebarOpen = false" 
+             class="fixed inset-0 z-40 bg-gray-600 bg-opacity-75 lg:hidden"
+             x-transition:enter="transition-opacity ease-linear duration-300"
+             x-transition:enter-start="opacity-0"
+             x-transition:enter-end="opacity-100"
+             x-transition:leave="transition-opacity ease-linear duration-300"
+             x-transition:leave-start="opacity-100"
+             x-transition:leave-end="opacity-0"></div>
+
+        <!-- Main content -->
+        <div class="flex-1 overflow-hidden flex flex-col">
+            <?php include __DIR__ . '/header.php'; ?>
+            
+            <!-- Page content -->
+            <main class="flex-1 overflow-y-auto">
+                <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
+                    <?= $content ?>
+                </div>
+            </main>
+        </div>
+    </div>
+
+    <script src='/js/admin/scripts.js'></script>
+</body>
+
+</html>

+ 28 - 0
resources/view/admin/partials/sidebar.php

@@ -0,0 +1,28 @@
+<!-- Sidebar -->
+<div :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'" 
+     class="fixed inset-y-0 left-0 z-50 w-64 bg-white shadow-xl transform transition-transform duration-300 ease-in-out lg:translate-x-0 lg:static lg:inset-0">
+    <div class="flex items-center justify-center h-16 bg-gradient-to-r from-blue-600 to-blue-700">
+        <h1 class="text-xl font-bold text-white">Admin Panel</h1>
+    </div>
+    <nav class="mt-6">
+        <div class="px-4 space-y-1">
+<?php
+$currentUri = $_SERVER['REQUEST_URI'];
+$isIndex = (strpos($currentUri, '/admin/pages/') === false && strpos($currentUri, '/admin/') !== false);
+$isPages = (strpos($currentUri, '/admin/pages/') !== false);
+?>
+            <a href="/admin/" class="<?= $isIndex ? 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-blue-700 bg-blue-50 border-r-4 border-blue-700' : 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition-colors' ?>">
+                <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
+                    <path d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z"/>
+                </svg>
+                Site Settings
+            </a>
+            <a href="/admin/pages/" class="<?= $isPages ? 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-blue-700 bg-blue-50 border-r-4 border-blue-700' : 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition-colors' ?>">
+                <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
+                    <path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z" clip-rule="evenodd"/>
+                </svg>
+                Dynamic Pages
+            </a>
+        </div>
+    </nav>
+</div>

+ 19 - 0
resources/view/admin/partials/tabs.php

@@ -0,0 +1,19 @@
+<!-- Tabs Navigation -->
+<div class="bg-white rounded-lg shadow-sm mb-6">
+    <div class="border-b border-gray-200">
+        <nav class="-mb-px flex space-x-8 px-6">
+            <?php if (isset($tabs) && is_array($tabs)): ?>
+                <?php foreach ($tabs as $tabKey => $tab): ?>
+                    <button @click="activeTab = '<?= $tabKey ?>'" 
+                            :class="activeTab === '<?= $tabKey ?>' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                            class="py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors">
+                        <svg class="w-5 h-5 inline mr-2" fill="currentColor" viewBox="0 0 20 20">
+                            <path d="<?= $tab['icon'] ?? '' ?>"/>
+                        </svg>
+                        <?= $tab['label'] ?>
+                    </button>
+                <?php endforeach; ?>
+            <?php endif; ?>
+        </nav>
+    </div>
+</div>

+ 18 - 2
src/Enums/PageLayout.php

@@ -37,8 +37,24 @@ enum PageLayout: string
     public function formClass(): string
     {
         return match($this) {
-            self::Default => '',
-            self::FrontPage => '',
+            self::Default => 'default',
+            self::FrontPage => 'front_page',
+        };
+    }
+
+    public function formPath(): string
+    {
+        return match($this) {
+            self::Default => 'layouts/default.php',
+            self::FrontPage => 'layouts/front_page.php',
+        };
+    }
+
+    public function description(): string
+    {
+        return match($this) {
+            self::Default => 'Basic page layout with standard content structure',
+            self::FrontPage => 'Homepage layout with hero section and featured content',
         };
     }
 

+ 2 - 1
src/Models/Page.php

@@ -41,7 +41,8 @@ class Page
             $data['is_homepage'] ?? 0
         ];
         
-        return $this->db->execute($sql, $params);
+        $this->db->execute($sql, $params);
+        return $this->db->lastInsertId();
     }
     
     public function update($id, $data)

+ 1 - 1
src/Pages/admin/index.php

@@ -127,7 +127,7 @@ if (isset($content['casino_list']) && !empty($content['casino_list'])) {
     $casinoItems = [];
 }
 
-return ViewRender('admin/index.php', [
+return ViewRender('admin/index_new.php', [
     'content' => $content,
     'styles' => $styles,
     'seo' => settings('seo')->getAll(),

+ 154 - 0
src/Pages/admin/pages.php

@@ -0,0 +1,154 @@
+<?php
+
+use App\Models\Page;
+use App\Enums\PageLayout;
+
+$pageModel = new Page();
+$action = $_GET['action'] ?? 'list';
+$id = $_GET['id'] ?? null;
+
+// Handle form submissions
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+    $data = $_POST;
+    
+    // Debug: check what data we received
+    error_log('POST data received: ' . print_r($_POST, true));
+    error_log('Current action: ' . $action);
+    error_log('Form action: ' . ($data['action'] ?? 'not set'));
+    
+    // Generate slug from name if not provided
+    if (empty($data['slug']) && !empty($data['name'])) {
+        $data['slug'] = getSlug($data['name']);
+    }
+    
+    // Validate layout
+    if (!empty($data['layout']) && !PageLayout::isValid($data['layout'])) {
+        $data['layout'] = PageLayout::Default->value;
+    }
+    
+    // Handle extra_fields - can be array or JSON string
+    if (isset($data['extra_fields'])) {
+        if (is_array($data['extra_fields'])) {
+            // Form data comes as array, keep as array for JSON encoding
+            $data['extra_fields'] = $data['extra_fields'];
+        } elseif (is_string($data['extra_fields']) && !empty($data['extra_fields'])) {
+            // Manual JSON input, decode and re-encode to validate
+            $decoded = json_decode($data['extra_fields'], true);
+            $data['extra_fields'] = is_array($decoded) ? $decoded : [];
+        } else {
+            $data['extra_fields'] = [];
+        }
+    } else {
+        $data['extra_fields'] = [];
+    }
+    
+    // Get action from form data
+    $formAction = $data['action'] ?? $action;
+    
+    try {
+        switch ($formAction) {
+            case 'create':
+                // Check if slug already exists
+                if ($pageModel->exists($data['slug'])) {
+                    $error = "Page with this slug already exists!";
+                } else {
+                    $newPageId = $pageModel->create($data);
+                    if ($newPageId) {
+                        $success = "Page created successfully! Redirecting to edit...";
+                        error_log("Page created with ID: $newPageId");
+                        // Redirect to edit the newly created page
+                        header("Location: /admin/pages/?action=edit&id=" . $newPageId);
+                        exit;
+                    } else {
+                        $error = "Failed to create page. Please check the database connection.";
+                        error_log("Failed to create page, no ID returned");
+                    }
+                }
+                break;
+                
+            case 'edit':
+                if ($id) {
+                    // Check if slug exists (excluding current page)
+                    if ($pageModel->exists($data['slug'], $id)) {
+                        $error = "Another page with this slug already exists!";
+                    } else {
+                        $pageModel->update($id, $data);
+                        $success = "Page updated successfully!";
+                        $action = 'list'; // Redirect to list
+                    }
+                }
+                break;
+                
+            case 'delete':
+                if ($id) {
+                    $pageModel->delete($id);
+                    $success = "Page deleted successfully!";
+                    $action = 'list'; // Redirect to list
+                }
+                break;
+        }
+    } catch (Exception $e) {
+        $error = "Error: " . $e->getMessage();
+    }
+}
+
+// Get data for different actions
+switch ($action) {
+    case 'create':
+    case 'new':
+        $page = [
+            'name' => '',
+            'slug' => '',
+            'title' => '',
+            'content' => '',
+            'extra_fields' => [],
+            'layout' => PageLayout::Default->value,
+            'is_homepage' => 0
+        ];
+        $action = 'create';
+        break;
+        
+    case 'edit':
+        if ($id) {
+            $page = $pageModel->getById($id);
+            if (!$page) {
+                $error = "Page not found!";
+                $action = 'list';
+            } else {
+                // Decode extra_fields JSON
+                if (!empty($page['extra_fields'])) {
+                    $page['extra_fields'] = json_decode($page['extra_fields'], true) ?: [];
+                } else {
+                    $page['extra_fields'] = [];
+                }
+            }
+        } else {
+            $action = 'list';
+        }
+        break;
+        
+    case 'list':
+    default:
+        $pages = $pageModel->getAll();
+        $action = 'list';
+        break;
+}
+
+// Get available layouts
+$layouts = PageLayout::selectOptions();
+
+// Determine which template to use
+$template = match($action) {
+    'list' => 'admin/pages/list.php',
+    'create', 'edit' => 'admin/pages/form.php',
+    default => 'admin/pages/list.php'
+};
+
+return ViewRender($template, [
+    'action' => $action,
+    'pages' => $pages ?? [],
+    'page' => $page ?? null,
+    'layouts' => $layouts,
+    'success' => $success ?? null,
+    'error' => $error ?? null
+]);