Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into addorder
This commit is contained in:
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
7
app/views/api/restaurant/item_sets/index.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
json.array! @item_sets do |set|
|
||||
json.id set.id
|
||||
json.name set.name
|
||||
json.alt_name set.alt_name
|
||||
json.min_selectable_qty set.min_selectable_qty
|
||||
json.max_selectable_qty set.max_selectable_qty
|
||||
end
|
||||
@@ -5,13 +5,14 @@ json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
|
||||
if (menu.menu_categories)
|
||||
json.menu_categories menu.menu_categories do |category|
|
||||
json.categories menu.menu_categories do |category|
|
||||
json.id category.id
|
||||
json.name category.name
|
||||
json.alt_name category.alt_name
|
||||
json.is_available category.is_available
|
||||
|
||||
if category.menu_items
|
||||
json.menu_items category.menu_items do |item|
|
||||
json.items category.menu_items do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,40 +1,47 @@
|
||||
|
||||
#Menu Item Information
|
||||
json.item_code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
json.type item.type
|
||||
json.min_qty item.min_qty
|
||||
json.min_selectable_item item.min_selectable_item
|
||||
json.max_selectable_item item.max_selectable_item
|
||||
json.id item.id
|
||||
json.item_code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
json.image item.image_path.url
|
||||
json.description item.description
|
||||
json.Information item.information
|
||||
json.type item.type
|
||||
json.account_id item.account_id
|
||||
json.min_qty item.min_qty
|
||||
json.is_available item.is_available
|
||||
json.is_sub_item item.is_sub_item
|
||||
json.attributes item.item_attributes
|
||||
json.options item.item_options
|
||||
# json.min_selectable_item item.min_selectable_item
|
||||
# json.max_selectable_item item.max_selectable_item
|
||||
|
||||
#Item instance
|
||||
if item.menu_item_instances.count == 1 then
|
||||
# if item.menu_item_instances.count == 1 then
|
||||
# item_instance = item.menu_item_instances[0]
|
||||
# json.price = item_instance.price
|
||||
# json.is_available = item_instance.is_available
|
||||
# json.is_on_promotion = item_instance.is_on_promotion
|
||||
# json.promotion_price = item_instance.promotion_price
|
||||
# json.item_attributes = item_instance.item_attributes
|
||||
|
||||
item_instance = item.menu_item_instances[0]
|
||||
json.price = item_instance.price
|
||||
json.is_available = item_instance.is_available
|
||||
json.is_on_promotion = item_instance.is_on_promotion
|
||||
json.promotion_price = item_instance.promotion_price
|
||||
json.item_attributes = item_instance.item_attributes
|
||||
|
||||
elsif item.menu_item_instances.count > 1 then
|
||||
|
||||
json.item_instances item.menu_item_instances do |is|
|
||||
json.item_instance_item_code = is.item_instance_code
|
||||
json.item_instance_name = is.item_instance_name
|
||||
# elsif item.menu_item_instances.count > 1 then
|
||||
json.instances item.menu_item_instances do |is|
|
||||
json.code = is.item_instance_code
|
||||
json.name = is.item_instance_name
|
||||
json.price = is.price
|
||||
json.is_available = is.is_available
|
||||
json.is_on_promotion = is.is_on_promotion
|
||||
json.promotion_price = is.promotion_price
|
||||
json.item_attributes = is.item_attributes
|
||||
end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
#Child Menu items
|
||||
if (item.menu_item_sets) then
|
||||
json.set_items item.menu_item_sets.each do |item|
|
||||
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
end
|
||||
|
||||
end
|
||||
# if (item.children) then
|
||||
# json.set_items item.children.each do |item|
|
||||
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||
# end
|
||||
# end
|
||||
@@ -4,9 +4,11 @@ json.array! @menus do |menu|
|
||||
json.valid_days menu.valid_days
|
||||
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
if (@current_menu)
|
||||
json.current_menu do
|
||||
json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
end
|
||||
end
|
||||
|
||||
json.partial! 'api/restaurant/menu/menu', menu: menu
|
||||
# if (@current_menu)
|
||||
# json.current_menu do
|
||||
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
json.array! @menu_attributes do |attribute|
|
||||
json.id attribute.id
|
||||
json.type attribute.attribute_type
|
||||
json.name attribute.name
|
||||
json.value attribute.value
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
json.array! @menu_options do |option|
|
||||
json.id option.id
|
||||
json.type option.option_type
|
||||
json.name option.name
|
||||
json.value option.value
|
||||
end
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
|
||||
<%= f.input :unit_price %>
|
||||
<%= f.input :unit_price, :input_html => { :id => 'unit_price'} %>
|
||||
<%= f.input :taxable %>
|
||||
<%= f.input :charge_type, :collection => [:hr, :day] %>
|
||||
<%= f.input :minimum_free_time %>
|
||||
<%= f.input :charge_block %>
|
||||
<%= f.input :charge_block, :input_html => { :id => 'charge_block'} %>
|
||||
<%= f.input :time_rounding %>
|
||||
<%= f.input :time_rounding_block %>
|
||||
<%= f.input :time_rounding_block, :input_html => { :id => 'time_rounding_block'} %>
|
||||
<%= f.input :time_rounding_block_price, :input_html => { :id => 'time_rounding_block_price'} %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
@@ -17,3 +18,39 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
|
||||
function price(){
|
||||
var unit_price = $("#unit_price").val();
|
||||
|
||||
var hour1 = $("select[name='dining_charge[time_rounding_block(4i)]']").val();
|
||||
var min1 = $("select[name='dining_charge[time_rounding_block(5i)]']").val();
|
||||
var time1=(parseInt(hour1)*60)+parseInt(min1);
|
||||
|
||||
var hour2 = $("select[name='dining_charge[charge_block(4i)]']").val();
|
||||
var min2 = $("select[name='dining_charge[charge_block(5i)]']").val();
|
||||
var time2=(parseInt(hour2)*60)+parseInt(min2);
|
||||
|
||||
var result=(unit_price*time1)/time2;
|
||||
$("#time_rounding_block_price").val(result);
|
||||
// return result;
|
||||
}
|
||||
|
||||
|
||||
$( "#unit_price" ).change(function() {
|
||||
price();
|
||||
});
|
||||
$( "select[name='dining_charge[time_rounding_block(4i)]']" ).change(function() {
|
||||
price();
|
||||
});
|
||||
$( "select[name='dining_charge[time_rounding_block(5i)]']" ).change(function() {
|
||||
price();
|
||||
});
|
||||
$( "select[name='dining_charge[charge_block(4i)]']" ).change(function() {
|
||||
price();
|
||||
});
|
||||
$( "select[name='dining_charge[charge_block(5i)]']" ).change(function() {
|
||||
price();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
</div>
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function randomNumber(len) {
|
||||
function randomNumber(len) {
|
||||
var randomNumber;
|
||||
var n = '';
|
||||
|
||||
@@ -27,6 +28,5 @@ function randomNumber(len) {
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
|
||||
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
|
||||
</script>
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.input :alt_name %>
|
||||
<%= f.input :min_selectable_qty,input_html: {value: f.object.min_selectable_qty || '0'} %>
|
||||
<%= f.input :max_selectable_qty,input_html: {value: f.object.max_selectable_qty || '0'} %>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Alt Name</th>
|
||||
<th>Min selectable qty</th>
|
||||
<th>Max selectable qty</th>
|
||||
<th>Action</th>
|
||||
@@ -24,6 +25,7 @@
|
||||
<% @settings_item_sets.each do |item| %>
|
||||
<tr>
|
||||
<td><%= item.name %></td>
|
||||
<td><%= item.alt_name %></td>
|
||||
<td><%= item.min_selectable_qty %></td>
|
||||
<td><%= item.max_selectable_qty %></td>
|
||||
<td><%= link_to 'Show', settings_item_set_path(item),:class=>'btn btn-sm btn-success' %>
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
<td><strong>Name:</strong></td>
|
||||
<td><%= @settings_item_set.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Alt Name:</strong></td>
|
||||
<td><%= @settings_item_set.alt_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Min selectable qty:</strong></td>
|
||||
<td> <%= @settings_item_set.min_selectable_qty %></td>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :menu_id, as: :hidden %>
|
||||
<%= f.input :menu_id, as: :hidden %>
|
||||
<%= f.input :code, label: "Category Code" %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :alt_name %>
|
||||
<%= f.input :is_available %>
|
||||
<%= f.input :order_by %>
|
||||
<%= f.association :parent %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<th>Menu</th>
|
||||
<th>Name</th>
|
||||
<th>Alt name</th>
|
||||
<th>Is Available</th>
|
||||
<th>Order by</th>
|
||||
<th>Parent</th>
|
||||
<th></th>
|
||||
@@ -31,6 +32,7 @@
|
||||
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
||||
|
||||
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
||||
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||
<td><%= settings_menu_category.order_by rescue ''%></td>
|
||||
<td><%= settings_menu_category.parent.name rescue ''%></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_path(settings_menu_category) %> | <%= link_to 'Destroy', settings_menu_category_path(settings_menu_category), method: :delete, data: { confirm: 'Are you sure?' } %></td></td>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<th>Menu</th>
|
||||
<th>Name</th>
|
||||
<th>Alt name</th>
|
||||
<th>Is Available</th>
|
||||
<th>Order by</th>
|
||||
<th>Created At</th>
|
||||
<th>Action</th>
|
||||
@@ -27,6 +28,7 @@
|
||||
<td><%= @settings_menu_category.menu.name %></td>
|
||||
<td><%= @settings_menu_category.name rescue "-" %></td>
|
||||
<td><%= @settings_menu_category.alt_name %></td>
|
||||
<td><%= settings_menu_category.is_available rescue false%></td>
|
||||
<td><%= @settings_menu_category.order_by %></td>
|
||||
<td><%= @settings_menu_category.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_menu_category_path(@settings_menu_category, @settings_menu_category) %></td>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :option_type %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :value %>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
@@ -21,6 +22,7 @@
|
||||
<tbody>
|
||||
<% @settings_menu_item_options.each do |settings_menu_item_option| %>
|
||||
<tr>
|
||||
<td><%= settings_menu_item_option.option_type %></td>
|
||||
<td><%= link_to settings_menu_item_option.name, settings_menu_item_option_path(settings_menu_item_option) %></td>
|
||||
<td><%= settings_menu_item_option.value %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_item_option_path(settings_menu_item_option) %>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
<th>Created At</th>
|
||||
@@ -22,6 +23,7 @@
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @settings_menu_item_option.option_type %></td>
|
||||
<td><%= @settings_menu_item_option.name %></td>
|
||||
<td><%= @settings_menu_item_option.value rescue "-" %></td>
|
||||
<td><%=l @settings_menu_item_option.created_at, format: :short %></td>
|
||||
|
||||
18
app/views/settings/products/_form.html.erb
Normal file
18
app/views/settings/products/_form.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<%= simple_form_for([:settings,@settings_product]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :alt_name %>
|
||||
<%= f.input :unit_price %>
|
||||
<%= f.input :image_path %>
|
||||
<%= f.input :description %>
|
||||
<%= f.input :information %>
|
||||
<label><%= f.check_box :taxable %>Taxable</label>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_product, :id, :created_at, :updated_at
|
||||
json.url settings_product_url(settings_product, format: :json)
|
||||
10
app/views/settings/products/edit.html.erb
Normal file
10
app/views/settings/products/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_products_path %>">Products</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', settings_product: @settings_product %>
|
||||
</div>
|
||||
45
app/views/settings/products/index.html.erb
Normal file
45
app/views/settings/products/index.html.erb
Normal file
@@ -0,0 +1,45 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Product</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_product_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item Code</th>
|
||||
<th>Name</th>
|
||||
<th>Alt Name</th>
|
||||
<th>Unit Price</th>
|
||||
<!-- <th style="width:20%">image_path</th> -->
|
||||
<th>Description</th>
|
||||
<th>Information</th>
|
||||
<th>Taxable</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_products.each do |settings_product| %>
|
||||
<tr>
|
||||
<td><%= settings_product.item_code %></td>
|
||||
<td><%= settings_product.name %></td>
|
||||
<td><%= settings_product.alt_name %></td>
|
||||
<td><%= settings_product.unit_price %></td>
|
||||
<td><%= settings_product.description %></td>
|
||||
<td><%= settings_product.information %></td>
|
||||
<td><%= settings_product.taxable %></td>
|
||||
<td><%= link_to 'Show', settings_product_path(settings_product) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_product_path(settings_product) %></td>
|
||||
<td><%= link_to 'Destroy', settings_product_path(settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
1
app/views/settings/products/index.json.jbuilder
Normal file
1
app/views/settings/products/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @settings_products, partial: 'settings_products/settings_product', as: :settings_product
|
||||
26
app/views/settings/products/new.html.erb
Normal file
26
app/views/settings/products/new.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_products_path %>">Products</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', settings_product: @settings_product %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function randomNumber(len) {
|
||||
var sValidCharacters = "01234ABCDEFGHIJabcdefghijk56789lmnKLMNOPQRSTUVWXYZopqrstuvwxyz";
|
||||
var sCharCode = "";
|
||||
|
||||
for (i = 1; i <= len; i++) {
|
||||
sCharCode = sCharCode + sValidCharacters.charAt(parseInt(Math.random() * sValidCharacters.length));
|
||||
if ((i === 4) || (i === 8)) {
|
||||
sCharCode = sCharCode + "-";
|
||||
}
|
||||
}
|
||||
return sCharCode;
|
||||
}
|
||||
document.getElementById("item_code").value = randomNumber(12);
|
||||
</script>
|
||||
33
app/views/settings/products/show.html.erb
Normal file
33
app/views/settings/products/show.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_products_path %>">Products</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Product</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr><td style="width:20%">Item code</td><td><%= @settings_product.item_code %></td></tr>
|
||||
<tr><td style="width:20%">Name</td><td><%= @settings_product.name %></td></tr>
|
||||
<tr><td style="width:20%">Alt name</td><td><%= @settings_product.alt_name %></td></tr>
|
||||
<tr><td style="width:20%">Unit price</td><td><%= @settings_product.unit_price %></td></tr>
|
||||
<tr><td style="width:20%">Image path</td><td><%= image_tag @settings_product.image_path, :size => '200x200'%></td></tr>
|
||||
<tr><td style="width:20%">Description</td><td><%= @settings_product.description %></td></tr>
|
||||
<tr><td style="width:20%">Information</td><td><%= @settings_product.information %></td></tr>
|
||||
<tr><td style="width:20%">Taxable</td><td><%= @settings_product.taxable %></td></tr>
|
||||
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_product_path(@settings_product) %></td><td><%= link_to 'Destroy', settings_product_path(@settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
1
app/views/settings/products/show.json.jbuilder
Normal file
1
app/views/settings/products/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "settings_products/settings_product", settings_product: @settings_product
|
||||
48
app/views/settings/promotions/_form.html.erb
Normal file
48
app/views/settings/promotions/_form.html.erb
Normal file
@@ -0,0 +1,48 @@
|
||||
<%= simple_form_for([:settings,@promotion]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<div class="div-border">
|
||||
<div class="row">
|
||||
<div class="col-md-6"><%= f.input :promo_code %></div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<span>Promo Start Date</span>
|
||||
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<span>Promo End Date</span>
|
||||
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= f.input :promo_start_hour %>
|
||||
<!-- <span>Promo Start Hour</span>
|
||||
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
|
||||
</div>
|
||||
<div class="col-md-6"><%= f.input :promo_end_hour %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12"><%= f.input :promo_day %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<%= f.input :promo_type,input_html: { class: "" },
|
||||
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
|
||||
<div class="col-md-6"><%= f.input :min_qty %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
2
app/views/settings/promotions/_promotion.json.jbuilder
Normal file
2
app/views/settings/promotions/_promotion.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! promotion, :id, :created_at, :updated_at
|
||||
json.url promotion_url(promotion, format: :json)
|
||||
10
app/views/settings/promotions/edit.html.erb
Normal file
10
app/views/settings/promotions/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', promotion: @promotion %>
|
||||
</div>
|
||||
58
app/views/settings/promotions/index.html.erb
Normal file
58
app/views/settings/promotions/index.html.erb
Normal file
@@ -0,0 +1,58 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li>Promotions</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_promotion_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Promotion Code</th>
|
||||
<th>Start Date</th>
|
||||
<th>End Date</th>
|
||||
<th>Start Time</th>
|
||||
<th>End Time</th>
|
||||
<th>Promotion Day</th>
|
||||
<th>Original Product</th>
|
||||
<th>Created By</th>
|
||||
<th>Created At</th>
|
||||
<th colspan="2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @promotions.each do |pro| %>
|
||||
<tr>
|
||||
<td><%= link_to pro.promo_code, settings_promotion_path(pro) %></td>
|
||||
<td><%= pro.promo_start_date %></td>
|
||||
<td><%= pro.promo_end_date %></td>
|
||||
<td><%= pro.promo_start_hour.strftime("%I:%M %P") rescue "-" %></td>
|
||||
<td><%= pro.promo_end_hour.strftime("%I:%M %P") rescue "-" %></td>
|
||||
<td><%= pro.promo_day %></td>
|
||||
<td>
|
||||
<% if MenuItem.exists?(pro.original_product) %>
|
||||
<%= MenuItem.find(pro.original_product).name %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if Employee.exists?(pro.created_by) %>
|
||||
<td><%= Employee.find(pro.created_by).name %></td>
|
||||
<% else %>
|
||||
<td><%= pro.created_by %></td>
|
||||
<% end %>
|
||||
<td><%= pro.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_promotion_path(pro) %></td>
|
||||
<td><%= link_to 'Destroy', settings_promotion_path(pro), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
1
app/views/settings/promotions/index.json.jbuilder
Normal file
1
app/views/settings/promotions/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @promotions, partial: 'promotions/promotion', as: :promotion
|
||||
17
app/views/settings/promotions/new.html.erb
Normal file
17
app/views/settings/promotions/new.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', promotion: @promotion %>
|
||||
</div>
|
||||
<script>
|
||||
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
|
||||
// $( "#fromtime" ).timepicker();
|
||||
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
|
||||
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
|
||||
</script>
|
||||
4
app/views/settings/promotions/show.html.erb
Normal file
4
app/views/settings/promotions/show.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= link_to 'Edit', edit_promotion_path(@promotion) %> |
|
||||
<%= link_to 'Back', promotions_path %>
|
||||
1
app/views/settings/promotions/show.json.jbuilder
Normal file
1
app/views/settings/promotions/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "promotions/promotion", promotion: @promotion
|
||||
@@ -21,10 +21,7 @@
|
||||
<th>Type</th>
|
||||
<th>Account Type</th>
|
||||
<th>Menu category</th>
|
||||
<th>Menu item</th>
|
||||
<th>Min qty</th>
|
||||
<th>Min selectable item</th>
|
||||
<th>Max selectable item</th>
|
||||
<th>Created At</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@@ -38,10 +35,7 @@
|
||||
<td><%= @settings_menu_item.type %></td>
|
||||
<td><%= @settings_menu_item.account.title %></td>
|
||||
<td><%= @settings_menu_item.menu_category_id %></td>
|
||||
<td><%= @settings_menu_item.menu_item_id %></td>
|
||||
<td><%= @settings_menu_item.min_qty %></td>
|
||||
<td><%= @settings_menu_item.min_selectable_item %></td>
|
||||
<td><%= @settings_menu_item.max_selectable_item %></td>
|
||||
<td><%= @settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, @settings_menu_item) %></td>
|
||||
@@ -51,58 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @sub_menu.count > 0 %>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Sub Menu Items </h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item code</th>
|
||||
<th>Name</th>
|
||||
<th>Alt name</th>
|
||||
<th>Type</th>
|
||||
<th>Parent Item</th>
|
||||
<th>Created by</th>
|
||||
<th>Created at</th>
|
||||
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @sub_menu.each do |settings_menu_item| %>
|
||||
<tr>
|
||||
<td><%= settings_menu_item.item_code %></td>
|
||||
<td><%= settings_menu_item.name %></td>
|
||||
<td><%= settings_menu_item.alt_name %></td>
|
||||
<td><%= settings_menu_item.type %></td>
|
||||
<td><%= settings_menu_item.parent.name rescue "-" %></td>
|
||||
<td><%= settings_menu_item.created_by %></td>
|
||||
|
||||
<td><%= settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
|
||||
<% if settings_menu_item.type == "SimpleMenuItem" %>
|
||||
<td><%= link_to 'Show', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@category, settings_menu_item) %></td>
|
||||
<td><%= link_to 'Destroy', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<% else %>
|
||||
<td><%= link_to 'Show', settings_menu_category_set_menu_item_path(@category, settings_menu_item ) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, settings_menu_item) %></td>
|
||||
<td><%= link_to 'Destroy', settings_menu_category_set_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%= paginate @sub_menu, param_name: :page, :outer_window => 3 %>
|
||||
|
||||
<% end %>
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Menu Item Instances
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
<th>Type</th>
|
||||
<th>Accout</th>
|
||||
<th>Menu category</th>
|
||||
<th>Menu item</th>
|
||||
<!-- <th>Menu item</th> -->
|
||||
<th>Min qty</th>
|
||||
<th>Min selectable item</th>
|
||||
<th>Max selectable item</th>
|
||||
<!-- <th>Min selectable item</th>
|
||||
<th>Max selectable item</th> -->
|
||||
<th>Created At</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@@ -40,10 +40,7 @@
|
||||
<td><%= @settings_menu_item.type %></td>
|
||||
<td><%= @settings_menu_item.account.title %></td>
|
||||
<td><%= @settings_menu_item.menu_category_id %></td>
|
||||
<td><%= @settings_menu_item.menu_item_id %></td>
|
||||
<td><%= @settings_menu_item.min_qty %></td>
|
||||
<td><%= @settings_menu_item.min_selectable_item %></td>
|
||||
<td><%= @settings_menu_item.max_selectable_item %></td>
|
||||
|
||||
<td><%= @settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
|
||||
@@ -54,60 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @sub_menu.count > 0 %>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Sub Menu Items </h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item code</th>
|
||||
<th>Name</th>
|
||||
<th>Alt name</th>
|
||||
<th>Type</th>
|
||||
<th>Parent Item</th>
|
||||
<th>Created by</th>
|
||||
<th>Created at</th>
|
||||
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @sub_menu.each do |settings_menu_item| %>
|
||||
<tr>
|
||||
<td><%= settings_menu_item.item_code %></td>
|
||||
<td><%= settings_menu_item.name %></td>
|
||||
<td><%= settings_menu_item.alt_name %></td>
|
||||
<td><%= settings_menu_item.type %></td>
|
||||
<td><%= settings_menu_item.parent.name rescue "-" %></td>
|
||||
<td><%= settings_menu_item.created_by %></td>
|
||||
|
||||
<td><%= settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
|
||||
|
||||
|
||||
<% if settings_menu_item.type == "SimpleMenuItem" %>
|
||||
<td><%= link_to 'Show', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@category, settings_menu_item) %></td>
|
||||
<td><%= link_to 'Destroy', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<% else %>
|
||||
<td><%= link_to 'Show', settings_menu_category_set_menu_item_path(@category, settings_menu_item ) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, settings_menu_item) %></td>
|
||||
<td><%= link_to 'Destroy', settings_menu_category_set_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%= paginate @sub_menu, param_name: :page, :outer_window => 3 %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Menu Item Instances
|
||||
|
||||
Reference in New Issue
Block a user