Move financial verification to its own page
This commit is contained in:
committed by
Luis Cielak
parent
db0db3f327
commit
c8e1026165
@@ -1,11 +1,6 @@
|
||||
import tornado
|
||||
from collections import defaultdict
|
||||
|
||||
from atst.handler import BaseHandler
|
||||
from atst.forms.request import RequestForm
|
||||
from atst.forms.org import OrgForm
|
||||
from atst.forms.poc import POCForm
|
||||
from atst.forms.review import ReviewForm
|
||||
from atst.forms.financial import FinancialForm
|
||||
|
||||
|
||||
@@ -25,12 +20,54 @@ class RequestFinancialVerification(BaseHandler):
|
||||
@tornado.web.authenticated
|
||||
@tornado.gen.coroutine
|
||||
def get(self, request_id=None):
|
||||
# self.check_xsrf_cookie()
|
||||
# post_data = self.request.arguments
|
||||
current_user = self.get_current_user()
|
||||
existing_request = yield self.get_existing_request(request_id)
|
||||
form = FinancialForm(data=existing_request['body'].get('financial_verification'))
|
||||
self.render(
|
||||
"requests/financial_verification.html.to",
|
||||
page=self.page,
|
||||
f=form,
|
||||
request_id=request_id,
|
||||
)
|
||||
|
||||
@tornado.gen.coroutine
|
||||
def update_request(self, request_id, form_data):
|
||||
request_data = {
|
||||
"creator_id": self.current_user["id"],
|
||||
"request": {"financial_verification": form_data},
|
||||
}
|
||||
response = yield self.requests_client.patch(
|
||||
"/requests/{}".format(request_id), json=request_data
|
||||
)
|
||||
return response
|
||||
|
||||
@tornado.web.authenticated
|
||||
@tornado.gen.coroutine
|
||||
def post(self, request_id=None):
|
||||
self.check_xsrf_cookie()
|
||||
post_data = self.request.arguments
|
||||
existing_request = yield self.get_existing_request(request_id)
|
||||
form = FinancialForm(post_data)
|
||||
|
||||
rerender_args = dict(request_id=request_id, f=form)
|
||||
|
||||
if form.validate():
|
||||
response = yield self.update_request(request_id, form.data)
|
||||
if response.ok:
|
||||
valid = yield form.perform_extra_validation(
|
||||
existing_request.get('body', {}).get('financial_verification'),
|
||||
self.fundz_client
|
||||
)
|
||||
if valid:
|
||||
self.redirect('/requests')
|
||||
else:
|
||||
self.render(
|
||||
"requests/financial_verification.html.to",
|
||||
**rerender_args
|
||||
)
|
||||
else:
|
||||
self.set_status(response.code)
|
||||
else:
|
||||
self.render(
|
||||
"requests/financial_verification.html.to",
|
||||
**rerender_args
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ from atst.forms.request import RequestForm
|
||||
from atst.forms.org import OrgForm
|
||||
from atst.forms.poc import POCForm
|
||||
from atst.forms.review import ReviewForm
|
||||
from atst.forms.financial import FinancialForm
|
||||
|
||||
|
||||
class RequestNew(BaseHandler):
|
||||
@@ -221,12 +220,6 @@ class JEDIRequestFlow(object):
|
||||
"form": ReviewForm,
|
||||
"show":True,
|
||||
},
|
||||
{
|
||||
"title": "Financial Verification",
|
||||
"section": "financial_verification",
|
||||
"form": FinancialForm,
|
||||
"show": self.request and self.request["status"] == "approved",
|
||||
},
|
||||
]
|
||||
|
||||
@tornado.gen.coroutine
|
||||
|
||||
Reference in New Issue
Block a user