This commit is contained in:
yarzar_code
2020-01-12 20:07:28 +06:30
parent 314cc507a3
commit dff2c69627
89 changed files with 492 additions and 469 deletions

View File

@@ -4,7 +4,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
# GET /inventory_definitions
# GET /inventory_definitions.json
def index
@inventory_definitions = InventoryDefinition.where("shop_code='#{@shop.shop_code}'")
@inventory_definitions = InventoryDefinition.all
end
# GET /inventory_definitions/1
@@ -14,7 +14,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
# GET /inventory_definitions/new
def new
@menus = Menu.where("shop_code='#{@shop.shop_code}'").order('created_at asc')
@menus = Menu.order('created_at asc')
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
@inventory_definition = InventoryDefinition.new
end
@@ -26,7 +26,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
# POST /inventory_definitions
# POST /inventory_definitions.json
def create
inventory = InventoryDefinition.find_by_item_code_and_shop_code(params[:item_code],@shop.shop_code)
inventory = InventoryDefinition.find_by_item_code(params[:item_code])
if inventory.nil?
@inventory_definition = InventoryDefinition.new
@@ -84,7 +84,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
# DELETE /inventory_definitions/1
# DELETE /inventory_definitions/1.json
def destroy
inventory = InventoryDefinition.find_by_id_and_shop_code(params[:id],@shop.shop_code)
inventory = InventoryDefinition.find_by_id(params[:id])
@inventory_definition.destroy
respond_to do |format|
format.html { redirect_to inventory_inventory_definitions_url, notice: 'Inventory definition was successfully destroyed.' }
@@ -107,7 +107,7 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
private
# Use callbacks to share common setup or constraints between actions.
def set_inventory_definition
@inventory_definition = InventoryDefinition.find_by_id_and_shop_code(params[:id],@shop.shop_code)
@inventory_definition = InventoryDefinition.find_by_id(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.