merge with master

This commit is contained in:
Yan
2018-03-19 14:41:40 +06:30
45 changed files with 416 additions and 132 deletions

View File

@@ -46,9 +46,12 @@ if (@booking)
child_spent += (item.price * item.qty)
end
# End YGN BBQ
json.order_items_id item.order_items_id
json.order_id item.order_id
json.item_code item.item_code
json.item_instance_code item.item_instance_code
json.item_name item.item_name
json.set_menu_items item.set_menu_items
json.price item.price
json.qty item.qty
json.options item.options

4
app/views/oqs/edit/index.html.erb Executable file → Normal file
View File

@@ -112,6 +112,8 @@ $(document).ready(function(){
var remarks = $("textarea[name='remarks']").val();
var order_items_id = $(this).attr('data-id');
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
var booking_id = '<%= @booking.booking_id %>';
$.ajax({
type: 'POST',
url: '/oqs/' + order_items_id,
@@ -121,6 +123,8 @@ $(document).ready(function(){
<% if !@link_type.nil? %>
<% if @link_type == 'oqs' %>
window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %>
<% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>

View File

@@ -375,7 +375,7 @@
<div class="modal-body">
<div class="row set-item">
<div class="col-md-4">
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
<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">

View File

@@ -241,7 +241,7 @@ $('#cash_out').on('click',function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/close';
var linkURL = '/origami/shift/cashier/close';
warnBeforeRedirect(linkURL);
})

View File

@@ -292,9 +292,26 @@
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
end %>
</td>
@@ -371,9 +388,26 @@
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
end %>
</td>

22
app/views/origami/pending_order/index.html.erb Normal file → Executable file
View File

@@ -34,7 +34,9 @@
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
<% if current_user.role != "waiter" %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<% end %>
</div>
</div>
</div>
@@ -51,4 +53,22 @@
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
})
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
</script>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
@@ -100,7 +100,7 @@
@order_items.each do |order_item|
sub_total = sub_total + order_item.price %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.price %></td>
@@ -148,7 +148,7 @@
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if current_user.role != "waiter" || @status != "sale"%>
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
@@ -167,6 +167,9 @@
<% if @status != "sale"%>
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
<%end%>
<% if current_user.role != "waiter" %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<% end %>
</div>
</div>
</div>
@@ -203,12 +206,11 @@ $(document).ready(function(){
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
console.log(result)
if (!result.status) {
swal("Information!", result.error_message);
}
else {
window.location.href = '../pending_order/'+ result.data;
location.reload();
}
}
});
@@ -269,5 +271,31 @@ $(document).ready(function(){
}
return false;
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
/*edit order in oqs*/
$('.edit_order').on('click',function(){
var assigned_order_item_id = $(this).attr('data-id');
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
}
});
});
</script>

View File

@@ -277,9 +277,26 @@
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
end %>
</td>
@@ -345,9 +362,26 @@
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
order_item.set_menu_items.each do |item_instance| %>
<br><span class="font-13"><%= item_instance %></span>
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
end %>
</td>

View File

@@ -58,6 +58,7 @@
</div>
</div>
<script>
var type = '<%= @type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();
var shift_id = "<%= @shift.id rescue ""%>"
@@ -72,7 +73,11 @@
});
$('#back').on('click',function(){
window.location.href = '/origami';
if(type!='quick_service'){
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
/** start CB Card Settle process **/
@@ -90,7 +95,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/close';
window.location.href = '/origami/shift/'+type+'/close';
});
}
});
@@ -115,7 +120,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/close';
window.location.href = '/origami/shift/'+type+'/close';
});
}
}

9
app/views/origami/split_bill/index.html.erb Executable file → Normal file
View File

@@ -53,12 +53,14 @@
</tr>
</thead>
<tbody>
<% order_item_count = 0 %>
<% if !@order_items.nil? %>
<% sub_total = 0 %>
<% @order_items.each do |order_item| %>
<% if order_item.include? ('all_order') %>
<% order_item['all_order'].each do |odr_item| %>
<%
order_item_count = order_item_count.to_i + 1
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
%>
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
@@ -385,10 +387,9 @@
//order_item_split
$('#order_item_split').on('click',function () {
var cnt_order_item = "<%= @order_items.count %>";
var cnt_order_item = "<%= order_item_count %>";
var order_items = get_selected_order_items();// Selected Order Items
var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length);
var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length);
if (order_items.length > 0){
// if(cnt_items > 0){
swal({
@@ -423,6 +424,7 @@
$.each(orders, function(key,value){
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
$(".item-row").removeClass('selected-split-item');
}
});
}
@@ -621,6 +623,7 @@ function orderItemSplitBillProcess(cnt_items){
if(cnt_items == 0){
booking_id = json_booking.booking_id;
}
console.log(booking_id);
var order_ids = [];
var arr_order_ids = [];

2
app/views/reports/product_sale/index.html.erb Normal file → Executable file
View File

@@ -1,7 +1,7 @@
<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 active"><%= t("views.right_panel.detail.sale_item_report") %></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.product_sale_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>

View File

@@ -7,6 +7,11 @@
</span>
</ol>
</div>
<!-- <h4>Import</h4>
<%= form_tag import_settings_menus_path, multipart:true do%>
<%=file_field_tag :file%>
<%=submit_tag "Import CSV"%>
<%end%> -->
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
<br><br>

View File

@@ -8,14 +8,16 @@
<%= f.error_notification %>
<div class="form-inputs p-l-15">
<%= f.input :name %>
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
<%= f.input :name, :input_html=>{:onchange=>"checkDuplicate(this.value);"} %>
<span id="tax_profile_nameErr" style="color:red;"></span>
<%= f.input :rate %>
<%= f.input :inclusive %>
<%= f.input :order_by %>
</div>
<div class="form-actions p-l-15">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect btn_submit' %>
</div>
<% end %>
</div>
@@ -45,5 +47,25 @@
</div>
</div>
<script type="text/javascript">
function checkDuplicate(obj){
// $("#tax_profile_nameErr").html("");
var name = '<%= @name %>';
var tax_profiles = JSON.parse('<%= @tax_profiles.to_json.html_safe %>');
var group_type = $("#tax_profile_group_type").val();
if(tax_profiles!=undefined && tax_profiles!=null && tax_profiles!=""){
$.each(tax_profiles,function(key,value){
if(value.group_type == group_type){
if(name.trim().toLowerCase()!=value.name.trim().toLowerCase()){
if(value.name.trim().toLowerCase() == obj.trim().toLowerCase()){
$("#tax_profile_name").val("");
$("#tax_profile_nameErr").html("duplicate group type and name");
}
}
return;
}
});
}
}
</script>

View File

@@ -17,6 +17,7 @@
<table class="table">
<thead>
<tr>
<th><%= t("views.right_panel.detail.group_type") %></th>
<th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.rate") %></th>
<th><%= t("views.right_panel.detail.inclusive") %></th>
@@ -29,6 +30,7 @@
<tbody>
<% @settings_tax_profiles.each do |settings_tax_profile| %>
<tr>
<td><%= settings_tax_profile.group_type %></td>
<td><%= settings_tax_profile.name %></td>
<td><%= settings_tax_profile.rate %></td>
<td><%= settings_tax_profile.inclusive %></td>

View File

@@ -15,6 +15,11 @@
<div class="card-block">
<h4 class="card-title"><%= t("en.tax_profile") %></h4>
<table class="table">
<tr>
<td><strong><%= t("views.right_panel.detail.group_type") %>:</strong></td>
<td><%= @settings_tax_profile.group_type %></td>
</tr>
<tr>
<td><strong><%= t("views.right_panel.detail.name") %>:</strong></td>
<td><%= @settings_tax_profile.name %></td>