Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring

* 'august_spring' of bitbucket.org:code2lab/sxrestaurant: (71 commits)
  Update
  Coupon / Voucher data change
  update menu_sync
  update addorder
  update addorder view
  add fields for Menu Sync
  update add oreder
  add menu api
  update add order and calculate subtotal
  update seed
  menu ui update
  update ability for setmenu
  fixed
  update show for foc
  add bootstrap file input and menu item img implemented
  update foc and pdf
  update menu item
  update receipt bill pdf for foc and credit
  add CarrierWave gems for menu image upload
  add CarrierWave gems for menu image upload
  ...
This commit is contained in:
Zin Lin Phyo
2017-08-21 13:30:28 +06:30
169 changed files with 4114 additions and 866 deletions

View 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

View File

@@ -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

View File

@@ -1,40 +1,70 @@
# Format for attributes json
attr_format = []
param_count = item.item_attributes.count
# Format for attributes json
item.item_attributes.each do|attr_id|
menu_attr = MenuItemAttribute.find(attr_id)
if attr_format.count == 0
attr_format.push({ type: menu_attr.attribute_type, value: [] })
end
attr_format.each do |af|
if menu_attr.attribute_type == af[:type]
af[:value].push(menu_attr.value)
else
new_attr = {type: menu_attr.attribute_type, value: [ menu_attr.value ] }
attr_format.push(new_attr)
end
break if attr_format.count > param_count
end
param_count -= 1
end
#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.item_sets item.item_sets
json.attributes attr_format
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
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
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
# 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
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_default is.is_default
json.is_on_promotion is.is_on_promotion
json.promotion_price is.promotion_price
json.item_attributes is.item_attributes
json.item_sets is.item_sets
end
#Child Menu items
if (item.children) then
json.set_items item.children.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

View File

@@ -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

View File

@@ -0,0 +1,48 @@
if @menu.menu_items
json.menu_items @menu.menu_items do |item|
#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
#Item instance
# 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
# 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
# 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
#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 category.menu_items
# json.items category.menu_items do |item|
json.partial! 'api/restaurant/menu/menu_item', item: item
# end
# end
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,3 @@
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
<%= f.error_notification %>

View File

@@ -1,25 +1,7 @@
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['card_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end %>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<label>Salutation :</label><br>
@@ -100,7 +82,39 @@
<div class="form-group">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
</div>
<div class="form-group">
<label>Select Customer Type</label>
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %></option>
<%end %>
</select>
</div>
<div class="form-group">
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['card_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end %>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<div class="form-group">
<label>Select Member Group</label>
@@ -110,8 +124,7 @@
<option value="<%= member.value %>">
<%= member.name %></option>
<%end %>
</select>
</select>
</div>
<div class="form-group">
@@ -138,6 +151,11 @@
},100);
}
});
// $("#customer_card_no").click(function(){
// var ab=$("#customer_tax_profiles").val();
// console.log(JSON.stringify(ab));
// });
});

View File

@@ -0,0 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -76,7 +76,7 @@
</div>
</div>
<%= render 'new_form', crm_customer: @crm_customer %>
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
<div class="col-lg-1 col-md-1 col-sm-1">
<br>
@@ -121,15 +121,24 @@ $(document).on('click',".customer_tr",function(){
update_sale(customer_id,sale_id);
}else{
var url = "customers/"+customer_id;
var url = "customers/" + customer_id + "/edit";
}
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
success: function(data) {
// Selected for Taxes
var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes);
$.each(parse_taxes, function(i, value){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
});
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
@@ -138,6 +147,7 @@ $(document).on('click',".customer_tr",function(){
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#customer_card_no').val(data.card_no);
$('#customer_type').val(data.customer_type);
$('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -5,13 +5,10 @@
<% elsif current_login_employee.role = "cashier" %>
<%= link_to "Cashier Station", origami_path %>
<% elsif current_login_employee = "account" %>
<%= link_to "Cashier Station", oishi_path %>
<% else %>
<%= link_to "Cashier Station", oishi_path %>
<% end %>
<% shop = Shop.first %>
@@ -228,28 +225,21 @@
<div class="footer">
<div class="card">
<div class="page-header" style="width:100%;text-align:center;background-color:#ddd;">
<h4 style="color : #ef404a;font-weight:bold;font-style:italic;margin-bottom:0px;"><%= shop.name %></h4>
<div class="page-header center-text">
<h4 class="footer-header">
<%= shop.name %>
</h4>
</div>
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
<div class="center-text">
<%= shop.address %>
</div>
<div class="card-block" style="text-align:center;background-color:#ddd;padding:0rem;">
<div class="center-text">
<%= shop.phone_no %>
</div>
</div>
</div>
<style type="text/css">
.footer {
position: fixed;
bottom: 0;
left: 0;
height: auto;
width: 100%;
}
.card {
margin-top: 10px;
box-sizing: border-box;
@@ -289,3 +279,4 @@
}
</style>

View File

@@ -13,6 +13,8 @@
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
<li><%= link_to "Item Sets ", settings_item_sets_path, :tabindex =>"-1" %></li>
<li><%= link_to "Menu Item Sets ", settings_menu_item_sets_path, :tabindex =>"-1" %></li>
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
<li><%= link_to "Menu Item Attributes", settings_menu_item_attributes_path, :tabindex =>"-1" %></li>
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
@@ -29,7 +31,7 @@
<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 "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
</ul>
</li>

View File

@@ -11,7 +11,10 @@
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'settings', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'fileinput.min', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'fileinput.min', 'data-turbolinks-track': 'reload' %>
</head>
<body>
@@ -32,8 +35,7 @@
<%= message %>
</div>
<% end %>
<%= yield %>
<%= yield %>
</div>
</body>
</html>

View File

@@ -0,0 +1,197 @@
<div class="row">
<!-- Column One -->
<div class="col-lg-8 col-md-8 col-sm-8">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li>
<% # For Tab Disable for Station is inactive
status=""
@queue_stations_items.each do |qsi|
if qsi[:is_active] == false
status="disabled"
end
%>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
<%= qsi[:station_name] %>
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
<%= qsi[:item_count] %>
</span>
<% if qsi[:is_ap] %>
<span>(ap)</span>
<% end %>
</a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="max-height:670px; overflow:auto">
<!--- Panel 0 - Completed -->
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone-type"><%= qid.type %> - </span>
<span class="order-zone"><%= qid.zone %></span>
<small class="pull-right"><%= qid.order_id %></small>
</h4>
<h4>
<span class="order-item">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
</span>
</small>
</p>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<%
end
%>
</div>
</div>
<!-- End Panel 0 - Completed -->
<!-- Order Item for Queue Station -->
<%
@queue_stations_items.each do |qsi|
%>
<!-- Generated Pane -->
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
<!--- Order Items -->
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_items_details.each do |qid|
if qid.price != 0
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone-type"><%= qid.type %> - </span>
<span class="order-zone"><%= qid.zone %></span>
<small class="pull-right"><%= qid.order_id %></small>
</h4>
<h4>
<span class="order-item"><%= qid.item_name %></span> [x
<span class="order-qty"><%= qid.qty %></span> ]
</h4>
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
</span>
</small>
</p>
<!-- Hidden Fields for Items -->
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
<div class="card-footer">
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
</div>
</div>
<%
end
end
end
%>
<!--- end of Items-->
</div>
</div>
<!-- end of Pane -->
<% end %>
<!-- End Order Item for Queue Station -->
</div>
</div>
<!-- Column Two -->
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">ORDER DETAILS - Table</strong></div>
</div>
<div class="card-block">
<div class="card-title">
<table class="table">
<thead>
<tr>
<th style="width:33%; text-align:left">Order By</th>
<th style="width:33%; text-align:right">Order At</td>
<th style="width:33%; text-align:right">Customer</td>
</tr>
</thead>
<tbody>
<tr>
<td id="order-by" style="width:33%; text-align:left"></td>
<td id="order-at" style="width:33%; text-align:right"></td>
<td id="order-customer" style="width:33%; text-align:right"></td>
</tr>
<tr>
<td><strong>Table/Room</strong></td>
<td id="order-from" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="card-text" style="min-height:360px; max-height:360px; overflow:auto">
<table class="table" id="oqs-order-details-table">
<thead>
<tr>
<th style="width:80%; text-align:left">Items</th>
<th style="width:20%; text-align:right">QTY</th>
</tr>
</thead>
<tbody>
<!-- Bind With JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three--->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_summary">Print <br/>Order<br/>Summary</button>
<a href="<%= dashboard_path %>" class="btn btn-primary btn-lg btn-block" role="button" aria-haspopup="true"> Back </a>
<!-- <button type="button" class="" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
</div>
</div>

View File

@@ -1,39 +1,66 @@
<br>
<div class="row">
<!-- Column One -->
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="col-md-6">
<%= form_tag oqs_root_path, :method => :get do %>
<div class="form-group col-md-8">
<input type="text" name="filter" class="form-control input-md" placeholder="">
</div>
<div class="form-group col-md-1">
<input type="submit" value="Search" class='btn btn-primary btn-md'>
</div>
<% end %>
</div>
</div>
<hr>
<!-- Column One -->
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
<!-- <li class="nav-item nav-search <%= @filter.to_s.length > 0? " " : "hide"%>">
<a class="nav-link <%= @filter.to_s.length > 0? "active" : " "%>" data-toggle="tab" href="#search" role="tab">Searching .. <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li> -->
<li class="nav-item nav-completed">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li>
<%
# For Tab Disable for Station is inactive
<% # For Tab Disable for Station is inactive
status=""
@queue_stations_items.each do |qsi|
if qsi[:is_active] == false
@queue_stations.each do |qsi|
if qsi.is_active == false
status="disabled"
end
%>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href=<%= '#' + qsi[:station_name].gsub(' ', '_') %> role="tab" <%= status %>>
<%= qsi[:station_name] %>
<span class="badge badge-pill badge-default" id=<%= qsi[:station_name].gsub(' ', '_') + '_count' %>>
<%= qsi[:item_count] %>
end %>
<li class="nav-item oqs_click" >
<p class="hidden oqs-id"><%= qsi.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab" <%= status %>>
<%= qsi.station_name %>
<% if @filter.nil? %>
<span class="badge badge-pill badge-default" id=""> <%= qsi.assigned_order_items.where("delivery_status=0").count %>
</span>
<% if qsi[:is_ap] %>
<span>(ap)</span>
<% end %>
</a>
<%else%>
<span class="badge badge-pill badge-default" id="">
<% @count.each do |c|%>
<% if qsi.id == c.station_id %>
<%= c.total %>
<%end %>
<%end %>
</span>
<%end%>
<% if qsi.auto_print %>
<span>(ap)</span>
<% end %>
</a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<p class="hidden filter"><%= @filter %></p>
<div class="tab-content" style="max-height:670px; overflow:auto">
<!--- Panel 0 - Completed -->
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@@ -77,66 +104,14 @@
%>
</div>
</div>
<!-- End Panel 0 - Completed -->
<!-- Order Item for Queue Station -->
<%
@queue_stations_items.each do |qsi|
%>
<!-- Generated Pane -->
<div class="tab-pane" id=<%= qsi[:station_name].gsub(' ', '_') %> role="tabpanel">
<!--- Order Items -->
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_items_details.each do |qid|
if qid.price != 0
if qid.zone_id == qsi[:zone_id] && qid.station_name == qsi[:station_name]
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone-type"><%= qid.type %> - </span>
<span class="order-zone"><%= qid.zone %></span>
<small class="pull-right"><%= qid.order_id %></small>
</h4>
<h4>
<span class="order-item"><%= qid.item_name %></span> [x
<span class="order-qty"><%= qid.qty %></span> ]
</h4>
<p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
</span>
</small>
</p>
<!-- Hidden Fields for Items -->
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
<div class="card-footer">
<button id=<%= 'edit_' + qid.assigned_order_item_id.to_s %> class="btn btn-warning order-item order-item-edit">EDIT</button>
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary order-item order-complete">COMPLETE</button>
</div>
</div>
<%
end
end
end
%>
<!--- end of Items-->
</div>
</div>
<!-- end of Pane -->
<% end %>
<!-- End Order Item for Queue Station -->
<!--- Order Items -->
<div class="card-columns oqs_append" style="padding-top:10px; column-gap: 1.2rem;">
</div>
<!--- end of Items-->
</div>
</div>
@@ -197,4 +172,6 @@
</div>
</div>
<script type="text/javascript">
</script>

View File

@@ -0,0 +1,108 @@
<div class="row">
<div class="col-lg-11 col-md-11 col-sm-11">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#table" role="tab">Tables</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#room" role="tab">Rooms</a>
</li>
</ul>
<div class="tab-content" style="max-height:650px; overflow:auto">
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
<% @tables.each do |zone| %>
<h3>Zone : <%=zone.zone.name%></h3>
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
<% @all_table.each do |table| %>
<% if zone.zone_id == table.zone_id %>
<div class="card click_table <%= table.status=="available" ? "available" : "occupied"%>" data-id = "<%= table.id %>">
<div class="card-block">
<p class="hidden table-status"><%= table.status %></p>
<p style="text-align: center"><%= table.name %></p>
<p style="text-align: center">Seat : <%= table.seater %></p>
</div>
</div>
<% end %> <% end %>
</div>
<% end %>
</div>
<div class="tab-pane" id="room" role="tabpanel" style="max-height:; overflow:auto">
<% @rooms.each do |zone| %>
<h3>Zone : <%=zone.zone.name%></h3>
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
<% @all_room.each do |room| %>
<% if zone.zone_id == room.zone_id %>
<div class="card click_table <%= room.status=="available" ? "available" : "occupied"%>" data-id = "<%= room.id %>">
<div class="card-block">
<p class="hidden table-status"><%= room.status %></p>
<p style="text-align: center"><%= room.name %></p>
<p style="text-align: center">Seat : <%= room.seater %></p>
</div>
</div>
<% end %> <% end %>
</div>
<% end %>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
</div>
</div>
<script>
$(document).on('click',".click_table",function(){
var dining_id = $(this).attr('data-id');
var status = $(this).find(".table-status").text();
if (status == "available") {
$.confirm({
title: 'Confirmation !',
content: 'Are you sure to assign this table',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami/addorders/'+dining_id;
}
}
}
});
} else {
$.confirm({
title: 'Alert!',
content: 'You cannot assign this table',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-red',
}
}
});
}
})
</script>
<style type="text/css">
.card-columns {
-webkit-column-count:5;
-moz-column-count:5;
column-count:5;
}
.occupied{
color: #fff !important;
background-color: red;
}
.available{
color: #fff !important;
background-color: #009900;
}
</style>

View File

@@ -0,0 +1,411 @@
<div class="row">
<div class="col-lg-2 col-md-2 col-sm-2">
<ul class="nav nav-tabs flex-column" role="tablist" >
<% @menu.each do |menu| %>
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
</li>
<% end %>
</ul>
</div>
<div class="col-md-7 col-lg-7 col-sm-7">
<div class="card-columns menu_items_list" style="column-gap: 10px;">
<!-- append data -->
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<div class="card-header">
<div>
<strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%>
</div>
</div>
<div class="card-block">
<div class="card-text" style="max-height:550px; overflow:auto"">
<table class="table table-striped summary-items">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-qty">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="sub_total">0.00</strong></td>
</tr>
</table>
<button type="button" class="btn btn-success create" id="create_order" disabled="disabled">Create Order</button>
</div>
</div>
</div>
<!-- Large modal -->
<button class="btn btn-primary" data-toggle="modal" data-target=".sx_item_detailModal">Large modal</button>
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;">
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">&times;</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-5">
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
<br><br>
<div class="form-group">
<h4 class="col-md-12">Quantity</h4>
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
</div>
<div class="form-group row">
<h4 class="col-md-6">Total</h4>
<h4 class="col-md-6" id="total_price"> 2500 Ks</h4>
</div>
</div>
<div class="col-md-7">
<h4>Options</h4>
<h4>Attributes</h4>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<table width="100%" class="table table-striped">
<thead>
<tr>
<th style="">Item Name</th>
<th style="">Quantity</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td class="item_name" id="modal-item-name"></td>
<td>
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
</td>
<td>
<button type="button" id="remove" class="btn btn-danger" data-dismiss="modal">Remove</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal" id="save">Update</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
//click menu sidebar menu category
$(".menu_category").on("click", function(){
var menu_id = $(this).find(".menu-id").text();
var url = $(this).attr('data-ref');
show_menu_item_list(url);
});
//End menu category Click
//show menu item list when click menu category
function show_menu_item_list(url_item){
var menu_list = $('.menu_items_list');
menu_list.empty();
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
console.log(data);
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
console.log(data);
for(var field in menu_items) {
var code = menu_items[field].instances[0].code
var name = menu_items[field].instances[0].name
var price = parseFloat(menu_items[field].instances[0].price).toFixed(2);
var is_available = menu_items[field].instances[0].is_available
var is_on_promotion = menu_items[field].instances[0].is_on_promotion
var item_attributes = menu_items[field].instances[0].item_attributes
var promotion_price = menu_items[field].instances[0].promotion_price
row = '<div class="card">'
+'<div class="card-head" style="line-height:14px;">'
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
+'<div class="col-md-3 add_icon"'
+'data-id="'+ menu_items[field].name +'"'
+'data-item-code="'+ menu_items[field].item_code +'"'
+'data-name="'+ menu_items[field].name +'"'
+'data-price="'+ price +'"'
+'data-available="'+ is_available +'"'
+'data-promotion="'+ is_on_promotion +'"'
+'data-attributes="'+ item_attributes +'"'
+'data-instance-code="'+ code +'"'
+'data-instance="'+ name +'"'
+'data-promotion-price="'+ promotion_price +'"'
+'>'
+'<i class="fa fa-plus "'
+ 'style="margin-top:4px;">'
+'</i></div>'
+'</div>'
+'<div class="menu_item_box" data-toggle="modal" data-target=".sx_item_detailModal">'
+'<div class="card-block">'
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
+'</div>'
+'<div class="card-footer">'
+'<small>'+ price +'</small>'
+'</div>'
+'</div>';
$('.menu_items_list').append(row);
}
}
});
//end Ajax
}
//end show detail function
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
show_item_detail(item_data);
calculate_sub_total();
}); //End Add Icon Click
function show_item_detail(data){
qty = 1;
append = 0;
price = parseFloat(data.attr('data-price')).toFixed(2);
instance_code = data.attr('data-instance');
if (instance_code == "undefined"){
instance = '';
}else{
instance = "("+data.attr('data-instance')+")";
}
var rowCount = $('.summary-items tbody tr').length+1;
var item_row = $('.summary-items tbody tr');
$(item_row).each(function(i){
if ($(item_row[i]).attr('data-code') == data.attr('data-item-code')) {
qty = parseInt($(item_row[i]).children('#item_qty').text()) +1;
$(item_row[i]).children('#item_qty').text(qty);
parseFloat($(item_row[i]).children('#item_price').text(price*qty)).toFixed(2);
append = 1;
}else{
qty = 1;
}
});
if (append===0) {
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + '</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(price).toFixed(2)
+'</td>'
+'</tr>';
$(".summary-items tbody").append(row);
}
}
//click item row for update qty
$('.summary-items').on('click', '.item_box', function(){
$(this).attr('data-active',true);
name = $(this).children('#item_name').text();
qty = $(this).children('#item_qty').text();
$('#modal-item-name').text(name);
$('#modal-qty').val(qty);
});
//click item row for update qty
$(document).on('click', '.menu_item_box', function(event){
data = $(this).parent().children().children('.add_icon');
$('#title_name').text(data.attr('data-name'));
console.log(data);
});
//click remove buttom in modal box
$('#sx_itemModal').on('click','#remove', function(){
$('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){
$(this).remove();
}
});
calculate_sub_total();
});
//click close
$('#sx_itemModal').on('click','#close', function(){
$(".item_box").removeAttr("data-active");
});
//click save buttom after change qty
$('#sx_itemModal').on('click','#save', function(){
summary_items_filter();
calculate_sub_total();
});
//calculate subtotal
function calculate_sub_total(){
var total_price = 0;
var taxable_amount = 0;
var item_row = $('.summary-items tbody tr');
$(item_row).each(function(i){
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
total_price += qty*unit_price;
});
var fixed_total_price = parseFloat(total_price).toFixed(2);
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
$('#sub_total').empty();
$('#sub_total').append(fixed_total_price);
if (fixed_total_price > 0) {
$('.create').removeAttr("disabled", false);
}else{
$('.create').attr("disabled", true);
}
}
function summary_items_filter(){
$('.summary-items tr').filter(function(){
if ($(this).attr('data-active') == 'true'){
qty = $('#modal-qty').val();
price = parseFloat($(this).attr('data-price'));
total_price = parseFloat(price*qty).toFixed(2);
$(this).find('#item_qty').text(qty);
$(this).find('.item-cell-price').text(total_price);
$(this).removeAttr('data-active');
}
});
}
});
</script>
<style type="text/css">
.card-head{
height: 40px;
background-color: #54A5AF;
padding:5px;
color :#fff;
}
.card-block {
padding: 0.3rem !important;
}
@media (min-width: 34em) {
.card-columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
}
@media (min-width: 48em) {
.card-columns {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
}
@media (min-width: 62em) {
.card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
}
@media (min-width: 75em) {
.card-columns {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
}
}
.nav-tabs .nav-item {
border-bottom: 1px solid #fff;
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
}
.nav > li > a{
color:#54A5AF;
}
.nav-tabs {
background-color: #eeeeee;
}
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
background-color: #fff;
border-left: 6px solid #111;
color:#54A5AF;
font-weight: bold;
border-color: #fff #fff #fff #54A5AF;
}
.modal-dialog {
left:auto;
right: auto;
width: 100%;
padding-top: 100px;
}
</style>

View File

@@ -81,23 +81,7 @@
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<label>Salutation :</label><br>
<label>Mr</label>
@@ -176,6 +160,37 @@
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
<div class="form-group">
<label>Select Customer Type</label>
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %></option>
<%end %>
</select>
</div>
<div class="form-group">
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<div class="form-group">
<label>Select Member Group</label>
<select class="selectpicker form-control col-md-12" name="member_group_id">
@@ -292,6 +307,12 @@
data: {},
dataType: "json",
success: function(data) {
var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes);
$.each(parse_taxes, function(i, value){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
});
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
@@ -301,7 +322,8 @@
$('#customer_membership_type').val(data.membership_type);
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code);
$('#customer_card_no').val(data.card_no);
$('#customer_type').val(data.customer_type);
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#paypar_account_no').val(data.paypar_account_no);

View File

@@ -108,9 +108,12 @@
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
<!-- Temporary Disabled -->
<!-- <button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Sammary</button> -->
<%if current_login_employee.role == "cashier" && @shop.quick_sale_summary == true%>
<button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Summary</button>
<%end%>
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
</button>

View File

@@ -305,31 +305,28 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
<% if @dining.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
<% end %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
<% end %>
<!-- Cashier Buttons -->
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
@@ -580,4 +577,9 @@ function show_customer_details(customer_id){
}
});
$('#add_order').on('click',function(){
var dining_id = "<%= @dining.id %>"
window.location.href = '/origami/addorders/'+ dining_id;
});
</script>

View File

@@ -41,24 +41,24 @@
<% sub_total = 0
count = 0
%>
<% @sale_data.sale_items.each do |sale_item|
<% @sale_data.sale_items.each do |sale_item|
count += 1
%>
<% sub_total += sale_item.price%>
<tr>
<% sub_total += sale_item.price%>
<tr>
<td><%= count %></td>
<td style="width:60%; text-align:left">
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"><%=sale_item.qty%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"><%=(sale_item.price)%></span>
</td>
</tr>
<%end %>
<td style="width:60%; text-align:left">
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"><%=sale_item.qty%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"><%=(sale_item.price)%></span>
</td>
</tr>
<%end %>
</tbody>
</table>
</div>
@@ -75,7 +75,7 @@
<%else%>
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
<%end%>
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
</tr>
<tr>
@@ -258,7 +258,7 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
<button type="button" class="btn btn-primary btn-block"> FOC </button>
<button type="button" class="btn btn-primary btn-block" id="foc"> FOC </button>
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
</div>
@@ -443,4 +443,40 @@ function update_balance(){
$('#balance').text(result.toFixed(2));
}
$('#foc').click(function() {
$( "#loading_wrapper" ).show();
// payment
var cash = $('#amount_due').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
$.ajax({type: "POST",
url: "<%= origami_payment_foc_path %>",
data: params,
success:function(result){
$( "#loading_wrapper" ).hide();
if (cash > 0) {
$.confirm({
title: 'Infomation!',
content: 'Thank you !',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami';
}
}
}
});
}
}
});
});
</script>

View File

@@ -0,0 +1,201 @@
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10">
<h3 style="text-align: center;">Sales Summary Quick View </h3>
<table class="table table-striped">
<tbody>
<tr>
<th>Cashier </th>
<th>Cashier Terminal </th>
<th>Opening Date </th>
<th>Opening float </th>
<th>Received Amount </th>
<th>Cast In </th>
<th>Cast Out </th>
<th>Total Receipt </th>
<th>Dining Count </th>
<th>Takeaway Count </th>
<th>Total Void</th>
</tr>
<tr style="border-bottom:2px solid #000">
<td><%= @shift.employee.name%></td>
<td><%=@shift.cashier_terminal.name%></td>
<td><%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
</td>
<td><%=@shift.opening_balance %></td>
<td><%=@shift.closing_balance %></td>
<td><%=@shift.cash_in %></td>
<td><%=@shift.cash_out %></td>
<th><%= @shift.total_receipt %></th>
<th><%= @shift.dining_count %></th>
<th><%= @shift.takeaway_count %></th>
<th>(<%= @shift.total_void.round(2) %>)</th>
</tr>
<tr>
<td colspan="5">
<table width="100%">
<% @total_amount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Amount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Net Sales</th>
<th><%=@shift.nett_sales %></th>
</tr>
<% @total_discount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Discount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<% if !@total_member_discount[0].member_discount.nil?
@member_discount = @total_member_discount[0].member_discount rescue 0.0
@overall = @shift.total_discounts - @member_discount
%>
<tr>
<th></th>
<th style="text-align: right;"> Total Member Discount</th>
<th><%= @member_discount %></th>
</tr>
<%else @overall = @shift.total_discounts %>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Overall Discount</th>
<th><%= @overall %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Total Discount</th>
<th><%= @shift.total_discounts %></th>
</tr>
<% @sale_taxes.each do |tax| %>
<tr>
<th></th>
<td style="text-align: right;"> <%= tax.tax_name %> </td>
<td><%= tax.st_amount.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Tax </th>
<th><%=@shift.total_taxes %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Rounding Adj </th>
<th><%= @shift.total_rounding.round(2) %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Grand Total </th>
<th><%= @shift.grand_total.round(2) %></th>
</tr>
</table>
</td>
<td colspan="6">
<table width="100%">
<tr>
<th></th>
<th style="text-align: right;">Cash Payment </th>
<th><%=@shift.cash_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Credit Payment </th>
<th><%=@shift.credit_sales %></th>
</tr>
<% @total_amount = 0
@other_payment.each do |other| %>
<tr>
<th></th>
<th style="text-align: right;">Other Payment Detail </th>
<th></th>
</tr>
<tr>
<th></th>
<td style="text-align: right;">MPU Payment </td>
<td><%=other.mpu_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.mpu_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">VISA Payment </td>
<td><%=other.visa_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.visa_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">JCB Payment </td>
<td><%=other.master_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Master Payment </td>
<td><%=other.jcb_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Reedem Payment </td>
<td><%=other.paypar_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.paypar_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;"><strong>FOC </strong></td>
<td><%=other.foc_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.foc_amount rescue 0.0 %>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;">Total Other Payment </th>
<th><%=@shift.other_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Total Payment </th>
<th><%= @total_amount+@shift.cash_sales+@shift.credit_sales %></th>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<br><br><br>
<button id="close_cashier" type="button" class="btn btn-block btn-primary btn-lg"> Close Cashier
</button>
<button id="back" type="button" class="btn btn-block btn-primary btn-lg"><i class="fa fa-home fa-lg"></i> Back
</button>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#close_cashier').on('click',function(){
window.location.href = '/origami/shift/close';
})
$('#back').on('click',function(){
window.location.href = '/origami';
})
})
</script>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= dashboard_path %>">Home</a></li>
<li>Credit Payment List Report</li>
<li>Void Sale Report</li>
</ul>
</div>

View File

@@ -0,0 +1,15 @@
<%= simple_form_for([:settings,@settings_item_set]) do |f| %>
<%= f.error_notification %>
<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>
<div class="form-actions">
<%= f.button :submit ,:class=>'btn btn-success'%>
<%= link_to 'Back', settings_item_sets_path,:class => 'btn btn-danger' %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_item_set, :id, :name, :min_selectable_qty, :max_selectable_qty, :created_at, :updated_at
json.url settings_item_set_url(settings_item_set, format: :json)

View File

@@ -0,0 +1,3 @@
<h1>Editing Settings Item Set</h1>
<%= render 'form', settings_item_set: @settings_item_set %>

View File

@@ -0,0 +1,40 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Item Set</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_item_set_path,:class => 'btn btn-primary btn-md' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Alt Name</th>
<th>Min selectable qty</th>
<th>Max selectable qty</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @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' %>
<%= link_to 'Edit', edit_settings_item_set_path(item),:class=>'btn btn-sm btn-primary' %>
<%= link_to 'Destroy', settings_item_set_path(item), method: :delete, data: { confirm: 'Are you sure?' } ,:class=>'btn btn-danger btn-sm'%></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @settings_item_sets, partial: 'settings_item_sets/settings_item_set', as: :settings_item_set

View File

@@ -0,0 +1,4 @@
<h1>New Settings Item Set</h1>
<%= render 'form', settings_item_set: @settings_item_set %>

View File

@@ -0,0 +1,38 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_item_sets_path %>">Item Set</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="col-md-6">
<table class="table">
<tbody>
<tr>
<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>
</tr>
<tr>
<td><strong>Max selectable qty:</strong></td>
<td><%= @settings_item_set.max_selectable_qty %></td>
</tr>
</tbody>
</table>
<%= link_to 'Edit', edit_settings_item_set_path(@settings_item_set),:class=>'btn btn-primary' %>
<%= link_to 'Back', settings_item_sets_path,:class=>'btn btn-danger' %>
</div>

View File

@@ -0,0 +1 @@
json.partial! "settings_item_sets/settings_item_set", settings_item_set: @settings_item_set

View File

@@ -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">

View File

@@ -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>

View File

@@ -1,6 +1,6 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li><a href="<%= settings_menus_path %>">Home</a></li>
<li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>
<li>Details</li>
<span style="float: right">
@@ -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>

View File

@@ -3,21 +3,32 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :item_instance_code %>
<%= f.input :item_instance_name %>
<%= f.input :price %>
<div class="col-md-8 panel">
<div class="form-group">
<%= f.input :item_instance_code %>
<%= f.input :item_instance_name %>
<%= f.input :price %>
<%= f.input :item_attributes, collection: MenuItemAttribute.collection, input_html: { multiple: true } %>
<%= f.input :item_attributes, collection: MenuItemAttribute.collection, input_html: { multiple: true } %>
<%= f.input :is_on_promotion %>
<%= f.input :promotion_price %>
<%= f.input :is_available %>
<%= f.input :is_on_promotion %>
<%= f.input :promotion_price %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
<div class="col-md-4">
<div class="panel padding-10">
<div class="form-group">
<%= f.input :is_available %>
<%= f.input :is_default %>
<%= f.input :item_sets, :collection => @item_sets, :input_html => { :multiple => true }, :class => "form-control item_sets" %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
</div>
<% end %>

View File

@@ -11,6 +11,6 @@
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_menu_item_menu_item_instances: @settings_menu_item_instances %>
<%= render 'form', settings_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
</div>

View File

@@ -14,6 +14,6 @@
<li>New Menu Item Instance</li>
</ul>
</div>
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances %>
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
</div>

View File

@@ -24,8 +24,8 @@
<th>On Promotion</th>
<th>Promotion Price</th>
<th>Available</th>
<th>Created At</th>
<th>Is Default</th>
<th>Created At</th>
</tr>
</thead>
@@ -38,6 +38,7 @@
<td><%= @settings_menu_item_instances.is_on_promotion %></td>
<td><%= @settings_menu_item_instances.promotion_price %></td>
<td><%= @settings_menu_item_instances.is_available %></td>
<td><%= @settings_menu_item_instances.is_default %></td>
<td><%= @settings_menu_item_instances.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<% if params[:simple_menu_item_id] %>
<td><%= link_to 'Edit', edit_settings_simple_menu_item_menu_item_instance_path(@item,@settings_menu_item_instances) %></td>

View File

@@ -3,6 +3,7 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :option_type %>
<%= f.input :name %>
<%= f.input :value %>

View File

@@ -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) %>

View File

@@ -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>

View File

@@ -0,0 +1,12 @@
<%= simple_form_for([:settings,@settings_menu_item_set]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.association :item_set %>
<%= f.association :menu_item %>
</div>
<div class="form-actions">
<%= f.button :submit,:class=>'btn btn-success' %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_menu_item_set, :id, :item_set_id_id, :menu_item_id_id, :created_at, :updated_at
json.url settings_menu_item_set_url(settings_menu_item_set, format: :json)

View File

@@ -0,0 +1,5 @@
<h1>Editing Settings Menu Item Set</h1>
<%= render 'form', settings_menu_item_set: @settings_menu_item_set %>
<%= link_to 'Back', settings_menu_item_sets_path,:class => 'btn btn-danger' %>

View File

@@ -0,0 +1,37 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= dashboard_path %>">Home</a></li>
<li>Menu Item Set</li>
<%= link_to 'New Settings Menu Item Set', new_settings_menu_item_set_path ,:class=>'btn btn-primary btn-sm pull-right'%>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Item set</th>
<th>Menu item</th>
<th></th>
</tr>
</thead>
<tbody>
<% @settings_menu_item_sets.each do |item| %>
<tr>
<td><%= item.item_set.name %></td>
<td><%= item.menu_item.name %></td>
<td><%= link_to 'Show', settings_menu_item_set_path(item),:class=>'btn btn-sm btn-success' %>
<%= link_to 'Edit', edit_settings_menu_item_set_path(item),:class=>'btn btn-sm btn-primary' %>
<%= link_to 'Destroy', settings_menu_item_set_path(item), method: :delete, data: { confirm: 'Are you sure?' } ,:class=>'btn btn-danger btn-sm'%></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @settings_menu_item_sets, partial: 'settings_menu_item_sets/settings_menu_item_set', as: :settings_menu_item_set

View File

@@ -0,0 +1,5 @@
<h1>New Settings Menu Item Set</h1>
<%= render 'form', settings_menu_item_set: @settings_menu_item_set %>
<%= link_to 'Back', settings_menu_item_sets_path,:class=>'btn btn-danger' %>

View File

@@ -0,0 +1,32 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= dashboard_path %>">Home</a></li>
<li><a href="<%= settings_menu_item_sets_path %>">Menu Item Set</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="col-md-6">
<table class="table">
<tbody>
<tr>
<td><strong>Item Set Name:</strong></td>
<td><%= @settings_menu_item_set.item_set.name %></td>
</tr>
<tr>
<td><strong>Menu Item Name:</strong></td>
<td><%= @settings_menu_item_set.menu_item.name %></td>
</tr>
<tr>
<td><strong>Create At</strong></td>
<td><%= @settings_menu_item_set.created_at %></td>
</tr>
</tbody>
</table>
<%= link_to 'Edit', edit_settings_menu_item_set_path(@settings_menu_item_set),:class=>'btn btn-primary' %>
<%= link_to 'Back', settings_menu_item_sets_path,:class=>'btn btn-danger' %>
</div>

View File

@@ -0,0 +1 @@
json.partial! "settings_menu_item_sets/settings_menu_item_set", settings_menu_item_set: @settings_menu_item_set

View File

@@ -7,6 +7,7 @@
<%= 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>

View File

@@ -1,20 +1,52 @@
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= f.error_notification %>
<div class="col-md-8 panel">
<div class="form-group">
<div class="col-md-6">
<%= f.input :item_code %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
<%= f.input :min_qty %>
<%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
</div>
<div class="col-md-6">
<%= f.input :is_available, :class => "form-control" %>
<div class="form-inputs">
<%= f.input :item_code %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
<%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
<%= f.input :menu_item_id, :label => "Parent Menu Item", :collection => MenuItem.collection %>
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :min_qty %>
<%= f.input :min_selectable_item %>
<%= f.input :max_selectable_item %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>
</div>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
<div class="col-md-4">
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<p>Menu Item Image</p>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="panel padding-10">
<div class="form-group">
<%= f.input :item_sets, :collection => @item_sets, :input_html => { :multiple => true }, :class => "form-control item_sets" %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
</div>
<% end %>

View File

@@ -1,5 +1,3 @@
<!-- <h1>Editing Settings Menu Item</h1>-->
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
@@ -8,5 +6,27 @@
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_set_menu_item: @settings_menu_item %>
<%= render 'form', settings_set_menu_item: @settings_menu_item, item_sets: @item_sets %>
</div>
<script type="text/javascript">
$(function(){
// auto selected after loaded
<%
@settings_menu_item.item_sets.each do |set|
%>
$("#simple_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
<%
end
%>
// After loaded
$("#simple_menu_item_item_sets").on('click', 'option', function(e){
if($(this).attr("selected")){
$(this).removeAttr("selected");
$(this).css({'color':'#000','background':'#fff'});
}
});
});
</script>

View File

@@ -11,5 +11,5 @@
<li>New</li>
</ul>
</div>
<%= render 'form', settings_set_menu_item: @settings_menu_item %>
<%= render 'form', settings_set_menu_item: @settings_menu_item, item_attributes: @item_attributes, item_options: @item_options, item_sets: @item_sets %>
</div>

View File

@@ -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

View File

@@ -1,19 +1,52 @@
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :item_code %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
<%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
<%= f.input :menu_item_id, :label => "Parent Menu Item", :collection => MenuItem.collection %>
<%= f.input :min_qty %>
<%= f.input :min_selectable_item %>
<%= f.input :max_selectable_item %>
<div class="col-md-8 panel">
<div class="form-group">
<div class="col-md-6">
<%= f.input :item_code %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :type %>
<%= f.input :min_qty %>
<%= f.input :account_id, :label => "Account type", :collection => Account.collection %>
</div>
<div class="col-md-6">
<%= f.input :is_available, :class => "form-control" %>
<%= f.input :is_sub_item, :class => "form-control" %>
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>
</div>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
<div class="col-md-4">
<div class="panel padding-10">
<div class="form-group">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<p>Menu Item Image</p>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="panel padding-10">
<div class="form-group">
<%= f.input :item_sets, :collection => @item_sets, :input_html => { :multiple => true }, :class => "form-control item_sets" %>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
</div>
<% end %>

View File

@@ -1,7 +1,3 @@
<!-- <h1>Editing Settings Menu Item</h1>
<%= render 'form', settings_menu_item: @settings_menu_item %>-->
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
@@ -10,5 +6,27 @@
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_simple_menu_item: @settings_menu_item %>
<%= render 'form', settings_simple_menu_item: @settings_menu_item, item_sets: @item_sets %>
</div>
<script type="text/javascript">
$(function(){
// auto selected after loaded
<%
@settings_menu_item.item_sets.each do |set|
%>
$("#simple_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
<%
end
%>
// After loaded
$("#simple_menu_item_item_sets").on('click', 'option', function(e){
if($(this).attr("selected")){
$(this).removeAttr("selected");
$(this).css({'color':'#000','background':'#fff'});
}
});
});
</script>

View File

@@ -2,7 +2,6 @@
<%= render 'form', settings_menu_item: @settings_menu_item %>-->
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
@@ -11,5 +10,9 @@
<li>New</li>
</ul>
</div>
<%= render 'form', settings_simple_menu_item: @settings_menu_item %>
<div class="row">
<div class="col-md-12">
<%= render 'form', settings_simple_menu_item: @settings_menu_item, item_attributes: @item_attributes, item_options: @item_options, item_sets: @item_sets %>
</div>
</div>
</div>

View File

@@ -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

View File

@@ -43,7 +43,7 @@
</div>
<div class="form-group col-md-1">
<label></label>
<label> &nbsp;</label>
<input type="submit" value="Search" class='btn btn-primary btn-md'>
</div>
<% end %>

View File

@@ -14,13 +14,17 @@
<div class="main-box-body clearfix">
<%= form_tag transactions_orders_path, :method => :get do %>
<div class="form-group col-md-3">
<label>Enter Keyword</label>
<label>Search Keyword</label>
<input type="text" name="filter" placeholder="Order ID" class="form-control input-md">
</div>
<div class="form-group col-md-2">
<label>Items Count</label>
<input id="number" data-id='numberRangePicker' type="range" data-min="0" data-max="20" data-step="1" data-value="14"/>
<div id="slider">
<input class="bar" name="count" min="0" max="20" type="range" id="rangeinput" onchange="rangevalue.value=value"/>
<span class="highlight"></span>
<output id="rangevalue">0</output>
</div>
</div>
<div class="form-group col-md-2">
<label class="">From</label>
@@ -32,7 +36,7 @@
</div>
<div class="form-group col-md-1">
<label></label>
<label>&nbsp;</label>
<input type="submit" value="Search" class='btn btn-primary btn-md'>
</div>
<% end %>
@@ -76,6 +80,132 @@
</div>
</div>
<style type="text/css">
#slider {
/*width: 400px;*/
height: 17px;
position: relative;
margin: 10px auto;
background: #10171D;
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
/*
-webkit-box-shadow: inset 0px 0px 1px 1px rgba(0, 0, 0, 0.9), 0px 1px 1px 0px rgba(255, 255, 255, 0.13);
-moz-box-shadow: inset 0px 0px 1px 1px rgba(0, 0, 0, 0.9), 0px 1px 1px 0px rgba(255, 255, 255, 0.13);
box-shadow: inset 0px 0px 1px 1px rgba(0, 0, 0, 0.9), 0px 1px 1px 0px rgba(255, 255, 255, 0.13);*/
}
#slider .bar {
width: 168px;
height: 5px;
background: #333;
position: relative;
top: -4px;
left: 4px;
background: #1d2e38;
background: -moz-linear-gradient(left, #1d2e38 0%, #2b4254 50%, #2b4254 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#1d2e38), color-stop(50%,#2b4254), color-stop(100%,#2b4254));
background: -webkit-linear-gradient(left, #1d2e38 0%,#2b4254 50%,#2b4254 100%);
background: -o-linear-gradient(left, #1d2e38 0%,#2b4254 50%,#2b4254 100%);
background: -ms-linear-gradient(left, #1d2e38 0%,#2b4254 50%,#2b4254 100%);
background: linear-gradient(left, #1d2e38 0%,#2b4254 50%,#2b4254 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1d2e38', endColorstr='#2b4254',GradientType=1 );
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
}
#slider .highlight {
height: 2px;
position: absolute;
width: 168px;
top: 6px;
left: 6px;
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
background: rgba(255, 255, 255, 0.25);
}
input[type="range"] {
-webkit-appearance: none;
background-color: black;
height: 2px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
position: relative;
top: 0px;
z-index: 1;
width: 11px;
height: 11px;
cursor: pointer;
-webkit-box-shadow: 0px 6px 5px 0px rgba(0,0,0,0.6);
-moz-box-shadow: 0px 6px 5px 0px rgba(0,0,0,0.6);
box-shadow: 0px 6px 5px 0px rgba(0,0,0,0.6);
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebf1f6), color-stop(50%,#abd3ee), color-stop(51%,#89c3eb), color-stop(100%,#d5ebfb));
}
input[type="range"]:hover ~ #rangevalue,input[type="range"]:active ~ #rangevalue {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
filter: alpha(opacity=20);
opacity: 1;
top: -75px;
}
/* Tool Tip */
#rangevalue {
color: white;
font-size: 10px;
text-align: center;
font-family: Arial, sans-serif;
display: block;
color: #fff;
margin: 20px 0;
position: relative;
left: 44.5%;
padding: 6px 12px;
border: 1px solid black;
-webkit-box-shadow: inset 0px 1px 1px 0px rgba(255, 255, 255, 0.2), 0px 2px 4px 0px rgba(0,0,0,0.4);
-moz-box-shadow: inset 0px 1px 1px 0px rgba(255, 255, 255, 0.2), 0px 2px 4px 0px rgba(0,0,0,0.4);
box-shadow: inset 0px 1px 1px 0px rgba(255, 255, 255, 0.2), 0px 2px 4px 0px rgba(0,0,0,0.4);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222931), color-stop(100%,#181D21));
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
width: 18px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
top: -95px;
}
input[type="range"]:focus{
outline:none;
}
</style>