diff --git a/pages/items.php b/pages/items.php
index a99994c..28ff6f8 100644
--- a/pages/items.php
+++ b/pages/items.php
@@ -9,9 +9,10 @@ redirectifnotloggedin();
-
-
-">var filter = "stock";
+
+ var filter = null;\n";
}
?>
@@ -31,50 +32,6 @@ redirectifnotloggedin();
- select('items', [
- '[>]categories' => ['catid' => 'catid'],
- '[>]locations' => ['locid' => 'locid']
- ], [
- 'itemid',
- 'name',
- 'catname',
- 'locname',
- 'loccode',
- 'code1',
- 'code2',
- 'qty',
- 'want',
- 'userid'
- ], ["LIMIT" => 100]);
- $usercache = [];
- foreach ($items as $item) {
- if (is_null($item['userid'])) {
- $user = "";
- } else {
- if (!isset($usercache[$item['userid']])) {
- $usercache[$item['userid']] = getUserByID($item['userid']);
- }
- $user = $usercache[$item['userid']]['name'];
- }
- ?>
-
- |
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
@@ -90,4 +47,17 @@ redirectifnotloggedin();
|
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/static/js/items.js b/static/js/items.js
index b09dc45..1375138 100644
--- a/static/js/items.js
+++ b/static/js/items.js
@@ -1,64 +1,73 @@
var itemtable = $('#itemtable').DataTable({
responsive: {
- details: {
- display: $.fn.dataTable.Responsive.display.modal({
- header: function (row) {
- var data = row.data();
- return "
" + data[2];
- }
- }),
- renderer: $.fn.dataTable.Responsive.renderer.tableAll({
- tableClass: 'table'
- }),
- type: "column"
- }
+ details: {
+ display: $.fn.dataTable.Responsive.display.modal({
+ header: function (row) {
+ var data = row.data();
+ return "
" + data[2];
+ }
+ }),
+ renderer: $.fn.dataTable.Responsive.renderer.tableAll({
+ tableClass: 'table'
+ }),
+ type: "column"
+ }
},
columnDefs: [
- {
- targets: 0,
- className: 'control',
- orderable: false
- },
- {
- targets: 1,
- orderable: false
- },
- {
- targets: 8,
- orderable: false
- }
+ {
+ targets: 0,
+ className: 'control',
+ orderable: false
+ },
+ {
+ targets: 1,
+ orderable: false
+ },
+ {
+ targets: 8,
+ orderable: false
+ }
],
order: [
- [2, 'asc']
+ [2, 'asc']
],
serverSide: true,
ajax: {
- 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.editbtn + " " + row.clonebtn,
- row.name,
- row.catname,
- row.locname + " (" + row.loccode + ")",
- row.code1,
- row.code2,
- row.qty,
- row.want,
- row.username
- ]);
- });
- return JSON.stringify(json);
- }
+ 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.editbtn + " " + row.clonebtn,
+ row.name,
+ row.catname,
+ row.locname + " (" + row.loccode + ")",
+ row.code1,
+ row.code2,
+ row.qty,
+ row.want,
+ row.username
+ ]);
+ });
+ return JSON.stringify(json);
+ }
}
});
-$('#itemtable_filter').append("
");
\ No newline at end of file
+$('#itemtable_filter').append("
");
+
+$(document).ready(function () {
+ if (search_preload_content !== false) {
+ var searchInput = $("#itemtable_filter label input");
+ $(searchInput).val(search_preload_content);
+ $(searchInput).trigger("input");
+ $(searchInput).trigger("change");
+ }
+});
\ No newline at end of file