Kgshop commited on
Commit
0a8408c
·
verified ·
1 Parent(s): befea04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -44
app.py CHANGED
@@ -1009,49 +1009,56 @@ ADMIN_TEMPLATE = '''
1009
  </form>
1010
  </div>
1011
 
1012
- <div class="card">
1013
- <h2><i class="fas fa-file-invoice-dollar"></i> История накладных</h2>
1014
- <div style="overflow-x: auto;">
1015
- <table class="orders-table">
1016
- <tr>
1017
- <th>ID / Дата</th>
1018
- <th>Клиент</th>
1019
- <th>Сумма</th>
1020
- <th>Скидка</th>
1021
- <th>К оплате</th>
1022
- <th>Действия</th>
1023
- </tr>
1024
- {% for order in orders.values()|sort(attribute='created_at', reverse=True) %}
1025
- {% set raw_total = 0 %}
1026
- {% for item in order.cart %}
1027
- {% set raw_total = raw_total + (item.price|float * item.quantity|int) %}
1028
- {% endfor %}
1029
- <tr>
1030
- <td>
1031
- <a href="/order/{{ order.id }}" target="_blank" style="color:var(--info); font-weight:bold; text-decoration:none;">{{ order.id }}</a><br>
1032
- <span style="font-size:0.8rem; color:#636e72;">{{ order.created_at }}</span>
1033
- </td>
1034
- <td style="font-size:0.9rem;">
1035
- {{ order.customer_name }}<br>
1036
- <i class="fas fa-phone" style="font-size:0.7rem; color:#999;"></i> {{ order.customer_phone }}<br>
1037
- <i class="fas fa-map-marker-alt" style="font-size:0.7rem; color:#999;"></i> {{ order.customer_city }}
1038
- </td>
1039
- <td style="font-weight:600;">{{ raw_total }} {{ currency_code }}</td>
1040
- <td>
1041
- <form method="POST" style="display:flex; gap:5px; margin:0; align-items:center;">
1042
- <input type="hidden" name="action" value="apply_discount">
1043
- <input type="hidden" name="order_id" value="{{ order.id }}">
1044
- <input type="number" name="discount_amount" value="{{ order.discount|default(0) }}" min="0" step="0.01" style="width:80px; padding:6px; font-size:0.9rem;">
1045
- <button type="submit" class="btn btn-warning" style="padding:6px 10px;" title="Применить скидку"><i class="fas fa-check"></i></button>
1046
- </form>
1047
- </td>
1048
- <td style="font-weight:800; color:var(--success);">{{ order.total_price }} {{ currency_code }}</td>
1049
- <td>
1050
- <a href="/order/{{ order.id }}" class="btn btn-primary" style="padding:6px 10px;" target="_blank"><i class="fas fa-eye"></i></a>
1051
- </td>
1052
- </tr>
1053
- {% endfor %}
1054
- </table>
 
 
 
 
 
 
 
1055
  </div>
1056
  </div>
1057
 
@@ -1505,4 +1512,4 @@ if __name__ == '__main__':
1505
  threading.Thread(target=periodic_backup, daemon=True).start()
1506
 
1507
  port = int(os.environ.get('PORT', 7860))
1508
- app.run(host='0.0.0.0', port=port)
 
1009
  </form>
1010
  </div>
1011
 
1012
+ <div class="card" style="padding: 0;">
1013
+ <div class="category-header" onclick="toggleCategory('orders-history')" style="border-radius: 16px; border-bottom: none;">
1014
+ <div style="display: flex; align-items: center; gap: 10px;">
1015
+ <i class="fas fa-chevron-down" id="icon-orders-history" style="color: #636e72;"></i>
1016
+ <span style="font-weight: 800; font-size: 1.2rem; color: #2d3436;"><i class="fas fa-file-invoice-dollar" style="color:var(--info);"></i> История накладных</span>
1017
+ </div>
1018
+ </div>
1019
+ <div class="category-content" id="orders-history" style="padding: 0 20px 20px 20px; border-top: 1px solid var(--border);">
1020
+ <div style="overflow-x: auto; padding-top: 15px;">
1021
+ <table class="orders-table">
1022
+ <tr>
1023
+ <th>ID / Дата</th>
1024
+ <th>Клиент</th>
1025
+ <th>Сумма</th>
1026
+ <th>Скидка</th>
1027
+ <th>К оплате</th>
1028
+ <th>Действия</th>
1029
+ </tr>
1030
+ {% for order in orders.values()|sort(attribute='created_at', reverse=True) %}
1031
+ {% set raw_total = 0 %}
1032
+ {% for item in order.cart %}
1033
+ {% set raw_total = raw_total + (item.price|float * item.quantity|int) %}
1034
+ {% endfor %}
1035
+ <tr>
1036
+ <td>
1037
+ <a href="/order/{{ order.id }}" target="_blank" style="color:var(--info); font-weight:bold; text-decoration:none;">{{ order.id }}</a><br>
1038
+ <span style="font-size:0.8rem; color:#636e72;">{{ order.created_at }}</span>
1039
+ </td>
1040
+ <td style="font-size:0.9rem;">
1041
+ {{ order.customer_name }}<br>
1042
+ <i class="fas fa-phone" style="font-size:0.7rem; color:#999;"></i> {{ order.customer_phone }}<br>
1043
+ <i class="fas fa-map-marker-alt" style="font-size:0.7rem; color:#999;"></i> {{ order.customer_city }}
1044
+ </td>
1045
+ <td style="font-weight:600;">{{ raw_total }} {{ currency_code }}</td>
1046
+ <td>
1047
+ <form method="POST" style="display:flex; gap:5px; margin:0; align-items:center;">
1048
+ <input type="hidden" name="action" value="apply_discount">
1049
+ <input type="hidden" name="order_id" value="{{ order.id }}">
1050
+ <input type="number" name="discount_amount" value="{{ order.discount|default(0) }}" min="0" step="0.01" style="width:80px; padding:6px; font-size:0.9rem;">
1051
+ <button type="submit" class="btn btn-warning" style="padding:6px 10px;" title="Применить скидку"><i class="fas fa-check"></i></button>
1052
+ </form>
1053
+ </td>
1054
+ <td style="font-weight:800; color:var(--success);">{{ order.total_price }} {{ currency_code }}</td>
1055
+ <td>
1056
+ <a href="/order/{{ order.id }}" class="btn btn-primary" style="padding:6px 10px;" target="_blank"><i class="fas fa-eye"></i></a>
1057
+ </td>
1058
+ </tr>
1059
+ {% endfor %}
1060
+ </table>
1061
+ </div>
1062
  </div>
1063
  </div>
1064
 
 
1512
  threading.Thread(target=periodic_backup, daemon=True).start()
1513
 
1514
  port = int(os.environ.get('PORT', 7860))
1515
+ app.run(host='0.0.0.0', port=port)