From 5c27dcff665e6d926a9c9f038356bde6b8511eb5 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 27 Oct 2017 17:06:07 +0630 Subject: [PATCH] merge with origin --- app/assets/javascripts/origami.js | 205 ++---------------- .../origami/in_duties_controller.rb | 20 +- app/views/origami/addorders/detail.html.erb | 2 +- app/views/origami/customers/index.html.erb | 2 +- app/views/origami/home/show.html.erb | 2 +- app/views/origami/in_duties/_form.html.erb | 43 +++- app/views/origami/in_duties/index.html.erb | 2 +- .../origami/in_duties/index_in_duty.html.erb | 87 +++++--- app/views/origami/jcb/index.html.erb | 2 +- .../origami/moveroom/move_dining.html.erb | 2 +- app/views/origami/mpu/index.html.erb | 2 +- .../origami/others_payments/index.html.erb | 2 +- .../load_commissioners.html.erb | 10 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/voucher/index.html.erb | 2 +- 15 files changed, 135 insertions(+), 250 deletions(-) diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index c7212c81..d6ad05e6 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -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 = - // '' + data["response_data"]["data"][i]["accountable_type"] +'' - // +'' + balance + ''; - - // $(".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; - // }) - }); diff --git a/app/controllers/origami/in_duties_controller.rb b/app/controllers/origami/in_duties_controller.rb index eaf23c5a..2c30bbd9 100755 --- a/app/controllers/origami/in_duties_controller.rb +++ b/app/controllers/origami/in_duties_controller.rb @@ -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 diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index fae66e28..aac52c6d 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -26,7 +26,7 @@
-
+
ORDER DETAILS | Table<%=@table.name%> diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index b82aa895..488f32e9 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -14,7 +14,7 @@
-
+
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 66fadd48..e098a0e0 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -314,7 +314,7 @@
- + <% if @dining.bookings.length >= 1 %> <% if @status_order == 'order' && @status_sale != 'sale' %> diff --git a/app/views/origami/in_duties/_form.html.erb b/app/views/origami/in_duties/_form.html.erb index 9e6ba0e4..c4890e4a 100755 --- a/app/views/origami/in_duties/_form.html.erb +++ b/app/views/origami/in_duties/_form.html.erb @@ -1,18 +1,43 @@ -<%= simple_form_for @in_duty, :url => origami_index_in_duty_path(@table.id), :method => :post do |f| %> +
+<%= simple_form_for @in_duty, :url => origami_index_in_duty_path, :method => :post do |f| %> <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> - -
- - <%= @table.name %> -

+
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %> <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
- <%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %> - <%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %> + + + +
+ +
+ + date_range + + <% if !@in_duty.in_time.nil?%> + + <% else %> + + <% end %> +
+
+
+ +
+ + date_range + + <% if !@in_duty.out_time.nil?%> + + <% else %> + + <% end %> +
+

@@ -21,7 +46,7 @@ <% f.button :button, "Reset", :class => 'btn bg-danger ', :id => 'reset' %>
- <%= f.button :submit, :class => 'btn bg-blue' %> + <%= f.submit "Create In Duty", :class => 'btn bg-blue' %>
<% end %> diff --git a/app/views/origami/in_duties/index.html.erb b/app/views/origami/in_duties/index.html.erb index 91adade2..8af03f8b 100755 --- a/app/views/origami/in_duties/index.html.erb +++ b/app/views/origami/in_duties/index.html.erb @@ -40,7 +40,7 @@
- +
diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb index c27013d2..ae77fa15 100755 --- a/app/views/origami/jcb/index.html.erb +++ b/app/views/origami/jcb/index.html.erb @@ -92,7 +92,7 @@
- +
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index bdd2ef93..77609586 100755 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -155,7 +155,7 @@
- +
diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb index 92a87dd2..b912de68 100755 --- a/app/views/origami/mpu/index.html.erb +++ b/app/views/origami/mpu/index.html.erb @@ -95,7 +95,7 @@
- +
diff --git a/app/views/origami/others_payments/index.html.erb b/app/views/origami/others_payments/index.html.erb index 3a715b12..b84ac87b 100755 --- a/app/views/origami/others_payments/index.html.erb +++ b/app/views/origami/others_payments/index.html.erb @@ -10,7 +10,7 @@
- +
diff --git a/app/views/origami/product_commissions/load_commissioners.html.erb b/app/views/origami/product_commissions/load_commissioners.html.erb index 2beb69a2..31e991d0 100755 --- a/app/views/origami/product_commissions/load_commissioners.html.erb +++ b/app/views/origami/product_commissions/load_commissioners.html.erb @@ -6,8 +6,8 @@
COMMISSIONERS
-
-
+
+
* Select One Item
<% @commissioners.each do |commissioner| %>
@@ -30,12 +30,12 @@
-

Receipt No: +

Receipt No: <%= @saleobj.receipt_no rescue '' %>

-

Date: +

Date: <%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %>

@@ -112,7 +112,7 @@
- +
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index d0b3804b..a8ed45a3 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -304,7 +304,7 @@
- + <% if @room.bookings.length >= 1 %> <% if @status_order == 'order' && @status_sale != 'sale' %> diff --git a/app/views/origami/voucher/index.html.erb b/app/views/origami/voucher/index.html.erb index db4de245..05e73797 100755 --- a/app/views/origami/voucher/index.html.erb +++ b/app/views/origami/voucher/index.html.erb @@ -92,7 +92,7 @@
- +