Files
mozo-backend/notes.js.coffee
T

26 lines
1.1 KiB
CoffeeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
build_product_list_as_modal: ->
wrapper = $('<div class="modal"></div>')
callback_wrapper = ->
wrapper.modal('hide')
callback()
header = $('<div class="modal-header"></div>')
.append('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>')
.append('<h3>Product list</h3>').appendTo(wrapper)
body = $('<div class="modal-body"></div>')
table = $('<table class="table"></table>').appendTo(body)
tbody = $('<tbody></tbody>').appendTo(table)
for product_id, info of window.active_products_list
row = $('<tr></tr>').appendTo(tbody)
row.append('<td>'+info.product.name+'</td>')
row.append('<td>'+info.number+'</td>')
row.append('<td>'+Qwaiter.currency(info.product.price * info.number)+'</td>')
body.appendTo(wrapper)
footer = $('<div class="modal-footer"></div>')
.append($('<a href="#" class="btn">Close</a>').click(-> wrapper.modal('hide')))
.append($('<a href="#" class="btn btn-primary">Yes</a>').click(callback_wrapper))
.appendTo(wrapper)
wrapper.modal()