diff --git a/templates/delivery.html b/templates/delivery.html index 77187a3..b0100cf 100644 --- a/templates/delivery.html +++ b/templates/delivery.html @@ -1,9 +1,6 @@
- - -

Jose Beltrano

-

moto

-

Tel.: (11) 2134.1234

- - +

{{delivery.app_user.name}}

+

{{delivery.app_user.vehicle}}

+

Tel.: {{delivery.app_user.phone}}

+

Ultimo endereco: {{delivery.app_user.last_position}}

\ No newline at end of file diff --git a/templates/listdeliveries.html b/templates/listdeliveries.html index 6b6dfa0..43f2cc5 100644 --- a/templates/listdeliveries.html +++ b/templates/listdeliveries.html @@ -23,7 +23,7 @@ {% elif deliver.state == 'Pendente' %}

{% else %} -

+

{% endif %} diff --git a/templates/welcome.html b/templates/welcome.html index 9f1b2a3..1bceaa1 100644 --- a/templates/welcome.html +++ b/templates/welcome.html @@ -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){ @@ -30,7 +36,7 @@ $('#modal-content').html(data); }); }); - + var requestDeliveries = function(){ $.get('listDeliveries', function(data){ $('#deliveryTable').html(data); @@ -82,12 +88,8 @@
- -

Jose Beltrano

-

moto

-

Tel.: (11) 2134.1234

- - +
+
diff --git a/urls.py b/urls.py index faadcb9..416036f 100644 --- a/urls.py +++ b/urls.py @@ -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'), diff --git a/views.py b/views.py index 63d4732..57e2c50 100644 --- a/views.py +++ b/views.py @@ -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))