Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -72,8 +72,11 @@ class Settings::MenusController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def import
|
def import
|
||||||
|
if params[:file]
|
||||||
Menu.import(params[:file])
|
Menu.import(params[:file])
|
||||||
redirect_to settings_menus_path, notice: "imported"
|
redirect_to settings_menus_path, notice: "Menu was successfully Imported"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -7,12 +7,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<h4>Import</h4>
|
|
||||||
<%= form_tag import_settings_menus_path, multipart:true do%>
|
|
||||||
<%=file_field_tag :file%>
|
|
||||||
<%=submit_tag "Import CSV"%>
|
|
||||||
<%end%>
|
|
||||||
<%= link_to "Export users as spreadsheet", settings_menus_path(format: "xlsx") %>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
|
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
|
||||||
<br><br>
|
<br><br>
|
||||||
@@ -30,7 +24,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
|
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
|
||||||
<div class="m-b-10 clearfix">
|
<div class="m-b-10 clearfix">
|
||||||
|
<div class="float-left">
|
||||||
|
<%= form_tag import_settings_menus_path,class:"col-md-", multipart:true do%>
|
||||||
|
<%=file_field_tag :file, :class => "img-thumbnail col-md-7" %>
|
||||||
|
<%=submit_tag "Import",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||||
|
<%end%>
|
||||||
|
</div>
|
||||||
<%= link_to t("views.btn.new"),new_settings_menu_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
|
<%= link_to t("views.btn.new"),new_settings_menu_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
|
||||||
|
|
||||||
|
<%= link_to "Export", settings_menus_path(format: "xlsx"),:class => 'btn btn-info btn-lg waves-effect float-right m-r-10' %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
wb = xlsx_package.workbook
|
wb = xlsx_package.workbook
|
||||||
wb.styles do |s|
|
wb.styles do |s|
|
||||||
date = s.add_style(:format_code => "yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER)
|
time_format = wb.styles.add_style :format_code => 'hh:mm:ss'
|
||||||
|
|
||||||
wrap_text = s.add_style :sz => 11,
|
wrap_text = s.add_style :sz => 11,
|
||||||
:alignment => { :horizontal => :left,:vertical => :center ,
|
:alignment => { :horizontal => :left,:vertical => :center ,
|
||||||
:wrap_text => true}
|
:wrap_text => true}
|
||||||
@@ -43,7 +44,7 @@ wb.styles do |s|
|
|||||||
wb.add_worksheet(name: "Menu") do |sheet|
|
wb.add_worksheet(name: "Menu") do |sheet|
|
||||||
sheet.add_row %w( id name is_active valid_days valid_time_from valid_time_to created_by ), :style=>header_text
|
sheet.add_row %w( id name is_active valid_days valid_time_from valid_time_to created_by ), :style=>header_text
|
||||||
@settings_menus.each do |menu|
|
@settings_menus.each do |menu|
|
||||||
sheet.add_row [ menu.id, menu.name, menu.is_active, menu.valid_days, menu.valid_time_from,menu.valid_time_to, menu.created_by], :style=>[wrap_text]
|
sheet.add_row [ menu.id, menu.name, menu.is_active, menu.valid_days, menu.valid_time_from,menu.valid_time_to, menu.created_by], :style=>[wrap_text,time_format]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,9 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
resources :employees
|
resources :employees
|
||||||
#menu
|
#menu
|
||||||
resources :menus do
|
resources :menus do
|
||||||
#menu_categories
|
collection do
|
||||||
|
post :import
|
||||||
|
end
|
||||||
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user