fix: usdt input min validasyonu

This commit is contained in:
Mukan Erkin TÖRÜK 2026-04-19 06:56:07 +03:00
parent f288eee5af
commit 43562be810

View file

@ -258,7 +258,9 @@ async function loadSymbols() {
onChange(value) { onChange(value) {
const item = allSymbols.find(s => s.symbol === value); const item = allSymbols.find(s => s.symbol === value);
if (!item) return; if (!item) return;
document.getElementById('f-usdt').value = item.min_notional; const usdtInput = document.getElementById('f-usdt');
usdtInput.value = item.min_notional;
usdtInput.min = item.min_notional;
document.getElementById('f-min-label').textContent = `(min ${item.min_notional} USDT)`; document.getElementById('f-min-label').textContent = `(min ${item.min_notional} USDT)`;
}, },
}); });
@ -340,7 +342,10 @@ async function createBot() {
const usdt_amount = parseFloat(document.getElementById('f-usdt').value); const usdt_amount = parseFloat(document.getElementById('f-usdt').value);
const profit_percent = parseFloat(document.getElementById('f-profit').value); const profit_percent = parseFloat(document.getElementById('f-profit').value);
const testnet = document.getElementById('f-testnet').value === 'true'; const testnet = document.getElementById('f-testnet').value === 'true';
const usdtInput = document.getElementById('f-usdt');
const minNotional = parseFloat(usdtInput.min) || 0;
if (!name || !symbol || !usdt_amount || !profit_percent) { alert('Tüm alanları doldurun'); return; } if (!name || !symbol || !usdt_amount || !profit_percent) { alert('Tüm alanları doldurun'); return; }
if (usdt_amount < minNotional) { alert(`Minimum işlem miktarı ${minNotional} USDT`); usdtInput.focus(); return; }
await api('POST', '/bots', { name, symbol, timeframe, usdt_amount, profit_percent, testnet }); await api('POST', '/bots', { name, symbol, timeframe, usdt_amount, profit_percent, testnet });
closeModal(); closeModal();
document.getElementById('f-name').value = ''; document.getElementById('f-name').value = '';