You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
5.5 KiB
160 lines
5.5 KiB
<!doctype html> |
|
<html> |
|
<head> |
|
<title>Edit Service</title> |
|
<link rel="icon" type="image/png" href="/static/favicon.png"> |
|
</head> |
|
<body> |
|
|
|
<h1>Edit Service</h1> |
|
|
|
<p><a href="/">Home</a></p> |
|
<p> |
|
<a href="/services">Back to Services</a> | |
|
<a href="/service-templates">Service Templates</a> |
|
</p> |
|
|
|
{% if errors %} |
|
<div style="border:1px solid red; padding:10px; margin-bottom:15px;"> |
|
<strong>Please fix the following:</strong> |
|
<ul> |
|
{% for error in errors %} |
|
<li>{{ error }}</li> |
|
{% endfor %} |
|
</ul> |
|
</div> |
|
{% endif %} |
|
|
|
<form method="post"> |
|
|
|
<p> |
|
Service Code<br> |
|
<input value="{{ service.service_code }}" readonly> |
|
</p> |
|
|
|
<p> |
|
Client *<br> |
|
<select name="client_id" required> |
|
<option value="">Select client</option> |
|
{% for c in clients %} |
|
<option value="{{ c.id }}" {% if service.client_id == c.id %}selected{% endif %}> |
|
{{ c.client_code }} - {{ c.company_name }} |
|
</option> |
|
{% endfor %} |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Load from Template<br> |
|
<select id="template_select"> |
|
<option value="">-- select template --</option> |
|
{% for t in templates %} |
|
<option |
|
value="{{ t.id }}" |
|
data-name="{{ t.template_name }}" |
|
data-type="{{ t.service_type }}" |
|
data-cycle="{{ t.billing_cycle }}" |
|
data-currency="{{ t.currency_code }}" |
|
data-recurring="{{ t.recurring_amount }}" |
|
data-setup="{{ t.setup_amount }}" |
|
data-description="{{ (t.description or '')|e }}" |
|
> |
|
{{ t.template_name }} ({{ t.recurring_amount|money(t.currency_code) }}{% if t.setup_amount and t.setup_amount != 0 %}, setup {{ t.setup_amount|money(t.currency_code) }}{% endif %}) |
|
</option> |
|
{% endfor %} |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Service Name *<br> |
|
<input name="service_name" value="{{ service.service_name }}" required> |
|
</p> |
|
|
|
<p> |
|
Service Type *<br> |
|
<select name="service_type" required> |
|
<option value="hosting" {% if service.service_type == 'hosting' %}selected{% endif %}>hosting</option> |
|
<option value="rpc" {% if service.service_type == 'rpc' %}selected{% endif %}>rpc</option> |
|
<option value="explorer" {% if service.service_type == 'explorer' %}selected{% endif %}>explorer</option> |
|
<option value="node" {% if service.service_type == 'node' %}selected{% endif %}>node</option> |
|
<option value="ipfs" {% if service.service_type == 'ipfs' %}selected{% endif %}>ipfs</option> |
|
<option value="consulting" {% if service.service_type == 'consulting' %}selected{% endif %}>consulting</option> |
|
<option value="crypto_infra" {% if service.service_type == 'crypto_infra' %}selected{% endif %}>Crypto Infra</option> |
|
<option value="other" {% if service.service_type == 'other' %}selected{% endif %}>other</option> |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Billing Cycle *<br> |
|
<select name="billing_cycle" required> |
|
<option value="one_time" {% if service.billing_cycle == 'one_time' %}selected{% endif %}>one_time</option> |
|
<option value="monthly" {% if service.billing_cycle == 'monthly' %}selected{% endif %}>monthly</option> |
|
<option value="quarterly" {% if service.billing_cycle == 'quarterly' %}selected{% endif %}>quarterly</option> |
|
<option value="yearly" {% if service.billing_cycle == 'yearly' %}selected{% endif %}>yearly</option> |
|
<option value="manual" {% if service.billing_cycle == 'manual' %}selected{% endif %}>manual</option> |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Currency Code *<br> |
|
<select name="currency_code" required> |
|
<option value="CAD" {% if service.currency_code == 'CAD' %}selected{% endif %}>CAD</option> |
|
<option value="ETHO" {% if service.currency_code == 'ETHO' %}selected{% endif %}>ETHO</option> |
|
<option value="EGAZ" {% if service.currency_code == 'EGAZ' %}selected{% endif %}>EGAZ</option> |
|
<option value="ALT" {% if service.currency_code == 'ALT' %}selected{% endif %}>ALT</option> |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Recurring Amount *<br> |
|
<input type="number" step="0.00000001" min="0" name="recurring_amount" value="{{ service.recurring_amount }}" required> |
|
</p> |
|
|
|
<p> |
|
Status *<br> |
|
<select name="status" required> |
|
<option value="pending" {% if service.status == 'pending' %}selected{% endif %}>pending</option> |
|
<option value="active" {% if service.status == 'active' %}selected{% endif %}>active</option> |
|
<option value="suspended" {% if service.status == 'suspended' %}selected{% endif %}>suspended</option> |
|
<option value="cancelled" {% if service.status == 'cancelled' %}selected{% endif %}>cancelled</option> |
|
</select> |
|
</p> |
|
|
|
<p> |
|
Start Date<br> |
|
<input type="date" name="start_date" value="{{ service.start_date }}"> |
|
</p> |
|
|
|
<p> |
|
Description<br> |
|
<textarea name="description" rows="5" cols="60">{{ service.description or '' }}</textarea> |
|
</p> |
|
|
|
<p> |
|
<button type="submit">Save Service</button> |
|
</p> |
|
|
|
</form> |
|
|
|
<script> |
|
(function() { |
|
var select = document.getElementById("template_select"); |
|
if (!select) return; |
|
|
|
select.addEventListener("change", function() { |
|
var opt = this.options[this.selectedIndex]; |
|
if (!opt || !opt.dataset || !opt.dataset.name) return; |
|
|
|
document.querySelector('[name="service_name"]').value = opt.dataset.name || ''; |
|
document.querySelector('[name="service_type"]').value = opt.dataset.type || 'other'; |
|
document.querySelector('[name="billing_cycle"]').value = opt.dataset.cycle || 'monthly'; |
|
document.querySelector('[name="currency_code"]').value = opt.dataset.currency || 'CAD'; |
|
document.querySelector('[name="recurring_amount"]').value = opt.dataset.recurring || '0.00000000'; |
|
document.querySelector('[name="description"]').value = opt.dataset.description || ''; |
|
}); |
|
})(); |
|
</script> |
|
|
|
{% include "footer.html" %} |
|
</body> |
|
</html>
|
|
|