mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-25 11:58:19 +02:00
More registrar currency related fixes
This commit is contained in:
parent
4d953d5ac1
commit
f6752b0d26
2 changed files with 30 additions and 29 deletions
|
@ -146,7 +146,6 @@ class FinancialsController extends Controller
|
|||
$data = $request->getParsedBody();
|
||||
$db = $this->container->get('db');
|
||||
$registrar_id = $data['registrar'];
|
||||
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||
$amount = $data['amount'];
|
||||
$description = empty($data['description']) ? "funds added to account balance" : $data['description'];
|
||||
|
||||
|
@ -207,11 +206,9 @@ class FinancialsController extends Controller
|
|||
|
||||
$db = $this->container->get('db');
|
||||
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||
$currency = $_SESSION['_currency'];
|
||||
|
||||
return view($response,'admin/financials/deposit.twig', [
|
||||
'registrars' => $registrars,
|
||||
'currency' => $currency
|
||||
'registrars' => $registrars
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
<div class="deposit-info">
|
||||
<h5>{{ __('Current Balance for') }} <span id="registrarName"></span></h5>
|
||||
<p class="fs-4">{{ currency }} <span id="currentFunds">0.00</span></p>
|
||||
<p class="fs-4"><span id="currentFunds">0.00</span></p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
|
@ -62,33 +62,37 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const registrarSelect = document.getElementById('registrarSelect');
|
||||
registrarSelect.addEventListener('change', function() {
|
||||
const selectedRegistrarId = registrarSelect.value;
|
||||
|
||||
// Real API call to get registrars
|
||||
fetch(`/api/records/registrar`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const registrarData = data.records.find(registrar => registrar.id == selectedRegistrarId);
|
||||
const accountBalance = registrarData ? registrarData.accountBalance : '0.00';
|
||||
|
||||
document.getElementById('registrarName').textContent = registrarData ? registrarData.name : 'N/A';
|
||||
document.getElementById('currentFunds').textContent = parseFloat(accountBalance).toFixed(2);
|
||||
document.querySelector('.deposit-info').style.display = 'block';
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was an error with the request:', error);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'partials/footer.twig' %}
|
||||
</div>
|
||||
<script>
|
||||
const registrarSelect = document.getElementById('registrarSelect');
|
||||
registrarSelect.addEventListener('change', function() {
|
||||
const selectedRegistrarId = registrarSelect.value;
|
||||
|
||||
// API call to get registrar details
|
||||
fetch(`/api/records/registrar`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const registrarData = data.records.find(registrar => registrar.id == selectedRegistrarId);
|
||||
|
||||
if (registrarData) {
|
||||
document.getElementById('registrarName').textContent = registrarData.name;
|
||||
document.getElementById('currentFunds').textContent = `${registrarData.currency} ${parseFloat(registrarData.accountBalance).toFixed(2)}`;
|
||||
} else {
|
||||
document.getElementById('registrarName').textContent = 'N/A';
|
||||
document.getElementById('currentFunds').textContent = '0.00';
|
||||
}
|
||||
|
||||
document.querySelector('.deposit-info').style.display = 'block';
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was an error with the request:', error);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue