Skip to content

Commit

Permalink
integration
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelnferreira committed Nov 23, 2013
1 parent 40a70dd commit 26fdeb8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
11 changes: 4 additions & 7 deletions templates/delivery.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<div class="col-xs-6 col-md-4 text-center">

<img src="../images/user.png">
<h3>Jose Beltrano</h3>
<h4><strong>moto</strong></h4>
<p>Tel.: (11) 2134.1234</p>


<h3>{{delivery.app_user.name}}</h3>
<h4>{{delivery.app_user.vehicle}}</h4>
<p>Tel.: {{delivery.app_user.phone}}</p>
<p> Ultimo endereco: {{delivery.app_user.last_position}}
</div>
2 changes: 1 addition & 1 deletion templates/listdeliveries.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% elif deliver.state == 'Pendente' %}
<td><p class="text-right"><button type="button" class="btn btn-danger">Aguardando...</button></p></td>
{% else %}
<td><p class="text-right"><button type="button" class="btn btn-waiting" onClick="updateMap({{deliver.key.id}})"><a href="#">Ver no Mapa</a></button></p></td>
<td><p class="text-right"><button type="button" class="btn btn-waiting" onClick="updateMap({{deliver.key.id}});updateDeliverInfo({{deliver.key.id}})"><a href="#">Ver no Mapa</a></button></p></td>
{% endif %}
</tr>

Expand Down
16 changes: 9 additions & 7 deletions templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
$.post("confirmOffer", { offerId: offerId })
}

function updateDeliverInfo(deliverId){
$.get('deliverInfo?deliverId='+deliverId, function(data){
$('#deliver-info').html(data);
});
}

$(window).load(function(){
$('#btnRefresh').click(function(){
$.get('listDeliveries', function(data){
Expand All @@ -30,7 +36,7 @@
$('#modal-content').html(data);
});
});

var requestDeliveries = function(){
$.get('listDeliveries', function(data){
$('#deliveryTable').html(data);
Expand Down Expand Up @@ -82,12 +88,8 @@

<div class="col-xs-6 col-md-4 text-center">

<img src="../images/user.png">
<h3>Jose Beltrano</h3>
<h4><strong>moto</strong></h4>
<p>Tel.: (11) 2134.1234</p>
<!--<button type="button" class="btn btn-danger" id="btnRefresh">Refresh</button>-->
<!--<button type="button" class="btn btn-success" data-toggle="modal" data-target="#Oferta" id="btnNewOffer">Profissionais disponíveis</button>-->
<div id="deliver-info"></div>

</div>
</div>
<div class="row">
Expand Down
1 change: 1 addition & 0 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
(r'^app/listOffers', 'views.listOffers'),
(r'^app/confirmOffer', 'views.confirmOffer'),
(r'^app/deliverCoordinates', 'views.deliverCoordinates'),
(r'^app/deliverInfo', 'views.deliverInfo'),
(r'^app/map', 'views.map'),
#(r'^admin/cameras$', 'views.listCam'),
#(r'^admin/camera/editar/(\d+)$', 'views.editCamera'),
Expand Down
14 changes: 14 additions & 0 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ def listOffers(request):

return respond(request,users.GetCurrentUser(), 'listoffers', { 'offers' : offers })

def deliverInfo(request):
deliver_id = int(request.GET.get('deliverId', 0))
deliver = DeliverFee.get(db.Key.from_path(DeliverFee.kind(), deliver_id))

if deliver is None:
return http.HttpResponseBadRequest('No Deliver exists with that key (%r)' %
deliver_id)

#ok, here we need to find the DeliveryOffer that is currently in progress, after the confirmation
q = db.GqlQuery("SELECT * FROM DeliverOffer WHERE deliver_fee = :1 AND state = 'Aceito' ", deliver)
offer = q.get()

return respond(request, users.GetCurrentUser(), 'delivery', { 'delivery' : offer })

def deliverCoordinates(request):
deliver_id = int(request.GET.get('deliverId', 0))
deliver = DeliverFee.get(db.Key.from_path(DeliverFee.kind(), deliver_id))
Expand Down

0 comments on commit 26fdeb8

Please sign in to comment.