pdf viewer add and menu export testing

This commit is contained in:
Yan
2018-04-18 18:12:01 +06:30
parent fc523ca390
commit 28a79fe60f
6 changed files with 6 additions and 4 deletions

Binary file not shown.

View File

@@ -167,8 +167,9 @@ class Settings::MenusController < ApplicationController
# end # end
end end
p.serialize("tmp/menus/" + menu.name + ".xlsx") file_path = "public/menus/" + menu.name + ".xlsx"
render :json => {status: true} p.serialize(file_path)
render :json => { status: true, path: file_path }
end end
def import def import

View File

@@ -160,7 +160,7 @@ class Menu < ApplicationRecord
account = Account.create({title: row["Account"], account_type: "0"}) account = Account.create({title: row["Account"], account_type: "0"})
end end
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", account_id: account_id, is_sub_item: 0, is_available: 1, created_by: created_by) menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", is_sub_item: 0, is_available: 1, created_by: created_by)
# else # else
# status = status + "Item Code already exists for " + row["Item Name"] + "." # status = status + "Item Code already exists for " + row["Item Name"] + "."
end end

View File

@@ -115,7 +115,8 @@
url: "/settings/menus/" + menu_id + "/export", url: "/settings/menus/" + menu_id + "/export",
success: function(result){ success: function(result){
if(result.status){ if(result.status){
swal("Success", "Export Success...", "success"); location.href = result.path.substring(6);
// swal("Success", "Export Success...", "success");
} }
} }
}); });

BIN
public/menus/Main Menu.xlsx Normal file

Binary file not shown.

Binary file not shown.