cart.html.twig 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {% extends "base.html.twig" %}
  2. {% block title %}
  3. {% if current_lang == 'en' %}Shopping Cart{% else %}Καλάθι Αγορών{% endif %} - {{ site_title }}
  4. {% endblock %}
  5. {% block extra_css %}
  6. <style>
  7. /* --- CART STYLES (DARK THEME) --- */
  8. .page-title { color: var(--text-main); margin-bottom: 25px; font-weight: 800; font-size: 28px; letter-spacing: -0.5px; text-transform: uppercase; }
  9. .cart-container { background: var(--panel-bg); padding: 30px; border-radius: var(--border-radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); }
  10. .cart-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
  11. .cart-table th, .cart-table td { padding: 18px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: left; vertical-align: middle; color: var(--text-main); }
  12. .cart-table th { background: rgba(0,0,0,0.2); color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
  13. .cart-table tr:last-child td { border-bottom: none; }
  14. .thumb { width: 65px; height: 65px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-color); }
  15. .no-img-placeholder { width: 65px; height: 65px; background: #0f172a; display:flex; align-items:center; justify-content:center; border-radius:6px; font-size:11px; color: var(--text-muted); border: 1px solid var(--border-color); text-transform: uppercase; font-weight: bold;}
  16. .btn-remove { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); padding: 8px 15px; text-decoration: none; border-radius: 6px; font-size: 13px; font-weight: 600; transition: 0.2s; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block;}
  17. .btn-remove:hover { background: #ef4444; color: white; border-color: #ef4444; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);}
  18. .total-price-box { text-align: right; font-size: 20px; font-weight: 700; margin-bottom: 30px; color: var(--text-muted); padding: 20px; background: rgba(0,0,0,0.15); border-radius: 8px; border: 1px solid var(--border-color); }
  19. .total-price-box span { color: var(--primary); font-size: 28px; font-weight: 900; margin-left: 10px; }
  20. /* --- CHECKOUT FORM --- */
  21. .checkout-box { background: rgba(0,0,0,0.2); padding: 30px; border-radius: var(--border-radius); border: 1px solid var(--border-color); margin-top: 10px; }
  22. .checkout-box h3 { color: var(--primary); margin-top: 0; margin-bottom: 25px; font-size: 18px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
  23. .form-group { margin-bottom: 20px; }
  24. .form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
  25. .form-group input { width: 100%; padding: 14px; background: #0f172a; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); font-family: 'Inter', sans-serif; font-size: 15px; outline: none; transition: 0.2s; box-sizing: border-box; }
  26. .form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2); }
  27. .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  28. .btn-checkout { background: var(--primary); color: white; border: none; padding: 16px 20px; font-size: 16px; font-weight: 800; border-radius: 6px; cursor: pointer; width: 100%; text-transform: uppercase; letter-spacing: 1px; transition: 0.3s; margin-top: 10px; }
  29. .btn-checkout:hover { background: var(--primary-hover); box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4); transform: translateY(-1px); }
  30. .empty-cart-msg { color: var(--text-muted); font-size: 16px; text-align: center; padding: 40px 0; }
  31. .empty-cart-msg a { color: var(--primary); font-weight: bold; text-decoration: none; border-bottom: 2px solid transparent; transition: 0.2s; }
  32. .empty-cart-msg a:hover { border-color: var(--primary); }
  33. @media (max-width: 768px) {
  34. .form-grid { grid-template-columns: 1fr; gap: 0; }
  35. .cart-table th, .cart-table td { padding: 10px 5px; font-size: 14px; }
  36. .thumb { width: 50px; height: 50px; }
  37. .btn-remove { padding: 6px 10px; font-size: 11px; }
  38. }
  39. </style>
  40. {% endblock %}
  41. {% block content %}
  42. <h2 class="page-title">{% if current_lang == 'en' %}Your Cart{% else %}Το Καλάθι σου{% endif %}</h2>
  43. <div class="cart-container">
  44. {% if cart_items|length > 0 %}
  45. <div style="overflow-x: auto;">
  46. <table class="cart-table">
  47. <thead>
  48. <tr>
  49. <th>{% if current_lang == 'en' %}Product{% else %}Προϊόν{% endif %}</th>
  50. <th>{% if current_lang == 'en' %}Price{% else %}Τιμή{% endif %}</th>
  51. <th>{% if current_lang == 'en' %}Qty{% else %}Ποσότητα{% endif %}</th>
  52. <th>{% if current_lang == 'en' %}Subtotal{% else %}Σύνολο{% endif %}</th>
  53. <th>{% if current_lang == 'en' %}Action{% else %}Ενέργεια{% endif %}</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. {% for item in cart_items %}
  58. <tr>
  59. <td>
  60. <div style="display: flex; align-items: center; gap: 15px;">
  61. {% if item.image_path %}
  62. <img src="{{ item.image_path }}" class="thumb">
  63. {% else %}
  64. <div class="no-img-placeholder">No IMG</div>
  65. {% endif %}
  66. <strong style="color: var(--text-main); font-size: 15px;">{{ item.title }}</strong>
  67. </div>
  68. </td>
  69. <td style="color: var(--text-muted); font-weight: 500;">{{ item.price|number_format(2, ',', '.') }} €</td>
  70. <td style="font-weight: bold;">{{ item.quantity }}</td>
  71. <td><strong style="color: var(--text-main); font-size: 16px;">{{ item.subtotal|number_format(2, ',', '.') }} €</strong></td>
  72. <td>
  73. <a href="cart.php?action=remove&id={{ item.id }}" class="btn-remove">
  74. {% if current_lang == 'en' %}Remove{% else %}Αφαίρεση{% endif %}
  75. </a>
  76. </td>
  77. </tr>
  78. {% endfor %}
  79. </tbody>
  80. </table>
  81. </div>
  82. <div class="total-price-box">
  83. {% if current_lang == 'en' %}Total Amount:{% else %}Συνολικό Ποσό:{% endif %}
  84. <span>{{ total_price|number_format(2, ',', '.') }} €</span>
  85. </div>
  86. <!-- Φόρμα Ολοκλήρωσης Παραγγελίας -->
  87. <div class="checkout-box">
  88. <h3>{% if current_lang == 'en' %}Shipping & Contact Details{% else %}Στοιχεία Αποστολής & Επικοινωνίας{% endif %}</h3>
  89. <form action="checkout.php" method="POST">
  90. <div class="form-grid">
  91. <div class="form-group">
  92. <label>{% if current_lang == 'en' %}Full Name *{% else %}Ονοματεπώνυμο *{% endif %}</label>
  93. <input type="text" name="customer_name" required>
  94. </div>
  95. <div class="form-group">
  96. <label>{% if current_lang == 'en' %}Email Address *{% else %}Email *{% endif %}</label>
  97. <input type="email" name="customer_email" required>
  98. </div>
  99. </div>
  100. <div class="form-grid">
  101. <div class="form-group">
  102. <label>{% if current_lang == 'en' %}Phone Number *{% else %}Τηλέφωνο Επικοινωνίας *{% endif %}</label>
  103. <input type="text" name="customer_phone" required>
  104. </div>
  105. <div class="form-group">
  106. <label>{% if current_lang == 'en' %}Shipping Address / City *{% else %}Διεύθυνση / Πόλη *{% endif %}</label>
  107. <input type="text" name="shipping_address" required>
  108. </div>
  109. </div>
  110. <button type="submit" class="btn-checkout">
  111. {% if current_lang == 'en' %}Place Order Now{% else %}Οριστική Υποβολή Παραγγελίας{% endif %}
  112. </button>
  113. </form>
  114. </div>
  115. {% else %}
  116. <div class="empty-cart-msg">
  117. <p>
  118. {% if current_lang == 'en' %}
  119. Your cart is completely empty. <a href="index.php">Explore the catalog</a>.
  120. {% else %}
  121. Το καλάθι σου είναι εντελώς άδειο. <a href="index.php">Εξερεύνησε τον κατάλογο</a>.
  122. {% endif %}
  123. </p>
  124. </div>
  125. {% endif %}
  126. </div>
  127. {% endblock %}