merge with origin

This commit is contained in:
Yan
2017-10-27 17:06:07 +06:30
parent 0f24cc0999
commit 5c27dcff66
15 changed files with 135 additions and 250 deletions

View File

@@ -5,6 +5,8 @@
//= require jquery_ujs
//= require turbolinks
//= require cable
//= require momentjs/moment
//= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker
//= require jquery-slimscroll/jquery.slimscroll.js
//= require bootstrap-notify/bootstrap-notify.js
//= require node-waves/waves.js
@@ -13,12 +15,28 @@
//= require BSBMaterial/demo.js
//= require custom.js
$(document).ready(function(){
// auto refresh every 60 seconds
// setTimeout(function(){
// window.location.reload(1);
// }, 60000);
$(document).on('turbolinks:load', function() {
$('.datetimepicker').bootstrapMaterialDatePicker({
format: 'DD-MM-YYYY - HH:mm',
clearButton: true,
weekStart: 1
});
$('.datepicker').bootstrapMaterialDatePicker({
format: 'DD-MM-YYYY',
clearButton: true,
weekStart: 1,
time: false
});
$('.timepicker').bootstrapMaterialDatePicker({
format: 'HH:mm',
clearButton: true,
date: false
});
});
$(document).ready(function(){
// For selected order return
var order_status = "";
order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim();
@@ -114,64 +132,6 @@ $(document).ready(function(){
$(this).addClass('selected-item');
});
// Bill Request
/*$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
if(order_id!=""){
window.location.href = '/origami/' + order_id + '/request_bills'
}
else {
alert("Please select an order!");
}
return false;
});*/
// Discount for Payment
// $('#discount').click(function() {
// var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
// if(order_id!=""){
// window.location.href = '/origami/' + order_id + '/discount'
// }
// else {
// alert("Please select an order!");
// }
// return false;
// });
// Pay Discount for Payment
// $("#pay-discount").on('click', function(e){
// e.preventDefault();
// var sale_id = $('#sale-id').text();
// var sale_item_id = $('.selected-item').attr('id').substr(0,16);
// var sub_total = $('#order-sub-total').text();
// var grand_total = $('#order-grand-total').text();
// var discount_type = $('#discount-type').val();
// var discount_value = $('#discount-amount').val();
// var discount_amount = discount_value;
// var ajax_url = "/origami/" + sale_id + "/discount";
// if(sale_item_id != null){
// ajax_url = "/origami/" + sale_item_id + "/discount";
// sub_total = $("#"+sale_item_id).children().find("#item-total-price").text();
// }
// // For Percentage Discount
// if(discount_type == 1){
// discount_amount=(sub_total*discount_value)/100;
// }
// var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
// $.ajax({
// type: "POST",
// url: ajax_url,
// data: params,
// success:function(result){ }
// });
// });
// Payment for Bill
$('#pay-bill').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
@@ -184,123 +144,4 @@ $(document).ready(function(){
return false;
});
// $('#customer').click(function() {
// var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
// if (sale.substring(0, 3)=="SAL") {
// var sale_id = sale
// }else{
// var sale_id = $(".selected-item").find(".order-cid").text();
// }
// window.location.href = '/origami/'+ sale_id + "/customers"
// return false;
// });
// $('#re-print').click(function() {
// var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
// window.location.href = '/origami/'+ sale_id + "/reprint"
// return false;
// });
// function show_customer_details(customer_id){
// if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
// var url = customer_id+"/get_customer/"
// }else{
// var url = "origami/"+customer_id+"/get_customer/"
// }
// $('.customer_detail').removeClass('hide');
// //Start Ajax
// $.ajax({
// type: "GET",
// url: url,
// data: {},
// dataType: "json",
// success: function(data) {
// $("#customer_name").text(data["customer"].name);
// if (data["response_data"]["data"].length) {
// $.each(data["response_data"]["data"], function (i) {
// if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
// var balance = data["response_data"]["data"][i]["balance"];
// if (data["response_data"]["status"]==true) {
// $('.rebate_amount').removeClass('hide');
// row =
// '<td class="charges-name">' + data["response_data"]["data"][i]["accountable_type"] +'</td>'
// +'<td class="item-attr">' + balance + '</td>';
// $(".rebate_amount").html(row);
// }
// }
// });
// }else{
// $('.rebate_amount').addClass('hide');
// }
// }
// });
// //End Ajax
// }
/* For Receipt - Calculate discount or tax */
// $('.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);
// update_balance();
// }
// else{
// $('#discount-amount').val(original_value + '' + input_value);
// update_balance();
// }
// break;
// case 'add':
// var input_value = $(this).attr("data-value");
// amount = parseInt(input_value);
// $('#discount-amount').val(amount);
// $('#discount-type').val(1);
// update_balance();
// break;
// case 'del' :
// var discount_text=$('#discount-amount').val();
// $('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
// update_balance();
// break;
// case 'clr':
// $('#discount-amount').val("0.0");
// update_balance();
// break;
// }
// event.handled = true;
// } else {
// return false;
// }
// });
// $('.discount-item-row').on('click',function(){
// $('.discount-item-row').removeClass('selected-item');
// $(this).addClass('selected-item');
// });
// $(".orders").on('click', function(){
// var dining_id = $(this).attr("data-id");
// window.location.href = '/origami/' + dining_id;
// })
});

View File

@@ -63,10 +63,12 @@ class Origami::InDutiesController < BaseOrigamiController
def create_for_in_duty
# this one use for create and update
in_duty = in_duty_params
in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
in_time = in_time.change(offset: '+06:30')
out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
out_time = out_time.change(offset: '+06:30')
# in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
# in_time = in_time.change(offset: '+06:30')
# out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
# out_time = out_time.change(offset: '+06:30')
puts in_duty.to_json
puts "sssssssssssssssssss"
@in_duty = InDuty.new
in_duty_id = in_duty[:id]
unless in_duty_id.empty?
@@ -75,16 +77,16 @@ class Origami::InDutiesController < BaseOrigamiController
@in_duty.dinning_id = in_duty_params[:dinning_id]
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
@in_duty.in_time = in_time
@in_duty.out_time = out_time
@in_duty.in_time = in_duty['in_time']
@in_duty.out_time = in_duty['out_time']
respond_to do |format|
if @in_duty.save
if in_duty_id.nil?
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully created.' }
format.html { redirect_to origami_index_in_duty_path, notice: 'In duty was successfully created.' }
format.json { render :show, status: :created, location: @in_duty }
else
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' }
format.html { redirect_to origami_index_in_duty_path, notice: 'In duty was successfully updated.' }
format.json { render :show, status: :created, location: @in_duty }
end
else
@@ -151,7 +153,7 @@ class Origami::InDutiesController < BaseOrigamiController
@in_duty.destroy
respond_to do |format|
format.html { redirect_to origami_index_in_duty_path(@table_id), notice: 'In duty was successfully removed.' }
format.html { redirect_to origami_index_in_duty_path, notice: 'In duty was successfully removed.' }
format.json { head :no_content }
end
end

View File

@@ -26,7 +26,7 @@
</div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<button type="button" class="btn btn-primary btn-md float-right" id="back"><i class="fa fa-arrow-left"></i> BACK </button> <br>
<button type="button" class="btn btn-default btn-md float-right" id="back"><i class="fa fa-arrow-left"></i> BACK </button> <br>
<div class="card-header">
<div>
<strong id="order-title">ORDER DETAILS </strong>| Table<%=@table.name%>

View File

@@ -14,7 +14,7 @@
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="main-box-body clearfix" style="min-height:500px; max-height:500px; overflow-x:scroll">
<div class="main-box-body clearfix" id="order-detail-slimscroll" style="">
<div class="table-responsive">
<table id="origami-crm-table" class="table table-striped">

View File

@@ -314,7 +314,7 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-block btn- bg-blue waves-effect" id='back'><i class="fa fa-arrow-left"></i> Back</button>
<button type="button" class="btn btn-block btn-default waves-effect" id='back'><i class="fa fa-arrow-left"></i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<% if @dining.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>

View File

@@ -1,18 +1,43 @@
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path(@table.id), :method => :post do |f| %>
<br>
<%= simple_form_for @in_duty, :url => origami_index_in_duty_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="form-inputs">
<label>Dining Name:</label>
<%= @table.name %>
<br/><br/>
<div class="form-inputs form-group">
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
<label>Commissioner Name:</label>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
<br/>
<%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %>
<!-- <%= f.input :in_time, :placeholder => "From Date", :class => "form-control datetimepicker" %>
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control datetimepicker" %>-->
<div class="form-group">
<label class="font-14">* In Time</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@in_duty.in_time.nil?%>
<input type="text" name="in_duty[in_time]" value="<%= @in_duty.in_time.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-12" placeholder="Start Date...">
<% else %>
<input type="text" name="in_duty[in_time]" class="datetimepicker form-control col-md-12" placeholder="In Time...">
<% end %>
</div>
</div>
<div class="form-group">
<label>* Out Time</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@in_duty.out_time.nil?%>
<input type="text" name="in_duty[out_time]" value="<%= @in_duty.out_time.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-12" placeholder="Start Date...">
<% else %>
<input type="text" name="in_duty[out_time]" class="datetimepicker form-control col-md-12" placeholder="Out Time...">
<% end %>
</div>
</div>
</div><br>
<div class="form-group">
@@ -21,7 +46,7 @@
<% f.button :button, "Reset", :class => 'btn bg-danger ', :id => 'reset' %>
</div>
<div class="form-actions">
<%= f.button :submit, :class => 'btn bg-blue' %>
<%= f.submit "Create In Duty", :class => 'btn bg-blue' %>
</div>
<% end %>

View File

@@ -40,7 +40,7 @@
</div>
<div class="col-md-1">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-default btn-block" id='back'>Back</button>
</div>
</div>
<script type="text/javascript">

View File

@@ -1,45 +1,62 @@
<div class="row">
<div class="col-md-7">
<label>Dining Name:</label>
<%= @table.name %>
<div class="col-md-8">
<br/>
<table class="table table-striped">
<thead>
<tr>
<th>Select</th>
<th>Dining Facility Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @duties_in.each do |in_duty| %>
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
<td><%= in_duty.dining_facility.name rescue '-' %></td>
<td><%= in_duty.commissioner.name rescue '-' %></td>
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= link_to 'Remove', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
<div class="card">
<div class="card-header">
<label>Dining Name:</label>
<%= @table.name %>
</div>
<div class="card-block">
<table class="table table-striped">
<thead>
<tr>
<th>Select</th>
<th>Table Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th>Action</th>
</tr>
<% end %>
</tbody>
</table>
</thead>
<tbody>
<% @duties_in.each do |in_duty| %>
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
<td><%= in_duty.dining_facility.name rescue '-' %></td>
<td><%= in_duty.commissioner.name rescue '-' %></td>
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td>
<button class="delete btn btn-danger btn-sm waves-effect" data-ref="../table/<%=in_duty.dining_facility.id%>/destroy_in_duty/<%=in_duty.id%>" data-method="delete">
Remove
</button>
<span class="hidden" id="delete_text">
<h6>Are you sure you want to remove this row ?</h6>
<h6>This action can't be undo. </h6>
</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @duties_in %>
</div>
</div>
<div class="col-md-4 partial">
<div class="col-md-3 partial">
<%= render 'form', in_duty: @in_duty, table: @table %>
</div>
<div class="col-md-1">
<button type="button" class="form-control btn btn-primary btn-block" id='back'>Back</button>
<br>
<button type="button" class="form-control btn btn-default btn-block" id='back'>Back</button>
<button class="form-control btn btn-info btn-block" id="reset">New</button>
</div>
</div>
@@ -89,18 +106,18 @@
$('#back').on('click', function () {
window.location.href = '/origami/table/' + "<%= @table.id %>";
});
$('#reset').click(function () {
var url = "<%= new_origami_in_duty_path %>";
$('#reset').click(function () {
location.reload();
/*var url = "<%= origami_index_in_duty_path %>";
console.log(url);
$.ajax({
type: "GET",
url: url,
data: { table_id: <%= @table.id %> },
success: function (data) {
$('.partial').empty().append(data);
$('.induty_tr > td > .checkbox_check').prop("checked", false);
}
});
});*/
});
</script>

View File

@@ -92,7 +92,7 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
<button type="button" class="btn btn-default m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
</div>
</div>

View File

@@ -155,7 +155,7 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-blue btn-block" id='back'>Back</button>
<button type="button" class="btn bg-default btn-block" id='back'>Back</button>
</div>

View File

@@ -95,7 +95,7 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
<button type="button" class="btn btn-default m-l-10 btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
</div>
</div>
</div>

View File

@@ -10,7 +10,7 @@
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-default btn-block" id='back'>Back</button>
</div>
</div>
</div>

View File

@@ -6,8 +6,8 @@
<div class="card-header">
<div><strong id="order-title">COMMISSIONERS </strong></div>
</div>
<div class="card-block">
<div class="card-columns" id="commissioners" style="float: left; padding-top:10px; column-gap: 1.2rem; min-height:600px; max-height:600px; overflow-x:scroll;">
<div class="card-block" id="custom-slimscroll">
<div class="card-columns" id="commissioners" style="float: left; padding-top:10px; column-gap: 1.2rem; ">
<div style="color: gray"><i>* Select One Item</i></div>
<% @commissioners.each do |commissioner| %>
<div class="card tables green text-white commissioner" data-commissioner-id="<%= commissioner.id %>" data-commissioner-name="<%= commissioner.name %>">
@@ -30,12 +30,12 @@
<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">
<p class="p-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>Date:
<p class="p-r-10">Date:
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
</p>
</div>
@@ -112,7 +112,7 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-default btn-block" id='back'>Back</button>
<!--<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>-->
</div>
</div>

View File

@@ -304,7 +304,7 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-blue btn-block" id='back'><i class="fa fa-arrow-left"></i> Back</button>
<button type="button" class="btn btn-default btn-block" id='back'><i class="fa fa-arrow-left"></i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<% if @room.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>

View File

@@ -92,7 +92,7 @@
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
</div>
</div>