Rushabh Mehta | 3023a8f | 2013-04-03 16:34:23 +0530 | [diff] [blame] | 1 | {% extends "app/website/templates/html/page.html" %} |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 2 | |
| 3 | {% set title="My Orders" %} |
| 4 | |
| 5 | {% block content %} |
Rushabh Mehta | da512ba | 2013-03-22 12:45:44 +0530 | [diff] [blame] | 6 | <script> |
| 7 | global_number_format = "{{ global_number_format }}"; |
| 8 | currency = "{{ currency }}"; |
| 9 | wn.currency_symbols = {{ currency_symbols }}; |
| 10 | </script> |
Rushabh Mehta | cce21d1 | 2013-08-21 17:48:08 +0530 | [diff] [blame^] | 11 | <div class="col-md-12"> |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 12 | <ul class="breadcrumb"> |
| 13 | <li><a href="index">Home</a> <span class="divider">/</span></li> |
| 14 | <li><a href="account">My Account</a> <span class="divider">/</span></li> |
| 15 | <li class="active">My Orders</li> |
| 16 | </ul> |
Anand Doshi | edbf3e1 | 2013-07-02 11:40:16 +0530 | [diff] [blame] | 17 | <h3><i class="icon-list icon-fixed-width"></i> My Orders</h3> |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 18 | <hr> |
| 19 | <div id="order-list" style="font-size: 13px;"> |
| 20 | <div class="progress progress-striped active"> |
Anand Doshi | 32f9f36 | 2013-06-13 16:11:03 +0530 | [diff] [blame] | 21 | <div class="progress-bar progress-bar-info" style="width: 100%;"></div> |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 22 | </div> |
| 23 | </div> |
| 24 | </div> |
| 25 | <script> |
| 26 | $(document).ready(function() { |
| 27 | var order_start = 0; |
| 28 | |
| 29 | wn.call({ |
| 30 | method: "selling.doctype.sales_order.sales_order.get_orders", |
| 31 | args: { |
| 32 | start: order_start |
| 33 | }, |
| 34 | callback: function(r) { |
| 35 | $("#order-list .progress").remove(); |
| 36 | var $list = $("#order-list"); |
| 37 | |
| 38 | if(!(r.message && r.message.length)) { |
| 39 | $list.html("<div class='alert'>No Orders Yet</div>"); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | $.each(r.message, function(i, order) { |
| 44 | |
| 45 | // parent |
| 46 | var $order = $(repl('<div class="row">\ |
Rushabh Mehta | cce21d1 | 2013-08-21 17:48:08 +0530 | [diff] [blame^] | 47 | <div class="col-md-3"><a href="order?name=%(name)s">%(name)s</a></div>\ |
| 48 | <div class="col-md-9"></div>\ |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 49 | </div>', order)).appendTo($list); |
| 50 | |
| 51 | // items |
| 52 | $.each(order.items || [], function(i, item) { |
Rushabh Mehta | da512ba | 2013-03-22 12:45:44 +0530 | [diff] [blame] | 53 | item.export_rate = format_currency(item.export_rate, order.currency); |
Rushabh Mehta | 3f72530 | 2013-03-22 14:56:31 +0530 | [diff] [blame] | 54 | item.export_amount = format_currency(item.export_amount, order.currency); |
Rushabh Mehta | da512ba | 2013-03-22 12:45:44 +0530 | [diff] [blame] | 55 | var $item = $(repl('<div class="row">\ |
Rushabh Mehta | cce21d1 | 2013-08-21 17:48:08 +0530 | [diff] [blame^] | 56 | <div class="col-md-3">%(item_name)s</div>\ |
| 57 | <div class="col-md-2" style="text-align: right;">%(export_rate)s</div>\ |
| 58 | <div class="col-md-2" style="text-align: right;">%(qty)s %(stock_uom)s</div>\ |
| 59 | <div class="col-md-2" style="text-align: right;">%(export_amount)s</div>\ |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 60 | </div>\ |
Rushabh Mehta | cce21d1 | 2013-08-21 17:48:08 +0530 | [diff] [blame^] | 61 | </div>', item)).appendTo($order.find(".col-md-9")); |
Rushabh Mehta | bed19ac | 2013-03-21 17:12:25 +0530 | [diff] [blame] | 62 | }); |
| 63 | |
| 64 | $("<hr>").appendTo($list); |
| 65 | }); |
| 66 | } |
| 67 | }) |
| 68 | }) |
| 69 | </script> |
| 70 | {% endblock %} |