supplier improvements
This commit is contained in:
@@ -11,7 +11,12 @@ module Suppliers
|
||||
@start_time += current_supplier.night_offset.to_f.hours
|
||||
@end_time += current_supplier.night_offset.to_f.hours
|
||||
end
|
||||
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
|
||||
if params[:show_all] == 'yes'
|
||||
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
|
||||
else
|
||||
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
|
||||
end
|
||||
@lists.include_relation(:table)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
|
||||
@@ -4,7 +4,7 @@ module Suppliers
|
||||
# GET /products
|
||||
# GET /products.json
|
||||
def index
|
||||
@products = ProductDecorator.decorate_collection(current_supplier.products)
|
||||
@products = current_supplier.products
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
@@ -15,7 +15,7 @@ module Suppliers
|
||||
# GET /products/1
|
||||
# GET /products/1.json
|
||||
def show
|
||||
@product = ProductDecorator.decorate(Product.find_by_supplier_id_and_id!(current_supplier.id, params[:id]))
|
||||
@product = Product.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
@@ -84,5 +84,12 @@ module Suppliers
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def preview_products
|
||||
@date = Date.parse(params[:date]) rescue Date.today
|
||||
product_categories = ProductCategory.for_supplier_in_time(current_supplier, @date.to_time)
|
||||
render json: {categories: product_categories.map(&:to_client_format).select(&:present?)}
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ module Suppliers
|
||||
# GET /tables.json
|
||||
def index
|
||||
@tables = Table.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25, from_number: params[:from_number], to_number: params[:to_number])
|
||||
@tables.include_relation(:section)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
@@ -88,6 +89,7 @@ module Suppliers
|
||||
|
||||
def qr_codes
|
||||
@tables = current_supplier.tables
|
||||
@tables.select!{|t| t.section_id == params[:section_id]} if params[:section_id].present?
|
||||
render layout: 'qr_sheet'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user