mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-02-18 14:48:42 -05:00
Fix bulk update refresh (#432)
This commit is contained in:
@@ -155,15 +155,15 @@ class Items extends Secure_area implements iData_controller
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
function get_row($item_id)
|
||||
function get_row($item_ids)
|
||||
{
|
||||
$item_info = $this->Item->get_info($item_id);
|
||||
$stock_location = $this->item_lib->get_item_location();
|
||||
$item_quantity = $this->Item_quantity->get_item_quantity($item_id,$stock_location);
|
||||
$item_info->quantity = $item_quantity->quantity;
|
||||
$data_row = get_item_data_row($item_info,$this);
|
||||
|
||||
echo json_encode($data_row);
|
||||
$item_infos = $this->Item->get_multiple_info(explode(":", $item_ids), $this->item_lib->get_item_location());
|
||||
$result = array();
|
||||
foreach($item_infos->result() as $item_info)
|
||||
{
|
||||
$result[$item_info->item_id] = get_item_data_row($item_info,$this);
|
||||
}
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function view($item_id=-1)
|
||||
@@ -245,7 +245,7 @@ class Items extends Secure_area implements iData_controller
|
||||
$result = array();
|
||||
|
||||
$item_ids = explode(':', $item_ids);
|
||||
$result = $this->Item->get_multiple_info($item_ids)->result_array();
|
||||
$result = $this->Item->get_multiple_info($item_ids, $this->item_lib->get_item_location())->result_array();
|
||||
$config = $this->barcode_lib->get_barcode_config();
|
||||
|
||||
$data['barcode_config'] = $config;
|
||||
@@ -289,7 +289,7 @@ class Items extends Secure_area implements iData_controller
|
||||
''=>$this->lang->line('items_do_nothing'),
|
||||
1 =>$this->lang->line('items_change_all_to_allow_alt_desc'),
|
||||
0 =>$this->lang->line('items_change_all_to_not_allow_allow_desc'));
|
||||
|
||||
|
||||
$data['serialization_choices'] = array(
|
||||
''=>$this->lang->line('items_do_nothing'),
|
||||
1 =>$this->lang->line('items_change_all_to_serialized'),
|
||||
|
||||
@@ -53,7 +53,7 @@ class Reports extends Secure_area
|
||||
)
|
||||
);
|
||||
|
||||
echo json_encode($summary_data);
|
||||
echo json_encode(array($sale_id => $summary_data));
|
||||
}
|
||||
|
||||
function get_detailed_receivings_row($receiving_id)
|
||||
@@ -85,7 +85,7 @@ class Reports extends Secure_area
|
||||
|
||||
$summary_data[] = $report_data['comment'];
|
||||
|
||||
echo json_encode($summary_data);
|
||||
echo json_encode(array($receiving_id => $summary_data));
|
||||
}
|
||||
|
||||
function get_summary_data($start_date, $end_date=null, $sale_type=0)
|
||||
|
||||
@@ -202,12 +202,13 @@ class Item extends CI_Model
|
||||
/*
|
||||
Gets information about multiple items
|
||||
*/
|
||||
public function get_multiple_info($item_ids)
|
||||
public function get_multiple_info($item_ids, $location_id)
|
||||
{
|
||||
$this->db->from('items');
|
||||
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
|
||||
$this->db->where_in('item_id', $item_ids);
|
||||
$this->db->order_by('item_id', 'asc');
|
||||
$this->db->join('item_quantities', 'item_quantities.item_id = items.item_id', 'left');
|
||||
$this->db->where('location_id', $location_id);
|
||||
$this->db->where_in('items.item_id', $item_ids);
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
@@ -237,7 +238,7 @@ class Item extends CI_Model
|
||||
*/
|
||||
public function update_multiple($item_data, $item_ids)
|
||||
{
|
||||
$this->db->where_in('item_id', explode(',', $item_ids));
|
||||
$this->db->where_in('item_id', explode(':', $item_ids));
|
||||
|
||||
return $this->db->update('items', $item_data);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Item_taxes extends CI_Model
|
||||
|
||||
function save_multiple(&$items_taxes_data, $item_ids)
|
||||
{
|
||||
foreach(explode(",", $item_ids) as $item_id)
|
||||
foreach(explode(":", $item_ids) as $item_id)
|
||||
{
|
||||
$this->save($items_taxes_data, $item_id);
|
||||
}
|
||||
|
||||
@@ -177,15 +177,9 @@ $(document).ready(function()
|
||||
{
|
||||
if(!confirm_message || confirm(confirm_message))
|
||||
{
|
||||
/* $('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'item_ids',
|
||||
value: $(table_support.selected_ids())
|
||||
}).appendTo(form);
|
||||
*/
|
||||
$(form).ajaxSubmit({
|
||||
beforeSubmit: function(arr, $form, options) {
|
||||
arr.push({name: 'item_ids', value: table_support.selected_ids()});
|
||||
arr.push({name: 'item_ids', value: table_support.selected_ids().join(":")});
|
||||
},
|
||||
success:function(response)
|
||||
{
|
||||
|
||||
37
dist/opensourcepos.js
vendored
37
dist/opensourcepos.js
vendored
@@ -44685,7 +44685,7 @@ THE SOFTWARE.*/
|
||||
|
||||
var rows_selector = function(ids) {
|
||||
var selectors = [];
|
||||
ids = ids instanceof Array ? ids : ("" + ids).split(",");
|
||||
ids = ids instanceof Array ? ids : ("" + ids).split(":");
|
||||
$.each(ids, function(index, element) {
|
||||
selectors.push(row_selector(element));
|
||||
});
|
||||
@@ -44693,10 +44693,12 @@ THE SOFTWARE.*/
|
||||
};
|
||||
|
||||
var highlight_row = function (id, color) {
|
||||
var original = $(row_selector(id)).css('backgroundColor');
|
||||
$(row_selector(id)).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
|
||||
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
|
||||
.animate({backgroundColor: original}, "slow", "linear");
|
||||
$(rows_selector(id)).each(function(index, element) {
|
||||
var original = $(element).css('backgroundColor');
|
||||
$(element).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
|
||||
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
|
||||
.animate({backgroundColor: original}, "slow", "linear");
|
||||
});
|
||||
};
|
||||
|
||||
var do_delete = function (url, ids) {
|
||||
@@ -44811,19 +44813,18 @@ THE SOFTWARE.*/
|
||||
var message = response.message;
|
||||
var selector = rows_selector(response.id);
|
||||
if ($(selector.join(",")).length > 0) {
|
||||
$.each(selector, function (index, element) {
|
||||
var id = $(element).data('uniqueid');
|
||||
$.get({
|
||||
url: [url || resource + '/get_row', id].join("/"),
|
||||
success: function (response) {
|
||||
table().updateByUniqueId({id: id, row: response});
|
||||
// TODO make selector more specific?
|
||||
dialog_support.init("a.modal-dlg");
|
||||
enable_actions();
|
||||
highlight_row(id);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
var ids = response.id.split(":");
|
||||
$.get({
|
||||
url: [url || resource + '/get_row', id].join("/"),
|
||||
success: function (response) {
|
||||
$.each(selector, function (index, element) {
|
||||
var id = $(element).data('uniqueid');
|
||||
table().updateByUniqueId({id: id, row: response[id]});
|
||||
dialog_support.init(element + " a.modal-dlg");
|
||||
});
|
||||
highlight_row(ids);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
} else {
|
||||
// call hightlight function once after refresh
|
||||
|
||||
28
dist/opensourcepos.min.js
vendored
28
dist/opensourcepos.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -132,7 +132,7 @@
|
||||
|
||||
var rows_selector = function(ids) {
|
||||
var selectors = [];
|
||||
ids = ids instanceof Array ? ids : ("" + ids).split(",");
|
||||
ids = ids instanceof Array ? ids : ("" + ids).split(":");
|
||||
$.each(ids, function(index, element) {
|
||||
selectors.push(row_selector(element));
|
||||
});
|
||||
@@ -140,10 +140,12 @@
|
||||
};
|
||||
|
||||
var highlight_row = function (id, color) {
|
||||
var original = $(row_selector(id)).css('backgroundColor');
|
||||
$(row_selector(id)).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
|
||||
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
|
||||
.animate({backgroundColor: original}, "slow", "linear");
|
||||
$(rows_selector(id)).each(function(index, element) {
|
||||
var original = $(element).css('backgroundColor');
|
||||
$(element).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear")
|
||||
.animate({backgroundColor: color || '#e1ffdd'}, 5000)
|
||||
.animate({backgroundColor: original}, "slow", "linear");
|
||||
});
|
||||
};
|
||||
|
||||
var do_delete = function (url, ids) {
|
||||
@@ -258,19 +260,18 @@
|
||||
var message = response.message;
|
||||
var selector = rows_selector(response.id);
|
||||
if ($(selector.join(",")).length > 0) {
|
||||
$.each(selector, function (index, element) {
|
||||
var id = $(element).data('uniqueid');
|
||||
$.get({
|
||||
url: [url || resource + '/get_row', id].join("/"),
|
||||
success: function (response) {
|
||||
table().updateByUniqueId({id: id, row: response});
|
||||
// TODO make selector more specific?
|
||||
dialog_support.init("a.modal-dlg");
|
||||
enable_actions();
|
||||
highlight_row(id);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
var ids = response.id.split(":");
|
||||
$.get({
|
||||
url: [url || resource + '/get_row', id].join("/"),
|
||||
success: function (response) {
|
||||
$.each(selector, function (index, element) {
|
||||
var id = $(element).data('uniqueid');
|
||||
table().updateByUniqueId({id: id, row: response[id]});
|
||||
dialog_support.init(element + " a.modal-dlg");
|
||||
});
|
||||
highlight_row(ids);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
} else {
|
||||
// call hightlight function once after refresh
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<!-- 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=1ebdfe86c6" language="javascript"></script>
|
||||
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=e17a7ef312" language="javascript"></script>
|
||||
<!-- end minjs template tags -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user