Spaces:
Running
Running
make the backend php - Follow Up Deployment
Browse files- auth.php +31 -0
- backend.html +301 -0
- config.php +26 -0
- customers.php +26 -0
- index.html +310 -18
- orders.php +89 -0
- products.php +83 -0
- prompts.txt +8 -0
- reports.php +45 -0
- schema.sql +94 -0
auth.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
require_once 'config.php';
|
| 4 |
+
|
| 5 |
+
use Firebase\JWT\JWT;
|
| 6 |
+
|
| 7 |
+
// Handle admin login
|
| 8 |
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
| 9 |
+
$data = json_decode(file_get_contents("php://input"));
|
| 10 |
+
|
| 11 |
+
// Validate admin credentials
|
| 12 |
+
if($data->username === 'admin' && $data->password === 'admin123') {
|
| 13 |
+
$token = array(
|
| 14 |
+
"iss" => "cebelarstvo_cigoj",
|
| 15 |
+
"iat" => time(),
|
| 16 |
+
"exp" => time() + (60 * 60),
|
| 17 |
+
"data" => array(
|
| 18 |
+
"username" => "admin",
|
| 19 |
+
"role" => "admin"
|
| 20 |
+
)
|
| 21 |
+
);
|
| 22 |
+
|
| 23 |
+
$jwt = JWT::encode($token, JWT_SECRET);
|
| 24 |
+
echo json_encode(array("success" => true, "token" => $jwt));
|
| 25 |
+
} else {
|
| 26 |
+
http_response_code(401);
|
| 27 |
+
echo json_encode(array("success" => false, "message" => "Invalid credentials"));
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
?>
|
| 31 |
+
```
|
backend.html
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="sl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Administracija | Čebelarstvo Cigoj</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
<style>
|
| 10 |
+
.sidebar {
|
| 11 |
+
transition: all 0.3s;
|
| 12 |
+
}
|
| 13 |
+
.sidebar-link:hover {
|
| 14 |
+
background-color: rgba(251, 191, 36, 0.1);
|
| 15 |
+
}
|
| 16 |
+
.dashboard-card {
|
| 17 |
+
transition: transform 0.2s;
|
| 18 |
+
}
|
| 19 |
+
.dashboard-card:hover {
|
| 20 |
+
transform: translateY(-2px);
|
| 21 |
+
}
|
| 22 |
+
</style>
|
| 23 |
+
</head>
|
| 24 |
+
<body class="bg-gray-100 font-sans">
|
| 25 |
+
<!-- Admin Layout -->
|
| 26 |
+
<div class="flex h-screen">
|
| 27 |
+
<!-- Sidebar -->
|
| 28 |
+
<div class="sidebar bg-amber-800 text-white w-64 flex-shrink-0">
|
| 29 |
+
<div class="p-4 border-b border-amber-700">
|
| 30 |
+
<h1 class="text-xl font-bold flex items-center">
|
| 31 |
+
<i data-feather="hexagon" class="mr-2"></i>
|
| 32 |
+
Čebelarstvo Cigoj
|
| 33 |
+
</h1>
|
| 34 |
+
<p class="text-xs text-amber-200 mt-1">Administracija</p>
|
| 35 |
+
</div>
|
| 36 |
+
<nav class="p-4">
|
| 37 |
+
<ul class="space-y-2">
|
| 38 |
+
<li>
|
| 39 |
+
<a href="#" class="sidebar-link flex items-center px-3 py-2 rounded-lg bg-amber-700 text-white">
|
| 40 |
+
<i data-feather="home" class="mr-3"></i>
|
| 41 |
+
Nadzorna plošča
|
| 42 |
+
</a>
|
| 43 |
+
</li>
|
| 44 |
+
<li>
|
| 45 |
+
<a href="products.php" class="sidebar-link flex items-center px-3 py-2 rounded-lg text-amber-200 hover:text-white">
|
| 46 |
+
<i data-feather="shopping-bag" class="mr-3"></i>
|
| 47 |
+
Izdelki
|
| 48 |
+
</a>
|
| 49 |
+
</li>
|
| 50 |
+
<li>
|
| 51 |
+
<a href="orders.php" class="sidebar-link flex items-center px-3 py-2 rounded-lg text-amber-200 hover:text-white">
|
| 52 |
+
<i data-feather="file-text" class="mr-3"></i>
|
| 53 |
+
Naročila
|
| 54 |
+
</a>
|
| 55 |
+
</li>
|
| 56 |
+
<li>
|
| 57 |
+
<a href="customers.php" class="sidebar-link flex items-center px-3 py-2 rounded-lg text-amber-200 hover:text-white">
|
| 58 |
+
<i data-feather="users" class="mr-3"></i>
|
| 59 |
+
Stranke
|
| 60 |
+
</a>
|
| 61 |
+
</li>
|
| 62 |
+
<li>
|
| 63 |
+
<a href="reports.php" class="sidebar-link flex items-center px-3 py-2 rounded-lg text-amber-200 hover:text-white">
|
| 64 |
+
<i data-feather="bar-chart-2" class="mr-3"></i>
|
| 65 |
+
Poročila
|
| 66 |
+
</a>
|
| 67 |
+
</li>
|
| 68 |
+
<li>
|
| 69 |
+
<a href="settings.php" class="sidebar-link flex items-center px-3 py-2 rounded-lg text-amber-200 hover:text-white">
|
| 70 |
+
<i data-feather="settings" class="mr-3"></i>
|
| 71 |
+
Nastavitve
|
| 72 |
+
</a>
|
| 73 |
+
</li>
|
| 74 |
+
</ul>
|
| 75 |
+
</nav>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<!-- Main Content -->
|
| 79 |
+
<div class="flex-1 overflow-auto">
|
| 80 |
+
<!-- Top Navigation -->
|
| 81 |
+
<header class="bg-white shadow-sm">
|
| 82 |
+
<div class="flex justify-between items-center p-4">
|
| 83 |
+
<div class="flex items-center">
|
| 84 |
+
<button class="p-2 rounded-full hover:bg-gray-100 mr-2">
|
| 85 |
+
<i data-feather="menu"></i>
|
| 86 |
+
</button>
|
| 87 |
+
<h2 class="text-lg font-semibold">Nadzorna plošča</h2>
|
| 88 |
+
</div>
|
| 89 |
+
<div class="flex items-center space-x-4">
|
| 90 |
+
<button class="p-2 rounded-full hover:bg-gray-100 relative">
|
| 91 |
+
<i data-feather="bell"></i>
|
| 92 |
+
<span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
|
| 93 |
+
</button>
|
| 94 |
+
<div class="flex items-center">
|
| 95 |
+
<div class="w-8 h-8 rounded-full bg-amber-200 flex items-center justify-center mr-2">
|
| 96 |
+
<i data-feather="user"></i>
|
| 97 |
+
</div>
|
| 98 |
+
<span class="text-sm">Admin</span>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</header>
|
| 103 |
+
|
| 104 |
+
<!-- Dashboard Content -->
|
| 105 |
+
<main class="p-6">
|
| 106 |
+
<!-- Stats Cards -->
|
| 107 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
| 108 |
+
<div class="dashboard-card bg-white rounded-lg shadow p-6">
|
| 109 |
+
<div class="flex justify-between items-start">
|
| 110 |
+
<div>
|
| 111 |
+
<p class="text-gray-500 text-sm">Skupni prihodek</p>
|
| 112 |
+
<h3 class="text-2xl font-bold mt-1">1.245,60€</h3>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="p-3 rounded-full bg-green-100 text-green-600">
|
| 115 |
+
<i data-feather="dollar-sign"></i>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
<p class="text-green-600 text-sm mt-2 flex items-center">
|
| 119 |
+
<i data-feather="trending-up" class="mr-1"></i> 12% v primerjavi z prejšnjim mesecem
|
| 120 |
+
</p>
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
<div class="dashboard-card bg-white rounded-lg shadow p-6">
|
| 124 |
+
<div class="flex justify-between items-start">
|
| 125 |
+
<div>
|
| 126 |
+
<p class="text-gray-500 text-sm">Naročila</p>
|
| 127 |
+
<h3 class="text-2xl font-bold mt-1">24</h3>
|
| 128 |
+
</div>
|
| 129 |
+
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
|
| 130 |
+
<i data-feather="shopping-cart"></i>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
<p class="text-blue-600 text-sm mt-2 flex items-center">
|
| 134 |
+
<i data-feather="trending-up" class="mr-1"></i> 3 nova danes
|
| 135 |
+
</p>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<div class="dashboard-card bg-white rounded-lg shadow p-6">
|
| 139 |
+
<div class="flex justify-between items-start">
|
| 140 |
+
<div>
|
| 141 |
+
<p class="text-gray-500 text-sm">Izdelki</p>
|
| 142 |
+
<h3 class="text-2xl font-bold mt-1">15</h3>
|
| 143 |
+
</div>
|
| 144 |
+
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
|
| 145 |
+
<i data-feather="package"></i>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
<p class="text-purple-600 text-sm mt-2 flex items-center">
|
| 149 |
+
<i data-feather="alert-circle" class="mr-1"></i> 3 izdelkov na zalogi
|
| 150 |
+
</p>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<div class="dashboard-card bg-white rounded-lg shadow p-6">
|
| 154 |
+
<div class="flex justify-between items-start">
|
| 155 |
+
<div>
|
| 156 |
+
<p class="text-gray-500 text-sm">Stranke</p>
|
| 157 |
+
<h3 class="text-2xl font-bold mt-1">42</h3>
|
| 158 |
+
</div>
|
| 159 |
+
<div class="p-3 rounded-full bg-amber-100 text-amber-600">
|
| 160 |
+
<i data-feather="users"></i>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
<p class="text-amber-600 text-sm mt-2 flex items-center">
|
| 164 |
+
<i data-feather="trending-up" class="mr-1"></i> 2 novi ta teden
|
| 165 |
+
</p>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
|
| 169 |
+
<!-- Recent Orders -->
|
| 170 |
+
<div class="bg-white rounded-lg shadow overflow-hidden mb-8">
|
| 171 |
+
<div class="p-4 border-b flex justify-between items-center">
|
| 172 |
+
<h3 class="font-semibold">Zadnja naročila</h3>
|
| 173 |
+
<a href="#" class="text-sm text-amber-600 hover:text-amber-800">Prikaži vse</a>
|
| 174 |
+
</div>
|
| 175 |
+
<div class="overflow-x-auto">
|
| 176 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 177 |
+
<thead class="bg-gray-50">
|
| 178 |
+
<tr>
|
| 179 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Št. naročila</th>
|
| 180 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Kupec</th>
|
| 181 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
| 182 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Znesek</th>
|
| 183 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Datum</th>
|
| 184 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
|
| 185 |
+
</tr>
|
| 186 |
+
</thead>
|
| 187 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 188 |
+
<tr>
|
| 189 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#1001</td>
|
| 190 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Janez Novak</td>
|
| 191 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 192 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Plačano</span>
|
| 193 |
+
</td>
|
| 194 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">24,50€</td>
|
| 195 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-15</td>
|
| 196 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 197 |
+
<a href="#" class="text-amber-600 hover:text-amber-900">Ogled</a>
|
| 198 |
+
</td>
|
| 199 |
+
</tr>
|
| 200 |
+
<tr>
|
| 201 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#1000</td>
|
| 202 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Ana Kovač</td>
|
| 203 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 204 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Čaka na plačilo</span>
|
| 205 |
+
</td>
|
| 206 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">32,00€</td>
|
| 207 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-14</td>
|
| 208 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 209 |
+
<a href="#" class="text-amber-600 hover:text-amber-900">Ogled</a>
|
| 210 |
+
</td>
|
| 211 |
+
</tr>
|
| 212 |
+
<tr>
|
| 213 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#999</td>
|
| 214 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Marko Žagar</td>
|
| 215 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 216 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Poslano</span>
|
| 217 |
+
</td>
|
| 218 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15,50€</td>
|
| 219 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-12</td>
|
| 220 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 221 |
+
<a href="#" class="text-amber-600 hover:text-amber-900">Ogled</a>
|
| 222 |
+
</td>
|
| 223 |
+
</tr>
|
| 224 |
+
</tbody>
|
| 225 |
+
</table>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
<!-- Low Stock Products -->
|
| 230 |
+
<div class="bg-white rounded-lg shadow overflow-hidden">
|
| 231 |
+
<div class="p-4 border-b flex justify-between items-center">
|
| 232 |
+
<h3 class="font-semibold">Izdelki z nizko zalogo</h3>
|
| 233 |
+
<a href="#" class="text-sm text-amber-600 hover:text-amber-800">Prikaži vse</a>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="overflow-x-auto">
|
| 236 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 237 |
+
<thead class="bg-gray-50">
|
| 238 |
+
<tr>
|
| 239 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Izdelek</th>
|
| 240 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
|
| 241 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Zaloga</th>
|
| 242 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
| 243 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
|
| 244 |
+
</tr>
|
| 245 |
+
</thead>
|
| 246 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 247 |
+
<tr>
|
| 248 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 249 |
+
<div class="flex items-center">
|
| 250 |
+
<div class="flex-shrink-0 h-10 w-10">
|
| 251 |
+
<img class="h-10 w-10 rounded" src="https://static.photos/nature/200x200/101" alt="">
|
| 252 |
+
</div>
|
| 253 |
+
<div class="ml-4">
|
| 254 |
+
<div class="text-sm font-medium text-gray-900">Cvetni prah 50g</div>
|
| 255 |
+
<div class="text-sm text-gray-500">4,50€</div>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</td>
|
| 259 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">PRD-001</td>
|
| 260 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">3</td>
|
| 261 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 262 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Nizka zaloga</span>
|
| 263 |
+
</td>
|
| 264 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 265 |
+
<a href="#" class="text-amber-600 hover:text-amber-900">Uredi</a>
|
| 266 |
+
</td>
|
| 267 |
+
</tr>
|
| 268 |
+
<tr>
|
| 269 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 270 |
+
<div class="flex items-center">
|
| 271 |
+
<div class="flex-shrink-0 h-10 w-10">
|
| 272 |
+
<img class="h-10 w-10 rounded" src="https://static.photos/nature/200x200/102" alt="">
|
| 273 |
+
</div>
|
| 274 |
+
<div class="ml-4">
|
| 275 |
+
<div class="text-sm font-medium text-gray-900">Balzam za ustnice</div>
|
| 276 |
+
<div class="text-sm text-gray-500">2,50€</div>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
</td>
|
| 280 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">PRD-005</td>
|
| 281 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5</td>
|
| 282 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 283 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Opozorilo</span>
|
| 284 |
+
</td>
|
| 285 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 286 |
+
<a href="#" class="text-amber-600 hover:text-amber-900">Uredi</a>
|
| 287 |
+
</td>
|
| 288 |
+
</tr>
|
| 289 |
+
</tbody>
|
| 290 |
+
</table>
|
| 291 |
+
</div>
|
| 292 |
+
</div>
|
| 293 |
+
</main>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<script>
|
| 298 |
+
feather.replace();
|
| 299 |
+
</script>
|
| 300 |
+
</body>
|
| 301 |
+
</html>
|
config.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
// Database configuration
|
| 4 |
+
define('DB_HOST', 'localhost');
|
| 5 |
+
define('DB_USER', 'root');
|
| 6 |
+
define('DB_PASS', '');
|
| 7 |
+
define('DB_NAME', 'cebelarstvo_cigoj');
|
| 8 |
+
|
| 9 |
+
// Establish database connection
|
| 10 |
+
try {
|
| 11 |
+
$pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASS);
|
| 12 |
+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
| 13 |
+
} catch(PDOException $e) {
|
| 14 |
+
die("ERROR: Could not connect. " . $e->getMessage());
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
// Set headers for API
|
| 18 |
+
header("Content-Type: application/json; charset=UTF-8");
|
| 19 |
+
header("Access-Control-Allow-Origin: *");
|
| 20 |
+
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE");
|
| 21 |
+
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
|
| 22 |
+
|
| 23 |
+
// JWT Secret key
|
| 24 |
+
define('JWT_SECRET', 'your_secret_key_here');
|
| 25 |
+
?>
|
| 26 |
+
```
|
customers.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
require_once 'config.php';
|
| 4 |
+
|
| 5 |
+
// JWT verification middleware
|
| 6 |
+
verifyToken();
|
| 7 |
+
|
| 8 |
+
// GET all customers
|
| 9 |
+
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
| 10 |
+
$stmt = $pdo->query("SELECT * FROM customers");
|
| 11 |
+
$customers = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 12 |
+
echo json_encode($customers);
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
// GET customer orders
|
| 16 |
+
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['customer_id'])) {
|
| 17 |
+
$customer_id = $_GET['customer_id'];
|
| 18 |
+
|
| 19 |
+
$stmt = $pdo->prepare("SELECT * FROM orders WHERE customer_email = (SELECT email FROM customers WHERE id = ?)");
|
| 20 |
+
$stmt->execute([$customer_id]);
|
| 21 |
+
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 22 |
+
|
| 23 |
+
echo json_encode($orders);
|
| 24 |
+
}
|
| 25 |
+
?>
|
| 26 |
+
```
|
index.html
CHANGED
|
@@ -1,19 +1,311 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="sl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Premium Naravni Med in Čebelarski Izdelki | Čebelarstvo Cigoj</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
|
| 9 |
+
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
<style>
|
| 13 |
+
.hero-gradient {
|
| 14 |
+
background: linear-gradient(135deg, #f9f3e6 0%, #f5e5c8 100%);
|
| 15 |
+
}
|
| 16 |
+
.product-card:hover {
|
| 17 |
+
transform: translateY(-5px);
|
| 18 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
| 19 |
+
}
|
| 20 |
+
.sale-badge {
|
| 21 |
+
position: absolute;
|
| 22 |
+
top: 10px;
|
| 23 |
+
right: 10px;
|
| 24 |
+
}
|
| 25 |
+
</style>
|
| 26 |
+
</head>
|
| 27 |
+
<body class="font-sans bg-gray-50">
|
| 28 |
+
<!-- Header -->
|
| 29 |
+
<header class="bg-amber-800 text-white shadow-md">
|
| 30 |
+
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
|
| 31 |
+
<div class="flex items-center space-x-2">
|
| 32 |
+
<i data-feather="hexagon" class="text-amber-300"></i>
|
| 33 |
+
<h1 class="text-xl font-bold">Čebelarstvo Cigoj</h1>
|
| 34 |
+
</div>
|
| 35 |
+
<nav class="hidden md:flex space-x-6">
|
| 36 |
+
<a href="#" class="hover:text-amber-200 transition">Domov</a>
|
| 37 |
+
<a href="#" class="hover:text-amber-200 transition">Izdelki</a>
|
| 38 |
+
<a href="#" class="hover:text-amber-200 transition">O nas</a>
|
| 39 |
+
<a href="#" class="hover:text-amber-200 transition">Kontakt</a>
|
| 40 |
+
</nav>
|
| 41 |
+
<div class="flex items-center space-x-4">
|
| 42 |
+
<button class="p-2 rounded-full hover:bg-amber-700 transition">
|
| 43 |
+
<i data-feather="shopping-cart"></i>
|
| 44 |
+
</button>
|
| 45 |
+
<button class="md:hidden p-2 rounded-full hover:bg-amber-700 transition">
|
| 46 |
+
<i data-feather="menu"></i>
|
| 47 |
+
</button>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</header>
|
| 51 |
+
|
| 52 |
+
<!-- Hero Banner -->
|
| 53 |
+
<section class="hero-gradient py-16">
|
| 54 |
+
<div class="container mx-auto px-4 flex flex-col md:flex-row items-center">
|
| 55 |
+
<div class="md:w-1/2 mb-8 md:mb-0" data-aos="fade-right">
|
| 56 |
+
<h2 class="text-3xl md:text-4xl font-bold text-amber-900 mb-4">Naravni cvetni prahovi</h2>
|
| 57 |
+
<p class="text-lg text-amber-800 mb-6">Izjemna superhrana direktno iz narave, bogata z vitamini in minerali.</p>
|
| 58 |
+
<p class="text-2xl font-bold text-amber-700 mb-6">Že od 5€</p>
|
| 59 |
+
<a href="#" class="bg-amber-600 hover:bg-amber-700 text-white px-6 py-3 rounded-lg font-medium inline-flex items-center transition">
|
| 60 |
+
Oglejte si ponudbo <i data-feather="arrow-right" class="ml-2"></i>
|
| 61 |
+
</a>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="md:w-1/2" data-aos="fade-left">
|
| 64 |
+
<img src="https://static.photos/nature/640x360/42" alt="Cvetni prah" class="rounded-lg shadow-xl w-full">
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</section>
|
| 68 |
+
|
| 69 |
+
<!-- Featured Products -->
|
| 70 |
+
<section class="py-16 bg-white">
|
| 71 |
+
<div class="container mx-auto px-4">
|
| 72 |
+
<h2 class="text-3xl font-bold text-center text-amber-900 mb-12" data-aos="fade-up">Priljubljeni izdelki</h2>
|
| 73 |
+
|
| 74 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8">
|
| 75 |
+
<!-- Product 1 -->
|
| 76 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="100">
|
| 77 |
+
<div class="sale-badge bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">
|
| 78 |
+
RAZPRODAJA!
|
| 79 |
+
</div>
|
| 80 |
+
<img src="https://static.photos/nature/320x240/101" alt="Cvetni prah 50g" class="w-full h-48 object-cover">
|
| 81 |
+
<div class="p-4">
|
| 82 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Cvetni prah 50g</h3>
|
| 83 |
+
<p class="text-amber-700 font-bold text-xl mb-3">4,50€</p>
|
| 84 |
+
<div class="flex justify-between">
|
| 85 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 86 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 87 |
+
</button>
|
| 88 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 89 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 90 |
+
</button>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<!-- Product 2 -->
|
| 96 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="200">
|
| 97 |
+
<img src="https://static.photos/nature/320x240/102" alt="Balzam za ustnice" class="w-full h-48 object-cover">
|
| 98 |
+
<div class="p-4">
|
| 99 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Balzam za ustnice iz čebeljega voska</h3>
|
| 100 |
+
<p class="text-amber-700 font-bold text-xl mb-3">2,50€</p>
|
| 101 |
+
<div class="flex justify-between">
|
| 102 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 103 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 104 |
+
</button>
|
| 105 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 106 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 107 |
+
</button>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<!-- Product 3 -->
|
| 113 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="300">
|
| 114 |
+
<div class="sale-badge bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">
|
| 115 |
+
RAZPRODAJA!
|
| 116 |
+
</div>
|
| 117 |
+
<img src="https://static.photos/nature/320x240/103" alt="Cvetni prah 100g" class="w-full h-48 object-cover">
|
| 118 |
+
<div class="p-4">
|
| 119 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Cvetni prah 100g</h3>
|
| 120 |
+
<p class="text-amber-700 font-bold text-xl mb-3">7,00€</p>
|
| 121 |
+
<div class="flex justify-between">
|
| 122 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 123 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 124 |
+
</button>
|
| 125 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 126 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 127 |
+
</button>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<!-- Product 4 -->
|
| 133 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="400">
|
| 134 |
+
<div class="sale-badge bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">
|
| 135 |
+
RAZPRODAJA!
|
| 136 |
+
</div>
|
| 137 |
+
<img src="https://static.photos/nature/320x240/104" alt="Balzam za ustnice" class="w-full h-48 object-cover">
|
| 138 |
+
<div class="p-4">
|
| 139 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Balzam za ustnice iz čebeljega voska</h3>
|
| 140 |
+
<p class="text-amber-700 font-bold text-xl mb-3">2,50€</p>
|
| 141 |
+
<div class="flex justify-between">
|
| 142 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 143 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 144 |
+
</button>
|
| 145 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 146 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 147 |
+
</button>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<div class="text-center mt-12">
|
| 154 |
+
<a href="#" class="inline-flex items-center text-amber-700 hover:text-amber-900 font-medium transition">
|
| 155 |
+
Vsi izdelki <i data-feather="chevron-right" class="ml-1"></i>
|
| 156 |
+
</a>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</section>
|
| 160 |
+
|
| 161 |
+
<!-- News Section -->
|
| 162 |
+
<section class="py-16 bg-amber-50">
|
| 163 |
+
<div class="container mx-auto px-4 flex flex-col md:flex-row items-center">
|
| 164 |
+
<div class="md:w-1/2 mb-8 md:mb-0" data-aos="fade-right">
|
| 165 |
+
<img src="https://static.photos/nature/640x360/105" alt="Nov čebelnjak" class="rounded-lg shadow-lg w-full">
|
| 166 |
+
</div>
|
| 167 |
+
<div class="md:w-1/2 md:pl-12" data-aos="fade-left">
|
| 168 |
+
<h2 class="text-3xl font-bold text-amber-900 mb-4">Čebelarstvo Cigoj gradi nov čebelnjak!</h2>
|
| 169 |
+
<p class="text-lg text-amber-800 mb-6">
|
| 170 |
+
Z veseljem sporočamo, da gradimo nov čebelnjak! Korak naprej za boljše pogoje za naše čebele in kakovostnejše pridelke iz domače narave.
|
| 171 |
+
</p>
|
| 172 |
+
<p class="text-amber-800 mb-6">
|
| 173 |
+
Hvala vsem, ki nas spremljate in podpirate.
|
| 174 |
+
</p>
|
| 175 |
+
<a href="#" class="text-amber-700 hover:text-amber-900 font-medium inline-flex items-center transition">
|
| 176 |
+
Preberite več <i data-feather="arrow-right" class="ml-2"></i>
|
| 177 |
+
</a>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</section>
|
| 181 |
+
|
| 182 |
+
<!-- Best Sellers -->
|
| 183 |
+
<section class="py-16 bg-white">
|
| 184 |
+
<div class="container mx-auto px-4">
|
| 185 |
+
<h2 class="text-3xl font-bold text-center text-amber-900 mb-12" data-aos="fade-up">Prodajne uspešnice</h2>
|
| 186 |
+
|
| 187 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 188 |
+
<!-- Product 1 -->
|
| 189 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="100">
|
| 190 |
+
<img src="https://static.photos/nature/320x240/106" alt="Balzam za ustnice" class="w-full h-48 object-cover">
|
| 191 |
+
<div class="p-4">
|
| 192 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Balzam za ustnice iz čebeljega voska</h3>
|
| 193 |
+
<p class="text-amber-700 font-bold text-xl mb-3">2,50€</p>
|
| 194 |
+
<div class="flex justify-between">
|
| 195 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 196 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 197 |
+
</button>
|
| 198 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 199 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 200 |
+
</button>
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
</div>
|
| 204 |
+
|
| 205 |
+
<!-- Product 2 -->
|
| 206 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="200">
|
| 207 |
+
<div class="sale-badge bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">
|
| 208 |
+
RAZPRODAJA!
|
| 209 |
+
</div>
|
| 210 |
+
<img src="https://static.photos/nature/320x240/107" alt="Balzam za ustnice" class="w-full h-48 object-cover">
|
| 211 |
+
<div class="p-4">
|
| 212 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Balzam za ustnice iz čebeljega voska</h3>
|
| 213 |
+
<p class="text-amber-700 font-bold text-xl mb-3">2,50€</p>
|
| 214 |
+
<div class="flex justify-between">
|
| 215 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 216 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 217 |
+
</button>
|
| 218 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 219 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 220 |
+
</button>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<!-- Product 3 -->
|
| 226 |
+
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md relative transition duration-300" data-aos="fade-up" data-aos-delay="300">
|
| 227 |
+
<div class="sale-badge bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full">
|
| 228 |
+
RAZPRODAJA!
|
| 229 |
+
</div>
|
| 230 |
+
<img src="https://static.photos/nature/320x240/108" alt="Cvetni prah 100g" class="w-full h-48 object-cover">
|
| 231 |
+
<div class="p-4">
|
| 232 |
+
<h3 class="font-bold text-lg mb-2 text-amber-900">Cvetni prah 100g</h3>
|
| 233 |
+
<p class="text-amber-700 font-bold text-xl mb-3">7,00€</p>
|
| 234 |
+
<div class="flex justify-between">
|
| 235 |
+
<button class="bg-amber-100 hover:bg-amber-200 text-amber-800 px-3 py-1 rounded text-sm flex items-center transition">
|
| 236 |
+
<i data-feather="eye" class="mr-1 w-4 h-4"></i> Hitri ogled
|
| 237 |
+
</button>
|
| 238 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white px-3 py-1 rounded text-sm flex items-center transition">
|
| 239 |
+
<i data-feather="shopping-cart" class="mr-1 w-4 h-4"></i> V košarico
|
| 240 |
+
</button>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<div class="text-center mt-12">
|
| 247 |
+
<a href="#" class="inline-flex items-center text-amber-700 hover:text-amber-900 font-medium transition">
|
| 248 |
+
Vse prodajne uspešnice <i data-feather="chevron-right" class="ml-1"></i>
|
| 249 |
+
</a>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
</section>
|
| 253 |
+
|
| 254 |
+
<!-- Footer -->
|
| 255 |
+
<footer class="bg-amber-900 text-white py-12">
|
| 256 |
+
<div class="container mx-auto px-4">
|
| 257 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 258 |
+
<div>
|
| 259 |
+
<h3 class="text-xl font-bold mb-4">Čebelarstvo Cigoj</h3>
|
| 260 |
+
<p class="text-amber-200">Kakovostni naravni izdelki iz čebeljega panja.</p>
|
| 261 |
+
</div>
|
| 262 |
+
<div>
|
| 263 |
+
<h4 class="font-bold mb-4">Izdelki</h4>
|
| 264 |
+
<ul class="space-y-2">
|
| 265 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Med</a></li>
|
| 266 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Cvetni prah</a></li>
|
| 267 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Čebelji vosek</a></li>
|
| 268 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Balzami</a></li>
|
| 269 |
+
</ul>
|
| 270 |
+
</div>
|
| 271 |
+
<div>
|
| 272 |
+
<h4 class="font-bold mb-4">Povezave</h4>
|
| 273 |
+
<ul class="space-y-2">
|
| 274 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">O nas</a></li>
|
| 275 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Blog</a></li>
|
| 276 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Pogoji poslovanja</a></li>
|
| 277 |
+
<li><a href="#" class="text-amber-200 hover:text-white transition">Varstvo zasebnosti</a></li>
|
| 278 |
+
<li><a href="backend.html" class="text-amber-200 hover:text-white transition">Administracija</a></li>
|
| 279 |
+
</ul>
|
| 280 |
+
</div>
|
| 281 |
+
<div>
|
| 282 |
+
<h4 class="font-bold mb-4">Kontakt</h4>
|
| 283 |
+
<ul class="space-y-2">
|
| 284 |
+
<li class="flex items-center">
|
| 285 |
+
<i data-feather="mail" class="mr-2"></i> info@cebelarstvo-cigoj.si
|
| 286 |
+
</li>
|
| 287 |
+
<li class="flex items-center">
|
| 288 |
+
<i data-feather="phone" class="mr-2"></i> +386 40 123 456
|
| 289 |
+
</li>
|
| 290 |
+
<li class="flex items-center">
|
| 291 |
+
<i data-feather="map-pin" class="mr-2"></i> Čebelarska ulica 1, 1000 Ljubljana
|
| 292 |
+
</li>
|
| 293 |
+
</ul>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
<div class="border-t border-amber-800 mt-8 pt-8 text-center text-amber-200">
|
| 297 |
+
<p>© 2023 Čebelarstvo Cigoj. Vse pravice pridržane.</p>
|
| 298 |
+
</div>
|
| 299 |
+
</div>
|
| 300 |
+
</footer>
|
| 301 |
+
|
| 302 |
+
<script>
|
| 303 |
+
AOS.init({
|
| 304 |
+
duration: 800,
|
| 305 |
+
easing: 'ease-in-out',
|
| 306 |
+
once: true
|
| 307 |
+
});
|
| 308 |
+
feather.replace();
|
| 309 |
+
</script>
|
| 310 |
+
</body>
|
| 311 |
</html>
|
orders.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
require_once 'config.php';
|
| 4 |
+
|
| 5 |
+
// JWT verification middleware
|
| 6 |
+
verifyToken();
|
| 7 |
+
|
| 8 |
+
// GET all orders
|
| 9 |
+
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
| 10 |
+
$stmt = $pdo->query("SELECT * FROM orders");
|
| 11 |
+
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 12 |
+
|
| 13 |
+
// Include order items for each order
|
| 14 |
+
foreach($orders as &$order) {
|
| 15 |
+
$stmt = $pdo->prepare("SELECT * FROM order_items WHERE order_id = ?");
|
| 16 |
+
$stmt->execute([$order['id']]);
|
| 17 |
+
$order['items'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
echo json_encode($orders);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
// POST create new order
|
| 24 |
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
| 25 |
+
$data = json_decode(file_get_contents("php://input"));
|
| 26 |
+
|
| 27 |
+
// Start transaction
|
| 28 |
+
$pdo->beginTransaction();
|
| 29 |
+
|
| 30 |
+
try {
|
| 31 |
+
// Create order
|
| 32 |
+
$stmt = $pdo->prepare("INSERT INTO orders (customer_name, customer_email, customer_address, total_amount, status) VALUES (?, ?, ?, ?, ?)");
|
| 33 |
+
$stmt->execute([
|
| 34 |
+
$data->customer->name,
|
| 35 |
+
$data->customer->email,
|
| 36 |
+
$data->customer->address,
|
| 37 |
+
$data->total,
|
| 38 |
+
'pending'
|
| 39 |
+
]);
|
| 40 |
+
$order_id = $pdo->lastInsertId();
|
| 41 |
+
|
| 42 |
+
// Add order items
|
| 43 |
+
foreach($data->items as $item) {
|
| 44 |
+
$stmt = $pdo->prepare("INSERT INTO order_items (order_id, product_id, product_name, quantity, unit_price) VALUES (?, ?, ?, ?, ?)");
|
| 45 |
+
$stmt->execute([
|
| 46 |
+
$order_id,
|
| 47 |
+
$item->product_id,
|
| 48 |
+
$item->product_name,
|
| 49 |
+
$item->quantity,
|
| 50 |
+
$item->unit_price
|
| 51 |
+
]);
|
| 52 |
+
|
| 53 |
+
// Update product stock
|
| 54 |
+
$stmt = $pdo->prepare("UPDATE products SET stock = stock - ? WHERE id = ?");
|
| 55 |
+
$stmt->execute([$item->quantity, $item->product_id]);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// Commit transaction
|
| 59 |
+
$pdo->commit();
|
| 60 |
+
|
| 61 |
+
http_response_code(201);
|
| 62 |
+
echo json_encode(array("success" => true, "order_id" => $order_id));
|
| 63 |
+
} catch(Exception $e) {
|
| 64 |
+
// Rollback on error
|
| 65 |
+
$pdo->rollBack();
|
| 66 |
+
http_response_code(500);
|
| 67 |
+
echo json_encode(array("success" => false, "message" => $e->getMessage()));
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// UPDATE order status
|
| 72 |
+
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
| 73 |
+
verifyToken();
|
| 74 |
+
|
| 75 |
+
$data = json_decode(file_get_contents("php://input"));
|
| 76 |
+
$id = $_GET['id'] ?? null;
|
| 77 |
+
|
| 78 |
+
if($id) {
|
| 79 |
+
$stmt = $pdo->prepare("UPDATE orders SET status = ? WHERE id = ?");
|
| 80 |
+
$stmt->execute([$data->status, $id]);
|
| 81 |
+
|
| 82 |
+
echo json_encode(array("success" => true, "message" => "Order updated"));
|
| 83 |
+
} else {
|
| 84 |
+
http_response_code(400);
|
| 85 |
+
echo json_encode(array("success" => false, "message" => "Order ID required"));
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
?>
|
| 89 |
+
```
|
products.php
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
require_once 'config.php';
|
| 4 |
+
|
| 5 |
+
// JWT verification middleware
|
| 6 |
+
function verifyToken() {
|
| 7 |
+
$headers = apache_request_headers();
|
| 8 |
+
if(!isset($headers['Authorization'])) {
|
| 9 |
+
http_response_code(401);
|
| 10 |
+
echo json_encode(array("message" => "Access Denied. No token provided."));
|
| 11 |
+
exit;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
try {
|
| 15 |
+
$token = str_replace('Bearer ', '', $headers['Authorization']);
|
| 16 |
+
$decoded = JWT::decode($token, JWT_SECRET, array('HS256'));
|
| 17 |
+
return $decoded;
|
| 18 |
+
} catch(Exception $e) {
|
| 19 |
+
http_response_code(401);
|
| 20 |
+
echo json_encode(array("message" => "Invalid token", "error" => $e->getMessage()));
|
| 21 |
+
exit;
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
// GET all products
|
| 26 |
+
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
| 27 |
+
$stmt = $pdo->query("SELECT * FROM products");
|
| 28 |
+
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 29 |
+
echo json_encode($products);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// POST new product (Admin only)
|
| 33 |
+
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
| 34 |
+
verifyToken();
|
| 35 |
+
|
| 36 |
+
$data = json_decode(file_get_contents("php://input"));
|
| 37 |
+
|
| 38 |
+
$stmt = $pdo->prepare("INSERT INTO products (name, description, price, stock, image_url) VALUES (?, ?, ?, ?, ?)");
|
| 39 |
+
$stmt->execute([$data->name, $data->description, $data->price, $data->stock, $data->image_url]);
|
| 40 |
+
|
| 41 |
+
$product_id = $pdo->lastInsertId();
|
| 42 |
+
$stmt = $pdo->query("SELECT * FROM products WHERE id = $product_id");
|
| 43 |
+
$product = $stmt->fetch(PDO::FETCH_ASSOC);
|
| 44 |
+
|
| 45 |
+
echo json_encode($product);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// UPDATE product (Admin only)
|
| 49 |
+
if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
|
| 50 |
+
verifyToken();
|
| 51 |
+
|
| 52 |
+
$data = json_decode(file_get_contents("php://input"));
|
| 53 |
+
$id = $_GET['id'] ?? null;
|
| 54 |
+
|
| 55 |
+
if($id) {
|
| 56 |
+
$stmt = $pdo->prepare("UPDATE products SET name = ?, description = ?, price = ?, stock = ?, image_url = ? WHERE id = ?");
|
| 57 |
+
$stmt->execute([$data->name, $data->description, $data->price, $data->stock, $data->image_url, $id]);
|
| 58 |
+
|
| 59 |
+
echo json_encode(array("success" => true, "message" => "Product updated"));
|
| 60 |
+
} else {
|
| 61 |
+
http_response_code(400);
|
| 62 |
+
echo json_encode(array("success" => false, "message" => "Product ID required"));
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
// DELETE product (Admin only)
|
| 67 |
+
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
|
| 68 |
+
verifyToken();
|
| 69 |
+
|
| 70 |
+
$id = $_GET['id'] ?? null;
|
| 71 |
+
|
| 72 |
+
if($id) {
|
| 73 |
+
$stmt = $pdo->prepare("DELETE FROM products WHERE id = ?");
|
| 74 |
+
$stmt->execute([$id]);
|
| 75 |
+
|
| 76 |
+
echo json_encode(array("success" => true, "message" => "Product deleted"));
|
| 77 |
+
} else {
|
| 78 |
+
http_response_code(400);
|
| 79 |
+
echo json_encode(array("success" => false, "message" => "Product ID required"));
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
?>
|
| 83 |
+
```
|
prompts.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
now make backend
|
| 3 |
+
now make the php fort it to work safely
|
| 4 |
+
now make the php fort it to work safely
|
| 5 |
+
now make the php fort it to work safely
|
| 6 |
+
make the backend so the user can anctualy cehck pout
|
| 7 |
+
make all the backend phps and
|
| 8 |
+
make the backend php
|
reports.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```php
|
| 2 |
+
<?php
|
| 3 |
+
require_once 'config.php';
|
| 4 |
+
|
| 5 |
+
// JWT verification middleware
|
| 6 |
+
verifyToken();
|
| 7 |
+
|
| 8 |
+
// GET sales report
|
| 9 |
+
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
| 10 |
+
$start_date = $_GET['start_date'] ?? date('Y-m-01');
|
| 11 |
+
$end_date = $_GET['end_date'] ?? date('Y-m-t');
|
| 12 |
+
|
| 13 |
+
// Total sales
|
| 14 |
+
$stmt = $pdo->prepare("SELECT SUM(total_amount) as total_sales FROM orders WHERE created_at BETWEEN ? AND ?");
|
| 15 |
+
$stmt->execute([$start_date, $end_date]);
|
| 16 |
+
$total_sales = $stmt->fetch(PDO::FETCH_ASSOC);
|
| 17 |
+
|
| 18 |
+
// Top products
|
| 19 |
+
$stmt = $pdo->prepare("
|
| 20 |
+
SELECT p.name, SUM(oi.quantity) as total_sold, SUM(oi.quantity * oi.unit_price) as revenue
|
| 21 |
+
FROM order_items oi
|
| 22 |
+
JOIN products p ON oi.product_id = p.id
|
| 23 |
+
JOIN orders o ON oi.order_id = o.id
|
| 24 |
+
WHERE o.created_at BETWEEN ? AND ?
|
| 25 |
+
GROUP BY p.id
|
| 26 |
+
ORDER BY total_sold DESC
|
| 27 |
+
LIMIT 5
|
| 28 |
+
");
|
| 29 |
+
$stmt->execute([$start_date, $end_date]);
|
| 30 |
+
$top_products = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
| 31 |
+
|
| 32 |
+
// Report data
|
| 33 |
+
$report = array(
|
| 34 |
+
'total_sales' => $total_sales['total_sales'] ?? 0,
|
| 35 |
+
'start_date' => $start_date,
|
| 36 |
+
'end_date' => $end_date,
|
| 37 |
+
'top_products' => $top_products
|
| 38 |
+
);
|
| 39 |
+
|
| 40 |
+
echo json_encode($report);
|
| 41 |
+
}
|
| 42 |
+
?>
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
You'll also need to create the database tables. Here's the SQL schema:
|
schema.sql
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```sql
|
| 2 |
+
CREATE DATABASE IF NOT EXISTS cebelarstvo_cigoj;
|
| 3 |
+
USE cebelarstvo_cigoj;
|
| 4 |
+
|
| 5 |
+
-- Products table
|
| 6 |
+
CREATE TABLE IF NOT EXISTS products (
|
| 7 |
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
| 8 |
+
name VARCHAR(255) NOT NULL,
|
| 9 |
+
description TEXT,
|
| 10 |
+
price DECIMAL(10,2) NOT NULL,
|
| 11 |
+
stock INT NOT NULL DEFAULT 0,
|
| 12 |
+
image_url VARCHAR(255),
|
| 13 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 14 |
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
| 15 |
+
);
|
| 16 |
+
|
| 17 |
+
-- Customers table
|
| 18 |
+
CREATE TABLE IF NOT EXISTS customers (
|
| 19 |
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
| 20 |
+
name VARCHAR(255) NOT NULL,
|
| 21 |
+
email VARCHAR(255) NOT NULL UNIQUE,
|
| 22 |
+
address TEXT,
|
| 23 |
+
phone VARCHAR(20),
|
| 24 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
-- Orders table
|
| 28 |
+
CREATE TABLE IF NOT EXISTS orders (
|
| 29 |
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
| 30 |
+
customer_name VARCHAR(255) NOT NULL,
|
| 31 |
+
customer_email VARCHAR(255) NOT NULL,
|
| 32 |
+
customer_address TEXT NOT NULL,
|
| 33 |
+
total_amount DECIMAL(10,2) NOT NULL,
|
| 34 |
+
status ENUM('pending', 'paid', 'shipped', 'delivered', 'cancelled') DEFAULT 'pending',
|
| 35 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 36 |
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
-- Order items table
|
| 40 |
+
CREATE TABLE IF NOT EXISTS order_items (
|
| 41 |
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
| 42 |
+
order_id INT NOT NULL,
|
| 43 |
+
product_id INT NOT NULL,
|
| 44 |
+
product_name VARCHAR(255) NOT NULL,
|
| 45 |
+
quantity INT NOT NULL,
|
| 46 |
+
unit_price DECIMAL(10,2) NOT NULL,
|
| 47 |
+
FOREIGN KEY (order_id) REFERENCES orders(id),
|
| 48 |
+
FOREIGN KEY (product_id) REFERENCES products(id)
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
-- Admin users table
|
| 52 |
+
CREATE TABLE IF NOT EXISTS admin_users (
|
| 53 |
+
id INT AUTO_INCREMENT PRIMARY KEY,
|
| 54 |
+
username VARCHAR(50) NOT NULL UNIQUE,
|
| 55 |
+
password_hash VARCHAR(255) NOT NULL,
|
| 56 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
-- Insert test admin
|
| 60 |
+
INSERT INTO admin_users (username, password_hash)
|
| 61 |
+
VALUES ('admin', '$2y$10$J4o8/.jGJt4vB7R7hNQ0L.Q5Qd8RZ1Z1d5Gz0V1W5gX6t5i2b1V1S2');
|
| 62 |
+
|
| 63 |
+
-- Insert sample products
|
| 64 |
+
INSERT INTO products (name, description, price, stock, image_url) VALUES
|
| 65 |
+
('Cvetni prah 50g', 'Naravni cvetni prah, bogat s proteini in vitamini', 5.00, 100, 'https://static.photos/nature/320x240/101'),
|
| 66 |
+
('Balzam za ustnice iz čebeljega voska', 'Neguje in ščiti ustnice', 2.50, 50, 'https://static.photos/nature/320x240/102'),
|
| 67 |
+
('Med ajdov', 'Visokokakovosten med iz ajdovega cveta', 7.50, 30, 'https://static.photos/nature/320x240/103');
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
To complete the setup, you'll need to:
|
| 71 |
+
1. Install required dependencies via Composer:
|
| 72 |
+
```
|
| 73 |
+
composer require firebase/php-jwt
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
2. Set up a web server (like Apache or Nginx) to serve these PHP files
|
| 77 |
+
3. Create the database using the schema.sql file
|
| 78 |
+
4. Configure the database credentials in config.php
|
| 79 |
+
|
| 80 |
+
The backend provides:
|
| 81 |
+
- Admin authentication with JWT
|
| 82 |
+
- CRUD operations for products
|
| 83 |
+
- Order processing
|
| 84 |
+
- Customer management
|
| 85 |
+
- Sales reporting
|
| 86 |
+
- Secure API endpoints
|
| 87 |
+
|
| 88 |
+
For production use, make sure to:
|
| 89 |
+
1. Change the default admin credentials
|
| 90 |
+
2. Use HTTPS
|
| 91 |
+
3. Add input validation and sanitization
|
| 92 |
+
4. Implement rate limiting
|
| 93 |
+
5. Regularly backup your database
|
| 94 |
+
6. Keep the system updated
|