mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-26 04:18:29 +02:00
Further improvements to deposit and registrar pages
This commit is contained in:
parent
c4b69480d9
commit
97f0c1db88
3 changed files with 85 additions and 105 deletions
|
@ -12,19 +12,24 @@ class FinancialsController extends Controller
|
||||||
{
|
{
|
||||||
return view($response,'admin/financials/transactions.twig');
|
return view($response,'admin/financials/transactions.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function overview(Request $request, Response $response)
|
public function overview(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/financials/overview.twig');
|
return view($response,'admin/financials/overview.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pricing(Request $request, Response $response)
|
public function pricing(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/financials/pricing.twig');
|
return view($response,'admin/financials/pricing.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deposit(Request $request, Response $response)
|
public function deposit(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/financials/deposit.twig');
|
$db = $this->container->get('db');
|
||||||
|
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||||
|
|
||||||
|
return view($response,'admin/financials/deposit.twig', [
|
||||||
|
'registrars' => $registrars
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "layouts/app.twig" %}
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ __('Price Management') }}{% endblock %}
|
{% block title %}{{ __('Registrar Deposit') }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
|
@ -14,28 +14,9 @@
|
||||||
Overview
|
Overview
|
||||||
</div>
|
</div>
|
||||||
<h2 class="page-title">
|
<h2 class="page-title">
|
||||||
{{ __('Price Management') }}
|
{{ __('Registrar Deposit') }}
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<!-- Page title actions -->
|
|
||||||
<div class="col-auto ms-auto d-print-none">
|
|
||||||
<div class="btn-list">
|
|
||||||
<span class="d-none d-sm-inline">
|
|
||||||
<a href="#" class="btn">
|
|
||||||
New view
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" data-bs-target="#modal-report">
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
|
||||||
Create new report
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" data-bs-target="#modal-report" aria-label="Create new report">
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,88 +25,82 @@
|
||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-body">
|
||||||
<h2 class="text-center">Registrar Deposit</h2>
|
<form id="depositForm">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="registrarSelect" class="form-label">Registrar</label>
|
||||||
|
<select class="form-select" id="registrarSelect" name="registrar" required>
|
||||||
|
<option selected disabled value="">Choose Registrar...</option>
|
||||||
|
{% for registrar in registrars %}
|
||||||
|
<option value="{{ registrar.id }}">{{ registrar.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mt-4">
|
<div class="deposit-info">
|
||||||
<div class="col-md-8 offset-md-2">
|
<h5>Current Funds for <span id="registrarName"></span></h5>
|
||||||
<form id="depositForm">
|
<p class="fs-4">$<span id="currentFunds">0.00</span></p>
|
||||||
<!-- Registrar Dropdown -->
|
</div>
|
||||||
<div class="mb-3">
|
|
||||||
<label for="registrarSelect" class="form-label">Registrar</label>
|
<div class="mb-3">
|
||||||
<select class="form-select" id="registrarSelect" required>
|
<label for="amount" class="form-label">Amount</label>
|
||||||
<option selected disabled value="">Choose Registrar...</option>
|
<input type="number" step="0.01" class="form-control" id="amount" placeholder="Enter deposit amount" required>
|
||||||
<!-- Sample options. You'd dynamically populate this in a real scenario -->
|
</div>
|
||||||
<option value="1">Registrar A</option>
|
|
||||||
<option value="2">Registrar B</option>
|
<div class="mb-3">
|
||||||
</select>
|
<label for="description" class="form-label">Description</label>
|
||||||
|
<textarea class="form-control" id="description" rows="3" placeholder="Optional deposit description"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
<!-- Deposit Info -->
|
<div class="row align-items-center">
|
||||||
<div class="deposit-info">
|
<div class="col-auto">
|
||||||
<h5>Current Funds for <span id="registrarName"></span></h5>
|
<button type="submit" class="btn btn-primary">Add Deposit</button>
|
||||||
<p class="fs-4">$<span id="currentFunds">0.00</span></p>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const registrarSelect = document.getElementById('registrarSelect');
|
||||||
|
registrarSelect.addEventListener('change', function() {
|
||||||
|
// Mock API call to get current funds for the selected registrar
|
||||||
|
fetch(`https://api.example.com/registrarFunds/${registrarSelect.value}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const registrarName = registrarSelect.options[registrarSelect.selectedIndex].text;
|
||||||
|
document.getElementById('registrarName').textContent = registrarName;
|
||||||
|
document.getElementById('currentFunds').textContent = data.funds.toFixed(2);
|
||||||
|
document.querySelector('.deposit-info').style.display = 'block';
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('There was an error with the request:', error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
<!-- Amount Input -->
|
document.getElementById('depositForm').addEventListener('submit', function(e) {
|
||||||
<div class="mb-3">
|
e.preventDefault();
|
||||||
<label for="amount" class="form-label">Amount</label>
|
|
||||||
<input type="number" step="0.01" class="form-control" id="amount" placeholder="Enter deposit amount" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Description Input -->
|
const amount = document.getElementById('amount').value;
|
||||||
<div class="mb-3">
|
|
||||||
<label for="description" class="form-label">Description</label>
|
|
||||||
<textarea class="form-control" id="description" rows="3" placeholder="Optional deposit description"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Submit Button -->
|
// Mock API call to add deposit
|
||||||
<button type="submit" class="btn btn-primary">Submit Deposit</button>
|
fetch("https://api.example.com/addDeposit", {
|
||||||
</form>
|
method: "POST",
|
||||||
</div>
|
headers: {
|
||||||
</div>
|
"Content-Type": "application/json"
|
||||||
</div>
|
},
|
||||||
|
body: JSON.stringify({ registrarId: registrarSelect.value, amount: amount })
|
||||||
<script>
|
})
|
||||||
const registrarSelect = document.getElementById('registrarSelect');
|
.then(response => response.json())
|
||||||
registrarSelect.addEventListener('change', function() {
|
.then(data => {
|
||||||
// Mock API call to get current funds for the selected registrar
|
// Update the displayed funds after deposit
|
||||||
fetch(`https://api.example.com/registrarFunds/${registrarSelect.value}`)
|
document.getElementById('currentFunds').textContent = data.newFunds.toFixed(2);
|
||||||
.then(response => response.json())
|
})
|
||||||
.then(data => {
|
.catch(error => {
|
||||||
const registrarName = registrarSelect.options[registrarSelect.selectedIndex].text;
|
console.error('There was an error with the request:', error);
|
||||||
document.getElementById('registrarName').textContent = registrarName;
|
});
|
||||||
document.getElementById('currentFunds').textContent = data.funds.toFixed(2);
|
});
|
||||||
document.querySelector('.deposit-info').style.display = 'block';
|
</script>
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('There was an error with the request:', error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById('depositForm').addEventListener('submit', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
const amount = document.getElementById('amount').value;
|
|
||||||
|
|
||||||
// Mock API call to add deposit
|
|
||||||
fetch("https://api.example.com/addDeposit", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ registrarId: registrarSelect.value, amount: amount })
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
// Update the displayed funds after deposit
|
|
||||||
document.getElementById('currentFunds').textContent = data.newFunds.toFixed(2);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('There was an error with the request:', error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" data-bs-target="#modal-report">
|
<a href="#" class="btn btn-primary d-none d-sm-inline-block" data-bs-toggle="modal" data-bs-target="#modal-report">
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
Create new report
|
Create new registrar
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" data-bs-target="#modal-report" aria-label="Create new report">
|
<a href="#" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" data-bs-target="#modal-report" aria-label="Create new report">
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
||||||
|
@ -59,9 +59,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="table-responsive mt-3">
|
||||||
<div class="table-responsive">
|
<div id="registrarTable"></div>
|
||||||
<div id="registrarTable"></div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue