Skip to content

Commit

Permalink
add stock to user purchase add
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed May 27, 2016
1 parent 6c58d30 commit 9b66920
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions chezbetty/static/js/chezbetty-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ function search_item_only_success (data) {
$(this).attr("data-item", data.matches[i][3]);
});
new_row.find(".user-search-row-item-name").text(data.matches[i][0] + ": " + data.matches[i][1]);
new_row.find(".user-search-row-item-stock").text('stock: ' + data.matches[i][5]);
new_row.addClass("user-search-item-addedrows");
new_row.show();

Expand Down
1 change: 1 addition & 0 deletions chezbetty/templates/admin/user_purchase_add.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<table id="user-search-table-items" style="width: 100%">
<tr id="user-search-item-row-0" class="user-search-row" style="display:none;">
<td class="user-search-row-item-name">Name</td>
<td class="user-search-row-item-stock">Stock</td>
<td>
<button type="button" id="user-search-item-row-button-0" class="btn btn-default user-search-item-row-button">Add</button>
</td>
Expand Down
8 changes: 4 additions & 4 deletions chezbetty/views_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,16 +520,16 @@ def admin_item_search_json(request):
ret = {'matches': []}

for b in boxes:
ret['matches'].append(('box', b.name, b.barcode, b.id, b.enabled))
ret['matches'].append(('box', b.name, b.barcode, b.id, b.enabled, 0))

for bv in box_vendors:
ret['matches'].append(('box', bv.box.name, bv.box.barcode, bv.box.id, bv.box.enabled))
ret['matches'].append(('box', bv.box.name, bv.box.barcode, bv.box.id, bv.box.enabled, 0))

for i in items:
ret['matches'].append(('item', i.name, i.barcode, i.id, i.enabled))
ret['matches'].append(('item', i.name, i.barcode, i.id, i.enabled, i.in_stock))

for iv in item_vendors:
ret['matches'].append(('item', iv.item.name, iv.item.barcode, iv.item.id, iv.item.enabled))
ret['matches'].append(('item', iv.item.name, iv.item.barcode, iv.item.id, iv.item.enabled, iv.item.in_stock))

ret['status'] = 'success'

Expand Down

0 comments on commit 9b66920

Please sign in to comment.