diff --git a/modules/mining-checker/assets/js/app.js b/modules/mining-checker/assets/js/app.js index cdfc3ace..78be5698 100644 --- a/modules/mining-checker/assets/js/app.js +++ b/modules/mining-checker/assets/js/app.js @@ -1609,6 +1609,7 @@ headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(raw), }); + invalidateProjectBootstrapCache(projectKey); setMessage(fromPreview ? 'OCR-Vorschlag bestaetigt und gespeichert.' : 'Messpunkt gespeichert.'); setMeasurementForm({ measured_at: '', @@ -1672,6 +1673,7 @@ await request(`${apiBase}/projects/${encodeURIComponent(projectKey)}/measurements/${encodeURIComponent(id)}`, { method: 'DELETE', }); + invalidateProjectBootstrapCache(projectKey); setMessage('Messpunkt geloescht.'); await reloadBootstrapAfterMutation('Messpunkt geloescht.'); } catch (err) { @@ -1693,6 +1695,7 @@ body: JSON.stringify(importForm), timeoutMs: 20000, }); + invalidateProjectBootstrapCache(projectKey); const summary = [ `${result.imported || 0} importiert`, @@ -2511,6 +2514,7 @@ message ? h('div', { key: 'message', className: 'mc-alert mc-alert--success' }, message) : null, loading ? h('div', { key: 'loading', className: 'mc-alert mc-alert--warning' }, 'Mining-Checker Daten werden aktualisiert …') : null, renderTab(), + renderWalletModals(), ]), ]), ]), @@ -3529,6 +3533,40 @@ ]); } + function renderWalletModals() { + if (activeTab !== 'wallet') { + return null; + } + + return [ + payoutModalOpen ? renderModal('Teiluebertragung ins NC Wallet', [ + h('form', { key: 'form', className: 'mc-form', onSubmit: submitPayout }, [ + h('div', { key: 'hint', className: 'mc-text' }, 'Hier kannst du einen Teilbetrag vom aktuellen Miner-Bestand in das NC Wallet uebertragen.'), + inputField('Transferzeitpunkt', 'datetime-local', payoutForm.payout_at, (value) => setPayoutForm({ ...payoutForm, payout_at: value })), + inputField('Coins', 'number', payoutForm.coins_amount, (value) => setPayoutForm({ ...payoutForm, coins_amount: value }), '0.000001'), + selectField('Waehrung', payoutForm.payout_currency, [currentMiningCurrency].concat(selectableCurrencies.map((currency) => currency.code).filter((code) => code !== currentMiningCurrency)), (value) => setPayoutForm({ ...payoutForm, payout_currency: value })), + textareaField('Notiz', payoutForm.note, (value) => setPayoutForm({ ...payoutForm, note: value })), + h('div', { className: 'mc-inline-row' }, [ + h('button', { type: 'button', className: 'mc-button mc-button--ghost', onClick: () => setPayoutModalOpen(false) }, 'Abbrechen'), + h('button', { type: 'submit', className: 'mc-button mc-button--secondary', disabled: saving }, saving ? 'Speichert …' : 'Transfer speichern'), + ]), + ]), + ], () => setPayoutModalOpen(false)) : null, + walletWithdrawalModalOpen ? renderModal('Aus NC Wallet auszahlen', [ + h('form', { key: 'form', className: 'mc-form', onSubmit: submitWalletWithdrawal }, [ + inputField('Auszahlungszeitpunkt', 'datetime-local', walletWithdrawalForm.withdrawal_at, (value) => setWalletWithdrawalForm({ ...walletWithdrawalForm, withdrawal_at: value })), + inputField('Coins', 'number', walletWithdrawalForm.coins_amount, (value) => setWalletWithdrawalForm({ ...walletWithdrawalForm, coins_amount: value }), '0.000001'), + selectField('Waehrung', walletWithdrawalForm.withdrawal_currency, [currentMiningCurrency].concat(selectableCurrencies.map((currency) => currency.code).filter((code) => code !== currentMiningCurrency)), (value) => setWalletWithdrawalForm({ ...walletWithdrawalForm, withdrawal_currency: value })), + textareaField('Notiz', walletWithdrawalForm.note, (value) => setWalletWithdrawalForm({ ...walletWithdrawalForm, note: value })), + h('div', { className: 'mc-inline-row' }, [ + h('button', { type: 'button', className: 'mc-button mc-button--ghost', onClick: () => setWalletWithdrawalModalOpen(false) }, 'Abbrechen'), + h('button', { type: 'submit', className: 'mc-button mc-button--secondary', disabled: saving }, saving ? 'Speichert …' : 'Wallet-Auszahlung speichern'), + ]), + ]), + ], () => setWalletWithdrawalModalOpen(false)) : null, + ]; + } + function panel(title, subtitle, content) { return h('section', { className: 'mc-panel' }, [ h(SectionTitle, { key: 'title', title, subtitle }),