diff --git a/myproject/orders/static/orders/js/payment_widget.js b/myproject/orders/static/orders/js/payment_widget.js
index eda750d..da6e18b 100644
--- a/myproject/orders/static/orders/js/payment_widget.js
+++ b/myproject/orders/static/orders/js/payment_widget.js
@@ -164,15 +164,18 @@ export class PaymentWidget {
const amountInput = document.getElementById(`${this.containerId}-amount`);
const hint = document.getElementById(`${this.containerId}-hint`);
+ // Вычисляем остаток с учетом уже добавленных платежей
+ const remaining = this.order.amount_due - this.getTotalPayments();
+
if (this.selectedMethod.code === 'account_balance' && this.customer) {
- const maxAmount = Math.min(this.order.amount_due, this.customer.wallet_balance);
+ const maxAmount = Math.min(remaining, this.customer.wallet_balance);
amountInput.max = maxAmount;
amountInput.value = maxAmount.toFixed(2);
- hint.textContent = `Макс: ${maxAmount.toFixed(2)} руб.`;
+ hint.textContent = `Макс: ${maxAmount.toFixed(2)} руб. | Осталось: ${remaining.toFixed(2)} руб.`;
} else {
amountInput.removeAttribute('max');
- amountInput.value = this.order.amount_due.toFixed(2);
- hint.textContent = '';
+ amountInput.value = remaining.toFixed(2);
+ hint.textContent = `Осталось оплатить: ${remaining.toFixed(2)} руб.`;
}
}
diff --git a/myproject/pos/templates/pos/terminal.html b/myproject/pos/templates/pos/terminal.html
index 7c01bbe..325b8dc 100644
--- a/myproject/pos/templates/pos/terminal.html
+++ b/myproject/pos/templates/pos/terminal.html
@@ -504,5 +504,5 @@
}
-
+
{% endblock %}