2017-12-16 13:32:58 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-07-05 00:03:33 -06:00
|
|
|
var itemtable = $('#itemtable').DataTable({
|
2017-05-17 23:09:51 -06:00
|
|
|
responsive: {
|
2017-12-26 17:53:04 -07:00
|
|
|
details: {
|
|
|
|
display: $.fn.dataTable.Responsive.display.modal({
|
|
|
|
header: function (row) {
|
|
|
|
var data = row.data();
|
2018-04-16 17:07:18 -06:00
|
|
|
return "<i class=\"fas fa-box fa-fw\"></i> " + data[2];
|
2017-12-26 17:53:04 -07:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
|
|
|
tableClass: 'table'
|
|
|
|
}),
|
|
|
|
type: "column"
|
|
|
|
}
|
2017-05-17 23:09:51 -06:00
|
|
|
},
|
|
|
|
columnDefs: [
|
2017-12-26 17:53:04 -07:00
|
|
|
{
|
|
|
|
targets: 0,
|
|
|
|
className: 'control',
|
|
|
|
orderable: false
|
|
|
|
},
|
|
|
|
{
|
2020-02-18 13:38:48 +02:00
|
|
|
targets: 8,
|
2017-12-26 17:53:04 -07:00
|
|
|
orderable: false
|
|
|
|
},
|
|
|
|
{
|
2020-02-18 13:38:48 +02:00
|
|
|
targets: 9,
|
2017-12-26 17:53:04 -07:00
|
|
|
orderable: false
|
|
|
|
}
|
2017-05-17 23:09:51 -06:00
|
|
|
],
|
|
|
|
order: [
|
2020-02-18 13:38:48 +02:00
|
|
|
[1, 'asc']
|
2017-05-17 23:09:51 -06:00
|
|
|
],
|
2017-05-27 20:02:27 -06:00
|
|
|
serverSide: true,
|
|
|
|
ajax: {
|
2017-12-26 17:53:04 -07:00
|
|
|
url: "lib/getitemtable.php",
|
|
|
|
data: function (d) {
|
|
|
|
if (filter == "stock") {
|
|
|
|
d.show_want = 1;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dataFilter: function (data) {
|
|
|
|
var json = jQuery.parseJSON(data);
|
|
|
|
json.data = [];
|
|
|
|
json.items.forEach(function (row) {
|
|
|
|
json.data.push([
|
|
|
|
"",
|
|
|
|
row.name,
|
|
|
|
row.catname,
|
|
|
|
row.locname + " (" + row.loccode + ")",
|
|
|
|
row.code1,
|
|
|
|
row.code2,
|
|
|
|
row.qty,
|
|
|
|
row.want,
|
2020-02-18 13:38:48 +02:00
|
|
|
row.username,
|
|
|
|
"<span class='btn-group btn-group-sm'>" + row.viewbtn + " " + row.editbtn + " " + row.addstockbtn + " " + row.removestockbtn + "</span>"
|
2017-12-26 17:53:04 -07:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
return JSON.stringify(json);
|
|
|
|
}
|
2017-05-27 20:02:27 -06:00
|
|
|
}
|
2017-07-05 00:03:33 -06:00
|
|
|
});
|
|
|
|
|
2018-01-29 00:43:11 -07:00
|
|
|
$('#itemtable_filter').append("<span class=\"btn btn-default btn-sm mobile-app-show mobile-app-display\" onclick=\"scancode('#itemtable_filter label input');\"><i class=\"fas fa-barcode fa-fw\"></i></span>");
|
2017-12-09 02:10:45 -07:00
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
if (search_preload_content !== false) {
|
2017-12-26 17:53:04 -07:00
|
|
|
var searchInput = $("#itemtable_filter label input");
|
|
|
|
$(searchInput).val(search_preload_content);
|
|
|
|
$(searchInput).trigger("input");
|
|
|
|
$(searchInput).trigger("change");
|
2017-12-09 02:10:45 -07:00
|
|
|
}
|
2020-02-18 11:03:20 +02:00
|
|
|
});
|