Kgshop commited on
Commit
8dee350
·
verified ·
1 Parent(s): 717e8e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -737,7 +737,7 @@ CATALOG_TEMPLATE = '''
737
  const repoId = '{{ repo_id }}';
738
  const currencyCode = '{{ currency_code }}';
739
  const orgName = `{{ settings.organization_name }}`.replace(/`/g, '');
740
- const enableCart = {{ 'true' if settings.enable_cart else 'false' }};
741
  const envId = '{{ env_id }}';
742
 
743
  const itemsPerPage = 10;
@@ -1726,7 +1726,7 @@ ORDER_TEMPLATE = '''
1726
  <head>
1727
  <meta charset="UTF-8">
1728
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1729
- <title>Заказ #{{ order.id }}</title>
1730
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap" rel="stylesheet">
1731
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
1732
  <style>
@@ -1753,35 +1753,35 @@ ORDER_TEMPLATE = '''
1753
  <div class="invoice-box">
1754
  <div class="header">
1755
  <h1>Накладная заказа</h1>
1756
- <p style="margin-top: 5px; color: #777;">#{{ order.id }} от {{ order.date }}</p>
1757
  </div>
1758
  <div class="info">
1759
- <p><strong>Покупатель:</strong> {{ order.customer_name }}</p>
1760
- <p><strong>Телефон:</strong> {{ order.customer_phone }}</p>
1761
- <p><strong>Продавец:</strong> {{ settings.organization_name }}</p>
1762
  </div>
1763
 
1764
  <div class="items">
1765
- {% for pid, item in order.items.items() %}
1766
  <div class="item">
1767
- {% if item.photo %}
1768
- <img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ item.photo }}" alt="{{ item.name }}">
1769
  {% else %}
1770
  <img src="https://via.placeholder.com/60x60.png?text=Фото" alt="Нет фото">
1771
  {% endif %}
1772
  <div class="item-details">
1773
- <div class="item-name">{{ item.name }}</div>
1774
- <div class="item-meta">{{ item.qty }} шт. × {{ "%.2f"|format(item.price) }} {{ currency }}</div>
1775
  </div>
1776
  <div class="item-sum">
1777
- {{ "%.2f"|format(item.qty * item.price) }} {{ currency }}
1778
  </div>
1779
  </div>
1780
  {% endfor %}
1781
  </div>
1782
 
1783
  <div class="total">
1784
- Итого: {{ "%.2f"|format(order.total) }} {{ currency }}
1785
  </div>
1786
 
1787
  {% if send_link != "#" %}
 
737
  const repoId = '{{ repo_id }}';
738
  const currencyCode = '{{ currency_code }}';
739
  const orgName = `{{ settings.organization_name }}`.replace(/`/g, '');
740
+ const enableCart = {{ 'true' if settings.get('enable_cart', False) else 'false' }};
741
  const envId = '{{ env_id }}';
742
 
743
  const itemsPerPage = 10;
 
1726
  <head>
1727
  <meta charset="UTF-8">
1728
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1729
+ <title>Заказ #{{ order['id'] }}</title>
1730
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap" rel="stylesheet">
1731
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
1732
  <style>
 
1753
  <div class="invoice-box">
1754
  <div class="header">
1755
  <h1>Накладная заказа</h1>
1756
+ <p style="margin-top: 5px; color: #777;">#{{ order['id'] }} от {{ order['date'] }}</p>
1757
  </div>
1758
  <div class="info">
1759
+ <p><strong>Покупатель:</strong> {{ order['customer_name'] }}</p>
1760
+ <p><strong>Телефон:</strong> {{ order['customer_phone'] }}</p>
1761
+ <p><strong>Продавец:</strong> {{ settings['organization_name'] }}</p>
1762
  </div>
1763
 
1764
  <div class="items">
1765
+ {% for pid, item in order['items'].items() %}
1766
  <div class="item">
1767
+ {% if item['photo'] %}
1768
+ <img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ item['photo'] }}" alt="{{ item['name'] }}">
1769
  {% else %}
1770
  <img src="https://via.placeholder.com/60x60.png?text=Фото" alt="Нет фото">
1771
  {% endif %}
1772
  <div class="item-details">
1773
+ <div class="item-name">{{ item['name'] }}</div>
1774
+ <div class="item-meta">{{ item['qty'] }} шт. × {{ "%.2f"|format(item['price']|float) }} {{ currency }}</div>
1775
  </div>
1776
  <div class="item-sum">
1777
+ {{ "%.2f"|format(item['qty']|int * item['price']|float) }} {{ currency }}
1778
  </div>
1779
  </div>
1780
  {% endfor %}
1781
  </div>
1782
 
1783
  <div class="total">
1784
+ Итого: {{ "%.2f"|format(order['total']|float) }} {{ currency }}
1785
  </div>
1786
 
1787
  {% if send_link != "#" %}