Pull from master
This commit is contained in:
@@ -24,7 +24,16 @@
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
|
||||
<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 "Export", settings_menus_path(format: "xlsx"),:class => 'btn btn-info btn-lg waves-effect float-right m-r-10' %>
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
|
||||
86
app/views/settings/menus/index.xlsx.axlsx
Normal file
86
app/views/settings/menus/index.xlsx.axlsx
Normal file
@@ -0,0 +1,86 @@
|
||||
wb = xlsx_package.workbook
|
||||
wb.styles do |s|
|
||||
time_format = wb.styles.add_style :format_code => 'hh:mm:ss'
|
||||
|
||||
wrap_text = s.add_style :sz => 11,
|
||||
:alignment => { :horizontal => :left,:vertical => :center ,
|
||||
:wrap_text => true}
|
||||
header_text = s.add_style :fg_color=> "FFFFFF",
|
||||
:b => true,
|
||||
:bg_color => "004586",
|
||||
:sz => 12,
|
||||
:border => { :style => :thin, :color => "00" },
|
||||
:alignment => { :horizontal => :left,
|
||||
:vertical => :center ,
|
||||
:header_text => true}
|
||||
wb.add_worksheet(name: "Account") do |sheet|
|
||||
sheet.add_row %w(id title account_type discount point bonus rebate), :style=>header_text
|
||||
Account.all.each do |acc|
|
||||
sheet.add_row [acc.id, acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Item Set") do |sheet|
|
||||
sheet.add_row %w(id name alt_name min_selectable_qty max_selectable_qty), :style=>header_text
|
||||
ItemSet.all.each do |set|
|
||||
sheet.add_row [set.id,set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Options") do |sheet|
|
||||
sheet.add_row %w(id option_type name value), :style=>header_text
|
||||
MenuItemOption.all.each do |option|
|
||||
sheet.add_row [option.id, option.option_type, option.name, option.value], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Attributes") do |sheet|
|
||||
sheet.add_row %w(id attribute_type name value), :style=>header_text
|
||||
MenuItemAttribute.all.each do |attr|
|
||||
sheet.add_row [attr.id, attr.attribute_type,attr.name,attr.value], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
@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,time_format]
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Category") do |sheet|
|
||||
sheet.add_row %w(id menu_id code name alt_name order_by created_by menu_category_id is_available), :style=>header_text
|
||||
MenuCategory.all.each do |mc|
|
||||
sheet.add_row [mc.id, mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item") do |sheet|
|
||||
sheet.add_row %w(id item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id min_qty taxable is_sub_item is_available created_by), :style=>header_text
|
||||
MenuItem.all.each do |mi|
|
||||
sheet.add_row [mi.id,mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Instance") do |sheet|
|
||||
sheet.add_row %w(id menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default), :style=>header_text
|
||||
MenuItemInstance.all.each do |mii|
|
||||
sheet.add_row [mii.id, mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Instance Item Set") do |sheet|
|
||||
sheet.add_row %w(id item_set_id menu_item_instance_id), :style=>header_text
|
||||
MenuInstanceItemSet.all.each do |miis|
|
||||
sheet.add_row [miis.id ,miis.item_set_id, miis.menu_item_instance_id], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Set") do |sheet|
|
||||
sheet.add_row %w(id item_set_id menu_item_id), :style=>header_text
|
||||
MenuItemSet.all.each do |mis|
|
||||
sheet.add_row [mis.id,mis.item_set_id, mis.menu_item_id], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -8,14 +8,16 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs p-l-15">
|
||||
<%= f.input :name %>
|
||||
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
|
||||
<%= f.input :name, :input_html=>{:onchange=>"checkDuplicate(this.value);"} %>
|
||||
<span id="tax_profile_nameErr" style="color:red;"></span>
|
||||
<%= f.input :rate %>
|
||||
<%= f.input :inclusive %>
|
||||
<%= f.input :order_by %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions p-l-15">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect btn_submit' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -45,5 +47,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function checkDuplicate(obj){
|
||||
// $("#tax_profile_nameErr").html("");
|
||||
var name = '<%= @name %>';
|
||||
var tax_profiles = JSON.parse('<%= @tax_profiles.to_json.html_safe %>');
|
||||
var group_type = $("#tax_profile_group_type").val();
|
||||
if(tax_profiles!=undefined && tax_profiles!=null && tax_profiles!=""){
|
||||
$.each(tax_profiles,function(key,value){
|
||||
if(value.group_type == group_type){
|
||||
if(name.trim().toLowerCase()!=value.name.trim().toLowerCase()){
|
||||
if(value.name.trim().toLowerCase() == obj.trim().toLowerCase()){
|
||||
$("#tax_profile_name").val("");
|
||||
$("#tax_profile_nameErr").html("duplicate group type and name");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.group_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.rate") %></th>
|
||||
<th><%= t("views.right_panel.detail.inclusive") %></th>
|
||||
@@ -29,6 +30,7 @@
|
||||
<tbody>
|
||||
<% @settings_tax_profiles.each do |settings_tax_profile| %>
|
||||
<tr>
|
||||
<td><%= settings_tax_profile.group_type %></td>
|
||||
<td><%= settings_tax_profile.name %></td>
|
||||
<td><%= settings_tax_profile.rate %></td>
|
||||
<td><%= settings_tax_profile.inclusive %></td>
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><%= t("en.tax_profile") %></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.group_type") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.group_type %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.name") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.name %></td>
|
||||
|
||||
Reference in New Issue
Block a user