Enable bootstrap-tables for items modules - wip (#293)

This commit is contained in:
jekkos
2016-04-20 08:49:20 +02:00
parent 46ad34548f
commit bb95a120b1
15 changed files with 149 additions and 319 deletions

View File

@@ -23,13 +23,10 @@ class Customers extends Person_controller
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$customers = $this->Customer->search($search, $lines_per_page, $offset);
$customers = $this->Customer->search($search, $limit, $offset);
$total_rows = $this->Customer->get_found_rows($search);
// updat pagination manually??
$links = $this->_initialize_pagination($this->Customer,$lines_per_page, $limit, $total_rows);
$data_rows = array();
foreach($customers->result() as $person)
{

View File

@@ -23,11 +23,9 @@ class Employees extends Person_controller
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$employees = $this->Employee->search($search, $offset, $limit);
$total_rows = $this->Employee->get_found_rows($search);
$links = $this->_initialize_pagination($this->Employee, $lines_per_page, $limit, $total_rows);
$data_rows = array();
foreach($employees->result() as $person)
{

View File

@@ -26,12 +26,10 @@ class Giftcards extends Secure_area implements iData_controller
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$giftcards = $this->Giftcard->search($search, $offset, $limit);
$total_rows = $this->Giftcard->get_found_rows($search);
$links = $this->_initialize_pagination($this->Giftcard, $lines_per_page, $limit, $total_rows);
$data_rows = array();
foreach($giftcards->result() as $giftcard)
{

View File

@@ -10,27 +10,24 @@ class Items extends Secure_area implements iData_controller
$this->load->library('item_lib');
}
function index($limit_from=0)
function index()
{
$stock_location = $this->item_lib->get_item_location();
$stock_locations = $this->Stock_location->get_allowed_locations();
$data['controller_name'] = $this->get_controller_name();
$lines_per_page = $this->Appconfig->get('lines_per_page');
$items = $this->Item->get_all($stock_location, $lines_per_page, $limit_from);
$data['links'] = $this->_initialize_pagination($this->Item, $lines_per_page, $limit_from);
// filters that will be loaded in the multiselect dropdown
$data['filters'] = array('empty_upc' => $this->lang->line('items_empty_upc_items'),
'low_inventory' => $this->lang->line('items_low_inventory_items'),
'is_serialized' => $this->lang->line('items_serialized_items'),
'no_description' => $this->lang->line('items_no_description_items'),
'search_custom' => $this->lang->line('items_search_custom_items'),
'is_deleted' => $this->lang->line('items_is_deleted'));
'low_inventory' => $this->lang->line('items_low_inventory_items'),
'is_serialized' => $this->lang->line('items_serialized_items'),
'no_description' => $this->lang->line('items_no_description_items'),
'search_custom' => $this->lang->line('items_search_custom_items'),
'is_deleted' => $this->lang->line('items_is_deleted'));
$data['stock_location'] = $stock_location;
$data['stock_locations'] = $stock_locations;
$data['manage_table'] = get_items_manage_table( $this->Item->get_all($stock_location, $lines_per_page, $limit_from), $this );
$data['table_headers'] = get_items_manage_table_headers();
$this->load->view('items/manage', $data);
}
@@ -40,13 +37,14 @@ class Items extends Secure_area implements iData_controller
*/
function search()
{
$search = $this->input->post('search') != '' ? $this->input->post('search') : null;
$limit_from = $this->input->post('limit_from');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$this->item_lib->set_item_location($this->input->post('stock_location'));
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$filters = array('start_date' => $this->input->post('start_date'),
'end_date' => $this->input->post('end_date'),
$this->item_lib->set_item_location($this->input->get('stock_location'));
$filters = array('start_date' => $this->input->get('start_date'),
'end_date' => $this->input->get('end_date'),
'stock_location_id' => $this->item_lib->get_item_location(),
'empty_upc' => FALSE,
'low_inventory' => FALSE,
@@ -56,21 +54,17 @@ class Items extends Secure_area implements iData_controller
'is_deleted' => FALSE);
// 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;
}
}
$items = $this->Item->search($search, $filters, $lines_per_page, $limit_from);
$data_rows = get_items_manage_table_data_rows($items, $this);
$total_rows = $this->Item->get_found_rows($search, $filters);
$links = $this->_initialize_pagination($this->Item, $lines_per_page, $limit_from, $total_rows, 'search');
$data_rows = get_items_manage_table_data_rows($items, $this);
$filters = array_merge($filters, $this->input->get('filters'));
echo json_encode(array('total_rows' => $total_rows, 'rows' => $data_rows, 'pagination' => $links));
$items = $this->Item->search($search, $filters, $offset, $limit);
$total_rows = $this->Item->get_found_rows($search, $filters);
$data_rows = array();
foreach($items->result() as $item)
{
$data_rows[] = get_item_data_row($item, $this);
}
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
}
function pic_thumb($pic_id)
@@ -369,7 +363,7 @@ class Items extends Secure_area implements iData_controller
foreach($stock_locations as $location_data)
{
$updated_quantity = $this->input->post('quantity_' . $location_data['location_id']);
$location_detail = array('item_id'=>$item_id,
$location_detail = array('id'=>$item_id,
'location_id'=>$location_data['location_id'],
'quantity'=>$updated_quantity);
$item_quantity = $this->Item_quantity->get_item_quantity($item_id, $location_data['location_id']);
@@ -393,7 +387,7 @@ class Items extends Secure_area implements iData_controller
{
$success_message = $this->lang->line('items_successful_' . ($new_item ? 'adding' : 'updating')) .' '. $item_data['name'];
echo json_encode(array('success'=>true, 'message'=>$success_message, 'item_id'=>$item_id));
echo json_encode(array('success'=>true, 'message'=>$success_message, 'id'=>$item_id));
}
else
{
@@ -401,7 +395,7 @@ class Items extends Secure_area implements iData_controller
$this->lang->line('items_error_adding_updating') .' '. $item_data['name'] :
$this->upload->display_errors();
echo json_encode(array('success'=>false, 'message'=>$error_message, 'item_id'=>$item_id));
echo json_encode(array('success'=>false, 'message'=>$error_message, 'id'=>$item_id));
}
}
else//failure

View File

@@ -23,11 +23,9 @@ class Suppliers extends Person_controller
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$lines_per_page = $this->Appconfig->get('lines_per_page');
$suppliers = $this->Supplier->search($search, $offset, $limit);
$total_rows = $this->Supplier->get_found_rows($search);
$links = $this->_initialize_pagination($this->Employee, $lines_per_page, $limit, $total_rows);
$data_rows = array();
foreach($suppliers->result() as $supplier)
{

View File

@@ -234,64 +234,32 @@ function get_supplier_data_row($supplier, $controller) {
));
}
/*
Gets the html table to manage items.
*/
function get_items_manage_table($items,$controller)
function get_items_manage_table_headers()
{
$CI =& get_instance();
$table='<table class="tablesorter table table-striped table-hover" id="sortable_table">';
$headers = array('<input type="checkbox" id="select_all" />',
$CI->lang->line('items_item_number'),
$CI->lang->line('items_name'),
$CI->lang->line('items_category'),
$CI->lang->line('suppliers_company_name'),
$CI->lang->line('items_cost_price'),
$CI->lang->line('items_unit_price'),
$CI->lang->line('items_quantity'),
$CI->lang->line('items_tax_percents'),
$CI->lang->line('items_image'),
'&nbsp;',
'&nbsp;',
'&nbsp;'
$headers = array(
array('checkbox' => 'select'),
array('id' => $CI->lang->line('common_id')),
array('item_number' => $CI->lang->line('items_item_number')),
array('item_name' => $CI->lang->line('items_name')),
array('item_category' => $CI->lang->line('items_category')),
array('company_name' => $CI->lang->line('suppliers_company_name')),
array('cost_price' => $CI->lang->line('items_cost_price')),
array('unit_price' => $CI->lang->line('items_unit_price')),
array('quantity' => $CI->lang->line('items_quantity')),
array('tax_percents' => $CI->lang->line('items_tax_percents')),
array('item_pic' => $CI->lang->line('items_image')),
array('inventory' => ''),
array('stock' => ''),
array('edit' => '')
);
$table.='<thead><tr>';
foreach($headers as $header)
{
$table.="<th>$header</th>";
}
$table.='</tr></thead><tbody>';
$table.=get_items_manage_table_data_rows($items,$controller);
$table.='</tbody></table>';
return $table;
return transform_headers($headers);
}
/*
Gets the html data rows for the items.
*/
function get_items_manage_table_data_rows($items,$controller)
{
$CI =& get_instance();
$table_data_rows='';
foreach($items->result() as $item)
{
$table_data_rows.=get_item_data_row($item,$controller);
}
if($items->num_rows()==0)
{
$table_data_rows.="<tr><td colspan='13'><div class='alert alert-dismissible alert-info'>".$CI->lang->line('items_no_items_to_display')."</div></td></tr>";
}
return $table_data_rows;
}
function get_item_data_row($item, $controller) {
function get_item_data_row($item,$controller)
{
$CI =& get_instance();
$item_tax_info=$CI->Item_taxes->get_info($item->item_id);
$tax_percents = '';
@@ -303,34 +271,35 @@ function get_item_data_row($item,$controller)
$tax_percents=substr($tax_percents, 0, -2);
$controller_name=strtolower(get_class($CI));
$item_quantity='';
$table_data_row='<tr>';
$table_data_row.="<td width='2%'><input type='checkbox' id='item_$item->item_id' value='".$item->item_id."'/></td>";
$table_data_row.='<td width="10%">'.$item->item_number.'</td>';
$table_data_row.='<td width="15%">'.$item->name.'</td>';
$table_data_row.='<td width="10%">'.$item->category.'</td>';
$table_data_row.='<td width="10%">'.$item->company_name.'</td>';
$table_data_row.='<td width="10%">'.to_currency($item->cost_price).'</td>';
$table_data_row.='<td width="10%">'.to_currency($item->unit_price).'</td>';
$table_data_row.='<td width="8%">'.to_quantity_decimals($item->quantity).'</td>';
$table_data_row.='<td width="8%">'.$tax_percents.'</td>';
$image = '';
if (!empty($item->pic_id))
{
$images = glob("uploads/item_pics/" . $item->pic_id . ".*");
if (sizeof($images) > 0)
{
$image.='<a class="rollover" href="'. base_url($images[0]) .'"><img src="'.site_url('items/pic_thumb/'.$item->pic_id).'"></a>';
$image .= '<a class="rollover" href="'. base_url($images[0]) .'"><img src="'.site_url('items/pic_thumb/'.$item->pic_id).'"></a>';
}
}
$table_data_row.='<td align="center" width="8%">' . $image . '</td>';
$table_data_row.='<td width="3%">'.anchor($controller_name."/view/$item->item_id", '<span class="glyphicon glyphicon-edit"></span>', array('class'=>"modal-dlg modal-btn-new modal-btn-submit",'title'=>$CI->lang->line($controller_name.'_update'))).'</td>';
$table_data_row.='<td width="3%">'.anchor($controller_name."/inventory/$item->item_id", '<span class="glyphicon glyphicon-pushpin"></span>', array('class'=>"modal-dlg modal-btn-submit",'title'=>$CI->lang->line($controller_name.'_count'))).'</td>';//inventory count
$table_data_row.='<td width="3%">'.anchor($controller_name."/count_details/$item->item_id", '<span class="glyphicon glyphicon-list-alt"></span>', array('class'=>"modal-dlg",'title'=>$CI->lang->line($controller_name.'_details_count'))).'</td>';//inventory details
$table_data_row.='</tr>';
return $table_data_row;
return array (
'id' => $item->item_id,
'item_number' => $item->item_number,
'item_name' => character_limiter($item->name,13),
'item_category' => character_limiter($item->category,13),
'cost_price' => to_currency($item->cost_price),
'unit_price' => to_currency($item->unit_price),
'quantity' => to_quantity_decimals($item->quantity),
'tax_percents' => $tax_percents,
'item_pic' => $image,
'inventory' => anchor($controller_name."/inventory/$item->person_id", '<span class="glyphicon glyphicon-pushpin"></span>',
array('class' => "modal-dlg modal-btn-submit", 'title' => $CI->lang->line($controller_name.'_count'))
),
'stock' => anchor($controller_name."/count_details/$item->person_id", '<span class="glyphicon glyphicon-list-alt"></span>',
array('class' => "modal-dlg modal-btn-submit", 'title' => $CI->lang->line($controller_name.'_details_count'))
),
'edit' => anchor($controller_name."/view/$item->person_id", '<span class="glyphicon glyphicon-edit"></span>',
array('class' => "modal-dlg modal-btn-submit", 'title' => $CI->lang->line($controller_name.'_update'))
));
}
function get_giftcards_manage_table_headers()

View File

@@ -26,24 +26,6 @@ class Giftcard extends CI_Model
return $this->db->count_all('giftcards');
}
/*
Returns all the giftcards
*/
function get_all($rows=0, $limit_from=0)
{
$this->db->from('giftcards');
$this->db->join('people', 'people.person_id=giftcards.person_id', 'left');
$this->db->where('deleted', 0);
$this->db->order_by('giftcard_number');
if ($rows > 0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
function count_all()
{
$this->db->from('giftcards');

View File

@@ -118,33 +118,6 @@ class Item extends CI_Model
return $this->db->get();
}
/*
Returns all the items
*/
public function get_all($stock_location_id=-1, $rows=0, $limit_from=0)
{
$this->db->from('items');
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
if ($stock_location_id > -1)
{
$this->db->join('item_quantities', 'item_quantities.item_id=items.item_id');
$this->db->where('location_id', $stock_location_id);
}
$this->db->where('items.deleted', 0);
// order by name of item
$this->db->order_by('items.name', 'asc');
if ($rows > 0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
/*
Gets information about a particular item
*/

View File

@@ -11,22 +11,6 @@ class Item_kit extends CI_Model
return ($this->db->get()->num_rows()==1);
}
/*
Returns all the item kits
*/
function get_all($rows=0, $limit_from=0)
{
$this->db->from('item_kits');
$this->db->order_by('name', 'asc');
if ($rows > 0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
function get_total_rows()
{

View File

@@ -346,7 +346,7 @@
{
dialog_support.hide();
}
post_item_form_submit(response, stay_open);
table_support.handle_submit(response, stay_open);
},
dataType: 'json'
});

View File

@@ -31,7 +31,7 @@ $(document).ready(function()
success:function(response)
{
dialog_support.hide();
post_item_form_submit(response);
table_support.handle_submit(response);
},
dataType:'json'
});

View File

@@ -104,7 +104,7 @@ $(document).ready(function()
success:function(response)
{
dialog_support.hide();
post_item_form_submit(response);
table_support.handle_submit('<?php echo site_url('items'); ?>', response);
},
dataType:'json'
});

View File

@@ -3,12 +3,7 @@
<script type="text/javascript">
$(document).ready(function()
{
init_table_sorting();
enable_select_all();
enable_checkboxes();
enable_row_selection();
enable_search({suggest_url: "<?php echo site_url("$controller_name/suggest_search")?>",
/*enable_search({suggest_url: '<?php echo site_url("$controller_name/suggest_search")?>',
confirm_search_message: "<?php echo $this->lang->line("common_confirm_search")?>",
extra_params: {
'is_deleted' : function () {
@@ -16,59 +11,38 @@ $(document).ready(function()
return $("#multi_filter li.selected").attr("data-original-index") == $("#filters option[value='is_deleted']").index() ? 1 : 0;
}
}
});
enable_delete("<?php echo $this->lang->line($controller_name."_confirm_delete")?>","<?php echo $this->lang->line($controller_name."_none_selected")?>");
enable_bulk_edit("<?php echo $this->lang->line($controller_name."_none_selected")?>");
});*/
$('#generate_barcodes').click(function()
{
var selected = get_selected_values();
if (selected.length == 0)
{
alert("<?php echo $this->lang->line("items_must_select_item_for_barcode"); ?>");
return false;
}
$(this).attr('href','index.php/items/generate_barcodes/'+selected.join(':'));
});
// 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);
});
// accept partial suggestion to trigger a search on enter press
$('#search').keypress(function (e) {
if (e.which == 13) {
$('#search_form').submit();
}
table_support.refresh();
});
// load the preset datarange picker
<?php $this->load->view('partial/daterangepicker'); ?>
// set the beginning of time as starting date
$('#daterangepicker').data('daterangepicker').setStartDate("<?php echo date($this->config->item('dateformat'), mktime(0,0,0,01,01,2010));?>");
start_date = "<?php echo date('Y-m-d', mktime(0,0,0,01,01,2010));?>";
// set default dates in the hidden inputs
$("#start_date").val(start_date);
$("#end_date").val(end_date);
// set the beginning of time as starting date
$('#daterangepicker').data('daterangepicker').setStartDate("<?php echo date($this->config->item('dateformat'), mktime(0,0,0,01,01,2010));?>");
// update the hidden inputs with the selected dates before submitting the search data
var start_date = "<?php echo date('Y-m-d', mktime(0,0,0,01,01,2010));?>";
$("#daterangepicker").on('apply.daterangepicker', function(ev, picker) {
$("#start_date").val(start_date);
$("#end_date").val(end_date);
// reset page number when selecting a specific page number
$('#limit_from').val("0");
do_search(true);
table_support.refresh();
});
table_support.init('<?php echo site_url($controller_name);?>', <?php echo $table_headers; ?>, function() {
return $.extend(arguments[0], {
start_date: start_date,
end_date: end_date,
filters: $("#filters").val() || []
});
});
table_support.init_delete('<?php echo $this->lang->line($controller_name."_confirm_delete")?>');
resize_thumbs();
});
@@ -77,53 +51,6 @@ function resize_thumbs()
$('a.rollover').imgPreview();
}
function init_table_sorting()
{
//Only init if there is more than one row
if($('.tablesorter tbody tr').length >1)
{
$("#sortable_table").tablesorter(
{
sortList: [[1,0]],
headers:
{
0: { sorter: 'false'},
8: { sorter: 'false'},
9: { sorter: 'false'},
10: { sorter: 'false'},
11: { sorter: 'false'},
12: { sorter: 'false'}
}
});
}
}
function post_item_form_submit(response)
{
if(!response.success)
{
set_feedback(response.message, 'alert alert-dismissible alert-danger', true);
}
else
{
//This is an update, just update one row
if(jQuery.inArray(response.item_id,get_visible_checkbox_ids()) != -1)
{
update_row(response.item_id,'<?php echo site_url("$controller_name/get_row")?>',resize_thumbs);
set_feedback(response.message, 'alert alert-dismissible alert-success', false);
}
else //refresh entire table
{
do_search(true, function()
{
//highlight new row
hightlight_row(response.item_id);
set_feedback(response.message, 'alert alert-dismissible alert-success', false);
});
}
}
}
function post_bulk_form_submit(response)
{
if(!response.success)
@@ -142,51 +69,49 @@ function post_bulk_form_submit(response)
}
</script>
<div id="title_bar">
<div id="pagination" class="pull-left"><?php echo $links; ?></div>
<div id="title_bar" class="btn-toolbar">
<?php echo anchor("$controller_name/excel_import",
"<div class='btn btn-info btn-sm pull-right'><span>" . $this->lang->line('common_import_excel') . "</span></div>",
array('class'=>'modal-dlg modal-btn-submit none', 'title'=>$this->lang->line('items_import_items_excel'))); ?>
<button class='btn btn-info btn-sm pull-right modal-dlg modal-btn-submit' data-href='<?php echo site_url($controller_name."/excel_import"); ?>'
title='<?php echo $this->lang->line('customers_import_items_excel'); ?>'>
<span class="glyphicon glyphicon-import"></span><?php echo $this->lang->line('common_import_excel'); ?>
</button>
<button class='btn btn-info btn-sm pull-right modal-dlg modal-btn-submit' data-href='<?php echo site_url($controller_name."/view"); ?>'
title='<?php echo $this->lang->line($controller_name . '_new'); ?>'>
<span class="glyphicon glyphicon-tag"></span><?php echo $this->lang->line($controller_name. '_new'); ?>
</button>
<?php echo anchor("$controller_name/view/-1",
"<div class='btn btn-info btn-sm pull-right' style='margin-right: 10px;'><span>" . $this->lang->line($controller_name . '_new') . "</span></div>",
array('class'=>'modal-dlg modal-btn-new modal-btn-submit', 'title'=>$this->lang->line($controller_name . '_new'))); ?>
</div>
<?php echo form_open("$controller_name/search", array('id'=>'search_form', 'class'=>'form-horizontal')); ?>
<fieldset>
<div id="table_action_header" class="form-group">
<ul>
<li class="pull-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="pull-left"><?php echo anchor("$controller_name/bulk_edit", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line("items_bulk_edit") . '</span></div>', array('id'=>'bulk_edit', 'class'=>'modal-dlg modal-btn-submit', 'title'=>$this->lang->line('items_edit_multiple_items'))); ?></li>
<li class="pull-left"><?php echo anchor("$controller_name/generate_barcodes", '<div class="btn btn-default btn-sm"><span>' . $this->lang->line("items_generate_barcodes") . '</span></div>', array('id'=>'generate_barcodes', 'target' =>'_blank', 'title'=>$this->lang->line('items_generate_barcodes'))); ?></li>
<div id="toolbar">
<div class="pull-left btn-toolbar" role="toolbar">
<button id="delete" class="btn btn-default btn-sm" data-href='<?php echo site_url($controller_name."/delete"); ?>'>
<span class="glyphicon glyphicon-trash"></span>
<?php echo $this->lang->line("common_delete");?></button>
<button id="bulk_edit" class="btn btn-default btn-sm" data-href='<?php echo site_url($controller_name."/bulk_edit"); ?>' title='<?php $this->lang->line('items_edit_multiple_items');?>'>
<span class="glyphicon glyphicon-edit"></span>
<?php echo $this->lang->line("items_bulk_edit"); ?></button>
<button id="generate_barcodes" class="btn btn-default btn-sm" data-href='<?php echo site_url($controller_name."/generate_barcodes"); ?>' title='<?php echo $this->lang->line('items_generate_barcodes');?>'>
<span class="glyphicon glyphicon-barcode"></span>
<?php echo $this->lang->line("items_generate_barcodes");?></button>
</div>
<div class="pull-right btn-toolbar">
<div>
<?php echo form_input(array('name'=>'daterangepicker', 'class'=>'form-control input-sm', 'id'=>'daterangepicker')); ?>
</div>
<li class="pull-right">
<?php echo form_input(array('name'=>'search', 'class'=>'form-control input-sm', 'id'=>'search')); ?>
<?php echo form_input(array('name'=>'limit_from', 'type'=>'hidden', 'id'=>'limit_from')); ?>
</li>
<li class="pull-right">
<?php echo form_input(array('name'=>'daterangepicker', 'class'=>'form-control input-sm pull-right', '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')); ?>
</li>
<li class="pull-right"><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>
<?php
if (count($stock_locations) > 1)
{
?>
<li class="pull-right"><?php echo form_dropdown('stock_location', $stock_locations, $stock_location, array('id'=>'stock_location', 'onchange'=>"$('#search_form').submit();", 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit')); ?></li>
<?php
}
?>
</ul>
</div>
</fieldset>
<?php echo form_close(); ?>
<?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')); ?>
<?php
if (count($stock_locations) > 1)
{
echo form_dropdown('stock_location', $stock_locations, $stock_location, array('id'=>'stock_location', 'class'=>'selectpicker show-menu-arrow', 'data-style'=>'btn-default btn-sm', 'data-width'=>'fit'));
}
?>
</div>
</div>
<div id="table_holder">
<?php echo $manage_table; ?>
<table id="table"></table>
</div>
<?php $this->load->view("partial/footer"); ?>

20
dist/opensourcepos.js vendored
View File

@@ -49474,7 +49474,7 @@ $.tablesorter.addWidget({
var enable_actions = function() {
var selection_empty = selected_rows().length == 0;
$("#delete, #generate_barcodes").attr('disabled', selection_empty);
$("#toolbar .btn-toolbar button").attr('disabled', selection_empty);
var email_disabled = $("tr.selected a[href^='mailto:']").length == 0;
$("#email").attr('disabled', email_disabled);
};
@@ -49487,7 +49487,7 @@ $.tablesorter.addWidget({
dialog_support.init("a.modal-dlg, button.modal-dlg");
};
var init = function (resource, headers) {
var init = function (resource, headers, queryParams) {
$('#table').bootstrapTable({
columns: headers,
url: resource + '/search',
@@ -49501,7 +49501,9 @@ $.tablesorter.addWidget({
uniqueId: 'id',
onCheck: enable_actions,
onUncheck: enable_actions,
onLoadSuccess: load_success
onLoadSuccess: load_success,
queryParams: queryParams,
queryParamsType: 'limit'
});
init_email();
enable_actions();
@@ -49517,8 +49519,11 @@ $.tablesorter.addWidget({
});
};
var refresh = function() {
table().refresh();
}
var handle_submit = function (resource, response) {
var $table = $("#table").data('bootstrap.table');
var id = response.id;
if (!response.success) {
@@ -49530,7 +49535,7 @@ $.tablesorter.addWidget({
$.get({
url: resource + '/get_row/' + id,
success: function (response) {
$table.updateByUniqueId({id: response.id, row: response});
table().updateByUniqueId({id: response.id, row: response});
highlight_rows();
set_feedback(message, 'alert alert-dismissible alert-success', false);
},
@@ -49539,7 +49544,7 @@ $.tablesorter.addWidget({
} else {
// call hightlight function once after refresh
load_callback = function() { highlight_rows(id); };
$table.refresh();
refresh();
set_feedback(message, 'alert alert-dismissible alert-success', false);
}
}
@@ -49549,7 +49554,8 @@ $.tablesorter.addWidget({
handle_submit: handle_submit,
init_delete: init_delete,
init: init,
init_email: init_email
init_email: init_email,
refresh : refresh
});
})(window.table_support = window.table_support || {}, jQuery);;(function($) {

View File

@@ -195,7 +195,7 @@
var enable_actions = function() {
var selection_empty = selected_rows().length == 0;
$("#delete, #generate_barcodes").attr('disabled', selection_empty);
$("#toolbar .btn-toolbar button").attr('disabled', selection_empty);
var email_disabled = $("tr.selected a[href^='mailto:']").length == 0;
$("#email").attr('disabled', email_disabled);
};
@@ -208,7 +208,7 @@
dialog_support.init("a.modal-dlg, button.modal-dlg");
};
var init = function (resource, headers) {
var init = function (resource, headers, queryParams) {
$('#table').bootstrapTable({
columns: headers,
url: resource + '/search',
@@ -222,7 +222,9 @@
uniqueId: 'id',
onCheck: enable_actions,
onUncheck: enable_actions,
onLoadSuccess: load_success
onLoadSuccess: load_success,
queryParams: queryParams,
queryParamsType: 'limit'
});
init_email();
enable_actions();
@@ -238,8 +240,11 @@
});
};
var refresh = function() {
table().refresh();
}
var handle_submit = function (resource, response) {
var $table = $("#table").data('bootstrap.table');
var id = response.id;
if (!response.success) {
@@ -251,7 +256,7 @@
$.get({
url: resource + '/get_row/' + id,
success: function (response) {
$table.updateByUniqueId({id: response.id, row: response});
table().updateByUniqueId({id: response.id, row: response});
highlight_rows();
set_feedback(message, 'alert alert-dismissible alert-success', false);
},
@@ -260,7 +265,7 @@
} else {
// call hightlight function once after refresh
load_callback = function() { highlight_rows(id); };
$table.refresh();
refresh();
set_feedback(message, 'alert alert-dismissible alert-success', false);
}
}
@@ -270,7 +275,8 @@
handle_submit: handle_submit,
init_delete: init_delete,
init: init,
init_email: init_email
init_email: init_email,
refresh : refresh
});
})(window.table_support = window.table_support || {}, jQuery);