separate foodcourt module
This commit is contained in:
81
app/views/foodcourt/addorders/_menu_item.json.jbuilder
Executable file
81
app/views/foodcourt/addorders/_menu_item.json.jbuilder
Executable file
@@ -0,0 +1,81 @@
|
||||
# Format for attributes json
|
||||
attr_format = []
|
||||
# Format for attributes json
|
||||
if item.item_attributes.count > 0
|
||||
item_attributes = MenuItemAttribute.where(id: item.item_attributes)
|
||||
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
end
|
||||
|
||||
# Format for option json
|
||||
opt_format = []
|
||||
# Format for attributes json
|
||||
if item.item_options.count > 0
|
||||
item_options = MenuItemOption.where(id: item.item_options)
|
||||
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
end
|
||||
|
||||
|
||||
#Menu Item Information
|
||||
json.id item.id
|
||||
json.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.unit item.unit
|
||||
|
||||
# Item Sets of Menu Item
|
||||
json.item_sets item.item_sets.includes(:menu_item_instances) do |its|
|
||||
json.id its.id
|
||||
json.name its.name
|
||||
json.alt_name its.alt_name
|
||||
json.min_selectable_qty its.min_selectable_qty
|
||||
json.max_selectable_qty its.max_selectable_qty
|
||||
json.instances its.menu_item_instances do |i|
|
||||
json.id i.id
|
||||
end
|
||||
end
|
||||
|
||||
json.attributes attr_format
|
||||
json.options opt_format
|
||||
# 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
|
||||
|
||||
json.instances item.menu_item_instances do |is|
|
||||
if is.is_available
|
||||
# Convert id to name for attributes
|
||||
instance_attr = MenuItemAttribute.where(id: item.item_attributes).pluck(:name)
|
||||
|
||||
json.id is.id
|
||||
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.values instance_attr
|
||||
end
|
||||
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
|
||||
15
app/views/foodcourt/addorders/create.json.jbuilder
Executable file
15
app/views/foodcourt/addorders/create.json.jbuilder
Executable file
@@ -0,0 +1,15 @@
|
||||
if @status == true
|
||||
json.status :success
|
||||
json.id @order.id
|
||||
json.booking_id @booking.id
|
||||
json.order_items do
|
||||
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark
|
||||
end
|
||||
else
|
||||
json.status :error
|
||||
if @error_messages
|
||||
json.error_messages @error_messages
|
||||
else
|
||||
json.error_messages @order.errors
|
||||
end
|
||||
end
|
||||
810
app/views/foodcourt/addorders/detail.html.erb
Normal file
810
app/views/foodcourt/addorders/detail.html.erb
Normal file
@@ -0,0 +1,810 @@
|
||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
|
||||
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
|
||||
<% modify_order = request.path_info.include?('modify_order')%>
|
||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
|
||||
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
|
||||
<input type="hidden" name="link_type" id="link_type" value="<%= @cashier_type %>">
|
||||
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||
<div class="row m-t--20">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
|
||||
<li class="list-menu">
|
||||
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
|
||||
|
||||
<span class="main_menu" id="main_menu menu_name" >
|
||||
<%if @menu.present? %>
|
||||
<%=@menus[0].name%>
|
||||
<% end%>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="ml-menu menu_list aria-hidden " style="border-top: 1px solid #fff">
|
||||
<% @menus.each do |menu| %>
|
||||
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>" style="">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
|
||||
</li>
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<div id="menu1-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
</li>
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
</ul>
|
||||
</li>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<li class="nav-item ">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
</ul>
|
||||
</li>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<li class="nav-item ">
|
||||
<p class="hidden menu-id"><%= menu.id %></p>
|
||||
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
|
||||
</a>
|
||||
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||
</ul>
|
||||
</li>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<%end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_cache">
|
||||
<li class="list-menu">
|
||||
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
|
||||
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
|
||||
</a>
|
||||
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
|
||||
</ul>
|
||||
</li>
|
||||
<div id="menu-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
|
||||
<div class="card">
|
||||
<div class="card-block" style="">
|
||||
<div class="card-text" id="custom-slimscroll">
|
||||
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
<% if menu.menu_category_id.nil? %>
|
||||
<!--if type quick_service or cashier for table -->
|
||||
<% if type %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- else quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% if @table.get_current_checkout_booking.nil? %>
|
||||
<% if !menu.code.include? "SPL" %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
|
||||
<div class='card-block custom-card-block'>
|
||||
<p><%=menu.name%> <p>
|
||||
<p><%=menu.code%> <p>
|
||||
</div>
|
||||
</div>
|
||||
<% end%>
|
||||
<!-- end quick_service or cashier for table -->
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>App Order
|
||||
</button>
|
||||
<br>
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<% if type %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-md-6 col-lg-6 col-sm-12">
|
||||
<strong id="order-title" class="font-13">ORDER DETAILS </strong>
|
||||
</div>
|
||||
|
||||
<% if modify_order %>
|
||||
<% if @table.nil? %>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">Table : </div>
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<p class="hidden" id="table_get_current"></p>
|
||||
<% else%>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">Table : <%=@table.name%></div>
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
|
||||
<% end%>
|
||||
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
|
||||
<p class="hidden" id="sale_id"><%=@sale_id%></p>
|
||||
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
|
||||
</button>
|
||||
</div>
|
||||
<% else%>
|
||||
<p class="hidden" id="table_type"></p>
|
||||
<div class="col-md-2 col-lg-2 col-sm-2">
|
||||
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
|
||||
</button>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@table.name%></span>
|
||||
|
||||
|
||||
<p class="hidden" id="table_id"><%=@table_id%></p>
|
||||
<p class="hidden" id="table_type"><%=@table.type%></p>
|
||||
<p class="hidden" id="booking_id"><%=@booking_id%></p>
|
||||
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
|
||||
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||
<button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear
|
||||
</button>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||
<table class="table table-striped summary-items" id="order-items-table" >
|
||||
<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 class="font-13" >
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class=" modal" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true" style="">
|
||||
<div class="modal-dialog custom-modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
||||
<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" data-value="0" id="modal-qty" value="" min="1" max="10000">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" id="remove" class="btn btn-danger" data-dismiss="modal">Remove</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||
</div>
|
||||
<div class="row bottom p-l-15 p-r-15">
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||
</div>
|
||||
<div class="row bottom p-l-15 p-r-15">
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="00" data-type="num">00</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left bg-orange" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-primary " data-dismiss="modal" id="save">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Menu Item modal -->
|
||||
|
||||
<div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
|
||||
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row no-set-item">
|
||||
<div class="col-md-5">
|
||||
<p style="text-align: center;" id="modal_box_img"></p>
|
||||
<div class="input-group">
|
||||
<input type="text" value="1" id="count" class="change_qty keypress_qty form-control col-md-6 ">
|
||||
<span class="input-group-btn col-md-3">
|
||||
<button type="button" class="btn btn-danger btn-block btn-number" value="-" id="minus">
|
||||
<i class="material-icons">remove</i>
|
||||
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<span class="input-group-btn col-md-3">
|
||||
<button type="button" class="btn btn-success btn-block btn-number" value="+" id="plus">
|
||||
<i class="material-icons">add</i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<p class="hidden" id="unit_price"></p>
|
||||
<p class="hidden" id="instance_code"></p>
|
||||
<p class="hidden" id="instance_name"></p>
|
||||
<p class="hidden" id="promotion_price"></p>
|
||||
<p class="hidden" id="item_instances"></p>
|
||||
<p class="hidden" id="item_code"></p>
|
||||
</div>
|
||||
<div class="col-md-7 item-detail">
|
||||
<h5>Attributes</h5>
|
||||
<div class="attributes-list">
|
||||
</div>
|
||||
<hr>
|
||||
<h5>Options</h5>
|
||||
<div class="options-list">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="mr-auto">
|
||||
<h4 class=" pull-left">Total : <span id="total_price"></span></h4>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-default " data-dismiss="modal" id="close">Close</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button type="button" class="btn btn-primary add_to_order " data-dismiss="modal" id="add_to_order">Add to Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Large modal -->
|
||||
<div class="modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
|
||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
|
||||
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-md-6" style="margin-top:5px">Quantity</label>
|
||||
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
|
||||
</div> -->
|
||||
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-danger btn-number" value="-" id="set_minus">
|
||||
<i class="material-icons">remove</i>
|
||||
</button>
|
||||
</span>
|
||||
<input type="text" value="1" id="set_count" class="set_change_qty keypress_qty form-control col-md-12 ">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-success btn-number" value="+" id="set_plus">
|
||||
<i class="material-icons">add</i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p class="hidden" id="set_unit_price"></p>
|
||||
<p class="hidden" id="set_instance_code"></p>
|
||||
<p class="hidden" id="set_instance_name"></p>
|
||||
<p class="hidden" id="set_promotion_price"></p>
|
||||
<p class="hidden" id="set_item_instances"></p>
|
||||
<p class="hidden" id="set_item_code"></p>
|
||||
<p></p>
|
||||
|
||||
<div class="" id="modal-set-slimscroll" data-height="100">
|
||||
<div class="options-list" style="margin-top:-5px">
|
||||
</div>
|
||||
|
||||
<div class='selected-set-list'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="instance-list row"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="mr-auto">
|
||||
<h4 class=" pull-left">Total : <span id="set_total_price"></span></h4>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button type="button" class="btn btn-primary set_order" data-dismiss="modal" id="set_order">Add to Order</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if type && !modify_order%>
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.fadeInRight{
|
||||
-webkit-animation-duration: 350ms !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var cashier_type = $('#cashier_type').val();
|
||||
jQuery(function(){
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
var id = menus[0]["categories"][0]["id"];
|
||||
// console.log(id);
|
||||
}else{
|
||||
var id = 1;
|
||||
}
|
||||
jQuery('.first_'+id).click();
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
menu_cache_append(menus);
|
||||
}else{
|
||||
$("#menu_data").removeClass("hidden");
|
||||
}
|
||||
|
||||
function menu_cache_append(menus){
|
||||
$("#menu_cache").removeClass("hidden");
|
||||
$(".menu_cache_name").text(menus[0]["name"])
|
||||
for(var i in menus) {
|
||||
menu_list_template(menus[i]);
|
||||
}
|
||||
var category = menus[0]["categories"];
|
||||
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
if (category[ii]["valid_time"]== true){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_type){
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}else{
|
||||
if ($("#table_get_current").text()) {
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}else {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(".tables").on('click', function () {
|
||||
$('.tables').css('background-color','');
|
||||
$('.tables').removeClass('purple')
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$(this).css('background-color','purple');
|
||||
$(this).addClass('purple')
|
||||
$('.confirm_table').attr("data-id",dining_id)
|
||||
$('.confirm_table').attr("data-name",name)
|
||||
$('.confirm_table').attr("data-type",type)
|
||||
});
|
||||
|
||||
$(".confirm_table").on('click', function () {
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var type = $(this).attr("data-type");
|
||||
$('#table_id').val(dining_id);
|
||||
$('#table_type').text(type);
|
||||
$('.select_table').text(name);
|
||||
});
|
||||
|
||||
$('#pending_order').on('click', function () {
|
||||
window.location.href = '/foodcourt/'+'<%= @cashier_type %>'+'/pending_order';
|
||||
});
|
||||
$('#app_order').on('click', function () {
|
||||
window.location.href = '/en/foodcourt/app_orders';
|
||||
});
|
||||
|
||||
$(document).on('click', '.menu_click', function(event){
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
|
||||
if (menus != null) {
|
||||
menu_click_cache_append(name,menus,menu_id);
|
||||
}else{
|
||||
var url = "get_menu/"+menu_id;
|
||||
show_menu_cat_list(name, url);
|
||||
}
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
function menu_click_cache_append(name,menus,menu_id) {
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name);
|
||||
|
||||
// row = ' <li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">'
|
||||
// +'<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>'
|
||||
// +'</li>';
|
||||
// $(".category_cache_list").append(row);
|
||||
|
||||
for(var i in menus) {
|
||||
|
||||
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||
|
||||
// menu_list_template(menus[i]);
|
||||
var category = menus[i]["categories"];
|
||||
|
||||
for(var ii in category) {
|
||||
if (category[ii]["is_available"]== true){
|
||||
if (category[ii]["valid_time"]== true){
|
||||
if (category[ii]["parent_id"] == null ){
|
||||
if(cashier_type){
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}else{
|
||||
if ($("#table_get_current").text()) {
|
||||
if (category[ii]["code"].includes("SPL") != true) {
|
||||
category_list_template(category[ii]);
|
||||
}else {
|
||||
category_list_template(category[ii]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function category_list_template(menu) {
|
||||
row = '<li class="nav-item">'
|
||||
+'<p class="hidden menu-id">'+menu.id+'</p> '
|
||||
+'<a class="nav-link menu_category sub_click first_'+menu.id+'" '
|
||||
+'data-toggle="tab" href="" role="tab" data-id="'+menu.id+'" '
|
||||
+'data-sub-id="'+menu.sub_category+'">'+menu.name+''
|
||||
+'</a>'
|
||||
+'<ul class="sub_category_list hidden fadeInTop animated" '
|
||||
+'id="sub_category_list">'
|
||||
+'</ul>'
|
||||
|
||||
+' </li>';
|
||||
$(".category_cache_list").append(row);
|
||||
}
|
||||
|
||||
function menu_list_template(menu) {
|
||||
row = '<li class="nav-item menu_click" data-name="'+menu.name+'" '
|
||||
+' data-id="'+menu.id+'" style="">'
|
||||
+' <a class="nav-link" data-toggle="tab" href="" role="tab"'
|
||||
+' style="text-transform: lowercase;">'+menu.name+'</a>'
|
||||
+'</li>';
|
||||
$(".menu_cache_list").append(row);
|
||||
}
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_cat_list(name, url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name);
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
if (cashier_type != -1 && modify_order != -1) {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}
|
||||
if(modify_order == -1 && cashier_type != -1){
|
||||
url_item = 'addorders/'+url_item
|
||||
}
|
||||
if (cashier_type ==-1 && modify_order == -1){
|
||||
url_item = url_item;
|
||||
}
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url_item,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
for(var i in data) {
|
||||
if (data[i].is_available == true) {
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+' <div class="card-block custom-card-block">'
|
||||
+' <p>'+ data[i].name +'<p>'
|
||||
+' <p>'+ data[i].code +' <p>'
|
||||
+' </div>'
|
||||
+' </div>';
|
||||
$('.menu_items_list').append(row);
|
||||
|
||||
list = '<li class="nav-item menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+'<p class="hidden menu-id">'+ data[i].id +'</p> '
|
||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab"> '+ data[i].name +''
|
||||
+'<ul class=" sub_category_list hidden fadeInTop animated"'
|
||||
+'id="sub_category_list">'
|
||||
+'</ul>'
|
||||
+'</a>'
|
||||
+'</li>';
|
||||
$('.category_list').append(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
//end show list function
|
||||
|
||||
$(document).on('click', '#clear_all', function(event){
|
||||
$(".summary-items tbody").empty();
|
||||
$('#sub_total').text("0.00");
|
||||
$('#total_qty').text("0");
|
||||
$(".create").attr("disabled","disabled");
|
||||
customer_display_view(null,"reload");
|
||||
});
|
||||
|
||||
function customer_display_view(data,status) {
|
||||
url = '../../../../foodcourt/customer_view';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {"data":data,"status":status},
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#modal-qty').attr('data-value');
|
||||
original_qty = $('#modal-qty').val();
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0"){
|
||||
$('#modal-qty').val(input_value);
|
||||
$('#modal-qty').attr('data-value',input_value);
|
||||
// update_total_amount();
|
||||
}else{
|
||||
$('#modal-qty').val(original_qty + input_value);
|
||||
$('#modal-qty').attr('data-value',original_qty + input_value);
|
||||
// update_total_amount();
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
|
||||
case 'del' :
|
||||
|
||||
case 'clr':
|
||||
$('#modal-qty').val(1);
|
||||
$('#modal-qty').attr('data-value',0);
|
||||
// update_total_amount();
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/* check webview loaded*/
|
||||
var webview = '';
|
||||
<%if @webview %>
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
||||
4
app/views/foodcourt/addorders/get_all_product.json.jbuilder
Executable file
4
app/views/foodcourt/addorders/get_all_product.json.jbuilder
Executable file
@@ -0,0 +1,4 @@
|
||||
|
||||
json.array! @product, :id, :item_code, :name, :alt_name,:image_path,
|
||||
:description,:information,:taxable,:unit_price, :created_at,
|
||||
:updated_at, :created_by
|
||||
@@ -0,0 +1,39 @@
|
||||
if(@instance)
|
||||
menu_item = MenuItem.find(@instance.menu_item_id)
|
||||
# Format for option json
|
||||
opt_format = []
|
||||
# Format for attributes json
|
||||
menu_item.item_options.each do|opt|
|
||||
menu_opt = MenuItemOption.find(opt)
|
||||
if opt_format.count == 0
|
||||
opt_format.push({ type: menu_opt.option_type, values: [menu_opt.name] })
|
||||
next
|
||||
end
|
||||
|
||||
opt_format.each do |of|
|
||||
if menu_opt.option_type.in? opt_format.map {|k| k[:type]}
|
||||
if menu_opt.option_type == of[:type]
|
||||
of[:values].push(menu_opt.name)
|
||||
end
|
||||
else
|
||||
new_opt = {type: menu_opt.option_type, values: [ menu_opt.name ] }
|
||||
opt_format.push(new_opt)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.success true
|
||||
json.id @instance.id
|
||||
json.name @instance.item_instance_name
|
||||
json.code @instance.item_instance_code
|
||||
|
||||
json.item_id @instance.menu_item_id
|
||||
json.attributes @instance.item_attributes
|
||||
json.price @instance.price
|
||||
json.is_default @instance.is_default
|
||||
|
||||
json.options opt_format
|
||||
else
|
||||
json.success false
|
||||
end
|
||||
1
app/views/foodcourt/addorders/get_menu.json.jbuilder
Normal file
1
app/views/foodcourt/addorders/get_menu.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @menu_category
|
||||
8
app/views/foodcourt/addorders/get_menu_category.json.jbuilder
Executable file
8
app/views/foodcourt/addorders/get_menu_category.json.jbuilder
Executable file
@@ -0,0 +1,8 @@
|
||||
if @menu.menu_items
|
||||
json.menu_items @menu.menu_items do |item|
|
||||
if item.is_available
|
||||
json.partial! 'foodcourt/addorders/menu_item', item: item
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
if @sub_menu
|
||||
json.sub_category @sub_menu.each do |sub_cat|
|
||||
json.id sub_cat.id
|
||||
json.code sub_cat.code
|
||||
json.name sub_cat.name
|
||||
json.menu_id sub_cat.menu_id
|
||||
json.menu_category_id sub_cat.menu_category_id
|
||||
end
|
||||
end
|
||||
101
app/views/foodcourt/cash_ins/new.html.erb
Executable file
101
app/views/foodcourt/cash_ins/new.html.erb
Executable file
@@ -0,0 +1,101 @@
|
||||
<div class="container-fluid">
|
||||
<div class='row'>
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<h2> <%= t :cash_in %> </h2>
|
||||
<br>
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td> <%= t :payment_reference %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="Reference" id="reference">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t("views.right_panel.detail.remark") %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="Remark" id="remark">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t :payment_method %>
|
||||
</td>
|
||||
<td>
|
||||
<button class='btn bg- waves-effect payment-type' data-id='cash' id='cash' style="background-color: #7a62d3;"><%= t("views.btn.cash") %></button>
|
||||
<button class='btn bg- waves-effect payment-type' data-id='mpu' id='mpu' style="background-color: #7a62d3;"><%= t("views.btn.mpu") %></button>
|
||||
<button class='btn bg- waves-effect payment-type' data-id='visa' id='visa' style="background-color: #7a62d3;"><%= t("views.btn.visa") %></button>
|
||||
<button class='btn bg- waves-effect payment-type' data-id='jcb' id='jcb' style="background-color: #7a62d3;"><%= t("views.btn.jcb") %></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t :reference_number %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" id="payment_method_reference">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t("views.right_panel.detail.amount") %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" placeholder="Amount" id="amount">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 ">
|
||||
<br>
|
||||
<div class="button-demo m-t-40">
|
||||
<button type="button" class="btn bg-default waves-effect btn-" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
|
||||
<button type="button" class="btn bg-blue waves-effect btn-" id='cash_in'> <%= t("views.btn.cash_in") %> </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
cashier_type = '<%= @cashier_type %>';
|
||||
console.log(cashier_type)
|
||||
|
||||
var payment_method = "";
|
||||
$('.payment-type').on('click',function(){
|
||||
$('.payment-type').css("background-color","#7a62d3");
|
||||
$(this).css("background-color","green");
|
||||
var type = $(this).attr('data-id')
|
||||
if(type == 'cash'){
|
||||
payment_method = 'cash';
|
||||
}else if(type == 'mpu'){
|
||||
payment_method = "mpu";
|
||||
}else if(type == 'visa'){
|
||||
payment_method = "visa";
|
||||
}else if(type == 'jcb'){
|
||||
payment_method = "jcb";
|
||||
}
|
||||
})
|
||||
$('#cash_in').on('click',function(){
|
||||
var reference = $('#reference').val();
|
||||
var remark = $('#remark').val();
|
||||
var amount = $('#amount').val();
|
||||
var payment_method_reference = $('#payment_method_reference').val();
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= foodcourt_cash_ins_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
|
||||
success:function(result){
|
||||
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
|
||||
window.location.href = '/foodcourt/'+cashier_type+'/pending_order';
|
||||
}else{
|
||||
window.location.href = '/foodcourt';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#back').on('click',function(){
|
||||
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
|
||||
window.location.href = '/foodcourt/'+cashier_type+'/pending_order';
|
||||
}else{
|
||||
window.location.href = '/foodcourt';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
2
app/views/foodcourt/cash_mgmt/create.html.erb
Executable file
2
app/views/foodcourt/cash_mgmt/create.html.erb
Executable file
@@ -0,0 +1,2 @@
|
||||
<h1>CashMgmt#create</h1>
|
||||
<p>Find me in app/views/cash_mgmt/create.html.erb</p>
|
||||
2
app/views/foodcourt/cash_mgmt/index.html.erb
Executable file
2
app/views/foodcourt/cash_mgmt/index.html.erb
Executable file
@@ -0,0 +1,2 @@
|
||||
<h1>CashMgmt#index</h1>
|
||||
<p>Find me in app/views/cash_mgmt/index.html.erb</p>
|
||||
3
app/views/foodcourt/cash_mgmt/new.html.erb
Executable file
3
app/views/foodcourt/cash_mgmt/new.html.erb
Executable file
@@ -0,0 +1,3 @@
|
||||
<h1>CashMgmt#new</h1>
|
||||
<p>Find me in app/views/cash_mgmt/new.html.erb</p>
|
||||
|
||||
53
app/views/foodcourt/cash_outs/new.html.erb
Executable file
53
app/views/foodcourt/cash_outs/new.html.erb
Executable file
@@ -0,0 +1,53 @@
|
||||
<div class="container-fluid">
|
||||
<div class='row'>
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<h2><%= t :cash_out %></h2>
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td> <%= t :payment_reference %></td>
|
||||
<td><input type="text" class="form-control" placeholder="Reference" id="reference"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t("views.right_panel.detail.remark") %></td>
|
||||
<td><input type="text" class="form-control" placeholder="Remark" id="remark"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= t("views.right_panel.detail.amount") %> </td>
|
||||
<td><input type="text" class="form-control" placeholder="Amount" id="amount"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<br><br>
|
||||
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i><%= t("views.btn.back") %> </button>
|
||||
<button type="button" class="btn bg-blue btn-block" id='cash_out'> <%= t("views.btn.cash_out") %> </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = '<%= @cashier_type %>';
|
||||
$('#cash_out').on('click',function(){
|
||||
var reference = $('#reference').val();
|
||||
var remark = $('#remark').val();
|
||||
var amount = $('#amount').val();
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= foodcourt_cash_outs_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
|
||||
success:function(result){
|
||||
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
|
||||
window.location.href = '/foodcourt/'+cashier_type+'/pending_order';
|
||||
}else{
|
||||
window.location.href = '/foodcourt';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
|
||||
window.location.href = '/foodcourt/'+cashier_type+'/pending_order';
|
||||
}else{
|
||||
window.location.href = '/foodcourt';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
715
app/views/foodcourt/customers/index.html.erb
Normal file
715
app/views/foodcourt/customers/index.html.erb
Normal file
@@ -0,0 +1,715 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<div class="row p-t-20 p-l-20">
|
||||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
|
||||
<% path ="/foodcourt/#{@sale_id}/#{@cashier_type}/customers/#{@page}" %>
|
||||
<%= form_tag path, :id => "filter_form", :method => :get do %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||
|
||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
|
||||
|
||||
</div>
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
|
||||
<button type="submit" class="btn bg-blue waves-effect waves-effect" style="height: 30%;margin-right: 10px;">Search</button>
|
||||
<!-- </div> -->
|
||||
|
||||
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;">Member Card</button>
|
||||
|
||||
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<button type="button" class="btn btn-md btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>Back
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
|
||||
<%= paginate @crm_customers %>
|
||||
<div class="main-box-body clearfix" id="order-detail-slimscroll" style="">
|
||||
<div class="table-responsive">
|
||||
<table id="origami-crm-table" class="table table-striped" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||
<th><%= t :customer %> <%= t("views.right_panel.detail.type") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||
<!-- <th>Paypar No</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
|
||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||
<td>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
<%= @i += 1 %>
|
||||
<%else%>
|
||||
-
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= crm_customer.customer_type rescue '-' %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td>
|
||||
<% if !@membership_types.nil? %>
|
||||
<% @membership_types.each do |member_type| %>
|
||||
<% if member_type[1] == crm_customer.membership_type %>
|
||||
<%= member_type[0] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||
<td style="width:20%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<%else%>
|
||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- .end-of-col-md-8 -->
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%if !@dining_facility.nil?%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
|
||||
<% elsif @cashier_type == 'quick_service' || @cashier_type == "food_court" %>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="" />
|
||||
<%end%>
|
||||
|
||||
<section>
|
||||
<div class="wizard">
|
||||
<div class="wizard-inner">
|
||||
<div class="active-line"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="nav-item">
|
||||
<div class="connecting-line border-right"></div>
|
||||
<a href="#step1" class="nav-link active" data-toggle="tab" aria-controls="step1" role="tab" title="Step 1">
|
||||
<span class="round-tab">
|
||||
1
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation" class="nav-item disabled">
|
||||
<div class="connecting-line"></div>
|
||||
<a href="#complete" class="nav-link disable" data-toggle="tab" aria-controls="complete" role="tab" title="Complete">
|
||||
<span class="round-tab">
|
||||
2
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<span class="patch_method"></span>
|
||||
<%= f.error_notification %>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" role="tabpanel" id="step1">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label><%= t("views.right_panel.detail.sr_no") %></label>
|
||||
<div class="form-line disabled">
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" disabled="" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label for="customer[salutation]" class="control-label"> <%= t("views.right_panel.detail.salutation") %> :</label><br>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :salutation,"Mr", :class => "salutation mr with-gap radio-col-indigo", :value=>"Mr"%><%= t("views.right_panel.detail.mr") %>
|
||||
</label>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :salutation,"Mrs", :class => "salutation mrs with-gap radio-col-indigo", :value=>"Mrs"%><%= t("views.right_panel.detail.miss") %>
|
||||
</label>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :salutation,"Miss", :class => "salutation miss with-gap radio-col-indigo", :value=>"Miss"%><%= t("views.right_panel.detail.mrs") %>
|
||||
</label>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :salutation,"Mdm", :class => "salutation mdm with-gap radio-col-indigo", :value=>"Mdm"%><%= t("views.right_panel.detail.mdm") %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :name, :class => "form-control name", :required => true %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :contact_no, :class => "form-control contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<lable class="error col-red m-t-10" style="margin-top:-6px"><%= str %></lable>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :email, :class => "form-control email" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['email']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<lable class="error col-red m-t-10" style="margin-top:-6px"><%= str %></lable>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12" align="right">
|
||||
<button type="button" class="btn btn-md bg-blue btn-info-full next-step">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- .end-of-step1 -->
|
||||
<div class="tab-pane" role="tabpanel" id="complete">
|
||||
<!-- <h4>Step 2</h4> -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label><%= t("views.right_panel.detail.customer_photo") %></label>
|
||||
<div class="panel padding-10">
|
||||
<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 %>
|
||||
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= f.file_field :image_path, :class => "img-thumbnail" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label for="customer[gender]" class="control-label"><%= t("views.right_panel.detail.gender") %> :</label><br>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male"%><%= t("views.right_panel.detail.male") %></label>
|
||||
<label class="font-12 radio-inline">
|
||||
<%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female"%><%= t("views.right_panel.detail.female") %></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :nrc_no,:label => "NRC No", :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company"%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<lable class="error col-red m-t-10" style="margin-top:-6px"><%= str %></lable>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label class="control-label"><%= t("views.right_panel.detail.date_of_birth") %></label>
|
||||
<%= f.text_field :date_of_birth, :value=>"01-01-1990",:class=>"datepicker form-control col-md-12"%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :address, :class => "form-control address" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
|
||||
<select class="form-control col-md-12 selectpicker show-tick" id="customer_type" name="customer[customer_type]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control tax_profiles" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<%= f.input :card_no, :class => "form-control card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['card_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<lable class="error col-red m-t-10" style="margin-top:-6px"><%= str %></lable>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label class="control-label"><%= t("views.right_panel.detail.paypar_account_no") %>:</label>
|
||||
<div class="-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>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label class="control-label"><%= t("views.right_panel.detail.select_membership_group") %></label>
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="member_group_id" style="height: " >
|
||||
<option value=""><%= t("views.right_panel.detail.select_membership_group") %></option>
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12" align="right">
|
||||
<button type="button" class="btn btn-md bg-blue prev-step">Prev</button>
|
||||
<%= f.submit t("views.btn.submit"),:class => 'btn bg-blue btn-md waves-effect', :id => 'submit_customer' %>
|
||||
<!-- <%= f.button :submit, "Update",:class => 'btn bg-blue btn-block', :disabled =>'', :id => 'update_customer' %> -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .end-of-step2 -->
|
||||
</div> <!-- .end-of-tab-content -->
|
||||
<% end %>
|
||||
</div> <!-- .end-of-wizard -->
|
||||
</section> <!-- .end-of-section -->
|
||||
</div><!-- .end-of-col-md-4 -->
|
||||
</div> <!-- .end-of-row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||
<div class="m-r-20" align="right">
|
||||
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var page = "<%= @page %>";
|
||||
var paypar_account_no = [];
|
||||
$(function() {
|
||||
paypar_account_no = JSON.parse('<%= @paypar_accountno.to_json.html_safe %>', function (key, value) {
|
||||
var type;
|
||||
if (value && typeof value === 'object') {
|
||||
type = value.type;
|
||||
if (typeof type === 'string' && typeof window[type] === 'function') {
|
||||
return new(window[type])(value);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
console.log(paypar_account_no);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
localStorage.setItem("member_card",false);
|
||||
/*$('.datepicker').datepicker({
|
||||
setDate: '12-12-1999',
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');*/
|
||||
|
||||
// Read Card Reader
|
||||
$("#paypar_account_no").on('focus', function(e){
|
||||
if($(this).val() == ''){
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
},100);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
setHeaderBreadCrumb(_CUSTOMERS_);
|
||||
|
||||
});
|
||||
// Read Card Reader
|
||||
$("#member_acc_no").on('click', function(e){
|
||||
localStorage.setItem("member_card",true);
|
||||
var cardNo = "";
|
||||
var customer_id = '';
|
||||
var customer_name = '';
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_mamber_card_no = 0;
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
customer_mamber_card_no = $("#search").val();
|
||||
|
||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/"+sale_id+"/get_customer" ,
|
||||
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data[0].customer_id == false) {
|
||||
swal("Alert!", data[0].message, "error");
|
||||
// $.alert({
|
||||
// title: 'Alert!',
|
||||
// content: data[0].message,
|
||||
// type: 'red',
|
||||
// typeAnimated: true,
|
||||
// btnClass: 'btn-danger',
|
||||
// });
|
||||
}else{
|
||||
customer_id = data[0].customer_id;
|
||||
customer_name = data[0].name;
|
||||
update_sale(customer_id, customer_name,sale_id);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},100);
|
||||
});
|
||||
|
||||
/*new customer UI func:*/
|
||||
//Initialize tooltips
|
||||
$('.nav-tabs > li a[title]').tooltip();
|
||||
|
||||
//Wizard
|
||||
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
|
||||
|
||||
var $target = $(e.target);
|
||||
|
||||
if ($target.parent().hasClass('disabled')) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$(".next-step").click(function (e) {
|
||||
var $active = $('.wizard .nav-tabs li a.active');
|
||||
$active.parent().next().removeClass('disabled');
|
||||
nextTab($active);
|
||||
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
|
||||
});
|
||||
$(".prev-step").click(function (e) {
|
||||
|
||||
var $active = $('.wizard .nav-tabs li a.active');
|
||||
prevTab($active);
|
||||
|
||||
});
|
||||
/*new customer UI func:*/
|
||||
});
|
||||
|
||||
/*customer UI tab btn*/
|
||||
function nextTab(elem) {
|
||||
$(elem).parent().next().find('a[data-toggle="tab"]').click();
|
||||
}
|
||||
function prevTab(elem) {
|
||||
$(elem).parent().prev().find('a[data-toggle="tab"]').click();
|
||||
}
|
||||
/*customer UI tab btn*/
|
||||
|
||||
|
||||
// Read NFC card no from java
|
||||
function getCardNo(){
|
||||
code2lab.readNFC();
|
||||
}
|
||||
|
||||
// get CardNo from Java
|
||||
function setCardNo(cardNo){
|
||||
check_member = localStorage.getItem("member_card");
|
||||
if(cardNo.length == 16){
|
||||
if(check_member == "true"){
|
||||
$("#paypar_account_no").val(cardNo);
|
||||
$("#search").val(cardNo);
|
||||
$("#type").val("card");
|
||||
}else{
|
||||
if($.inArray(cardNo, paypar_account_no) !== -1){
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'CardNo already registered, Please try another card!',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}else{
|
||||
$("#paypar_account_no").val(cardNo);
|
||||
$("#search").val(cardNo);
|
||||
$("#type").val("card");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// QR Code Reader
|
||||
$("#qr_code").on('click', function(e){
|
||||
var code = "";
|
||||
var customer_id = '';
|
||||
var customer_name = '';
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_mamber_card_no = 0;
|
||||
|
||||
setTimeout(function(){
|
||||
code=getQRCode();
|
||||
setQRCode(code);
|
||||
}, 100);
|
||||
|
||||
customer_mamber_card_no = $("#search").val();
|
||||
|
||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/"+sale_id+"/get_customer" ,
|
||||
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data[0].customer_id == false) {
|
||||
swal("Alert!", data[0].message, "error");
|
||||
// $.alert({
|
||||
// title: 'Alert!',
|
||||
// content: data[0].message,
|
||||
// type: 'red',
|
||||
// typeAnimated: true,
|
||||
// btnClass: 'btn-danger',
|
||||
// });
|
||||
}else{
|
||||
customer_id = data[0].customer_id;
|
||||
customer_name = data[0].name;
|
||||
update_sale(customer_id, customer_name,sale_id);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Read qrcode from java
|
||||
function getQRCode(){
|
||||
return code2lab.readQRCode();
|
||||
}
|
||||
|
||||
// get QRCode from Java
|
||||
function setQRCode(code){
|
||||
$("#qr_code").text(code);
|
||||
$("#search").val(code);
|
||||
}
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_id = $(this).attr('data-ref');
|
||||
var customer_name = $(this).children("td:nth-child(3)").text();
|
||||
console.log(sale_id);
|
||||
if(sale_id != 0){
|
||||
// var url = "/"+customer_id;
|
||||
update_sale(customer_id, customer_name,sale_id);
|
||||
}else{
|
||||
|
||||
var url = "customers/"+customer_id;
|
||||
}
|
||||
|
||||
// Need To Clean?
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
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);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
$('#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);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
if (data.salutation == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
} else if(data.salutation == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salutation == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
// $('#submit_customer').attr('disabled','disabled');
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+$('#customer_id').val();
|
||||
$("#new_customer").attr('id', id);
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".patch_method").append('<input type="hidden" name="_method" value="patch">');
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
|
||||
// }
|
||||
})
|
||||
|
||||
function update_sale(customer_id, customer_name, sale_id) {
|
||||
var customer="";
|
||||
if(customer_name != ""){
|
||||
customer = '(' + customer_name + ')';
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Confirmation !",
|
||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "green",
|
||||
confirmButtonText: "Yes!",
|
||||
cancelButtonClass: 'btn btn-danger',
|
||||
closeOnConfirm: false,
|
||||
}, function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||
data: {customer_id:customer_id,sale_id:sale_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
var id = $("#table_id").val();
|
||||
var type = $("#table_type").val();
|
||||
var booking_id = "";
|
||||
<% if !@booking_order.nil? %>
|
||||
booking_id = "<%= @booking_order.booking_id %>";
|
||||
<% end %>
|
||||
if (cashier_type == "quick_service" || cashier_type == "food_court") {
|
||||
if(booking_id!= "" && page == "pending"){
|
||||
window.location.href = '/foodcourt/'+cashier_type+'/pending_order/'+booking_id;
|
||||
}else{
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}
|
||||
}else{
|
||||
if(page == "payment"){
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/foodcourt/table/'+id
|
||||
}else{
|
||||
window.location.href = '/foodcourt/room/'+id
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
swal("Alert!", "Record not found!", "error");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").val();
|
||||
var type = $("#table_type").val();
|
||||
var sale_id = $("#sale_id").val();
|
||||
if (cashier_type == "quick_service" || cashier_type == "food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(page == "pending"){
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/pending/';
|
||||
}
|
||||
else if(page == "payment"){
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/foodcourt/table/'+id;
|
||||
}else{
|
||||
window.location.href = '/foodcourt/room/'+id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
112
app/views/foodcourt/dashboard/_menu.json.jbuilder
Normal file
112
app/views/foodcourt/dashboard/_menu.json.jbuilder
Normal file
@@ -0,0 +1,112 @@
|
||||
json.id menu.id
|
||||
json.name menu.name
|
||||
json.is_ordering menu.is_ordering
|
||||
json.is_active menu.is_active
|
||||
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)
|
||||
order_by = Lookup.find_by_lookup_type("order_by")
|
||||
# if !order_by.nil? && order_by.value == "name"
|
||||
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||
# else
|
||||
# categories = menu.menu_categories
|
||||
# end
|
||||
categories = menu.menu_categories
|
||||
json.categories categories do |category|
|
||||
if category.is_available
|
||||
parent_category = category.parent
|
||||
if !parent_category.nil?
|
||||
json.sub_category "true"
|
||||
else
|
||||
json.sub_category "false"
|
||||
end
|
||||
valid_time = category.valid_time
|
||||
json.valid_time valid_time
|
||||
|
||||
json.id category.id
|
||||
json.code category.code
|
||||
json.order_by category.order_by
|
||||
json.name category.name
|
||||
json.alt_name category.alt_name
|
||||
json.order_by category.order_by
|
||||
json.parent_id category.menu_category_id
|
||||
json.is_available category.is_available
|
||||
|
||||
if !order_by.nil? && order_by.value == "name"
|
||||
menu_items = category.menu_items.sort_by(&:name)
|
||||
else
|
||||
menu_items = category.menu_items
|
||||
end
|
||||
|
||||
if category.menu_items
|
||||
json.items menu_items do |item|
|
||||
if item.is_available
|
||||
# Format for attributes json
|
||||
attr_format = []
|
||||
# Format for attributes json
|
||||
if item.item_attributes.count > 0
|
||||
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
|
||||
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
end
|
||||
|
||||
# Format for option json
|
||||
opt_format = []
|
||||
# Format for attributes json
|
||||
if item.item_options.count > 0
|
||||
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
|
||||
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
||||
end
|
||||
|
||||
#Menu Item Information
|
||||
json.id item.id
|
||||
json.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.unit item.unit
|
||||
|
||||
# Item Sets of Menu Item
|
||||
json.item_sets item.item_sets.map { |its|
|
||||
{ id: its.id,
|
||||
name: its.name,
|
||||
alt_name: its.alt_name,
|
||||
min_selectable_qty: its.min_selectable_qty,
|
||||
max_selectable_qty: its.max_selectable_qty,
|
||||
instances: its.menu_item_instances.pluck(:id).map { |id| {id: id}}
|
||||
}
|
||||
}
|
||||
|
||||
json.attributes attr_format
|
||||
json.options opt_format
|
||||
|
||||
json.instances item.menu_item_instances do |is|
|
||||
if is.is_available
|
||||
# Convert id to name for attributes
|
||||
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
|
||||
|
||||
json.id is.id
|
||||
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.values instance_attr
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
18
app/views/foodcourt/dashboard/get_all_menu.json.jbuilder
Normal file
18
app/views/foodcourt/dashboard/get_all_menu.json.jbuilder
Normal file
@@ -0,0 +1,18 @@
|
||||
menu_json = json.array! @menus do |menu|
|
||||
|
||||
if !menu.is_ordering
|
||||
json.id menu.id
|
||||
json.name menu.name
|
||||
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")
|
||||
|
||||
json.partial! 'foodcourt/dashboard/menu', menu: menu
|
||||
# if (@current_menu)
|
||||
# json.current_menu do
|
||||
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
281
app/views/foodcourt/dashboard/index.html.erb
Normal file
281
app/views/foodcourt/dashboard/index.html.erb
Normal file
@@ -0,0 +1,281 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="block-header">
|
||||
<!-- <h2><%= t :dashboard %></h2> -->
|
||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||
</div>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<% if @quick_service == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 qs_view">
|
||||
<div class="info-box bg-purple">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :quick_service %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @food_court == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 fc_view">
|
||||
<div class="info-box bg-pink">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= @food_court_name %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @dinein_cashier == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 cashier_view">
|
||||
<div class="info-box bg-green">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @reservation == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 reservation">
|
||||
<div class="info-box bg-orange">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :reservation %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @order_reservation == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 order_reservation">
|
||||
<div class="info-box bg-blue">
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :order_reservation %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' && @setting_flag %>
|
||||
<!-- CPU Usage -->
|
||||
<div class="row clearfix">
|
||||
|
||||
<% if !@summ_sale.nil? %>
|
||||
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :sale %></h6>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
|
||||
<td align="right"><%= @summ_sale.total_receipt %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||
<td align="right"><%= number_with_precision( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
||||
<tr>
|
||||
<% if payment.payment_method == 'paypar' %>
|
||||
<td>Redeem Sale : </td>
|
||||
<% else %>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<% end %>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= data[""+pay_mth+""] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
|
||||
<% if !total_card.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||
<td align="right">
|
||||
<%= total_card["card"].to_f %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :customer %></h6>
|
||||
<table class="table">
|
||||
<% if !@total_customer.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
|
||||
<td align="right"><%= @total_customer %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_dinein.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.dine_in") %> : </td>
|
||||
<td align="right"><%= @total_dinein %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_takeaway.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.takeaway") %> : </td>
|
||||
<td align="right"><%= @total_takeaway %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- <% if !@total_other_customer.nil? %>
|
||||
<tr>
|
||||
<td><%= t :customer %> : </td>
|
||||
<td align="right"><%= @total_other_customer.total_cus %></td>
|
||||
</tr>
|
||||
<% end %> -->
|
||||
<% if !@total_membership.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.membership") %> : </td>
|
||||
<td align="right"><%= @total_membership %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t("views.right_panel.detail.order") %></h6>
|
||||
<table class="table">
|
||||
<% if !@total_order.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.order") %> : </td>
|
||||
<td align="right" width="60px"><%= @total_order.total_order %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if !@total_accounts.nil? %>
|
||||
<% @total_accounts.each do |account| %>
|
||||
<tr>
|
||||
<td width="40px"><%= account.title %> (Account) : </td>
|
||||
<td align="right" width="60px">
|
||||
<% @account_data.each do |data| %>
|
||||
<% acc = account.title %>
|
||||
<%= data[""+acc+""] %> <% if !data[''+acc+''].nil? %> ( <%= data[''+acc+'_amount'] %> ) <% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !@top_items.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t :top %> <%= t("views.right_panel.detail.item") %> : </td>
|
||||
<td align="right" width="60px"><%= @top_items.item_name %>
|
||||
<br>(<%= @top_items.item_total_price %>)</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@total_foc_items.nil? %>
|
||||
<tr>
|
||||
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
|
||||
<td align="right" width="60px"><%= @total_foc_items.to_int %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<button type="button" data-href="<%=foodcourt_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
<script>
|
||||
$(function() {
|
||||
$("#loading_wrapper").show();
|
||||
getAllMenu();
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
window.location.href = '/foodcourt';
|
||||
});
|
||||
|
||||
$(".qs_view").on('click', function() {
|
||||
var display_type = '<%= @display_type %>';
|
||||
if (display_type.length>0) {
|
||||
display_type = '<%= @display_type %>';
|
||||
}else{
|
||||
display_type = null;
|
||||
}
|
||||
if ($('#server_mode').val() != "cloud" && display_type == 2) {
|
||||
document.getElementById('second_view').click();
|
||||
}
|
||||
window.location.href = '/foodcourt/quick_service';
|
||||
});
|
||||
|
||||
$(".fc_view").on('click', function() {
|
||||
var display_type = '<%= @display_type %>';
|
||||
if (display_type.length>0) {
|
||||
display_type = '<%= @display_type %>';
|
||||
}else{
|
||||
display_type = null;
|
||||
}
|
||||
if ($('#server_mode').val() != "cloud" && display_type == 2) {
|
||||
document.getElementById('second_view').click();
|
||||
}
|
||||
window.location.href = '/foodcourt/food_court';
|
||||
});
|
||||
|
||||
$(".order_reservation").on('click', function() {
|
||||
window.location.href = '/foodcourt/order_reservation';
|
||||
});
|
||||
|
||||
$("#second_view").on('click', function () {
|
||||
var url = $(this).attr("data-href");
|
||||
window.open(url,'_blank');
|
||||
});
|
||||
|
||||
$(".reservation").on("click", function(){
|
||||
window.location.href = '/foodcourt/reservation';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
919
app/views/foodcourt/discounts/index.html.erb
Executable file
919
app/views/foodcourt/discounts/index.html.erb
Executable file
@@ -0,0 +1,919 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<!-- Order Details -->
|
||||
<div class="card" >
|
||||
<!-- <div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
||||
</div> -->
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<%if !@table.nil?%>
|
||||
<span class="hidden" id ="table_id" value="<%=@table.id%>"><%=@table.id%></span>
|
||||
<span class="hidden" id="table_type" value="<%=@table.type%>"><%=@table.type%></span>
|
||||
<%else%>
|
||||
<span class="hidden" id ="table_id" value="<%=@table%>"><%=@table%></span>
|
||||
<span class="hidden" id="table_type" value="<%=@table%>"><%=@table%></span>
|
||||
<%end%>
|
||||
|
||||
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||
<p class="m-l-10">Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p class="m-r-10">Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text dining">
|
||||
<span id="discount_itemsErr" style="color:red;"></span>
|
||||
<table class="table table-default" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<% sub_total += sale_item.qty * sale_item.unit_price %>
|
||||
<% if sale_item.price > 0 && sale_item.status.blank? %>
|
||||
<tr class="item-row item" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
|
||||
<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.qty*sale_item.unit_price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% elsif sale_item.price < 0 && sale_item.status == "Discount" %>
|
||||
<tr class="item-row discount" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
<span id="item-account-qty" class="hidden"><%=sale_item.qty%></span>
|
||||
<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.abs%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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="order-sub-total"><%= number_with_precision(sub_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td class="charges-name"><strong>Food:</strong></td>
|
||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||
</tr> -->
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td class="item-attr">(<strong id="order-discount"><%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<!-- Discount Amount -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Discount Control</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<input type="text" id="discount-amount" name="discount-amount" value="0" class="form-control" />
|
||||
<span id="discount-amountErr" style="color:red;"></span>
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group">
|
||||
<% @accounts.each do |acc| %>
|
||||
<button id="account-<%= acc.id %>" class="accounts-type btn bg-default"><%= acc.title %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<div class="p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="5" data-type="add">5%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num" style="margin-left: 6px;">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom clearfix">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="10" data-type="add">10%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num" style="margin-left: 6px;">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="15" data-type="add">15%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num" style="margin-left: 6px;">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num" style="margin-left: 6px;">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" style="margin-left: 6px;"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<button id="net" class="btn bg-info fluid action-btn">Nett</button>
|
||||
<button id="percentage" class="btn bg-primary fluid action-btn" style="font-size: 12.4px">Percentage</button>
|
||||
<button id="remove-item" class="btn bg-default fluid action-btn">Clear Discount</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Promo Code</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-md-8 form-group">
|
||||
<div class="form-group">
|
||||
<input type="text" id="promo-code" name="promo-code" value="" class="form-control" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button id="" class="btn bg-primary btn-block action-btn">Promo</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<button type="button" class="btn bg-default btn-block" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||
<button id="remove-item-discount" class="btn btn-primary btn- action-btn">Remove Item Discount</button>
|
||||
<button id="remove-all" class="btn bg-primary btn-block action-btn">Remove All</button>
|
||||
<button id="pay-discount" class="btn bg-primary btn-block action-btn">Enter</button>
|
||||
<% if @member_discount%>
|
||||
<!-- <hr />
|
||||
<button id="member-discount" class="btn btn-success btn-block action-btn
|
||||
<%= @sale_data.customer.membership_id ? " " : "disabled"%>">Member Discount</button> -->
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var totalAmount = <%= sub_total %>;
|
||||
var totalDiscount = <%= @sale_data.total_discount %>
|
||||
var precision = <%= precision %>;
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var id = $("#table_id").text();
|
||||
var type = $("#table_type").text();
|
||||
var sale_id = $('#sale-id').text();
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/foodcourt/table/'+id
|
||||
}else{
|
||||
window.location.href = '/foodcourt/room/'+id
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#discount-amount').val(amount);
|
||||
break;
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Select Sale Item
|
||||
$('#order-items-table').on('click', '.item-row', function(){
|
||||
if($(this).hasClass('selected-item') == true){
|
||||
$(this).removeClass('selected-item');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-item');
|
||||
}
|
||||
});
|
||||
|
||||
// Select for account types
|
||||
$(".accounts-type").on('click', function(e){
|
||||
var account_id = $(this).attr('id').substr(8);
|
||||
if($(this).hasClass('selected-account') == true){
|
||||
$(this).removeClass('selected-account');
|
||||
$(".item-row").each(function(i){
|
||||
if($(this).children().find("#item-account-type").text() == account_id){
|
||||
$(this).removeClass("selected-item");
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-account');
|
||||
$(".item-row").each(function(i){
|
||||
if($(this).children().find("#item-account-type").text() == account_id){
|
||||
if(parseInt($(this).children().find("#item-account-qty").text()) >0 && parseInt($(this).children().find("#item-total-price").text()) >0){
|
||||
$(this).addClass("selected-item");
|
||||
}
|
||||
else{
|
||||
console.log("discount item");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Net Discount for Payment
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var sub_total = parseFloat($('#order-sub-total').text());
|
||||
var ajax_url = "/foodcourt/" + sale_id + "/discount";
|
||||
|
||||
if(discount_value!=""){
|
||||
if(discount_value > 0){
|
||||
if(parseFloat(discount_value) > sub_total){
|
||||
$("#discount-amount").val("");
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}else{
|
||||
$("#discount-amountErr").html("");
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(0, discount_value);
|
||||
}
|
||||
else if(sale_items.length > 0){
|
||||
calculate_item_discount(0, discount_value, sale_items, account_types);
|
||||
}
|
||||
|
||||
// Remove Selection
|
||||
selection_remove();
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("Discount must be greater than 0!");
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("can't be blank");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Calculate Percentage Discount for Payment
|
||||
$("#percentage").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var ajax_url = "/foodcourt/" + sale_id + "/discount";
|
||||
|
||||
if(discount_value!=""){
|
||||
if(discount_value > 0){
|
||||
$("#discount-amountErr").val("");
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
// Selected Account
|
||||
var account_types = get_selected_account_types();
|
||||
|
||||
if(sale_items.length == 0 && account_types.length == 0){
|
||||
calculate_overall_discount(1, discount_value);
|
||||
} else if(sale_items.length > 0){
|
||||
calculate_item_discount(1, discount_value, sale_items, account_types);
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("Discount must be greater than 0!");
|
||||
}
|
||||
}else{
|
||||
$("#discount-amountErr").html("can't be blank");
|
||||
}
|
||||
|
||||
// Remove Selection
|
||||
selection_remove();
|
||||
});
|
||||
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
// var total = 0;
|
||||
|
||||
$('.item-row.new-discount').each(function(i){
|
||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||
totalAmount += Math.abs(amount)
|
||||
// total = total + Math.abs(amount);
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#order-sub-total").text(totalAmount);
|
||||
$("#order-discount").text(totalDiscount.toFixed(<%= precision.to_i %>));
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
if($('#pay-discount').is(":visible")) {
|
||||
$('#pay-discount').prop("disabled",true);
|
||||
}
|
||||
$("#loading_wrapper").show();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_items = JSON.stringify(get_new_discount_item_rows());
|
||||
var overall_discount = $("#order-discount").text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var ajax_url = "/foodcourt/" + sale_id + "/discount";
|
||||
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
$("#loading_wrapper").hide();
|
||||
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
type: "success"
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Remove selected given discount item
|
||||
$("#remove-item-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_items = [];
|
||||
|
||||
var sale_items = get_selected_discount_items();
|
||||
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(sale_items[i].price < 0){
|
||||
discount_items.push(sale_items[i]);
|
||||
}
|
||||
else {
|
||||
swal ("Oops" , "You have no selected item!" , "error" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var params = { 'cashier_type': cashier_type,'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/" + sale_id + "/remove_discount_items",
|
||||
data: params,
|
||||
success: function(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
type: "success",
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#remove-all").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/foodcourt/" + sale_id + "/" + cashier_type + "/remove_all_discount",
|
||||
success: function(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
type: "success",
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Pay Discount for membership
|
||||
$("#member-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var ajax_url = "/foodcourt/" + sale_id + "/member_discount";
|
||||
|
||||
// Selected Account
|
||||
//var account_types = JSON.stringify(get_selected_account_types());
|
||||
|
||||
// if($('.accounts-type').hasClass('selected-account') == true){
|
||||
|
||||
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
|
||||
var params = {'cashier_type': cashier_type,'sale_id':sale_id, 'sub_total':sub_total };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (result.status == "Success") {
|
||||
type = 'success'
|
||||
btn_color = 'green'
|
||||
}else{
|
||||
type = 'error'
|
||||
btn_color = 'red'
|
||||
}
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor: btn_color,
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});//end member discount
|
||||
});
|
||||
|
||||
/* Remove Selection */
|
||||
function selection_remove(){
|
||||
$(".item-row").removeClass("selected-item");
|
||||
$(".accounts-type").removeClass("selected-account");
|
||||
}
|
||||
|
||||
/* Get Item rows but not discount*/
|
||||
function get_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.item-row.item').not('.discount').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get discount Item rows */
|
||||
function get_new_discount_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.item-row.new-discount').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id');
|
||||
sale_item.name = $(this).find('#item-name-price').text();
|
||||
sale_item.account_id = $(this).find('#item_account_type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get discount Item rows */
|
||||
function get_selected_discount_items(){
|
||||
var sale_items = [];
|
||||
$('.item-row.discount.selected-item').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id');
|
||||
sale_item.name = $(this).find('#item-name-price').text();
|
||||
sale_item.account_id = $(this).find('#item_account_type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get Selected Sale Item's ID and Price */
|
||||
function get_selected_sale_items(){
|
||||
var sale_items = [];
|
||||
$('.item-row.item.selected-item').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id').substr(0,16);
|
||||
sale_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
sale_item.account_id = $(this).find('#item-account-type').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
/* Get Selected Accounts ID and Price */
|
||||
function get_selected_account_types(){
|
||||
var account_types = [];
|
||||
|
||||
$('.selected-account').each(function(i){
|
||||
var account= {};
|
||||
account.id = $(this).attr('id').substr(8);
|
||||
account.name = $(this).text();
|
||||
account_types.push(account);
|
||||
});
|
||||
return account_types;
|
||||
}
|
||||
|
||||
/* Calculate Overall Discount*/
|
||||
function calculate_overall_discount(type, amount){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text()) + parseFloat($("#order-discount").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
|
||||
// For Net Pay
|
||||
if(type == 0){
|
||||
total_discount = Math.round(amount * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
swal({
|
||||
title:"Oops!",
|
||||
text:'Percentage Value over 100!',
|
||||
type: "error",
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor:"red"
|
||||
});
|
||||
}
|
||||
else{
|
||||
total_discount = Math.round(totalAmount * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = parseFloat(totalAmount) - parseFloat(total_discount)
|
||||
|
||||
$("#order-discount").text(parseFloat(total_discount).toFixed(<%= precision.to_i %>));
|
||||
}
|
||||
|
||||
/* Calculate Items Discount*/
|
||||
function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var dis_amount = 0;
|
||||
var sub_total = 0;
|
||||
var total_discount = 0;
|
||||
var arrItemName = "";
|
||||
|
||||
$("#discount_itemsErr").html("");
|
||||
$("#discount-amountErr").html("");
|
||||
// For Net Pay
|
||||
if(origin_sub_total > 0){
|
||||
if(type == 0){
|
||||
dis_amount = -Math.round(amount * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
if(parseFloat(amount) > parseFloat(sale_items[i].price)){
|
||||
arrItemName += ", " + sale_items[i].name;
|
||||
}else{
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
total_discount = parseFloat(total_discount) + parseFloat(amount);
|
||||
|
||||
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
}else{
|
||||
total_discount = parseFloat(total_discount) - parseFloat(amount);
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if(arrItemName!=""){
|
||||
arrItemName = arrItemName.substr(2);
|
||||
if(arrItemName.match(/,/g || []) != null){
|
||||
if(arrItemName.match(/,/g || []).length >= 1){
|
||||
$("#discount_itemsErr").html("Discount is greater than "+arrItemName+" prices");
|
||||
}
|
||||
}else{
|
||||
$("#discount_itemsErr").html("Discount is greater than "+arrItemName+" price");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = parseFloat(origin_sub_total) - parseFloat(total_discount);
|
||||
totalAmount = sub_total
|
||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||
}
|
||||
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
swal({
|
||||
title:"Oops!",
|
||||
text:'Percentage Value over 100!',
|
||||
type: "error",
|
||||
confirmButtonText: 'OK',
|
||||
confirmButtonColor:"red"
|
||||
});
|
||||
}
|
||||
else{
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = -Math.round(sale_items[i].price * amount / 100 * Math.pow(10, precision)) / Math.pow(10, precision);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
|
||||
total_discount = total_discount + dis_amount;
|
||||
if(parseFloat(origin_sub_total) >= parseFloat(total_discount)){
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
}else{
|
||||
total_discount = total_discount - dis_amount;
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
// }
|
||||
}
|
||||
sub_total = parseFloat(origin_sub_total) + parseFloat(total_discount);
|
||||
totalAmount = sub_total
|
||||
$("#order-sub-total").text(parseFloat(sub_total).toFixed(<%= precision.to_i %>));
|
||||
}
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}else{
|
||||
$("#discount-amountErr").html("Discount is greater than sub total!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function item_row_template(type, item, discount_amount, amount){
|
||||
var dis_str = "-discount";
|
||||
if(type == 1){
|
||||
dis_str = dis_str + "(" + amount + "%)"
|
||||
}
|
||||
var discount_item_row = "<tr class='item-row new-discount' id='" + item.id + "'>" +
|
||||
"<td style='width: 60%; text-align: left;'>" +
|
||||
"<span id='item_account_type' class='hidden'>" +
|
||||
item.account_id +
|
||||
"</span>" +
|
||||
"<span id='item-name-price'>" +
|
||||
item.name + dis_str +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-qty'>1</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-total-price'>" +
|
||||
discount_amount +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"</tr>";
|
||||
return discount_item_row;
|
||||
}
|
||||
|
||||
</script>
|
||||
39
app/views/foodcourt/orders/app_order_by_booking.html.erb
Normal file
39
app/views/foodcourt/orders/app_order_by_booking.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<div class="row m-t--20">
|
||||
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
|
||||
<strong class="font-14 p-l-10">Booking Id : </strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||
<table class="table table-striped summary-items" id="order-items-table" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-qty">QTY</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="font-13 order_item_list" >
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||
<input type="hidden" name="customer_id" id="customer_id" value="CUS-000000000001">
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-11" id="done_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">done</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
17
app/views/foodcourt/orders/app_orders.html.erb
Normal file
17
app/views/foodcourt/orders/app_orders.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<div class="row m-t--20">
|
||||
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<div class="card-block">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
391
app/views/foodcourt/orders/show.html.erb
Executable file
391
app/views/foodcourt/orders/show.html.erb
Executable file
@@ -0,0 +1,391 @@
|
||||
|
||||
<div class="container-fluid"><div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
|
||||
</li>
|
||||
<li class="nav-item credit_items">
|
||||
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane " id="completed" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||
<div style="font-size:12px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %> hide">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane active" id="orders" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
sale_order = SaleOrder.find_by_order_id(order)
|
||||
if sale_order
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
end
|
||||
end
|
||||
else
|
||||
order_status = order.status
|
||||
end
|
||||
%>
|
||||
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Credit Item Lists-->
|
||||
<div class="tab-pane dining" id="credits" role="tabpanel">
|
||||
<div class="card-block">
|
||||
<div class="row m-t-10 m-l-10 clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
|
||||
<input type="text" name="filter" id="filter" style="height: 32px;" placeholder="Receipt No." class="form-control" onchange="getCreditData('cashier');">
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
|
||||
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('cashier');" >
|
||||
<option value="">-- Select Customer --</option>
|
||||
<% if !@customers.empty? %>
|
||||
<% @customers.each do |cus| %>
|
||||
<option value="<%= cus[0] %>"><%= cus[1] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix m-t-20 m-l-10">
|
||||
<table class="table table-responsive tbl_credit_lists">
|
||||
<thead>
|
||||
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
|
||||
</thead>
|
||||
<tbody class="tbd_credit_lists"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">ORDERS DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Order No: <span id="receipt_no"> <%= @order.order_id %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @order.created_at.utc.getlocal.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Customer : <span id="customer_name"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="<%= @status_sale=="sale" ? 200 : 160%>">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
@order.order_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'>
|
||||
<%= sale_item.item_name %>
|
||||
<% if !sale_item.set_menu_items.nil?
|
||||
sale_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if !@split_bill.nil? && @split_bill == '1' %>
|
||||
<button type="button" class="btn bg-blue btn-block waves-effect" id='by_order'>By Order</button>
|
||||
<% end %>
|
||||
<% if @sale_status != 'completed' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
||||
<% end %>
|
||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- script data for credit lists -->
|
||||
<script type="text/html" id="html_credit_items">
|
||||
<tr class="row_{key} credit_detail" data-id="{sale_id}" data-type="{cashier_type}">
|
||||
<td>{receipt_date}</td>
|
||||
<td>{receipt_no}</td>
|
||||
<td>{cashier_name}</td>
|
||||
<td>{customer_name}</td>
|
||||
<td>{credit_amount}</td>
|
||||
</tr>
|
||||
</script>
|
||||
<!-- script data for credit lists -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
getCreditSales("","","cashier"); //credit sales script data binding
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/order/' + order_id;
|
||||
})
|
||||
});
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var url = '/foodcourt/sale/'+ sale_id + "/rounding_adj" ;
|
||||
alert(url)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/foodcourt/sale/'+ sale_id + "/rounding_adj",
|
||||
success:function(result){
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/foodcourt/';
|
||||
})
|
||||
$('#move').on('click',function(){
|
||||
|
||||
});
|
||||
|
||||
//order_split
|
||||
$('#by_order').on('click',function () {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure, you want to Split?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, split it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
orderSplitBillProcess();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* function for order items split bill process */
|
||||
function orderSplitBillProcess(){
|
||||
var booking = JSON.parse('<%= @booking.to_json.html_safe %>');
|
||||
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
||||
var order = JSON.parse('<%= @order.to_json.html_safe %>');
|
||||
var arr_order = [];
|
||||
arr_order.push({id : order.order_id});
|
||||
|
||||
var dining_id = booking[0].dining_facility_id || 0;
|
||||
var type = booking[0].type || '';
|
||||
var customer_id = order.customer_id || '';
|
||||
var booking_id = "";
|
||||
if(orders.length == 1){
|
||||
booking_id = booking[0].booking_id;
|
||||
}
|
||||
var cashier_type = "cashier";
|
||||
|
||||
var ajax_url = "/foodcourt/split_bills";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'cashier_type':cashier_type,'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(arr_order)},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else{
|
||||
if (dining_id == 0) {
|
||||
window.location.href = '/foodcourt';
|
||||
}else{
|
||||
if(type=='Table'){
|
||||
window.location.href = '/foodcourt/table/' + dining_id;
|
||||
}else{
|
||||
window.location.href = '/foodcourt/room/' + dining_id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
406
app/views/foodcourt/other_charges/index.html.erb
Executable file
406
app/views/foodcourt/other_charges/index.html.erb
Executable file
@@ -0,0 +1,406 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<!-- Order Details -->
|
||||
<div class="card" >
|
||||
<!-- <div class="card-header">
|
||||
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
||||
</div> -->
|
||||
<div class="card-block">
|
||||
<div class="row card-title">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||
<p>Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text dining">
|
||||
<table class="table table-default" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<%
|
||||
sub_total += sale_item.qty*sale_item.unit_price
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||
<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.qty*sale_item.unit_price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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="order-sub-total"><%=sub_total%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
|
||||
<!-- Discount Amount -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Other Charges Control</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="bottom-5">
|
||||
<input type="number" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" onkeypress="return isNumberKey(event);", onkeyup="otherCharges(this.value);" />
|
||||
<br><span id="other-charges-amountErr" style="color:red;"></span>
|
||||
</div>
|
||||
<div class="bottom-5">
|
||||
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
|
||||
</div>
|
||||
<div class="bottom-5">
|
||||
<input type="checkbox" id="is_taxable" name="is_taxable" />
|
||||
<lable for="is_taxable">Is Taxable</lable>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
|
||||
<div class="p-l-20">
|
||||
<div class="row bottom">
|
||||
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
||||
<div class="fluid cashier_number" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="5000" data-type="add">5000</div>
|
||||
</div>
|
||||
<div class="col-md-9 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="col-md-9 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="15000" data-type="add">15000</div>
|
||||
</div>
|
||||
<div class="col-md-9 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20000" data-type="add">20000</div>
|
||||
</div>
|
||||
<div class="col-md-9 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 m-l--15">
|
||||
<div class="form-group">
|
||||
<button id="add_charges" class="btn bg-info fluid action-btn">Add</button>
|
||||
<button id="remove-item" class="btn bg-danger fluid action-btn">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<%if !@table.nil?%>
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/foodcourt/<%=@table.type.downcase%>/<%=@table.id%>'"><i class="material-icons">reply</i> Back </button>
|
||||
<%else%>
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/foodcourt/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'"><i class="material-icons">reply</i> Back </button>
|
||||
<%end%>
|
||||
<button id="charge_other" class="btn bg-primary btn-block action-btn">Enter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
function otherCharges(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#other-charges-amount").val("");
|
||||
}
|
||||
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_OTHER_CHARGES_);
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#other-charges-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#other-charges-amount').val(input_value);
|
||||
}
|
||||
else{
|
||||
$('#other-charges-amount').val(original_value + '' + input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('#other-charges-amount').val(amount);
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#other-charges-amount').val();
|
||||
$('#other-charges-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#other-charges-amount').val("0.0");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Select discount-item
|
||||
$('#order-items-table tbody').on('click', '.other-item-row',function(){
|
||||
if($(this).hasClass('selected-item') == true){
|
||||
$(this).removeClass('selected-item');
|
||||
}
|
||||
else {
|
||||
$(this).addClass('selected-item');
|
||||
}
|
||||
});
|
||||
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$('.other-item-row.selected-item').each(function(i){
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var charge_amount = $(this).children('td').find("#item-total-price").text();
|
||||
|
||||
// Update sub total
|
||||
$('#order-sub-total').text(parseFloat(sub_total) - parseFloat(charge_amount));
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
// Calculate Net Discount for Payment
|
||||
$("#add_charges").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var charge_amount = $("#other-charges-amount").val();
|
||||
var reasons = $("#reasons").val();
|
||||
var is_taxable = 0
|
||||
if ($("#is_taxable:checked").length > 0) {
|
||||
is_taxable = 1
|
||||
}
|
||||
$("#other-charges-amountErr").html("");
|
||||
if(charge_amount != ""){
|
||||
$("#other-charges-amount").val("");
|
||||
$("#reasons").val("");
|
||||
// Update sub total
|
||||
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
||||
|
||||
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
|
||||
$("#order-items-table tbody").append(item_row);
|
||||
}
|
||||
else{
|
||||
$("#other-charges-amountErr").html("can't be blank");
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate Other Charges for Payment
|
||||
$("#charge_other").on('click', function(e){
|
||||
e.preventDefault();
|
||||
if($('#charge_other').is(":visible")) {
|
||||
$('#charge_other').prop("disabled",true);
|
||||
}
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||
var ajax_url = "/foodcourt/" + sale_id + "/other_charges";
|
||||
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Success",
|
||||
type:"success"
|
||||
}, function () {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + result.table_id
|
||||
}
|
||||
}s
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* Remove Selection */
|
||||
function selection_remove(){
|
||||
$(".item-row").removeClass("selected-item");
|
||||
$(".discount_item_row").removeClass("selected-item");
|
||||
$(".accounts-type").removeClass("selected-account");
|
||||
}
|
||||
|
||||
/* Get discount Item rows */
|
||||
function get_other_item_rows(){
|
||||
var sale_items = [];
|
||||
$('.other-item-row').each(function(i){
|
||||
var sale_item = {};
|
||||
sale_item.id = $(this).attr('id');
|
||||
sale_item.name = $(this).find('#item-name-price').text();
|
||||
sale_item.price = $(this).find('#item-total-price').text()
|
||||
sale_item.is_taxable = $(this).find('#item_taxable').text();
|
||||
sale_items.push(sale_item);
|
||||
});
|
||||
return sale_items;
|
||||
}
|
||||
|
||||
function item_row_template(sale_id, charge_amount, reasons, is_taxable){
|
||||
var item_row = "<tr class='other-item-row' id='SLI-000000000000'>" +
|
||||
"<td style='width: 60%; text-align: left;'>" +
|
||||
"<span id='item_account_type' class='hidden'>" +
|
||||
0 +
|
||||
"</span>" +
|
||||
"<span id='item-name-price'>" +
|
||||
reasons +
|
||||
"</span>" +
|
||||
"<span id='item_taxable' class='hidden'>" + is_taxable + "</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-qty'>1</span>" +
|
||||
"</td>" +
|
||||
"<td style='width: 20%; text-align: right;'>" +
|
||||
"<span id='item-total-price'>" +
|
||||
charge_amount +
|
||||
"</span>" +
|
||||
"</td>" +
|
||||
"</tr>";
|
||||
return item_row;
|
||||
}
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
2
app/views/foodcourt/paymal/create.json.jbuilder
Normal file
2
app/views/foodcourt/paymal/create.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
404
app/views/foodcourt/paymal/index.html.erb
Normal file
404
app/views/foodcourt/paymal/index.html.erb
Normal file
@@ -0,0 +1,404 @@
|
||||
<div class="container-fluid">
|
||||
<!-- <div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%=foodcourt_root_path %>"><%= t :home %></a></li>
|
||||
<li class="breadcrumb-item"><a href="/foodcourt/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.details.redeem") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back',:default => t("views.btn.back")),'/foodcourt/sale/'+@sale_id+'/payment/others_payment'%>
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
|
||||
<div class="rebate-form">
|
||||
<input type="hidden" name="receipt_no" id="receipt_no" value="<%= @receipt_no%>">
|
||||
<p class="hidden" name="sale_id" id="sale_id"><%=@sale_id %></p>
|
||||
<p class="hidden" name="membership_id" id="membership_id" ><%=@membership_id %></p>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">You can pay up to </label>
|
||||
<%@payment_prices = @payment_prices +@rounding_adj%>
|
||||
<input type="text" name="" id="paymentamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payment_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @payparcount > 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">Recent Payment Amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payparcount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">Available Balance </label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">Payment Balance</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <% if @payparcount > 0 %>
|
||||
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
||||
<% end %>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @payment_prices %></span></p> -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="m-t-10 p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number green border-left" data-type="nett">Nett</div>
|
||||
<div class="col-md-4 cashier_number red border-left" data-type="del">Del</div>
|
||||
<div class="col-md-4 cashier_number orange border-left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="pay purple left" id="paymal_payment">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default m-t-10 btn-lg btn-block" onclick="window.location.href = '/foodcourt/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||
<div class="m-r-20" align="right">
|
||||
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- customer light box -->
|
||||
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
||||
<input type="hidden" name="qr_code" id="qr_code" />
|
||||
<div class="row text-center m-t-20">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
setHeaderBreadCrumb(_PAYMAL_);
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#paymentamt').val();
|
||||
$('#used_amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#paymal_payment").on('click',function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
payment_amount = parseFloat($("#used_amount").text());
|
||||
if(payment_amount > 0){
|
||||
if((membership_id!=undefined) && (membership_id!="") && (membership_id > 0)){
|
||||
if(payment_amount<=0 ){
|
||||
swal ( "Oops" , "Please type valid amount!" , "warning" );
|
||||
}else if(valid_amount< payment_amount){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "warning" );
|
||||
}else{
|
||||
if(payment_amount <= "<%= @payment_prices %>"){
|
||||
$(this).off("click");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=foodcourt_payment_paymal_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:"",account_no:0},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.message,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/"+cashier_type+"/payment"
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
swal ( "Oops" , "Payment Amount is over!" , "warning" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#is_paymemberModal").show();
|
||||
$("#is_paymemberModal").modal({show : true, backdrop: false, keyboard : false});
|
||||
}
|
||||
}else{
|
||||
swal ( "Oops" , "Amount should be greater than 0!" , "warning" );
|
||||
}
|
||||
});
|
||||
|
||||
// Read Card Reader
|
||||
$(".btn_member").on('click', function(){
|
||||
var cardNo = "";
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
var receipt_no = $("#receipt_no").val() || "";
|
||||
|
||||
var customer_mamber_card_no = 0;
|
||||
var payment_amount = parseFloat($("#used_amount").text());
|
||||
|
||||
$("#is_paymemberModal").hide();
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
customer_mamber_card_no = $("#paypar_account_no").val();
|
||||
if (customer_mamber_card_no == 0) {
|
||||
customer_mamber_card_no = $("#membership_id").text() || 0;
|
||||
}
|
||||
if(sale_id != 0 && customer_mamber_card_no !=0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/"+sale_id+"/send_account" ,
|
||||
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == true) {
|
||||
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
||||
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=foodcourt_payment_paymal_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.message,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opp","Please Check Member","warning")
|
||||
}
|
||||
},100);
|
||||
});
|
||||
|
||||
// Read NFC card no from java
|
||||
function getCardNo(){
|
||||
code2lab.readNFC();
|
||||
}
|
||||
|
||||
// get CardNo from Java
|
||||
function setCardNo(cardNo){
|
||||
if(cardNo.length == 16){
|
||||
$("#paypar_account_no").val(cardNo);
|
||||
}
|
||||
}
|
||||
|
||||
// QR Code Reader
|
||||
$(".btn_qr_code").on('click', function(e){
|
||||
$("#is_paymemberModal").hide();
|
||||
var code = "";
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
var receipt_no = $("#receipt_no").val() || "";
|
||||
var payment_amount = parseFloat($("#used_amount").text());
|
||||
setTimeout(function(){
|
||||
code=getQRCode();
|
||||
if(sale_id != 0 && code != ""){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/"+sale_id+"/send_account" ,
|
||||
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == true) {
|
||||
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
||||
$("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=foodcourt_payment_paymal_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.message,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Opps",result.message ,"warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},100);
|
||||
});
|
||||
|
||||
// Read qrcode from java
|
||||
function getQRCode(){
|
||||
return code2lab.readQRCode();
|
||||
$("#qr_code").val(code);
|
||||
}
|
||||
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
</script>
|
||||
2
app/views/foodcourt/payments/create.json.jbuilder
Executable file
2
app/views/foodcourt/payments/create.json.jbuilder
Executable file
@@ -0,0 +1,2 @@
|
||||
json.status true
|
||||
|
||||
1788
app/views/foodcourt/payments/show.html.erb
Executable file
1788
app/views/foodcourt/payments/show.html.erb
Executable file
File diff suppressed because it is too large
Load Diff
2
app/views/foodcourt/paypar_payments/create.json.jbuilder
Executable file
2
app/views/foodcourt/paypar_payments/create.json.jbuilder
Executable file
@@ -0,0 +1,2 @@
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
21
app/views/foodcourt/paypar_payments/index.html.erb
Executable file
21
app/views/foodcourt/paypar_payments/index.html.erb
Executable file
@@ -0,0 +1,21 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card">
|
||||
<% if @membership_id!=0 %>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 long purple " id="redim">Redim Amount</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 m-t-10">
|
||||
<button type="button" class="btn bg-default m- btn-block" onclick="window.location.href = '/foodcourt/sale/<%= @sale_id %>/<%= @cashier_type %>/payment';"> Back </button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
setHeaderBreadCrumb(_PAYPAR_PAYMENT_);
|
||||
});
|
||||
</script>
|
||||
7
app/views/foodcourt/request_bills/print.json.jbuilder
Executable file
7
app/views/foodcourt/request_bills/print.json.jbuilder
Executable file
@@ -0,0 +1,7 @@
|
||||
if @status == true
|
||||
#show invoice number and stuff
|
||||
json.status @status
|
||||
else
|
||||
json.status @status
|
||||
json.error_message @error_message
|
||||
end
|
||||
149
app/views/foodcourt/reservation/index.html.erb
Normal file
149
app/views/foodcourt/reservation/index.html.erb
Normal file
@@ -0,0 +1,149 @@
|
||||
<%= stylesheet_link_tag 'reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'reservation', 'data-turbolinks-track': 'reload' %>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||
<div class="card" id="make-reservation-slimscroll" data-height="-50">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title text-center bg-faded"><%= t :make_reservation %></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="wizard">
|
||||
<div class="wizard-inner">
|
||||
<div class="active-line"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="nav-item">
|
||||
<div class="connecting-line border-right"></div>
|
||||
<a href="#reservation" class="nav-link active" data-toggle="tab" aria-controls="reservation" role="tab" title="Reservation">
|
||||
<span class="round-tab">
|
||||
1
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation" class="nav-item disabled">
|
||||
<div class="connecting-line"></div>
|
||||
<a href="#personal_detail" class="nav-link disable" data-toggle="tab" aria-controls="personal_detail" role="tab" title="Personal Detail">
|
||||
<span class="round-tab">
|
||||
2
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- .end.wizard-inner -->
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" role="tabpanel" id="reservation">
|
||||
<div class="form-row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-12">
|
||||
<label class="font-12 radio-inline">
|
||||
<input type="radio" name="reservation_type" checked class="radio-col-indigo reservation_type" value="0"><%= t("views.right_panel.detail.dine_in") %>
|
||||
</label>
|
||||
<label class="font-12 radio-inline">
|
||||
<input type="radio" name="reservation_type" class="radio-col-indigo reservation_type" value="1"><%= t :room %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dining_type">
|
||||
<div class="form-row clearfix">
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_in_date datepicker" name="check_in_date" id="check_in_date" type="text" placeholder="Check-in Date">
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_out_date datepicker" name="check_out_date" id="check_out_date" type="text" placeholder="Check Out Date">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row clearfix">
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_in_time timepicker" name="check_in_time" id="check_in_time" type="text" placeholder="Check-in Time">
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_out_time timepicker" name="check_out_time" id="check_out_time" type="text" placeholder="Check Out Time">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="room_type">
|
||||
<div class="form-row clearfix">
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_in_date datepicker" name="check_in_date" id="check_in_date" type="text" placeholder="Check-in Date">
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<input class="form-control check_out_date datepicker" name="check_out_date" id="check_out_date" type="text" placeholder="Check Out Date">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row clearfix">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<label for="room_count" class="control-label">ROOMS</label>
|
||||
<input type="number" class="form-control number_limit" name="room_count" id="room_count" data-type="room" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row clearfix">
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<label for="adult_count" class="control-label">ADULT</label>
|
||||
<input type="number" class="form-control number_limit" name="adult_count" id="adult_count" data-type="adult" value="1">
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-6 col-lg-6">
|
||||
<label for="child_count" class="control-label">CHILD</label>
|
||||
<input type="number" class="form-control number_limit" name="child_count" id="child_count" data-type="child">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<button class="btn bg-blue btn-lg waves-effect">CHECK AVAILABLE</button>
|
||||
<button class="btn bg-blue btn-lg waves-effect next-step">NEXT</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- .end.tab-panel .reservation -->
|
||||
|
||||
<div class="tab-pane" role="tabpanel" id="personal_detail">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<input class="form-control" name="name" id="name" type="text" placeholder="NAME">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<input class="form-control" name="contact_no" id="contact_no" type="number" placeholder="PHONE NUMBER">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<input class="form-control" name="address" id="address" type="text" placeholder="ADDRESS">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<label for="reservation_note" class="control-label">RESERVATION NOTE</label>
|
||||
<textarea rows="3" id="reservation_note" name="reservation_note" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="form-group col-sm-12 col-md-12 col-lg-12">
|
||||
<button class="btn bg-blue btn-lg prev-step">PREV</button>
|
||||
<button class="btn bg-blue btn-lg">SUBMIT</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- .end.tab-content .personal_detail -->
|
||||
</div> <!-- .end.wizard -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
|
||||
<div class="card font-13">
|
||||
<div class="row clearfix">
|
||||
<div class="col-xs-7 col-sm-7 col-md-7 col-lg-7" id="process-reservation-slimscroll" data-height="-80">
|
||||
|
||||
</div>
|
||||
<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5" id="reservation-info-slimscroll" data-height="-80">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/foodcourt/sale_edit/apply_void.json.jbuilder
Executable file
1
app/views/foodcourt/sale_edit/apply_void.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
1
app/views/foodcourt/sale_edit/cancel_all_void.json.jbuilder
Executable file
1
app/views/foodcourt/sale_edit/cancel_all_void.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
427
app/views/foodcourt/sale_edit/edit.html.erb
Executable file
427
app/views/foodcourt/sale_edit/edit.html.erb
Executable file
@@ -0,0 +1,427 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p class="m-l-10"> Receipt No: <span id="receipt_no">
|
||||
<%= @saleobj.receipt_no rescue '' %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p class="m-r-10">Date:
|
||||
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text dining">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="2%">#</th>
|
||||
<th class="" width="20%">Items</th>
|
||||
<th style="" width="5%">QTY
|
||||
</th>
|
||||
<th class="" width="10%">Price
|
||||
</th>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="20%"> Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td class="p-1" width="2%"><%= count %></td>
|
||||
<td class="p-2" width="20%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.status != 'void' && sale_item.status != 'edit' && sale_item.status != 'foc' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control " onkeyup="checkQuantity(this.value,'<%= sale_item.id %>');" onkeypress="return isNumberKey(event);" />
|
||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-blue waves-effect update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" data-type="void" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">Void</button>
|
||||
|
||||
<button data-id="<%= sale_item.id %>" data-type="foc" class='editModal btn btn-lg bg-danger waves-effect' data-toggle="modal" data-target="#editModal">FOC</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.status == 'edit' %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="10%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td> -->
|
||||
<td class="p-1" width="25%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-danger waves-effect cancel'>Cancel
|
||||
Void/Update
|
||||
</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class="p-1" width="5%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="p-1" width="50%"><strong>Sub Total:</strong></td>
|
||||
<td><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-md-3">
|
||||
<div class="card p-l-15 p-r-15">
|
||||
<div class="card-block">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-top border- border-left green" data-type="nett">Nett</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left red" data-type="del">Del</div>
|
||||
<div class="col-md-4 cashier_number border-top border- border-left orange" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="editModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="editModalLabel">Please Enter Remark</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" id="action">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
|
||||
setHeaderBreadCrumb(_SALE_EDIT_);
|
||||
$('.editModal').on('click', function () {
|
||||
$("#action").attr('data-type', $(this).attr('data-type'));
|
||||
$("#action").attr('data-id', $(this).attr('data-id'));
|
||||
$("#action").text($(this).attr('data-type'))
|
||||
})
|
||||
|
||||
$(".update").on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#' + sale_item_id + "_qty").val();
|
||||
var price = $('#' + sale_item_id + "_price").val();
|
||||
var qty_status = true;
|
||||
var price_status = true;
|
||||
if((qty > 0) && (price > 0)){
|
||||
qty_status = true;
|
||||
price_status = true;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else if((qty > 0) && (price <= 0 || price == '')){
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
if(price == ''){
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_price").val("");
|
||||
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
|
||||
}
|
||||
}else if((qty <= 0 || qty == '') && (price > 0)){
|
||||
qty_status = false;
|
||||
if(qty == ''){
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_qty").val("");
|
||||
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
|
||||
}
|
||||
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else{
|
||||
qty_status = false;
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}
|
||||
|
||||
if(qty_status && price_status){
|
||||
var ajax_url = "/foodcourt/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code + "&type=" + cashier_type,
|
||||
success: function (result) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Qty and Price was successfully Updated",
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/*$('.void').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/foodcourt/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.foc').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/foodcourt/item_foc";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})*/
|
||||
|
||||
$('#action').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var type = $(this).attr('data-type');
|
||||
var remark = $("#remark").val();
|
||||
if (type=='foc') {
|
||||
var ajax_url = "/foodcourt/item_foc";
|
||||
}else{
|
||||
var ajax_url = "/foodcourt/item_void";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code + "&type=" + cashier_type,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.cancel').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/foodcourt/item_void_cancel";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code + "&type=" + cashier_type,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_id %>'
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
if (cashier_type=="quick_service" || cashier_type == "food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
window.location.href = '/foodcourt/table/' + table_id;
|
||||
}
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/foodcourt/cancel_all_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id +'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#apply').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/foodcourt/apply_void";
|
||||
var table_id = '<%= @table_id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
window.location.href = '/foodcourt/table/' + table_id;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$( "input" ).focusin(function() {
|
||||
$('.addfocus').removeClass('addfocus');
|
||||
$( this ).addClass('addfocus');
|
||||
});
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
|
||||
var original_value='';
|
||||
original_value = $('.addfocus').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('.addfocus').val(input_value);
|
||||
}
|
||||
else{
|
||||
$('.addfocus').val(original_value + '' + input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('.addfocus').val(amount);
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('.addfocus').val();
|
||||
$('.addfocus').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('.addfocus').val("");
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//check for isNumber
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkQuantity(obj_value,sale_item_id) {
|
||||
if(obj_value == '0'){
|
||||
$("#"+sale_item_id+"_qty").val('1');
|
||||
}
|
||||
}
|
||||
|
||||
function checkPrice(obj_value,sale_item_id) {
|
||||
|
||||
}
|
||||
</script>
|
||||
1
app/views/foodcourt/sale_edit/item_void.json.jbuilder
Executable file
1
app/views/foodcourt/sale_edit/item_void.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
1
app/views/foodcourt/sale_edit/item_void_cancel.json.jbuilder
Executable file
1
app/views/foodcourt/sale_edit/item_void_cancel.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
1
app/views/foodcourt/sales/add_to_existing_invoice.json.jbuilder
Executable file
1
app/views/foodcourt/sales/add_to_existing_invoice.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
565
app/views/foodcourt/sales/show.html.erb
Executable file
565
app/views/foodcourt/sales/show.html.erb
Executable file
@@ -0,0 +1,565 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
<li class="nav-item credit_items">
|
||||
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credit %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<!-- Nav tabs - End -->
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane active" id="completed" role="tabpanel" style="max-height:600px; overflow:auto">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @complete.each do |sale| %>
|
||||
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(table.id) %>
|
||||
(Orders : <%= @order_items_count[table.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||
<div style="font-size:12px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(table.id) %>
|
||||
(Orders : <%= @order_items_count[table.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %> <br>
|
||||
<%= table.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %> <br>
|
||||
<%= room.zone.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(room.id) %>
|
||||
(Orders : <%= @order_items_count[room.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %><br>
|
||||
<%= room.zone.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(room.id) %>
|
||||
(Orders : <%= @order_items_count[room.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %><br>
|
||||
<%= room.zone.name %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %> hide">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
sale_order = SaleOrder.find_by_order_id(order)
|
||||
if sale_order
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
end
|
||||
end
|
||||
else
|
||||
order_status = order.status
|
||||
end
|
||||
%>
|
||||
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Credit Item Lists-->
|
||||
<div class="tab-pane dining" id="credits" role="tabpanel">
|
||||
<div class="card-block">
|
||||
<div class="row m-t-10 m-l-10 clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
|
||||
<input type="text" name="filter" id="filter" style="height: 32px;" placeholder="Receipt No." class="form-control" onchange="getCreditData('cashier');">
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
|
||||
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('cashier');" >
|
||||
<option value="">-- Select Customer --</option>
|
||||
<% if !@customers.empty? %>
|
||||
<% @customers.each do |cus| %>
|
||||
<option value="<%= cus[0] %>"><%= cus[1] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix m-t-20 m-l-10">
|
||||
<table class="table table-responsive tbl_credit_lists">
|
||||
<thead>
|
||||
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
|
||||
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
|
||||
</thead>
|
||||
<tbody class="tbd_credit_lists"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<%= @sale.receipt_no rescue '' %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Customer : <%= @sale.customer.name rescue "-" %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<div class="card-text" style="">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
sub_total = 0
|
||||
@sale.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||
<% #unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
#end
|
||||
end
|
||||
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<% if @sale.payment_status != 'foc' %>
|
||||
<a class="btn btn-block bg-danger waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% end %>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
|
||||
<% else %>
|
||||
<% if @sale.payment_status != 'foc' %>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
|
||||
<% end %>
|
||||
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-sm" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
|
||||
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
|
||||
<div class="row bottom p-l-15 p-r-15 m-t-10">
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
|
||||
</div>
|
||||
<div class="row bottom p-l-15 p-r-15">
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
|
||||
</div>
|
||||
<div class="row bottom p-l-15 p-r-15">
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
|
||||
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- script data for credit lists -->
|
||||
<script type="text/html" id="html_credit_items">
|
||||
<tr class="row_{key} credit_detail" data-id="{sale_id}" data-type="{cashier_type}">
|
||||
<td>{receipt_date}</td>
|
||||
<td>{receipt_no}</td>
|
||||
<td>{cashier_name}</td>
|
||||
<td>{customer_name}</td>
|
||||
<td>{credit_amount}</td>
|
||||
</tr>
|
||||
</script>
|
||||
<!-- script data for credit lists -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
getCreditSales("","","cashier"); //credit sales script data binding
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/table/' + dining_id;
|
||||
})
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/sale/' + sale_id;
|
||||
})
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/room/' + dining_id;
|
||||
})
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/foodcourt/order/' + order_id;
|
||||
})
|
||||
});
|
||||
|
||||
$('#reprint').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = '/foodcourt/'+ sale_id + "/reprint";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/foodcourt/sale/'+ sale_id + "/payment";
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/foodcourt/';
|
||||
})
|
||||
|
||||
// $('#void').on('click',function () {
|
||||
// var sure = confirm("Are you sure want to Void");
|
||||
// if (sure == true) {
|
||||
// // var sale_id = $('#sale_id').val();
|
||||
// // var ajax_url = "/foodcourt/sale/" + sale_id + '/void';
|
||||
// // $.ajax({
|
||||
// // type: 'POST',
|
||||
// // url: ajax_url,
|
||||
// // success: function () {
|
||||
// // window.location.href = '/foodcourt/';
|
||||
// // }
|
||||
// // });
|
||||
// }
|
||||
// });
|
||||
|
||||
$(document).on('click', '.access_modal', function(event){
|
||||
type = $(this).data("type");
|
||||
$(".ok").attr("data-action",type);
|
||||
$('#AccessCodeModal').modal('show');
|
||||
});
|
||||
$('#void').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/foodcourt/sale/" + sale_id +'/'+'cashier'+ '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: {'access_code':access_code},
|
||||
success: function () {
|
||||
window.location.href = '/foodcourt/sale/'+sale_id;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function check_emp_access_code(access_code,type) {
|
||||
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: {},
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
if (result.status == true) {
|
||||
createAccessCode(code);
|
||||
if (type == "edit") {
|
||||
var dining_id = $('#dining').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
if (dining_id) {
|
||||
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}else{
|
||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}
|
||||
}else if(type == "void"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#voidModal').modal('show');
|
||||
// overall_void();
|
||||
}else if(type == "waste") {
|
||||
// $('#AccessCodeModal').modal('hide');
|
||||
// $('#focModal').modal('show');
|
||||
waste_and_spoilage("waste")
|
||||
}else if(type == "waste") {
|
||||
// $('#AccessCodeModal').modal('hide');
|
||||
// $('#focModal').modal('show');
|
||||
waste_and_spoilage("waste")
|
||||
}else if(type == "reprint") {
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/foodcourt/"+ sale_id + "/reprint";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}else if(type == "foc"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#focModal').modal('show');
|
||||
// overall_foc();
|
||||
}
|
||||
}else{
|
||||
swal("Opps",result.message,"warning")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
67
app/views/foodcourt/second_display/_second_display.html.erb
Normal file
67
app/views/foodcourt/second_display/_second_display.html.erb
Normal file
@@ -0,0 +1,67 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="card-text" >
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<table class="table table-striped second_display_items" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-">QTY</th>
|
||||
<th class="item-">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="item-attr"><strong id="s_sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount Amount:</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="item-attr"><strong id="s_total_discount">0.00</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax Amount:</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="item-attr"><strong id="s_tatal_tax">0.00</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand:</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="item-attr"><strong id="s_grand_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div id="wowslider-container" style="max-width: 100%;">
|
||||
<div class="ws_images full_screen">
|
||||
<% @display_images.each do |p| %>
|
||||
<%= image_tag "#{p.image}", :alt => "rss feed"%>
|
||||
<% break %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
20
app/views/foodcourt/second_display/_slider.html.erb
Normal file
20
app/views/foodcourt/second_display/_slider.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<%= stylesheet_link_tag 'wow_style', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'wowslider', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'wow_script', 'data-turbolinks-track': 'reload' %>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div id="wowslider-container" style="max-width: 100%;">
|
||||
<div class="ws_images full_screen">
|
||||
<ul>
|
||||
<% @display_images.each do |p| %>
|
||||
<li>
|
||||
<%= image_tag "#{p.image}", :alt => "rss feed"%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ws_bullets"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
20
app/views/foodcourt/second_display/index.html.erb
Normal file
20
app/views/foodcourt/second_display/index.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<div class="container-fluid" style="margin-top:-65px;">
|
||||
<button type="button" class="hidden" id="s_reload">Reload</button>
|
||||
<div class="slider" id="second_display_slider">
|
||||
<%= render 'slider' %>
|
||||
</div>
|
||||
|
||||
<div class="item hidden" id="second_display_items">
|
||||
<%= render 'second_display' %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
//html font-size for second display till 35px!
|
||||
// document.getElementsByTagName( "html" )[0].style[ "font-size" ] = "35px";
|
||||
|
||||
$('#s_reload').on('click', function () {
|
||||
window.location.href = '/foodcourt/second_display';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
1
app/views/foodcourt/shifts/create.json.jbuilder
Executable file
1
app/views/foodcourt/shifts/create.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
1
app/views/foodcourt/shifts/edit.html.erb
Executable file
1
app/views/foodcourt/shifts/edit.html.erb
Executable file
@@ -0,0 +1 @@
|
||||
<h1> Close Cashier </h1>
|
||||
2
app/views/foodcourt/shifts/index.html.erb
Executable file
2
app/views/foodcourt/shifts/index.html.erb
Executable file
@@ -0,0 +1,2 @@
|
||||
<h1>Origami::Shifts#index</h1>
|
||||
<p>Find me in app/views/origami/shifts/index.html.erb</p>
|
||||
126
app/views/foodcourt/shifts/new.html.erb
Executable file
126
app/views/foodcourt/shifts/new.html.erb
Executable file
@@ -0,0 +1,126 @@
|
||||
<div class="container-fluid">
|
||||
<h1>Open Cashier</h1>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<th>Cashier Terminal</th>
|
||||
<th>
|
||||
<select class="form-control show-tick" id='cashier_terminal'>
|
||||
<% @terminal.each do |ter| %>
|
||||
<option value="<%= ter.id %>" ><%= ter.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<% @float.each do |float| %>
|
||||
<tr>
|
||||
<th><%= float.name %></th>
|
||||
<th><input class='float-value form-control' type='text' data-value ="<%= float.value %>" value='0' id='<%= float.value %>'></input></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><div id='total'></div></th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<div class="row p-l-30">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
|
||||
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="4" data-type="num">4</div>
|
||||
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
|
||||
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="7" data-type="num">7</div>
|
||||
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
|
||||
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="0" data-type="num">0</div>
|
||||
<div class=" cashier_number left" data-value="." data-type="num">.</div>
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number orange " data-type="clr">Clr</div>
|
||||
<div class=" cashier_number left" data-type='ent' >Calculate</div>
|
||||
<div class=" cashier_number purple left" id="open_cashier">Open Cashier</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var float_value = ""
|
||||
var total = 0
|
||||
|
||||
$(document).on('focusout', '.float-value', function(event){
|
||||
float_value = $(this).attr("data-value");
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
if(event.handled !== true) {
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
var original = $('#'+float_value).val();
|
||||
if (original == "0"){
|
||||
$('#'+float_value).val(input_value);
|
||||
}else{
|
||||
$('#'+float_value).val(original + input_value);
|
||||
}
|
||||
break;
|
||||
case 'clr':
|
||||
$('#'+float_value).val("0");
|
||||
break;
|
||||
case 'ent':
|
||||
var sum = 0
|
||||
<%
|
||||
sum = 0
|
||||
@float.each do |float|
|
||||
%>
|
||||
var float = "<%= float.value %>"
|
||||
console.log(float)
|
||||
var cal = $('#'+ float).val() * float
|
||||
sum += cal;
|
||||
<%
|
||||
end
|
||||
%>
|
||||
total = sum
|
||||
$('#total').text(total)
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#open_cashier').on('click touchstart', function(event){
|
||||
$(this).off("click touchstart touchend");
|
||||
var cashier_terminal = $('#cashier_terminal').val();
|
||||
var amount = $('#total').text()||0;
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= foodcourt_shifts_path %>",
|
||||
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
|
||||
success:function(result){
|
||||
if(result){
|
||||
window.location.href = "<%= foodcourt_food_court_path%>";
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
201
app/views/foodcourt/shifts/sale_summary.html.erb
Executable file
201
app/views/foodcourt/shifts/sale_summary.html.erb
Executable 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 = '/foodcourt/shift/close';
|
||||
})
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/foodcourt';
|
||||
})
|
||||
})
|
||||
</script>
|
||||
282
app/views/foodcourt/shifts/show.html.erb
Executable file
282
app/views/foodcourt/shifts/show.html.erb
Executable file
@@ -0,0 +1,282 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class='row clearfix'>
|
||||
<div class='col-md-10'>
|
||||
<h1><%= t :close_cashier %></h1>
|
||||
<br>
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td><%= t :shift_started_at %></td>
|
||||
<td><%= @shift.shift_started_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t :cashier_name %></td>
|
||||
<td><%= @shift.employee.name rescue ''%></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<hr>
|
||||
<div class='row clearfix '>
|
||||
<div class='col-md-5'>
|
||||
<span style='font-size:20px;'><b><%= t :closing_balance %></b></span>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<span style='font-size:20px;'><b><input type='number' class="form-control" id='closing_balance_amount' value='' onkeypress="return isNumberKey(event);" onkeyup="closeCashier(this.value);"></b></span>
|
||||
</div>
|
||||
</div><br>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
|
||||
<button type="button" class="btn bg-blue btn-block green close_cashier"> <%= t("views.btn.close_cashier") %> </button>
|
||||
<% if @bank_integration == '1' && @cashier_type!="ordering" %>
|
||||
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="cardSettleModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="cardSettleModal">Select Device: </h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick sel_com_port" id="sel_com_port" >
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" id="card_settle">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
// $(document).ready(function(){
|
||||
// var val = $('#sale_items').val()
|
||||
// if (val == 1) {
|
||||
// $('#sale_items').prop( "checked", true );
|
||||
// }
|
||||
// })
|
||||
|
||||
function closeCashier(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#closing_balance_amount").val("");
|
||||
}
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function greaterThanOne(val){
|
||||
if(parseInt(val)==0) $("#closing_balance_amount").val(1);
|
||||
}
|
||||
|
||||
var cashier_type = '<%= @cashier_type %>';
|
||||
$('.close_cashier').on('click',function(){
|
||||
var amount = $('#closing_balance_amount').val();
|
||||
var shift_id = "<%= @shift.id rescue ""%>"
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= foodcourt_close_shift_path %>",
|
||||
data: "closing_balance="+ amount + "&shift_id="+ shift_id ,
|
||||
success:function(result){
|
||||
console.log(result)
|
||||
window.location.href = '/';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = "<%= foodcourt_food_court_path%>";
|
||||
});
|
||||
|
||||
/** start CB Card Settle process **/
|
||||
$("#card_settlement").on('click', function(){
|
||||
if(typeof code2lab != 'undefined'){
|
||||
$('#cardSettleModal').modal({ keyboard: false, backdrop: false });
|
||||
code2lab.getCommPorts();
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'Settlement can not print out in browser!',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/shift/'+cashier_type+'/close';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//CB Bank payment settlement ECR integration
|
||||
function setCommPorts(comPortLists) {
|
||||
// alert(comPortLists);
|
||||
$('#sel_com_port').html("");
|
||||
var jsonPortLists = $.parseJSON(comPortLists);
|
||||
if((jsonPortLists!=undefined && jsonPortLists!='') && (jsonPortLists.length > 0)){
|
||||
$.each(jsonPortLists,function(key,value){
|
||||
$('#sel_com_port').append("<option value='"+value+"'>"+value+"</option>");
|
||||
});
|
||||
}
|
||||
else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'Payment can not pay in browser!',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/shift/'+cashier_type+'/close';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#card_settle").on('click', function () {
|
||||
$("#loading_wrapper").show();
|
||||
$('#cardSettleModal').modal('hide');
|
||||
reqCBBankMPUSettlement();
|
||||
});
|
||||
|
||||
//add req data to card_settle_trans table
|
||||
function reqCardSettleTrans(cmd_type,payment_type,com_port) {
|
||||
var jobj = {"cmd_type" : cmd_type, "payment_type" : payment_type};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/bank_integration/settle_trans",
|
||||
data: {type:"request", data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == "success"){
|
||||
resCardSettleTrans(data.card_settle_trans_id,cmd_type,payment_type,com_port);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//add res data to card_settle_trans table
|
||||
function resCardSettleTrans(card_settle_trans_id,cmd_type,payment_type,com_port) {
|
||||
var resMsg = "";
|
||||
if($("#loading_wrapper").is(':visible')){
|
||||
resMsg = code2lab.reqBankPayment(cmd_type, payment_type, 1, "", com_port);
|
||||
}
|
||||
|
||||
if(resMsg.includes("STATUS")){
|
||||
var jobj = $.parseJSON(resMsg);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/bank_integration/settle_trans",
|
||||
data: {type:"response", card_settle_trans_id: card_settle_trans_id, data: jobj},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == "success"){
|
||||
if(payment_type == "MPU"){
|
||||
reqCBBankVMJSettlement();
|
||||
}
|
||||
else if(payment_type == "VMJ"){
|
||||
reqCBBankJCBSettlement();
|
||||
}
|
||||
else if(payment_type == "JCB"){
|
||||
reqCBBankCUPSettlement();
|
||||
}
|
||||
else if(payment_type == "CUP"){
|
||||
$("#loading_wrapper").hide();
|
||||
swal({
|
||||
title: 'Information!',
|
||||
text: 'Settlement is successfully.',
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/foodcourt/shift/'+cashier_type+'/close';
|
||||
});
|
||||
// reqCBBankAlipaySettlement();
|
||||
}
|
||||
// else if(payment_type == "Alipay"){
|
||||
// reqCBBankIPPSettlement();
|
||||
// $('#loading').hide();
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#loading_wrapper").hide();
|
||||
swal ( "Oops" , resMsg.toString() , "error" );
|
||||
}
|
||||
}
|
||||
|
||||
//settle for MPU / MPU-UPI
|
||||
function reqCBBankMPUSettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "MPU";
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
|
||||
//settle for VMJ (VISA, MASTER)
|
||||
function reqCBBankVMJSettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "VMJ"; //VISA,Master and JCB
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
|
||||
//settle for JCB
|
||||
function reqCBBankJCBSettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "JCB";
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
|
||||
//settle for International Union Pay (CUP)
|
||||
function reqCBBankCUPSettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "CUP";
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
|
||||
//settle for Alipay
|
||||
function reqCBBankAlipaySettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "Alipay";
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
|
||||
//settle for insert/direct swipe (now does not using this state - future one)
|
||||
function reqCBBankIPPSettlement() {
|
||||
var com_port = $('#sel_com_port').val();
|
||||
var cmd_type = "SETTLEMENT";
|
||||
var payment_type = "IPP";
|
||||
$("#loading_wrapper").show();
|
||||
reqCardSettleTrans(cmd_type,payment_type,com_port);
|
||||
}
|
||||
/** end CB Card Settle process **/
|
||||
</script>
|
||||
1
app/views/foodcourt/shifts/update_shift.json.jbuilder
Executable file
1
app/views/foodcourt/shifts/update_shift.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
534
app/views/foodcourt/surveys/_form.html.erb
Executable file
534
app/views/foodcourt/surveys/_form.html.erb
Executable file
@@ -0,0 +1,534 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
|
||||
<div class="card">
|
||||
<%= simple_form_for(@survey, :url => foodcourt_create_surveys_path) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
<div class="form-inputs p-l-10">
|
||||
<% if !@survey_data.nil? %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();", :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyChild(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10', :onChange => "total_customer();", :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyAdult(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :male , input_html: { value: @survey_data.male, class: 'col-md-10', :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyMale(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :female , input_html: { value: @survey_data.female, class: 'col-md-10', :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyFemale(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.input :total_customer, input_html: { value:@survey_data.total_customer , :readonly => true, class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-11', :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyLocal(this.value);" }%>
|
||||
<!--<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;"> -->
|
||||
<!-- <legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend> -->
|
||||
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
|
||||
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>
|
||||
<div class="row clearfix foreignerDiv">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden" id="newTemplate" >
|
||||
</div>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :child , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();", :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyChild(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :adult , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();", :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyAdult(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :male , input_html: { min:'1',class: 'col-md-10' , :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyMale(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :female , input_html: { min:'1',class: 'col-md-10' , :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyFemale(this.value);" }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.input :total_customer, input_html: { :readonly => true,min:'1', class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { min:'1',class: 'col-md-11', :onkeypress => "return isNumberKey(event);", :onkeyup => "surveyLocal(this.value);" }%>
|
||||
|
||||
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
|
||||
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Foreigner</label>
|
||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||
<% Lookup.where("lookup_type = ? and shop_code='#{@shop.shop_code}'", "country" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<label class="p-l-10">Number</label>
|
||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||
<br>
|
||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden" id="newTemplate" >
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%if !@dining_facility.nil? %>
|
||||
<input type="hidden" name="table_id" id="table_id" value="<%= @dining_facility.id %>">
|
||||
<input type="hidden" name="table_type" id="table_type" value="<%= @table_type %>">
|
||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
|
||||
<%else%>
|
||||
<input type="hidden" name="table_id" id="table_id" value="0">
|
||||
<input type="hidden" name="table_type" id="table_type" value="0">
|
||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => 0 } %>
|
||||
<%end%>
|
||||
<input type="hidden" name="sale_id" value="<%=@id%>">
|
||||
<input type="hidden" name="cashier_type" value="<%=@cashier_type%>">
|
||||
|
||||
<% if !@survey_data.nil? %>
|
||||
<input type="hidden" name="survey_id" value=<%= @survey_data.id %> />
|
||||
<% else %>
|
||||
<input type="hidden" name="survey_id" />
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
||||
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
||||
<%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
|
||||
</div>
|
||||
<div class="form-actions form-inputs p-l-10">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="p-l-70 m-b-10 m-t-10">
|
||||
<div class="row bottom">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 hidden">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.detail.title") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.title_txt") %> <br>
|
||||
2) <%= t("views.right_panel.detail.account_type") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.account_type_txt") %> <br>
|
||||
3) <%= t("views.right_panel.detail.discount") %> - <%= t("views.right_panel.detail.checkbox") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.discount_txt") %> <br>
|
||||
4) <%= t("views.right_panel.detail.point") %> - <%= t("views.right_panel.detail.checkbox") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.point_txt") %> <br>
|
||||
5) <%= t("views.right_panel.detail.bonus") %> - <%= t("views.right_panel.detail.checkbox") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.bonus_txt") %> <br>
|
||||
6) <%= t("views.right_panel.detail.rebate") %> - <%= t("views.right_panel.detail.checkbox") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.rebate_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function surveyChild(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#survey_child").val("");
|
||||
}
|
||||
function surveyAdult(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#survey_adult").val("");
|
||||
}
|
||||
function surveyMale(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#survey_male").val("");
|
||||
}
|
||||
function surveyFemale(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#survey_female").val("");
|
||||
}
|
||||
function surveyLocal(val){
|
||||
var aa = parseInt(val);
|
||||
if(isNaN(aa)) $("#survey_local").val("");
|
||||
}
|
||||
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function(){
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
|
||||
$('.foreignerDiv').removeClass("hidden");
|
||||
setHeaderBreadCrumb(_SURVEY_);
|
||||
<% if !@survey_data.nil? %>
|
||||
addSurveyForeignerLists(<%= @survey_data.foreigner.to_json.html_safe %>);
|
||||
<% end %>
|
||||
//click add button for new row
|
||||
$('#addForeigner').on('click',function(){
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
|
||||
var text_box = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ? and shop_code='#{@shop.shop_code}'", "country" ).each do |ct| %>'
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('#newTemplate').append(text_box);
|
||||
});
|
||||
|
||||
//click add button for new row
|
||||
$('#newTemplate').on('click','#addForeigner',function(){
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
|
||||
var text_box = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ? and shop_code='#{@shop.shop_code}'", "country" ).each do |ct| %>'
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
$('#newTemplate').append(text_box);
|
||||
});
|
||||
|
||||
//click remove buttom
|
||||
$('#newTemplate').on('click','#removeRow', function(){
|
||||
$(this).parent().parent().remove()
|
||||
});
|
||||
|
||||
$( "input" ).focusin(function() {
|
||||
$('.addfocus').removeClass('addfocus');
|
||||
$( this ).addClass('addfocus');
|
||||
});
|
||||
|
||||
$(".cashier_number").on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
|
||||
var original_value='';
|
||||
original_value = $('.addfocus').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
var value = $('.addfocus').val(input_value);
|
||||
if ($("#survey_child").hasClass('addfocus')){
|
||||
var child = $("#survey_child").val()+value;
|
||||
var adult = $("#survey_adult").val() || 0;
|
||||
var result = parseInt(child) + parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
if ($("#survey_adult").hasClass('addfocus')){
|
||||
var adult = $("#survey_adult").val()+value;
|
||||
var child = $("#survey_child").val() || 0;
|
||||
var result = parseInt(child) + parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
}
|
||||
else{
|
||||
var value = $('.addfocus').val(original_value + '' + input_value);
|
||||
if ($("#survey_child").hasClass('addfocus')){
|
||||
var child = $("#survey_child").val()+value;
|
||||
var adult = $("#survey_adult").val() || 0;
|
||||
var result = parseInt(child) + parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
if ($("#survey_adult").hasClass('addfocus')){
|
||||
var adult = $("#survey_adult").val()+value;
|
||||
var child = $("#survey_child").val() || 0;
|
||||
var result = parseInt(child) + parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value);
|
||||
$('.addfocus').val(amount);
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('.addfocus').val();
|
||||
$('.addfocus').val(discount_text.substr(0,discount_text.length-1));
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('.addfocus').val("");
|
||||
if($("#survey_child").hasClass('addfocus')){
|
||||
$("#survey_child").val("");
|
||||
var adult = $("#survey_adult").val() || 0;
|
||||
var result = parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}else if($("#survey_adult").hasClass('addfocus')){
|
||||
$("#survey_adult").val("");
|
||||
var child = $("#survey_child").val() || 0;
|
||||
var result = parseInt(child);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// click back button for redirect
|
||||
$('#back').on('click',function(){
|
||||
var table_type = $('#table_type').val();
|
||||
var table_id = $('#table_id').val();
|
||||
|
||||
if (cashier_type == "quick_service" || cashier_type == "food_court") {
|
||||
window.location.href = '/foodcourt/sale/<%= @id %>/<%= @cashier_type %>/payment/';
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + table_id;
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + table_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function addSurveyForeignerLists(foreigner_lists){
|
||||
if((foreigner_lists != undefined) && (foreigner_lists != null) && (foreigner_lists != "")){
|
||||
$('.foreignerDiv').remove();
|
||||
$('#newTemplate').removeClass('hidden');
|
||||
foreigner_lists = foreigner_lists.substring(1, (foreigner_lists.length - 1)).replace(new RegExp('"', "g"),'').split(",");
|
||||
var arr_foreigner = {};
|
||||
$.each(foreigner_lists,function(key,value){
|
||||
if(!value.match(/^[0-9]+$/)){
|
||||
arr_foreigner[value] = 0;
|
||||
}else{
|
||||
$.each(arr_foreigner,function(k,val){
|
||||
if(arr_foreigner[k] == 0){
|
||||
arr_foreigner[k] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(foreigner_lists);
|
||||
// console.log(arr_foreigner);
|
||||
$.each(arr_foreigner, function(key,value){
|
||||
if(Object.keys(arr_foreigner)[0] == key){
|
||||
var fgn_template = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ? and shop_code='#{@shop.shop_code}'", "country" ).each do |ct| %>'
|
||||
// if (key.toString() == '<%= ct.value.to_s %>')
|
||||
// var selected = "selected";
|
||||
// else
|
||||
// var selected = "";
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control" value="'+value+'">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-success" id="addForeigner">Add</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
}else{
|
||||
var fgn_template = '<div id="newRow" class="row clearfix">'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+' <select class="form-control col-md-12 selectpicker show-tick" '
|
||||
+' name="survey[foreigner][]" style="height: " >'
|
||||
+'<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>'
|
||||
// if (key.toString() == '<%= ct.value.to_s %>')
|
||||
// var selected = "selected";
|
||||
// else
|
||||
// var selected = "";
|
||||
+'<option value="<%= ct.value %>">'
|
||||
+'<%= ct.name %></option>'
|
||||
+'<%end %>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 ">'
|
||||
+'<div class="form-group p-l-10 p-r-10">'
|
||||
+'<input type="number" name="survey[foreigner][]" class="form-control" value="'+value+'">'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
|
||||
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
}
|
||||
|
||||
$('#newTemplate').append(fgn_template);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function total_customer(){
|
||||
var child = $("#survey_child").val() || 0;
|
||||
var adult = $("#survey_adult").val() || 0;
|
||||
var result = parseInt(child) + parseInt(adult);
|
||||
$("#survey_total_customer").val(result);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
2
app/views/foodcourt/surveys/_survey.json.jbuilder
Executable file
2
app/views/foodcourt/surveys/_survey.json.jbuilder
Executable file
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_account, :id, :title, :account_type, :created_at, :updated_at
|
||||
json.url settings_account_url(settings_account, format: :json)
|
||||
12
app/views/foodcourt/surveys/edit.html.erb
Executable file
12
app/views/foodcourt/surveys/edit.html.erb
Executable file
@@ -0,0 +1,12 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back', :default => t("views.btn.back")), settings_accounts_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<%= render 'form', settings_account: @settings_account %>
|
||||
91
app/views/foodcourt/surveys/index.html.erb
Executable file
91
app/views/foodcourt/surveys/index.html.erb
Executable file
@@ -0,0 +1,91 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= foodcourt_root_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.account") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back', :default => t("views.btn.back")), foodcourt_root_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.title") %></th>
|
||||
<th><%= t("views.right_panel.detail.account_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.discount") %></th>
|
||||
<th><%= t("views.right_panel.detail.point") %></th>
|
||||
<th><%= t("views.right_panel.detail.bonus") %></th>
|
||||
<th><%= t("views.right_panel.detail.rebate") %></th>
|
||||
<th><%= t("views.right_panel.detail.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_accounts.each do |account| %>
|
||||
<tr>
|
||||
<td><%= account.title %></td>
|
||||
<td><%= account.account_type == 1 ? "Expense" : "Income"%></td>
|
||||
<td><%= account.discount %></td>
|
||||
<td><%= account.point %></td>
|
||||
<td><%= account.bonus %></td>
|
||||
<td><%= account.rebate %></td>
|
||||
<td>
|
||||
<%= link_to t("views.btn.show"), settings_account_path(account),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||
<%= link_to t("views.btn.edit"), edit_settings_account_path(account),:class => 'btn btn-primary btn-sm waves-effect' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.detail.title") %> - <%= t("views.right_panel.detail.title_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
2) <%= t("views.right_panel.detail.account_type") %> - <%= t("views.right_panel.detail.account_type_txt") %> <br>
|
||||
3) <%= t("views.right_panel.detail.discount") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.discount_txt") %> <br>
|
||||
4) <%= t("views.right_panel.detail.point") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.point_txt") %> <br>
|
||||
5) <%= t("views.right_panel.detail.bonus") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.bonus_txt") %> <br>
|
||||
6) <%= t("views.right_panel.detail.rebate") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.rebate_txt") %> <br>
|
||||
7) <%= t("views.right_panel.detail.actions") %> - <%= t("views.right_panel.detail.actions_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.new") %> - <%= t("views.right_panel.detail.new_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.show") %> - <%= t("views.right_panel.detail.show_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %> <br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#back').on('click',function(){
|
||||
table_type = '<%=@table_type%>';
|
||||
table = '<%=@dining_facility.id%>';
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/foodcourt/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/foodcourt/room/" + table_id
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
1
app/views/foodcourt/surveys/index.json.jbuilder
Executable file
1
app/views/foodcourt/surveys/index.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.array! @settings_accounts, partial: 'settings_accounts/settings_account', as: :settings_account
|
||||
3
app/views/foodcourt/surveys/new.html.erb
Executable file
3
app/views/foodcourt/surveys/new.html.erb
Executable file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
<%= render 'form', survey: @survey %>
|
||||
84
app/views/foodcourt/surveys/show.html.erb
Executable file
84
app/views/foodcourt/surveys/show.html.erb
Executable file
@@ -0,0 +1,84 @@
|
||||
<!-- -->
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item"><a href="<%= settings_accounts_path %>"><%= t("views.right_panel.detail.account") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t :details %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back', :default => t("views.btn.back")), settings_accounts_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">Account</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.title") %></th>
|
||||
<th><%= t("views.right_panel.detail.account_type") %></th>
|
||||
<!-- <th>Can get Discount</th> -->
|
||||
<th><%= t("views.right_panel.detail.can_get_points") %></th>
|
||||
<!-- <th>Can get Bonus</th> -->
|
||||
<th><%= t("views.right_panel.detail.can_rebate") %></th>
|
||||
<th><%= t("views.right_panel.detail.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @settings_account.title %></td>
|
||||
<td><%= @settings_account.account_type %></td>
|
||||
<!-- <td><%= @settings_account.discount %></td> -->
|
||||
<td><%= @settings_account.point %></td>
|
||||
<!-- <td><%= @settings_account.bonus %></td> -->
|
||||
<td><%= @settings_account.rebate %></td>
|
||||
|
||||
<td><%= link_to t("views.btn.edit"), edit_settings_account_path(@settings_account),:class => 'btn btn-primary btn-sm waves-effect' %>
|
||||
<button class="delete btn btn-danger btn-sm waves-effect" data-ref="<%= settings_account_path(@settings_account)%>" data-method="delete">
|
||||
<%= t("views.btn.delete") %>
|
||||
</button>
|
||||
|
||||
<span class="hidden" id="delete_text">
|
||||
<h6>Are you sure you want to delete this row ?</h6>
|
||||
<h6>This action can't be undo. </h6>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.detail.title") %> - <%= t("views.right_panel.detail.title_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
2) <%= t("views.right_panel.detail.account_type") %> - <%= t("views.right_panel.detail.account_type_txt") %> <br>
|
||||
3) <%= t("views.right_panel.detail.can_get_points") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.point_txt") %> <br>
|
||||
4) <%= t("views.right_panel.detail.can_rebate") %> - <%= t("views.right_panel.detail.status_txt2") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.rebate_txt") %> <br>
|
||||
5) <%= t("views.right_panel.detail.actions") %> - <%= t("views.right_panel.detail.actions_txt2") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.delete") %> - <%= t("views.right_panel.detail.delete_btn_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||
<p>
|
||||
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.account_txt") %> <br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
app/views/foodcourt/surveys/show.json.jbuilder
Executable file
1
app/views/foodcourt/surveys/show.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
||||
json.partial! "settings_accounts/settings_account", settings_account: @settings_account
|
||||
Reference in New Issue
Block a user