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

This commit is contained in:
Aung Myo
2017-08-24 13:30:02 +06:30
64 changed files with 1942 additions and 1032 deletions

View File

@@ -0,0 +1,16 @@
<div class="card">
<div class="card-header">
<div><strong id="order-title">COMMISSIONERS </strong></div>
</div>
<div class="card-block">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem; min-height:600px; max-height:600px; overflow-x:scroll;">
<% @commissioners.each do |commissioner| %>
<div class="card tables green text-white" data-id="<%= commissioner.id %>">
<div class="card-block">
<%= commissioner.name %>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -5,10 +5,13 @@
<div class="form-inputs">
<%= f.input :name %>
<%= f.label :emp_id %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :emp_id, :name, {prompt: "Select an Employee"}, {class: "form-control"} %><br/>
<%= f.input :commission_type %>
<label><%= f.check_box :is_active %> Active </label>
</div>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %><br/>
<%= f.label :commission_type %>
<%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
<br/>
<label><%= f.check_box :is_active %> Active </label>
</div><br/>
<div class="form-actions">
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>

View File

@@ -1,11 +1,11 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissioner</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path ,:class => 'btn btn-primary btn-sm' %>
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissioner</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</ul>
</div>
<br>
@@ -23,22 +23,18 @@
<tbody>
<% @commissioners.each do |commissioner| %>
<tr>
<td><%= commissioner.name %></td>
<td>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?',commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
</td>
<td><%= commissioner.commission_type %></td>
<td><%= commissioner.is_active %></td>
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<tr>
<td><%= commissioner.name %></td>
<td>
<%= commissioner.employee.name rescue '-' %>
</td>
<td><%= commissioner.commission.menu_item.name rescue '-' %></td>
<td><%= commissioner.is_active %></td>
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</tbody>
</table>
</div>

View File

@@ -21,16 +21,12 @@
<tr>
<td style="width:20%">Employee Name</td>
<td>
<% if Employee.exists? %>
<% employee = Employee.where('emp_id=?', @commissioner.emp_id) %>
<%= employee[0].name %>
<% end %>
<%= @commissioner.employee.name rescue '-' %>
</td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission_type %></td>
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Active</td>

View File

@@ -4,11 +4,12 @@
<div class="form-inputs">
<%= f.label :product_id %>
<%= f.collection_select :product_id, Product.all.order('name asc'), :id, :name, {prompt: "Select a Product"}, {class: "form-control"} %><br/>
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
<%= f.input :amount %>
<%= f.input :commission_type, :collection => [:percentage, :net_amount] %>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
<label><%= f.check_box :is_active %> Active </label>
</div>
</div><br>
<div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>

View File

@@ -1,11 +1,11 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path ,:class => 'btn btn-primary btn-sm' %>
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</ul>
</div>
<br>
@@ -23,22 +23,16 @@
<tbody>
<% @commissions.each do |commission| %>
<tr>
<td>
<% if Product.exists? %>
<% product = Product.find(commission.product_id) %>
<%= product.name %>
<% end %>
</td>
<td><%= commission.amount %></td>
<td><%= commission.commission_type %></td>
<td><%= commission.is_active %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<tr>
<td><%= commission.menu_item.name rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.commission_type rescue '-' %></td>
<td><%= commission.is_active rescue '-' %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,217 @@
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5" style="height: 100%">
<%= render 'origami/commissioners/commissioners_form', commissioners: @commissioners %>
</div>
<!-- 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></div>
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p> 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>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" style="min-height:500px; max-height:500px; overflow-x:scroll">
<table class="table " id="order-items-table">
<thead>
<tr>
<th width="4%">#</th>
<th class="" width="60%">Items</th>
<th style="" width="20%">QTY
</td>
<th class="" width="30%">Price
</td>
</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 id="sale_item" data-sale-item="<%= sale_item.sale_item_id %>">
<td width="4%"><%= count %></td>
<td class='' width="60%">
<%= sale_item.product_name %>
</td>
<td class='' width="20%">
<%= sale_item.qty %>
</td>
<td class='' width="20%">
<%= sale_item.unit_price %>
</td>
</tr>
<%
end
end
%>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<tr class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>
</div>
</div>
<script>
// Bill Request
$(document).ready(function () {
$(".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();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
success: function (result) {
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function () {
location.reload();
}
}
}
});
}
});
});
$('.void').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.foc').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_foc";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.cancel').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
})
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/' + table_id;
})
$('#cancel_all_void').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
location.reload();
}
});
})
$('#apply').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
window.location.href = '/origami/table/' + table_id;
}
});
})
$('#sale_item').on('click', function () {
var sale_item_id = this.getAttribute('data-sale-item');
var ajax_url = "/origami/select_sale_item";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
// window.location.href = '/origami/table/' + table_id;
}
});
})
</script>

View File

@@ -16,12 +16,7 @@
<tbody>
<tr>
<td style="width:20%">Product Name</td>
<td>
<% if Product.exists? %>
<% product = Product.find(@commission.product_id) %>
<%= product.name %>
<% end %>
</td>
<td><%= @commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Amount</td>

View File

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

View File

@@ -572,6 +572,12 @@
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
});
$('#commissions').on('click', function () {
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners";
});
$('#void').on('click', function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {

View File

@@ -0,0 +1,33 @@
<div class="col-md-3">
<%= simple_form_for([:origami,@in_juty]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.label :dinning_id %>
<%= f.collection_select :dinning_id, DiningFacility.all, :id, :name, {prompt: 'Select Dining Facilities'}, {class: 'form-control'} %><br/>
<%= f.label :commissioner_ids %>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/>
<label>In time</label>
<%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%><br/>
<label>Out time</label>
<%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
</div><br>
<div class="form-actions">
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>
<script type="text/javascript">
$(function() {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script>

View File

@@ -0,0 +1,2 @@
json.extract! in_juty, :id, :created_at, :updated_at
json.url in_juty_url(in_juty, format: :json)

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', in_juty: @in_juty %>
</div>

View File

@@ -0,0 +1,38 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li>In Juties</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Dining Facility Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @in_juties.each do |in_juty| %>
<tr>
<td><%= in_juty.dining_facility.name rescue '-' %></td>
<td><%= in_juty.commissioner.name rescue '-' %></td>
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= link_to 'Show', origami_in_juty_path(in_juty) %></td>
<td><%= link_to 'Edit', edit_origami_in_juty_path(in_juty) %></td>
<td><%= link_to 'Destroy', origami_in_juty_path(in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @in_juties, partial: 'in_juties/in_juty', as: :in_juty

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', in_juty: @in_juty %>
</div>

View File

@@ -0,0 +1,43 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_in_juties_path %>">In Juties</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">In Juty</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Dining Facility Name</td>
<td><%= @in_juty.dining_facility.name%></td>
</tr>
<tr>
<td style="width:20%">Commissioner Name</td>
<td>
<%= @in_juty.commissioner.name rescue '-' %>
</td>
</tr>
<tr>
<td style="width:20%">In Time</td>
<td><%= @in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Out Time</td>
<td><%= @in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_in_juty_path(@in_juty), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_in_juty_path(@in_juty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "in_juties/in_juty", in_juty: @in_juty