mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-14 10:43:56 -04:00
Fix item kits view + search, item bulk edit (#293)
Refactored table_helper to add first and last column automatically
This commit is contained in:
@@ -29,7 +29,7 @@ class Item_kits extends Secure_area implements iData_controller
|
||||
function index()
|
||||
{
|
||||
$data['controller_name'] = $this->get_controller_name();
|
||||
$data['table_headers'] = get_suppliers_manage_table_headers();
|
||||
$data['table_headers'] = get_item_kits_manage_table_headers();
|
||||
|
||||
$this->load->view('item_kits/manage', $data);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class Item_kits extends Secure_area implements iData_controller
|
||||
{
|
||||
// calculate the total cost and retail price of the Kit so it can be printed out in the manage table
|
||||
$item_kit = $this->add_totals_to_item_kit($item_kit);
|
||||
$data_rows = get_item_kit_data_row($item_kits, $this);
|
||||
$data_rows[] = get_item_kit_data_row($item_kit, $this);
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
|
||||
@@ -161,7 +161,7 @@ class Items extends Secure_area implements iData_controller
|
||||
$item_info->quantity = $item_quantity->quantity;
|
||||
$data_row = get_item_data_row($item_info,$this);
|
||||
|
||||
echo $data_row;
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
function view($item_id=-1)
|
||||
@@ -363,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('id'=>$item_id,
|
||||
$location_detail = array('item_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']);
|
||||
|
||||
@@ -140,7 +140,7 @@ function transform_headers($array)
|
||||
{
|
||||
return json_encode(array_map(function($v) {
|
||||
return array('field' => key($v), 'title' => current($v), 'checkbox' => (key($v) == 'checkbox'));
|
||||
}, $array));
|
||||
}, array_merge(array(array('checkbox' => 'select')), $array, array(array('edit' => '')))));
|
||||
}
|
||||
|
||||
function get_people_manage_table_headers()
|
||||
@@ -148,13 +148,11 @@ function get_people_manage_table_headers()
|
||||
$CI =& get_instance();
|
||||
|
||||
$headers = array(
|
||||
array('checkbox' => 'select'),
|
||||
array('id' => $CI->lang->line('common_id')),
|
||||
array('last_name' => $CI->lang->line('common_last_name')),
|
||||
array('first_name' => $CI->lang->line('common_first_name')),
|
||||
array('email' => $CI->lang->line('common_email')),
|
||||
array('phone_number' => $CI->lang->line('common_phone_number')),
|
||||
array('edit' => '')
|
||||
array('phone_number' => $CI->lang->line('common_phone_number'))
|
||||
);
|
||||
|
||||
return transform_headers($headers);
|
||||
@@ -201,15 +199,13 @@ function get_suppliers_manage_table_headers()
|
||||
$CI =& get_instance();
|
||||
|
||||
$headers = array(
|
||||
array('checkbox' => 'select'),
|
||||
array('id' => $CI->lang->line('common_id')),
|
||||
array('company_name' => $CI->lang->line('suppliers_company_name')),
|
||||
array('agency_name' => $CI->lang->line('suppliers_agency_name')),
|
||||
array('last_name' => $CI->lang->line('common_last_name')),
|
||||
array('first_name' => $CI->lang->line('common_first_name')),
|
||||
array('email' => $CI->lang->line('common_email')),
|
||||
array('phone_number' => $CI->lang->line('common_phone_number')),
|
||||
array('edit' => '')
|
||||
array('phone_number' => $CI->lang->line('common_phone_number'))
|
||||
);
|
||||
|
||||
return transform_headers($headers);
|
||||
@@ -239,7 +235,6 @@ function get_items_manage_table_headers()
|
||||
$CI =& get_instance();
|
||||
|
||||
$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')),
|
||||
@@ -251,8 +246,7 @@ function get_items_manage_table_headers()
|
||||
array('tax_percents' => $CI->lang->line('items_tax_percents')),
|
||||
array('item_pic' => $CI->lang->line('items_image')),
|
||||
array('inventory' => ''),
|
||||
array('stock' => ''),
|
||||
array('edit' => '')
|
||||
array('stock' => '')
|
||||
);
|
||||
|
||||
return transform_headers($headers);
|
||||
@@ -286,6 +280,7 @@ function get_item_data_row($item, $controller) {
|
||||
'item_number' => $item->item_number,
|
||||
'item_name' => character_limiter($item->name,13),
|
||||
'item_category' => character_limiter($item->category,13),
|
||||
'company_name' => character_limiter($item->company_name,20),
|
||||
'cost_price' => to_currency($item->cost_price),
|
||||
'unit_price' => to_currency($item->unit_price),
|
||||
'quantity' => to_quantity_decimals($item->quantity),
|
||||
@@ -307,13 +302,11 @@ function get_giftcards_manage_table_headers()
|
||||
$CI =& get_instance();
|
||||
|
||||
$headers = array(
|
||||
array('checkbox' => 'select'),
|
||||
array('id' => $CI->lang->line('common_id')),
|
||||
array('last_name' => $CI->lang->line('common_last_name')),
|
||||
array('first_name' => $CI->lang->line('common_first_name')),
|
||||
array('giftcard_number' => $CI->lang->line('giftcards_giftcard_number')),
|
||||
array('giftcard_value' => $CI->lang->line('giftcards_card_value')),
|
||||
array('edit' => '')
|
||||
array('giftcard_value' => $CI->lang->line('giftcards_card_value'))
|
||||
);
|
||||
|
||||
return transform_headers($headers);
|
||||
@@ -339,13 +332,11 @@ function get_item_kits_manage_table_headers()
|
||||
$CI =& get_instance();
|
||||
|
||||
$headers = array(
|
||||
array('checkbox' => 'select'),
|
||||
array('id' => $CI->lang->line('item_kits_kit')),
|
||||
array('kit_name' => $CI->lang->line('item_kits_name')),
|
||||
array('kit_description' => $CI->lang->line('item_kits_description')),
|
||||
array('cost_price' => $CI->lang->line('items_cost_price')),
|
||||
array('unit_price' => $CI->lang->line('items_unit_price')),
|
||||
array('edit' => '')
|
||||
array('unit_price' => $CI->lang->line('items_unit_price'))
|
||||
);
|
||||
|
||||
return transform_headers($headers);
|
||||
|
||||
@@ -151,7 +151,7 @@ class Item_kit extends CI_Model
|
||||
$this->db->from('item_kits');
|
||||
$this->db->like('name', $search);
|
||||
$this->db->or_like('description', $search);
|
||||
|
||||
|
||||
//KIT #
|
||||
if (stripos($search, 'KIT ') !== false)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ class Item_kit extends CI_Model
|
||||
$this->db->from('item_kits');
|
||||
$this->db->like('name', $search);
|
||||
$this->db->or_like('description', $search);
|
||||
|
||||
|
||||
//KIT #
|
||||
if (stripos($search, 'KIT ') !== false)
|
||||
{
|
||||
|
||||
@@ -6,10 +6,13 @@ $(document).ready(function()
|
||||
table_support.init('<?php echo site_url($controller_name);?>', <?php echo $table_headers; ?>);
|
||||
table_support.init_delete('<?php echo $this->lang->line($controller_name."_confirm_delete")?>');
|
||||
|
||||
$('#generate_barcodes').click(function()
|
||||
{
|
||||
$(this).attr('href','index.php/item_kits/generate_barcodes/'+selected.join(':'));
|
||||
});
|
||||
$('#generate_barcodes').click(function()
|
||||
{
|
||||
window.open(
|
||||
'index.php/items/generate_barcodes/'+table_support.selected_ids().join(':'),
|
||||
'_blank' // <- This is what makes it open in a new window.
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -177,18 +177,17 @@ $(document).ready(function()
|
||||
{
|
||||
if(!confirm_message || confirm(confirm_message))
|
||||
{
|
||||
//Get the selected ids and create hidden fields to send with ajax submit.
|
||||
var selected_item_ids=get_selected_values();
|
||||
for(k=0;k<selected_item_ids.length;k++)
|
||||
{
|
||||
$(form).append("<input type='hidden' name='item_ids[]' value='"+selected_item_ids[k]+"' />");
|
||||
}
|
||||
$('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'item_ids[]',
|
||||
value: table_support.selected_ids().join(",")
|
||||
}).appendTo(form);
|
||||
|
||||
$(form).ajaxSubmit({
|
||||
success:function(response)
|
||||
{
|
||||
dialog_support.hide();
|
||||
post_bulk_form_submit(response);
|
||||
table_support.handle_submit('<?php echo site_url('items'); ?>', response);
|
||||
},
|
||||
dataType:'json'
|
||||
});
|
||||
|
||||
@@ -36,9 +36,11 @@ $(document).ready(function()
|
||||
});
|
||||
table_support.init_delete('<?php echo $this->lang->line($controller_name."_confirm_delete")?>');
|
||||
|
||||
var resize_thumbs = function() {
|
||||
$('a.rollover').imgPreview();
|
||||
};
|
||||
var handle_submit = table_support.handle_submit;
|
||||
table_support.handle_submit = function() {
|
||||
debugger;;
|
||||
handle_submit.apply(this, arguments) && $('a.rollover').imgPreview();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -63,7 +65,7 @@ $(document).ready(function()
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<?php echo $this->lang->line("common_delete");?>
|
||||
</button>
|
||||
<button id="bulk_edit" class="btn btn-default btn-sm model-dlg modal-btn-submit" data-href='<?php echo site_url($controller_name."/bulk_edit"); ?>' title='<?php $this->lang->line('items_edit_multiple_items');?>'>
|
||||
<button id="bulk_edit" class="btn btn-default btn-sm modal-dlg modal-btn-submit" 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>
|
||||
|
||||
12
dist/opensourcepos.js
vendored
12
dist/opensourcepos.js
vendored
@@ -49414,7 +49414,7 @@ $.tablesorter.addWidget({
|
||||
|
||||
var enable_actions = function() {
|
||||
var selection_empty = selected_rows().length == 0;
|
||||
$("#toolbar button").attr('disabled', selection_empty);
|
||||
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
|
||||
};
|
||||
|
||||
var table = function() {
|
||||
@@ -49486,6 +49486,8 @@ $.tablesorter.addWidget({
|
||||
uniqueId: 'id',
|
||||
onCheck: enable_actions,
|
||||
onUncheck: enable_actions,
|
||||
onCheckAll: enable_actions,
|
||||
onUncheckAll: enable_actions,
|
||||
onLoadSuccess: load_success,
|
||||
queryParams: queryParams,
|
||||
queryParamsType: 'limit'
|
||||
@@ -49516,12 +49518,12 @@ $.tablesorter.addWidget({
|
||||
var message = response.message;
|
||||
|
||||
if (selected_ids().length > 0) {
|
||||
selected_ids().each(function(id) {
|
||||
$.each(selected_ids(), function(element, id) {
|
||||
$.get({
|
||||
url: resource + '/get_row/' + id,
|
||||
success: function (response) {
|
||||
table().updateByUniqueId({id: response.id, row: response});
|
||||
highlight_rows();s
|
||||
highlight_rows();
|
||||
set_feedback(message, 'alert alert-dismissible alert-success', false);
|
||||
},
|
||||
dataType: 'json'
|
||||
@@ -49529,7 +49531,9 @@ $.tablesorter.addWidget({
|
||||
});
|
||||
} else {
|
||||
// call hightlight function once after refresh
|
||||
load_callback = function() { highlight_rows(id); };
|
||||
load_callback = function() {
|
||||
highlight_rows(id);
|
||||
};
|
||||
refresh();
|
||||
set_feedback(message, 'alert alert-dismissible alert-success', false);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
var enable_actions = function() {
|
||||
var selection_empty = selected_rows().length == 0;
|
||||
$("#toolbar button").attr('disabled', selection_empty);
|
||||
$("#toolbar button:not(.dropdown-toggle)").attr('disabled', selection_empty);
|
||||
};
|
||||
|
||||
var table = function() {
|
||||
@@ -207,6 +207,8 @@
|
||||
uniqueId: 'id',
|
||||
onCheck: enable_actions,
|
||||
onUncheck: enable_actions,
|
||||
onCheckAll: enable_actions,
|
||||
onUncheckAll: enable_actions,
|
||||
onLoadSuccess: load_success,
|
||||
queryParams: queryParams,
|
||||
queryParamsType: 'limit'
|
||||
@@ -237,12 +239,12 @@
|
||||
var message = response.message;
|
||||
|
||||
if (selected_ids().length > 0) {
|
||||
selected_ids().each(function(id) {
|
||||
$.each(selected_ids(), function(element, id) {
|
||||
$.get({
|
||||
url: resource + '/get_row/' + id,
|
||||
success: function (response) {
|
||||
table().updateByUniqueId({id: response.id, row: response});
|
||||
highlight_rows();s
|
||||
highlight_rows();
|
||||
set_feedback(message, 'alert alert-dismissible alert-success', false);
|
||||
},
|
||||
dataType: 'json'
|
||||
@@ -250,7 +252,9 @@
|
||||
});
|
||||
} else {
|
||||
// call hightlight function once after refresh
|
||||
load_callback = function() { highlight_rows(id); };
|
||||
load_callback = function() {
|
||||
highlight_rows(id);
|
||||
};
|
||||
refresh();
|
||||
set_feedback(message, 'alert alert-dismissible alert-success', false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user