5 changed files with 246 additions and 26 deletions
@ -1,14 +1,13 @@ |
|||||||
import re |
import re |
||||||
|
|
||||||
def generate_client_code(company_name, last_number): |
def generate_client_code(company_name, last_number): |
||||||
# remove non letters |
cleaned = re.sub(r'[^A-Za-z]', '', (company_name or '').upper()) |
||||||
cleaned = re.sub(r'[^A-Za-z]', '', company_name.upper()) |
suffix = cleaned[:5] or "CLIENT" |
||||||
|
|
||||||
# first 5 characters |
|
||||||
suffix = cleaned[:5] |
|
||||||
|
|
||||||
number = last_number + 1 |
number = last_number + 1 |
||||||
|
return f"{number:04d}-{suffix}" |
||||||
|
|
||||||
code = f"{number:04d}-{suffix}" |
def generate_service_code(service_name, last_number): |
||||||
|
cleaned = re.sub(r'[^A-Za-z]', '', (service_name or '').upper()) |
||||||
return code |
suffix = cleaned[:5] or "SERVI" |
||||||
|
number = last_number + 1 |
||||||
|
return f"SVC-{number:04d}-{suffix}" |
||||||
|
|||||||
@ -0,0 +1,45 @@ |
|||||||
|
<!doctype html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<title>Services</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
|
||||||
|
<h1>Services</h1> |
||||||
|
|
||||||
|
<p><a href="/">Home</a></p> |
||||||
|
<p><a href="/services/new">Add Service</a></p> |
||||||
|
|
||||||
|
<table border="1" cellpadding="6"> |
||||||
|
<tr> |
||||||
|
<th>ID</th> |
||||||
|
<th>Service Code</th> |
||||||
|
<th>Client</th> |
||||||
|
<th>Service Name</th> |
||||||
|
<th>Type</th> |
||||||
|
<th>Cycle</th> |
||||||
|
<th>Currency</th> |
||||||
|
<th>Amount</th> |
||||||
|
<th>Status</th> |
||||||
|
<th>Start Date</th> |
||||||
|
</tr> |
||||||
|
|
||||||
|
{% for s in services %} |
||||||
|
<tr> |
||||||
|
<td>{{ s.id }}</td> |
||||||
|
<td>{{ s.service_code }}</td> |
||||||
|
<td>{{ s.client_code }} - {{ s.company_name }}</td> |
||||||
|
<td>{{ s.service_name }}</td> |
||||||
|
<td>{{ s.service_type }}</td> |
||||||
|
<td>{{ s.billing_cycle }}</td> |
||||||
|
<td>{{ s.currency_code }}</td> |
||||||
|
<td>{{ s.recurring_amount }}</td> |
||||||
|
<td>{{ s.status }}</td> |
||||||
|
<td>{{ s.start_date }}</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
|
||||||
|
</table> |
||||||
|
|
||||||
|
</body> |
||||||
|
</html> |
||||||
@ -0,0 +1,93 @@ |
|||||||
|
<!doctype html> |
||||||
|
<html> |
||||||
|
<head> |
||||||
|
<title>New Service</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
|
||||||
|
<h1>Add Service</h1> |
||||||
|
|
||||||
|
<form method="post"> |
||||||
|
|
||||||
|
<p> |
||||||
|
Client<br> |
||||||
|
<select name="client_id" required> |
||||||
|
<option value="">Select client</option> |
||||||
|
{% for c in clients %} |
||||||
|
<option value="{{ c.id }}">{{ c.client_code }} - {{ c.company_name }}</option> |
||||||
|
{% endfor %} |
||||||
|
</select> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Service Name<br> |
||||||
|
<input name="service_name" required> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Service Type<br> |
||||||
|
<select name="service_type" required> |
||||||
|
<option value="hosting">hosting</option> |
||||||
|
<option value="rpc">rpc</option> |
||||||
|
<option value="explorer">explorer</option> |
||||||
|
<option value="node">node</option> |
||||||
|
<option value="ipfs">ipfs</option> |
||||||
|
<option value="consulting">consulting</option> |
||||||
|
<option value="other">other</option> |
||||||
|
</select> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Billing Cycle<br> |
||||||
|
<select name="billing_cycle" required> |
||||||
|
<option value="one_time">one_time</option> |
||||||
|
<option value="monthly" selected>monthly</option> |
||||||
|
<option value="quarterly">quarterly</option> |
||||||
|
<option value="yearly">yearly</option> |
||||||
|
<option value="manual">manual</option> |
||||||
|
</select> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Currency Code<br> |
||||||
|
<select name="currency_code" required> |
||||||
|
<option value="CAD" selected>CAD</option> |
||||||
|
<option value="ETHO">ETHO</option> |
||||||
|
<option value="EGAZ">EGAZ</option> |
||||||
|
<option value="ALT">ALT</option> |
||||||
|
</select> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Recurring Amount<br> |
||||||
|
<input type="number" step="0.00000001" name="recurring_amount" value="0.00000000" required> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Status<br> |
||||||
|
<select name="status" required> |
||||||
|
<option value="pending">pending</option> |
||||||
|
<option value="active" selected>active</option> |
||||||
|
<option value="suspended">suspended</option> |
||||||
|
<option value="cancelled">cancelled</option> |
||||||
|
</select> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Start Date<br> |
||||||
|
<input type="date" name="start_date"> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
Description<br> |
||||||
|
<textarea name="description" rows="5" cols="60"></textarea> |
||||||
|
</p> |
||||||
|
|
||||||
|
<p> |
||||||
|
<button type="submit">Create Service</button> |
||||||
|
</p> |
||||||
|
|
||||||
|
</form> |
||||||
|
|
||||||
|
</body> |
||||||
|
</html> |
||||||
Loading…
Reference in new issue