seller_orders.html.twig 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {% extends "base.html.twig" %}
  2. {% block title %}{{ t.customer_orders }} - {{ site_title }}{% endblock %}
  3. {% block extra_css %}
  4. <style>
  5. /* --- SELLER DASHBOARD COMMON STYLES --- */
  6. .dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 2px solid var(--border-color); padding-bottom: 15px; }
  7. .dashboard-header h2 { margin: 0; color: var(--primary); font-size: 24px; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
  8. .dashboard-nav { display: flex; gap: 10px; }
  9. .nav-btn { padding: 10px 15px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; transition: 0.2s; border: 1px solid transparent; }
  10. .nav-btn.active { background: rgba(249, 115, 22, 0.1); color: var(--primary); border-color: rgba(249, 115, 22, 0.2); }
  11. .nav-btn:not(.active) { background: rgba(255,255,255,0.05); color: var(--text-main); border-color: var(--border-color); }
  12. .nav-btn:hover { background: rgba(255,255,255,0.1); }
  13. .alert { padding: 15px; border-radius: 6px; margin-bottom: 25px; font-weight: 600; font-size: 14px;}
  14. .success { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
  15. .error { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
  16. /* --- ORDERS STYLES --- */
  17. .orders-container { max-width: 1000px; margin: 0 auto; }
  18. .order-card { background: var(--panel-bg); border-radius: var(--border-radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); margin-bottom: 25px; overflow: hidden; display: flex; flex-direction: column;}
  19. .order-header { background: rgba(0,0,0,0.2); padding: 15px 25px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
  20. .order-id { font-size: 18px; font-weight: 900; color: var(--text-main); }
  21. .order-date { font-size: 13px; color: var(--text-muted); font-weight: 600; }
  22. .order-body { padding: 25px; display: grid; grid-template-columns: 1fr 1.5fr; gap: 30px; }
  23. .customer-info h4 { margin-top: 0; color: var(--primary); font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
  24. .customer-info p { margin: 0 0 8px 0; font-size: 14px; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
  25. .customer-info p i { color: var(--text-muted); font-size: 12px; }
  26. .order-items h4 { margin-top: 0; color: var(--primary); font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
  27. .item-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
  28. .item-row:last-child { border-bottom: none; padding-bottom: 0; }
  29. .item-title { font-weight: 600; color: var(--text-main); font-size: 15px; }
  30. .item-qty { background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; margin-left: 10px; color: var(--text-muted); }
  31. .item-price { font-weight: 800; color: var(--accent-green); }
  32. /* --- ORDER ACTIONS (STATUS & DELETE) --- */
  33. .order-actions { background: rgba(0,0,0,0.15); padding: 15px 25px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
  34. .status-form { display: flex; align-items: center; gap: 10px; }
  35. .status-select { padding: 8px 12px; background: #0f172a; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; outline: none; }
  36. .status-select:focus { border-color: var(--primary); }
  37. .btn-update { padding: 8px 15px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--accent-green); font-size: 13px; font-weight: 700; border-radius: 6px; cursor: pointer; text-transform: uppercase; transition: 0.2s; }
  38. .btn-update:hover { background: var(--accent-green); color: white; }
  39. .delete-form { margin: 0; }
  40. .btn-delete { padding: 8px 15px; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #ef4444; font-size: 13px; font-weight: 700; border-radius: 6px; cursor: pointer; text-transform: uppercase; transition: 0.2s; }
  41. .btn-delete:hover { background: #ef4444; color: white; }
  42. @media (max-width: 768px) {
  43. .dashboard-header { flex-direction: column; gap: 15px; text-align: center; }
  44. .order-body { grid-template-columns: 1fr; gap: 20px; padding: 20px;}
  45. .customer-info { border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
  46. .order-actions { flex-direction: column; gap: 15px; align-items: stretch; padding: 20px;}
  47. .status-form { justify-content: space-between; }
  48. }
  49. </style>
  50. {% endblock %}
  51. {% block content %}
  52. <div class="dashboard-header">
  53. <h2>🏪 {{ t.seller_panel }}</h2>
  54. <div class="dashboard-nav">
  55. <a href="seller_dashboard.php" class="nav-btn">{{ t.my_listings }}</a>
  56. <a href="seller_orders.php" class="nav-btn active">{{ t.customer_orders }}</a>
  57. </div>
  58. </div>
  59. <div class="orders-container">
  60. {% if message %}
  61. {{ message|raw }}
  62. {% endif %}
  63. {% if orders|length > 0 %}
  64. {% for order in orders %}
  65. <div class="order-card">
  66. <div class="order-header">
  67. <div class="order-id">#{{ order.id }}</div>
  68. <div style="display: flex; align-items: center; gap: 15px;">
  69. <div class="order-date">{{ order.created_at|date("d/m/Y H:i") }}</div>
  70. </div>
  71. </div>
  72. <div class="order-body">
  73. <div class="customer-info">
  74. <h4>{{ t.customer }} & {{ t.contact }}</h4>
  75. <p>👤 <strong>{{ order.customer_name }}</strong></p>
  76. <p>✉️ <a href="mailto:{{ order.customer_email }}" style="color: var(--accent-blue); text-decoration: none;">{{ order.customer_email }}</a></p>
  77. <p>📞 {{ order.customer_phone }}</p>
  78. <p>📍 {{ order.shipping_address }}</p>
  79. </div>
  80. <div class="order-items">
  81. <h4>{{ t.my_products }}</h4>
  82. {% for item in order.items %}
  83. <div class="item-row">
  84. <div>
  85. <span class="item-title">{{ item.title }}</span>
  86. <span class="item-qty">x{{ item.quantity }}</span>
  87. </div>
  88. <div class="item-price">{{ item.price|number_format(2, ',', '.') }} €</div>
  89. </div>
  90. {% endfor %}
  91. </div>
  92. </div>
  93. <!-- ORDER ACTIONS (Status & Delete) -->
  94. <div class="order-actions">
  95. <!-- Φόρμα αλλαγής Status -->
  96. <form method="POST" action="seller_orders.php" class="status-form">
  97. <input type="hidden" name="action" value="update_status">
  98. <input type="hidden" name="order_id" value="{{ order.id }}">
  99. <select name="status" class="status-select">
  100. <option value="pending" {% if order.status == 'pending' %}selected{% endif %}>{{ t.status_pending }}</option>
  101. <option value="completed" {% if order.status == 'completed' %}selected{% endif %}>{{ t.status_completed }}</option>
  102. <option value="cancelled" {% if order.status == 'cancelled' %}selected{% endif %}>{{ t.status_cancelled }}</option>
  103. </select>
  104. <button type="submit" class="btn-update">{{ t.btn_update }}</button>
  105. </form>
  106. <!-- Φόρμα Διαγραφής Παραγγελίας -->
  107. <form method="POST" action="seller_orders.php" class="delete-form" onsubmit="return confirm('{{ t.confirm_delete }}');">
  108. <input type="hidden" name="action" value="delete_order">
  109. <input type="hidden" name="order_id" value="{{ order.id }}">
  110. <button type="submit" class="btn-delete">{{ t.btn_delete }}</button>
  111. </form>
  112. </div>
  113. </div>
  114. {% endfor %}
  115. {% else %}
  116. <div style="text-align: center; padding: 80px 20px; color: var(--text-muted); background: var(--panel-bg); border-radius: var(--border-radius); border: 1px dashed var(--border-color);">
  117. <span style="font-size: 50px; display: block; margin-bottom: 15px; opacity: 0.5;">🛒</span>
  118. <strong style="font-size: 18px; color: var(--text-main);">{{ t.no_orders }}</strong>
  119. </div>
  120. {% endif %}
  121. </div>
  122. {% endblock %}