mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-26 06:04:45 +02:00
Added deposit UI
This commit is contained in:
parent
92767a834c
commit
fc72a57bdd
4 changed files with 156 additions and 2 deletions
|
@ -22,4 +22,9 @@ class FinancialsController extends Controller
|
|||
{
|
||||
return view($response,'admin/financials/pricing.twig');
|
||||
}
|
||||
|
||||
public function deposit(Request $request, Response $response)
|
||||
{
|
||||
return view($response,'admin/financials/deposit.twig');
|
||||
}
|
||||
}
|
148
cp/resources/views/admin/financials/deposit.twig
Normal file
148
cp/resources/views/admin/financials/deposit.twig
Normal file
|
@ -0,0 +1,148 @@
|
|||
{% extends "layouts/app.twig" %}
|
||||
|
||||
{% block title %}{{ __('Price Management') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-wrapper">
|
||||
<!-- Page header -->
|
||||
<div class="page-header d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col">
|
||||
<!-- Page pre-title -->
|
||||
<div class="page-pretitle">
|
||||
Overview
|
||||
</div>
|
||||
<h2 class="page-title">
|
||||
{{ __('Price Management') }}
|
||||
</h2>
|
||||
</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>
|
||||
<!-- Page body -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body border-bottom py-3">
|
||||
<h2 class="text-center">Registrar Deposit</h2>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<form id="depositForm">
|
||||
<!-- Registrar Dropdown -->
|
||||
<div class="mb-3">
|
||||
<label for="registrarSelect" class="form-label">Registrar</label>
|
||||
<select class="form-select" id="registrarSelect" required>
|
||||
<option selected disabled value="">Choose Registrar...</option>
|
||||
<!-- Sample options. You'd dynamically populate this in a real scenario -->
|
||||
<option value="1">Registrar A</option>
|
||||
<option value="2">Registrar B</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Deposit Info -->
|
||||
<div class="deposit-info">
|
||||
<h5>Current Funds for <span id="registrarName"></span></h5>
|
||||
<p class="fs-4">$<span id="currentFunds">0.00</span></p>
|
||||
</div>
|
||||
|
||||
<!-- Amount Input -->
|
||||
<div class="mb-3">
|
||||
<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 -->
|
||||
<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 -->
|
||||
<button type="submit" class="btn btn-primary">Submit Deposit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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);
|
||||
});
|
||||
});
|
||||
|
||||
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>
|
||||
<footer class="footer footer-transparent d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||
<ul class="list-inline list-inline-dots mb-0">
|
||||
<li class="list-inline-item">
|
||||
Copyright © 2023
|
||||
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -263,7 +263,7 @@
|
|||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li {{ is_current_url('pricing') or is_current_url('transactions') or is_current_url('overview') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||
<li {{ is_current_url('pricing') or is_current_url('deposit') or is_current_url('transactions') or is_current_url('overview') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
|
||||
<span class="nav-link-icon d-md-none d-lg-inline-block"><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"></path><path d="M7 9m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"></path><path d="M14 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M17 9v-2a2 2 0 0 0 -2 -2h-10a2 2 0 0 0 -2 2v6a2 2 0 0 0 2 2h2"></path></svg>
|
||||
</span>
|
||||
|
@ -275,7 +275,7 @@
|
|||
<a class="dropdown-item" href="{{route('pricing')}}">
|
||||
{{ __('Pricing') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{route('hosts')}}">
|
||||
<a class="dropdown-item" href="{{route('deposit')}}">
|
||||
{{ __('Add Deposit') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
|
@ -56,6 +56,7 @@ $app->group('', function ($route) {
|
|||
$route->get('/reports', ReportsController::class .':view')->setName('reports');
|
||||
|
||||
$route->get('/pricing', FinancialsController::class .':pricing')->setName('pricing');
|
||||
$route->get('/deposit', FinancialsController::class .':deposit')->setName('deposit');
|
||||
$route->get('/transactions', FinancialsController::class .':transactions')->setName('transactions');
|
||||
$route->get('/overview', FinancialsController::class .':overview')->setName('overview');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue