make section table management with adding and positioning tables

This commit is contained in:
2012-11-20 16:27:10 +01:00
parent 633665daaa
commit a53e7e9ecd
7 changed files with 160 additions and 5 deletions
@@ -166,5 +166,18 @@ root.Qsupplier=
if table.needs_payment then to.addClass('needs_payment') else to.removeClass('needs_payment')
)
add_tables_to_active_section: ->
number_start = $('#add-tables-number-start')
number_end = $('#add-tables-number-end')
number_start = $('#add-tables-number-start').val()
number_end = $('#add-tables-number-end').val()
$.post('/supplier/sections/'+current_section_id+'/add_tables', {number_start: number_start, number_end: number_end}, -> window.location.reload())
#$('#add-tables-modal').modal('hide')
false
arrange_tables_of_active_section: ->
option = $('input[name=arrange-table-option]:checked').val()
by_row_count = parseInt($('#arrange-tables-by-row-count').val())
by_column_count = parseInt($('#arrange-tables-by-column-count').val())
if(option == "by_row")
return alert('Please fill in a positive number representing the number of tables per row') unless by_row_count && by_row_count > 0
if(option == "by_column")
return alert('Please fill in a positive number representing the number of tables per column') unless by_column_count && by_column_count > 0
$.post('/supplier/sections/'+current_section_id+'/arrange_tables', {option: option, row_count: by_row_count, column_count: by_column_count}, -> window.location.reload())
false
@@ -32,3 +32,9 @@ body
dd
&:after
content: '\a0'
form
.controls
label
display: inline-block
padding-left: 1em
padding-right: 1em