Requests index rendering
This commit is contained in:
parent
41135d0b2f
commit
5987748898
1
Pipfile
1
Pipfile
@ -17,7 +17,6 @@ flask = "*"
|
|||||||
flask-sqlalchemy = "*"
|
flask-sqlalchemy = "*"
|
||||||
flask-assets = "*"
|
flask-assets = "*"
|
||||||
flask-session = "*"
|
flask-session = "*"
|
||||||
flask-wtf = "*"
|
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
bandit = "*"
|
bandit = "*"
|
||||||
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "e04e11d9bd5c1dcc725de48b20902f5c416417e73774e557e45af7bd0c147ff5"
|
"sha256": "f097384512537988c799b892830b52e78bcc19133327213e9c6e2876210d62d3"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -62,14 +62,6 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.3.2"
|
"version": "==2.3.2"
|
||||||
},
|
},
|
||||||
"flask-wtf": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:5d14d55cfd35f613d99ee7cba0fc3fbbe63ba02f544d349158c14ca15561cc36",
|
|
||||||
"sha256:d9a9e366b32dcbb98ef17228e76be15702cd2600675668bca23f63a7947fd5ac"
|
|
||||||
],
|
|
||||||
"index": "pypi",
|
|
||||||
"version": "==0.14.2"
|
|
||||||
},
|
|
||||||
"itsdangerous": {
|
"itsdangerous": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"
|
"sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from flask import Flask, request, g
|
from flask import Flask, request, g, session
|
||||||
from unipath import Path
|
from unipath import Path
|
||||||
|
|
||||||
from atst.database import db
|
from atst.database import db
|
||||||
|
52
atst/routes/requests.py
Normal file
52
atst/routes/requests.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
from flask import Blueprint, g, render_template
|
||||||
|
import pendulum
|
||||||
|
|
||||||
|
from atst.domain.requests import Requests
|
||||||
|
|
||||||
|
requests_bp = Blueprint("requests", __name__)
|
||||||
|
|
||||||
|
def map_request(user, request):
|
||||||
|
time_created = pendulum.instance(request.time_created)
|
||||||
|
is_new = time_created.add(days=1) > pendulum.now()
|
||||||
|
|
||||||
|
return {
|
||||||
|
"order_id": request.id,
|
||||||
|
"is_new": is_new,
|
||||||
|
"status": request.status,
|
||||||
|
"app_count": 1,
|
||||||
|
"date": time_created.format("M/DD/YYYY"),
|
||||||
|
"full_name": "{} {}".format(user["first_name"], user["last_name"]),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@requests_bp.route("/requests", methods=["GET"])
|
||||||
|
def requests_index():
|
||||||
|
requests = []
|
||||||
|
if "review_and_approve_jedi_workspace_request" in g.current_user["atat_permissions"]:
|
||||||
|
requests = Requests.get_many()
|
||||||
|
else:
|
||||||
|
requests = Requests.get_many(creator_id=g.current_user["id"])
|
||||||
|
|
||||||
|
mapped_requests = [map_request(g.current_user, r) for r in requests]
|
||||||
|
|
||||||
|
return render_template("requests.html", requests=mapped_requests)
|
||||||
|
|
||||||
|
|
||||||
|
@requests_bp.route("/requests/new/<int:screen>", methods=["GET"])
|
||||||
|
def requests_new():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@requests_bp.route("/requests/new/<int:screen>/<string:request_id>", methods=["GET"])
|
||||||
|
def requests_form_update():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@requests_bp.route("/requests/verify/<string:request_id>", methods=["GET"])
|
||||||
|
def financial_verification():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@requests_bp.route("/requests/verify/<string:request_id>", methods=["POST"])
|
||||||
|
def update_financial_verification():
|
||||||
|
pass
|
@ -7,11 +7,11 @@
|
|||||||
{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%}
|
{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%}
|
||||||
<li>
|
<li>
|
||||||
<a class="sidenav__link {% if active %}sidenav__link--active{% endif %}" href="{{href}}" title="{{label}}">
|
<a class="sidenav__link {% if active %}sidenav__link--active{% endif %}" href="{{href}}" title="{{label}}">
|
||||||
{% if icon %}
|
{% if icon %}
|
||||||
{{ Icon(icon, classes="sidenav__link-icon") }}
|
{{ Icon(icon, classes="sidenav__link-icon") }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<span class="sidenav__link-label">{{label}}</span>
|
<span class="sidenav__link-label">{{label}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% if subnav and active %}
|
{% if subnav and active %}
|
||||||
@ -90,56 +90,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro TextInput(field, placeholder='') -%}
|
|
||||||
<div class='usa-input {% if errors %}usa-input--error{% endif %}'>
|
|
||||||
<label for={{field.name}}>
|
|
||||||
{{ field.label }}
|
|
||||||
|
|
||||||
{% if field.description %}
|
|
||||||
<span class='usa-input__help'>{{ field.description | safe }}</span>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if errors %}
|
|
||||||
{{ Icon('alert') }}
|
|
||||||
{% endif %}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
{{ field(placeholder=placeholder) | safe }}
|
|
||||||
|
|
||||||
{% if field.errors %}
|
|
||||||
{% for error in field.errors %}
|
|
||||||
<span class='usa-input__message'>{{ error }}</span>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{%- endmacro %}
|
|
||||||
|
|
||||||
{% macro OptionsInput(field, inline=False) -%}
|
|
||||||
<div class='usa-input {% if errors %}usa-input--error{% endif %}'>
|
|
||||||
|
|
||||||
<fieldset class="usa-input__choices {% if inline %}usa-input__choices--inline{% endif %}">
|
|
||||||
<legend>
|
|
||||||
{{ field.label }}
|
|
||||||
|
|
||||||
{% if field.description %}
|
|
||||||
<span class='usa-input__help'>{{ field.description | safe }}</span>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if field.errors %}
|
|
||||||
{{ Icon('alert') }}
|
|
||||||
{% endif %}
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
{{ field() }}
|
|
||||||
|
|
||||||
{% if field.errors %}
|
|
||||||
{% for error in field.errors %}
|
|
||||||
<span class='usa-input__message'>{{ error }}</span>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{%- endmacro %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user