Skip to content

Commit

Permalink
Customer, Warrantors und Ratings immer anzeigen (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankoegl committed Nov 11, 2011
1 parent 265277b commit 3910e5a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
24 changes: 24 additions & 0 deletions webapp/frontend/templates/enter-request.html
Expand Up @@ -7,6 +7,15 @@ <h2>Enter Credit Request</h2>
{% csrf_token %}

<table>
<tr>
<th>Customer</th>
<td>
{{ customer.first_name }}
{{ customer.middle_name }}
{{ customer.last_name }}
</td>
<td>{{ customer.rating }}</td>
</tr>
<tr>
<th>Reason</th>
<td><input type="text" name="reason" value="{{ credit_request.reason }}"></td>
Expand All @@ -23,6 +32,21 @@ <h2>Enter Credit Request</h2>
<th>Duration</th>
<td><input type="text" name="duration" value="{{ credit_request.duration.years }}"/> Years</td>
</tr>

{% for warrantor in credit_request.warrantors %}
<tr>
<th>Warrantor</th>
<td>
{{ warrantor.first_name }}
{{ warrantor.middle_name }}
{{ warrantor.last_name }}
</td>
<td>
{{ warrantor.rating }}
</td>
</tr>
{% endfor %}

<tr>
<td colspan="2">
<input type="submit" value="Continue" />
Expand Down
12 changes: 12 additions & 0 deletions webapp/frontend/templates/search-warrantors.html
Expand Up @@ -6,6 +6,15 @@ <h2>Enter Credit Request</h2>
<form method="post" action="/show-warrantor">
{% csrf_token %}
<table>
<tr>
<th>Customer</th>
<td>
{{ credit_request.customer.first_name }}
{{ credit_request.customer.middle_name }}
{{ credit_request.customer.last_name }}
</td>
<td>{{ credit_request.customer.rating }}</td>
</tr>
<tr>
<th>Reason</th>
<td>{{ credit_request.reason }}</td>
Expand Down Expand Up @@ -34,6 +43,9 @@ <h2>Enter Credit Request</h2>
{{ warrantor.middle_name }}
{{ warrantor.last_name }}
</td>
<td>
{{ warrantor.rating }}
</td>
</tr>
{% endfor %}

Expand Down
13 changes: 9 additions & 4 deletions webapp/frontend/views.py
Expand Up @@ -32,7 +32,13 @@ def customers(request):


def enter_request(request):

customer = sessionstore.get_customer(request)
customer = ratingclient.setRating(customer)
sessionstore.set_customer(request, customer)

return render_to_response('enter-request.html', {
'customer': customer,
'target': 'create-request',
}, context_instance=RequestContext(request))

Expand Down Expand Up @@ -60,7 +66,9 @@ def show_warrantor(request):

warrantor = creditapprovalclient.getCustomerByName(name)
if warrantor:
warrantor = ratingclient.setRating(warrantor)
credit_req.warrantors.append(warrantor)

sessionstore.set_request(request, credit_req)

return render_to_response('search-warrantors.html', {
Expand All @@ -72,10 +80,6 @@ def submit_request(request):

credit_req = sessionstore.get_request(request)

customer = credit_req.customer
credit_req.customer = ratingclient.setRating(customer)
credit_req.warrantors = map(ratingclient.setRating, credit_req.warrantors)

offer = creditapprovalclient.placeCreditRequest(credit_req)

sessionstore.set_offer(request, offer)
Expand Down Expand Up @@ -124,6 +128,7 @@ def edit_request(request):
credit_req = offer.request

return render_to_response('enter-request.html', {
'customer': offer.request.customer,
'credit_request': credit_req,
'target': 'update-request',
}, context_instance=RequestContext(request))
Expand Down

0 comments on commit 3910e5a

Please sign in to comment.