section improvements, area elements mostly
This commit is contained in:
@@ -124,14 +124,16 @@ module Suppliers
|
||||
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
number_start = params[:number_start].to_i
|
||||
number_end = params[:number_end].to_i
|
||||
added_tables = []
|
||||
for table_number in number_start..number_end
|
||||
next if table_number.zero?
|
||||
table = Table.new(number: table_number)
|
||||
table.supplier = current_supplier
|
||||
table.section = @section
|
||||
table.save
|
||||
added_tables << table
|
||||
end
|
||||
@section.arrange_tables_in_grid
|
||||
@section.arrange_tables_in_grid added_tables
|
||||
table_json = ActiveModel::ArraySerializer.new(@section.tables, each_serializer: SupplierTableSerializer, root: false).as_json
|
||||
render json: {tables: table_json}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user