add admin order confirm page
This commit is contained in:
parent
233fe39b32
commit
2c5d46d4b3
8 changed files with 70 additions and 6 deletions
|
@ -7,7 +7,7 @@ from .forms import ChargeForm, Addr2PoolForm, OrderForm
|
||||||
|
|
||||||
from .. import db
|
from .. import db
|
||||||
from ..email import send_email
|
from ..email import send_email
|
||||||
from ..models import User, Transaction, Server, Deployment, Service, Region, Address, Domain, contact_proxmaster
|
from ..models import User, Transaction, Order, Server, Deployment, Service, Region, Address, Domain, contact_proxmaster
|
||||||
from ..decorators import admin_required, permission_required
|
from ..decorators import admin_required, permission_required
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
@ -34,6 +34,12 @@ def after_request(response):
|
||||||
def index():
|
def index():
|
||||||
return redirect(url_for('admin.list_users'))
|
return redirect(url_for('admin.list_users'))
|
||||||
|
|
||||||
|
@admin.route("/listorders", methods=['GET', 'POST'])
|
||||||
|
@fresh_login_required
|
||||||
|
@admin_required
|
||||||
|
def list_orders():
|
||||||
|
AllOrders = Order.query.all()
|
||||||
|
return render_template('admin/list_orders.html', orders=AllOrders)
|
||||||
|
|
||||||
@admin.route("/listdeployments", methods=['GET'])
|
@admin.route("/listdeployments", methods=['GET'])
|
||||||
@fresh_login_required
|
@fresh_login_required
|
||||||
|
|
|
@ -87,6 +87,7 @@ class User(db.Model, UserMixin):
|
||||||
wallet = db.Column(db.Float)
|
wallet = db.Column(db.Float)
|
||||||
currency = db.Column(db.String, default='BGN')
|
currency = db.Column(db.String, default='BGN')
|
||||||
inv_transactions = db.relationship('Transaction', backref='owner', lazy='dynamic')
|
inv_transactions = db.relationship('Transaction', backref='owner', lazy='dynamic')
|
||||||
|
inv_orders = db.relationship('Order', backref='owner', lazy='dynamic')
|
||||||
|
|
||||||
inv_servers = db.relationship('Server', backref='owner', lazy='dynamic')
|
inv_servers = db.relationship('Server', backref='owner', lazy='dynamic')
|
||||||
inv_deployments = db.relationship('Deployment', backref='owner', lazy='dynamic')
|
inv_deployments = db.relationship('Deployment', backref='owner', lazy='dynamic')
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
</style>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
|
58
app/templates/admin/list_orders.html
Normal file
58
app/templates/admin/list_orders.html
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{ super() }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="row">
|
||||||
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-danger" id="orders">
|
||||||
|
<div class="panel-heading">Orders</div>
|
||||||
|
<div class="panel-body"><p>
|
||||||
|
<div class="no-more-tables">
|
||||||
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<!--<th>Region</th>-->
|
||||||
|
<th>User</th>
|
||||||
|
<th>Recipe</th>
|
||||||
|
<th>param 1</th>
|
||||||
|
<th>param 2</th>
|
||||||
|
<th>param 3</th>
|
||||||
|
<th>param 4</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for order in orders %}
|
||||||
|
<tr>
|
||||||
|
<!--<td data-title="Region">region1</td>-->
|
||||||
|
<td data-title="User"><a href="{{ url_for('admin.dashboard', user_pid=order.user_id) }}">{{ order.owner.email }}</a></td>
|
||||||
|
<td data-title="Recipe"><a href="#" title="{{ order.recipe.description }}">{{ order.recipe.templatefile }}</a></td>
|
||||||
|
<td data-title="Parameter1">{{ order.parameter1 }}</td>
|
||||||
|
<td data-title="Parameter2">{{ order.parameter2 }}</td>
|
||||||
|
<td data-title="Parameter3">{{ order.parameter3 }}</td>
|
||||||
|
<td data-title="Parameter4">{{ order.parameter4 }}</td>
|
||||||
|
<td data-title="Status">{{ order.status }}</td>
|
||||||
|
<td><button class="btn btn-default" onclick="window.open('{{ url_for('vmanager.vmcreate') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Confirm</button></td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<button class="btn btn-danger btn-md" onclick="window.open('{{ url_for('admin.list_orders') }}','_self')"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Orders</button>
|
||||||
<button class="btn btn-success btn-md" onclick="window.open('{{ url_for('admin.list_deployments') }}','_self')"><span class="glyphicon glyphicon-hdd" aria-hidden="true"></span> Deployments</button>
|
<button class="btn btn-success btn-md" onclick="window.open('{{ url_for('admin.list_deployments') }}','_self')"><span class="glyphicon glyphicon-hdd" aria-hidden="true"></span> Deployments</button>
|
||||||
<button class="btn btn-success btn-md" onclick="window.open('{{ url_for('admin.list_services') }}','_self')"><span class="glyphicon glyphicon-star" aria-hidden="true"></span> Services</button>
|
<button class="btn btn-success btn-md" onclick="window.open('{{ url_for('admin.list_services') }}','_self')"><span class="glyphicon glyphicon-star" aria-hidden="true"></span> Services</button>
|
||||||
<button class="btn btn-primary btn-md" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
<button class="btn btn-primary btn-md" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% block services %}
|
{% block services %}
|
||||||
<div id="no-more-tables">
|
<div class="no-more-tables">
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -83,7 +83,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="misc{{ deploy.machine_id }}" class="tab-pane fade">
|
<div id="misc{{ deploy.machine_id }}" class="tab-pane fade">
|
||||||
<br />
|
|
||||||
<p>
|
<p>
|
||||||
Unit: {{ deploy.machine_id }}<br />
|
Unit: {{ deploy.machine_id }}<br />
|
||||||
State: {{ status[deploy.machine_id] }}<br />
|
State: {{ status[deploy.machine_id] }}<br />
|
||||||
|
|
Loading…
Reference in a new issue