Edit filter

This commit is contained in:
San Wai Lwin
2018-08-06 13:52:47 +06:30
parent af6aae5cb6
commit 10d93a658c
6 changed files with 40 additions and 62 deletions

View File

@@ -134,37 +134,30 @@
</div>
<script type="text/javascript">
var item = $('#item').val();
var payment_type = $('#payment_type');
var status_type = $('#status_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
if(status_type){
$('#status_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
$(function(){
$('#sale_id').val("<%= params[:sale_id] %>");
$('#receipt_no').val("<%= params[:receipt_no] %>");
$('#from').val("<%= params[:from] %>");
$('#to').val("<%= params[:to] %>");
$('#payment_type').val("<%= params[:payment_type] %>");
$('#status_type').val("<%= params[:status_type] %>");
$('#status_type').val("<%= params[:status_type] %>");
$('#sale_id').val("<%= params[:sale_id] %>");
$('#sel_period').val("<%= params[:period] %>");
var check_arr = [];
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 = "";
show_shift_name(period,period_type,from,to,'shift_item');
}
// OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
@@ -182,7 +175,7 @@
search_by_date();
});
function search_by_date(){
function search_by_date(){
from = $("#from").val();
to = $("#to").val();
@@ -202,9 +195,10 @@
if(check_arr.length == 3){
check_arr = [];
}
}
}
}
function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name');
if (from == '' && to == '') {
@@ -246,13 +240,4 @@
}
});
});
</script>
</script>