diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index a05ea4ee..b0937554 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -18,6 +18,139 @@ //= require cable //= require settings/processing_items +$(document).on("focus", "[data-behaviour~='datepicker']", function(e){ + $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true}); + $('.dropdown-toggle').dropdown(); +}); + +/* +* ToDo Move to here from pages +* +* +$(function(){ + $('#custom_excel').hide(); + + $('#custom_excel').click(function(){ + var url = $('#custom_excel').attr('data-url'); + $('#frm_report').attr('action',url) + $('#frm_report').submit(); + // window.location = url; + }); + + var item = $('#item').val(); + var payment_type = $('#payment_type'); + + if(item == 'order'){ + $('#cashier').hide(); + $('#waiter').show(); + if(payment_type){ + $('#payment_type').hide(); + } + } + else if(item == 'sale'){ + $('#waiter').hide(); + $('#cashier').show(); + } + else{ + $('#waiter').hide(); + $('#cashier').show(); + $("#item").val('sale'); + } +}); + +//Reset the form to pervious values +$("#branch").val(<%=params[:branch]%>); +$("#waiter").val("<%=params[:waiter]%>"); +$("#cashier").val(<%=params[:cashier]%>); +$("#product").val(<%=params[:product]%>); +$("#singer").val(<%=params[:singer]%>); +$("#item").val('<%=params[:item]%>'); +$("#guest_role").val('<%=params[:guest_role]%>'); + + +$("#from").val("<%=params[:from]%>"); +$("#to").val("<%=params[:to]%>"); +$("#sel_period").val(<%=params[:period]%>); +$("#sel_sale_type").val(<%=params[:sale_type]%>); + +<% if params[:period_type] == 1 || params[:period_type] == "1" %> + $("#rd_period_type_1").attr("checked","checked"); +<% else %> + $("#rd_period_type_0").attr("checked","checked"); +<% end %> +$(".btn-group button").removeClass("active"); +<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %> +$("#btn_report_type_<%= report_type %>").addClass("active"); + +$('#item').change(function(){ + var item = $('#item').val(); + var payment_type = $('#payment_type'); + + if(item == 'sale'){ + $('#waiter').hide(); + $('#cashier').show(); + if(payment_type){ + $('#payment_type').show(); + } + } + else{ + $('#cashier').hide(); + $('#waiter').show(); + if(payment_type){ + $('#payment_type').hide(); + } + } +}); + +$(function(){ + var check_arr = []; + var search = '<%= params[:period_type] %>'; + if(search){ + if(parseInt(search) == 0){ + search_by_period(); + } + else{ + search_by_date(); + } + }else{ + search_by_period(); + } + $('#sel_period').change(function(){ + search_by_period(); + }); + function search_by_period(){ + var period = $('#sel_period').val(); + var period_type = 0; + var from = ""; + var to = ""; + } + + $('#from').change(function(){ + search_by_date(); + }); + + $('#to').change(function(){ + search_by_date(); + }); + function search_by_date(){ + var from = $('#from').val(); + var to = $('#to').val(); + var period = 0; + var period_type = 1; + if(to != '' && from != ''){ + shift_name = from + ',' + to; + check_arr.push(to); + // console.log(check_arr.length) + if(check_arr.length == 1){ + } + if(check_arr.length == 3){ + check_arr = []; + } + } + } +}); +*/ +>>>>>>> d54fd19d1c18384ee6b21c43ca51587fb7fa843f diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6097a890..bed2e04f 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -58,3 +58,19 @@ ul.dropdown-menu li a{ /*----- Header Bar -----*/ /*----- Header Bar -----*/ + +/*----- Layout ------ */ + +.margin-top-20 { + margin: 20px 0 0 0; +} + +/*----- Layout ------ */ + +/*--- Reset --- */ + +select.form-control { + height: inherit !important; +} + +/*--- Reset --- */ diff --git a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb index 8cac8b64..1b4082f5 100644 --- a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb @@ -1,156 +1,121 @@ -<%= form_tag report_path, :method => :get, :id=>"frm_report" do %>