diff --git a/cookies.txt b/cookies.txt new file mode 100644 index 0000000..99f826f --- /dev/null +++ b/cookies.txt @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +localhost FALSE / FALSE 0 PHPSESSID 7ksl899v5vo08i9all8u0pma2i diff --git a/items.php b/items.php index 3955f30..7a4e473 100644 --- a/items.php +++ b/items.php @@ -274,19 +274,34 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { $service_id = $_POST['service_id']; $price = $_POST['price']; - $stmt = db()->prepare("INSERT INTO prices (item_id, service_id, price) - VALUES (?, ?, ?) - ON DUPLICATE KEY UPDATE price = ?"); - $stmt->execute([$item_id, $service_id, $price, $price]); - - if ($isAjax) { - header('Content-Type: application/json'); - echo json_encode(['success' => true]); + // Handle empty/invalid price + if ($price === '') $price = 0; + $price = str_replace(',', '.', $price); // Handle comma as decimal separator + $price = (float)$price; + + try { + $stmt = db()->prepare("INSERT INTO prices (item_id, service_id, price) + VALUES (?, ?, ?) + ON DUPLICATE KEY UPDATE price = ?"); + $stmt->execute([$item_id, $service_id, $price, $price]); + + if ($isAjax) { + header('Content-Type: application/json'); + echo json_encode(['success' => true]); + exit; + } + + header('Location: items.php?success=price_updated'); + exit; + } catch (Exception $e) { + if ($isAjax) { + header('Content-Type: application/json'); + echo json_encode(['success' => false, 'error' => $e->getMessage()]); + exit; + } + header('Location: items.php?error=save_failed'); exit; } - - header('Location: items.php?success=price_updated'); - exit; } } @@ -338,257 +353,208 @@ foreach ($prices_raw as $p) { ?>
-

-
+
+ - -
-
-
+
-
- - - - + +
- - +
-
- - - - +
+
- - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

-
-
-
- - - -
-
-
- - - -
-
-
- - - - % - - - - - - - - -
-
-
- -
-
- -
-
How to manage Services?
-

- Services: Actions like "Wash Only", "Urgent Wash", "Iron Only". Add them using the Services button at the top, then set prices for each item in the table above.
- Simplified: We removed "Variants" to make it easier. Now you just define your services and set their prices for each item. -

+
+
+
+
+ + <?= htmlspecialchars($item['name_en']) ?> +
+ +
+ +
+ + + +
+
+
+
+

+ +
+
+ +
+
+ + + + + + + +
+
+
+
- + + +