Fix: добавлена передача данных о текущем складе в JavaScript
Исправлена ошибка 'currentWarehouse is not defined' при проведении продажи. Добавлен JSON блок currentWarehouseData в template и инициализация переменной currentWarehouse в terminal.js. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -64,13 +64,16 @@ function saveCartToRedis() {
|
|||||||
}, 500); // Debounce 500ms
|
}, 500); // Debounce 500ms
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== УПРАВЛЕНИЕ КЛИЕНТОМ =====
|
// ===== УПРАВЛЕНИЕ КЛИЕНТОМ И СКЛАДОМ =====
|
||||||
// Загружаем данные системного клиента
|
// Загружаем данные системного клиента
|
||||||
const SYSTEM_CUSTOMER = JSON.parse(document.getElementById('systemCustomerData').textContent);
|
const SYSTEM_CUSTOMER = JSON.parse(document.getElementById('systemCustomerData').textContent);
|
||||||
|
|
||||||
// Текущий выбранный клиент (загружается из Redis или системный)
|
// Текущий выбранный клиент (загружается из Redis или системный)
|
||||||
let selectedCustomer = JSON.parse(document.getElementById('selectedCustomerData').textContent);
|
let selectedCustomer = JSON.parse(document.getElementById('selectedCustomerData').textContent);
|
||||||
|
|
||||||
|
// Текущий склад
|
||||||
|
const currentWarehouse = JSON.parse(document.getElementById('currentWarehouseData').textContent);
|
||||||
|
|
||||||
function formatMoney(v) {
|
function formatMoney(v) {
|
||||||
return (Number(v)).toFixed(2);
|
return (Number(v)).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -497,6 +497,12 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="cartData" type="application/json">{{ cart_data|safe }}</script>
|
<script id="cartData" type="application/json">{{ cart_data|safe }}</script>
|
||||||
|
<script id="currentWarehouseData" type="application/json">
|
||||||
|
{
|
||||||
|
"id": {% if current_warehouse %}{{ current_warehouse.id }}{% else %}null{% endif %},
|
||||||
|
"name": "{% if current_warehouse %}{{ current_warehouse.name|escapejs }}{% else %}""{% endif %}"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script src="{% static 'pos/js/terminal.js' %}"></script>
|
<script src="{% static 'pos/js/terminal.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user