bootstrapified and completed rework of the filters section in Sales/Takings (#116 #293)

This commit is contained in:
FrancescoUK
2016-03-30 22:13:17 +01:00
parent 68f5e73bff
commit 22e38b6f2a
8 changed files with 58 additions and 73 deletions

View File

@@ -47,15 +47,19 @@ class Sales extends Secure_area
'location_id' => $location_id,
'start_date' => $start_date_formatter->format('Y-m-d H:i:s'),
'end_date' => $end_date_formatter->format('Y-m-d H:i:s'),
'only_invoices' => $only_invoices,
'only_cash' => $only_cash,
'only_invoices' => $only_invoices,
'is_valid_receipt' => $is_valid_receipt);
$sales = $this->Sale->search($search, $filters, $lines_per_page, $limit_from)->result_array();
$payments = $this->Sale->get_payments_summary($search, $filters);
$total_rows = $this->Sale->get_found_rows($search, $filters);
$data['only_invoices'] = $only_invoices;
$data['only_cash '] = $only_cash;
// filters that will be loaded in the multiselect dropdown
$data['filters'] = array('only_cash' => $this->lang->line('sales_cash_filter'),
'only_invoices' => $this->lang->line('sales_invoice_filter'));
$data['selected'] = array( ($only_cash ? 'only_cash' : ''), ($only_invoices ? 'only_invoices' : '') );
$data['start_date'] = $start_date;
$data['end_date'] = $end_date;
$data['links'] = $this->_initialize_pagination($this->Sale, $lines_per_page, $limit_from, $total_rows, 'manage', $only_invoices);
@@ -106,9 +110,18 @@ class Sales extends Secure_area
'location_id' => $location_id,
'start_date' => $start_date_formatter->format('Y-m-d H:i:s'),
'end_date' => $end_date_formatter->format('Y-m-d H:i:s'),
'only_invoices' => $only_invoices,
'only_cash' => $only_cash,
'only_cash' => FALSE,
'only_invoices' => FALSE,
'is_valid_receipt' => $is_valid_receipt);
// check if any filter is set in the multiselect dropdown
if( $this->input->post('filters') != null )
{
foreach($this->input->post('filters') as $key)
{
$filters[$key] = TRUE;
}
}
$sales = $this->Sale->search($search, $filters, $lines_per_page, $limit_from)->result_array();
$payments = $this->Sale->get_payments_summary($search, $filters);

View File

@@ -172,10 +172,13 @@ function post_bulk_form_submit(response)
<li class="float_left"><div id="multi_filter"><?php echo form_multiselect('filters[]', $filters, '', array('id'=>'filters', 'class'=>'selectpicker show-menu-arrow', 'data-selected-text-format'=>'count > 1', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?></div></li>
<li class="float_left">
<?php echo form_input(array('name'=>'daterangepicker', 'class'=>'form-control input-sm', 'id'=>'daterangepicker')); ?>
<?php echo form_input(array('name'=>'start_date', 'type'=>'hidden', 'id'=>'start_date'));?>
<?php echo form_input(array('name'=>'end_date', 'type'=>'hidden', 'id'=>'end_date'));?>
<?php echo form_input(array('name'=>'start_date', 'type'=>'hidden', 'id'=>'start_date')); ?>
<?php echo form_input(array('name'=>'end_date', 'type'=>'hidden', 'id'=>'end_date')); ?>
</li>
<li class="float_right">
<input type="text" name="search" id="search", class="form-control input-sm"/>
<input type="hidden" name="limit_from" id="limit_from"/>
</li>
<li class="float_right"><input type="text" name="search" id="search", class="form-control input-sm"/><input type="hidden" name="limit_from" id="limit_from"/></li>
</ul>
</div>
</fieldset>

View File

@@ -63,11 +63,11 @@
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=5345485acb"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=17ddff094c"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos_bower.css"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=94597bdfba" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=6d21794406" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -18,13 +18,15 @@ $(document).ready(function()
on_complete: on_complete});
enable_delete('<?php echo $this->lang->line($controller_name."_confirm_delete"); ?>', '<?php echo $this->lang->line($controller_name."_none_selected"); ?>');
// on any input action in the search filter section trigger a do_search
$("#search_filter_section input").click(function()
{
// when any filter is clicked and the dropdown window is closed
$('#filters').on('hidden.bs.select', function(e)
{
// reset page number when selecting a specific page number
$('#limit_from').val("0");
do_search(true, on_complete);
});
do_search(true);
});
//$('#filters').selectpicker('val', [<?php echo "'" . implode("','", $selected) . "'" ?>]);
// accept partial suggestion to trigger a search on enter press
$('#search').keypress(function (e) {
@@ -78,6 +80,8 @@ $(document).ready(function()
bootcssVer: 3,
language: "<?php echo $this->config->item('language'); ?>"
}).on('changeDate', function(event) {
// reset page number when selecting a specific page number
$('#limit_from').val("0");
do_search(true, on_complete);
return false;
});
@@ -111,22 +115,6 @@ function post_bulk_form_submit(response)
set_feedback(response.message, 'alert alert-dismissible alert-success', false);
}
}
function show_hide_search_filter(search_filter_section, switchImgTag)
{
var ele = document.getElementById(search_filter_section);
var imageEle = document.getElementById(switchImgTag);
if(ele.style.display == "block")
{
ele.style.display = "none";
imageEle.innerHTML = '<img src=" <?php echo base_url(); ?>images/plus.png" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;" >';
}
else
{
ele.style.display = "block";
imageEle.innerHTML = '<img src=" <?php echo base_url(); ?>images/minus.png" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;" >';
}
}
function init_table_sorting()
{
@@ -205,31 +193,23 @@ function init_table_sorting()
<a href="javascript:printdoc();"><div class="btn btn-info btn-sm pull-right"><?php echo $this->lang->line('common_print'); ?></div></a>
</div>
<div id="titleTextImg" class="print_hide">
<div style="float:left; vertical-align:text-top;"><?php echo $this->lang->line('common_search_options') . ': '; ?></div>
<a id="imageDivLink" href="javascript:show_hide_search_filter('search_filter_section', 'imageDivLink');" style="outline:none;">
<img src="<?php echo base_url().'images/plus.png'; ?>" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;"></a>
</div>
<?php echo form_open("$controller_name/search", array('id'=>'search_form', 'class'=>'form-horizontal')); ?>
<fieldset>
<div id="search_filter_section" class="form-group print_show" style="display:none;">
<?php echo form_label($this->lang->line('sales_invoice_filter').' '.':', 'invoices_filter');?>
<?php echo form_checkbox(array('name'=>'only_invoices','id'=>'only_invoices','value'=>1,'checked'=> isset($only_invoices)? ( ($only_invoices)? 1 : 0) : 0)) . ' | ';?>
<?php echo form_label($this->lang->line('sales_cash_filter').' '.':', 'cash_filter');?>
<?php echo form_checkbox(array('name'=>'only_cash','id'=>'only_cash','value'=>1,'checked'=> isset($only_cash)? ( ($only_cash)? 1 : 0) : 0)) . ' | ';?>
<?php echo form_label($this->lang->line('sales_date_range').' :', 'start_date');?>
<?php echo form_input(array('name'=>'start_date', 'value'=>$start_date, 'class'=>'date_filter', 'size' => '22'));?>
<?php echo form_label(' - ', 'end_date');?>
<?php echo form_input(array('name'=>'end_date', 'value'=>$end_date, 'class'=>'date_filter', 'size' => '22'));?>
</div>
<div id="table_action_header" class="form-group print_hide">
<div id="table_action_header" class="form-group">
<ul>
<li class="float_left"><?php echo anchor($controller_name . "/delete", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line("common_delete") . '</span></div>', array('id'=>'delete')); ?></li>
<!-- li class="float_left"><?php echo anchor($controller_name . "/update_invoice_numbers", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line('sales_invoice_update') . '</span></div>', array('id'=>'update_invoice_numbers')); ?></li -->
<li class="float_right"><input type="text" name="search" id="search", class="form-control input-sm"/><input type="hidden" name="limit_from" id="limit_from"/></li>
<li class="float_left print_hide"><?php echo anchor($controller_name . "/delete", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line("common_delete") . '</span></div>', array('id'=>'delete')); ?></li>
<!-- li class="float_left print_hide"><?php echo anchor($controller_name . "/update_invoice_numbers", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line('sales_invoice_update') . '</span></div>', array('id'=>'update_invoice_numbers')); ?></li -->
<li class="float_left print_show"><div id="multi_filter"><?php echo form_multiselect('filters[]', $filters, '', array('id'=>'filters', 'class'=>'selectpicker show-menu-arrow', 'data-selected-text-format'=>'count > 3', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?></div></li>
<li class="float_left print_show"><?php echo form_label($this->lang->line('sales_date_range').':', 'start_date');?></li>
<li class="float_left print_show"><?php echo form_input(array('name'=>'start_date', 'value'=>$start_date, 'class'=>'date_filter form-control input-sm'));?></li>
<li class="float_left print_show"><?php echo form_label('-', 'end_date');?></li>
<li class="float_left print_show"><?php echo form_input(array('name'=>'end_date', 'value'=>$end_date, 'class'=>'date_filter form-control input-sm'));?></li>
<li class="float_right print_hide">
<input type="text" name="search" id="search", class="form-control input-sm"/>
<input type="hidden" name="limit_from" id="limit_from"/>
</li>
</ul>
</div>
</fieldset>

View File

@@ -1,19 +1,3 @@
#titleTextImg
{
margin-top: 0.5em;
background-color: transparent;
position: relative;
}
#search_filter_section
{
position: relative;
width: 100%;
padding: 0.5em;
margin-left: 0;
background-color: transparent;
}
#table_action_header
{
position: relative;
@@ -46,6 +30,11 @@
margin-left: 1em;
}
#table_action_header ul li label
{
margin-top: 0.5em;
}
#table_holder
{
position: relative;

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

@@ -63,12 +63,12 @@
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/bootstrap.min.css?rel=9ed20b1ee8"/>
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=5345485acb"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=17ddff094c"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos_bower.css"/>
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=94597bdfba" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=6d21794406" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>