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 %>
-
-
- <% if defined? product_account %> - <%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account])%> - <% end %> - <% if defined? shift_product_account %> - <%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account]), :prompt => 'All Group'%> - <% end %> -
+
+ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
+
+ + +
+
+ + +
+
+ + + +
+
+ + +
+
+ +
+
+ <% end %> + + -
- <% if period_type != false %> - - - <% end %> +
+
+ <% if defined? promotions %> + <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %> + <% end %> + + <% if defined? menu_types %> + <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %> + <% end %> + + <% if defined? payments %> + <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> + <% end %> + + <% if defined? shift_name %> + + <% end %> + + <% if defined? cashiers %> + <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %> + <% end %> + + <% if defined? singer %> + <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %> + <% end %> + + <% if defined? bsm %> + <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %> + <% end %> + + <% if defined? guest_role %> + <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %> + <% end %> + + <% if defined? list_by_payment_type %> + <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %> + <% end %> + + <% if defined? products %> + <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %> + <% end %> + + <% if defined? items %> + <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %> + <% end %> +
+
+ + + + <% end %>
- -
-
- Export to Excel - - -
-
-
-
-
-
-
- <% if defined? show_sale_type %> - - <% end %> - - <% if defined? promotions %> - <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]) %> - <% end %> - - <% if defined? menu_types %> - <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]) %> - <% end %> - - <% if defined? payments %> - <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]) %> - <% end %> - - <% if defined? shift_name %> - - <% end %> - <% if defined? cashiers %> - <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations" %> - <% end %> - - <% if defined? singer %> - <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List" %> - <% end %> - - <% if defined? bsm %> - <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List" %> - <% end %> - - <% if defined? guest_role %> - <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List" %> - <% end %> - - <% if defined? list_by_payment_type %> - <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]) %> - <% end %> - - <% if defined? products %> - <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products" %> - <% end %> - <% if defined? items %> - <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]) %> - <% end %> -
- -
- - -
- To     - -
-
- - - <% if defined? show_monthly %> -
- -
- - - -
-
- <% end %> - -
- -
-
-<% end %>