Browse Source

UI tweaks

stock_management
João Andrade 2 years ago
parent
commit
0e2c2c17a2
  1. 2
      langs/en/items.json
  2. 14
      lib/getitemtable.php
  3. 26
      pages.php
  4. 12
      pages/categories.php
  5. 4
      pages/items.php
  6. 12
      pages/locations.php
  7. 6
      static/js/categories.js
  8. 10
      static/js/items.js
  9. 6
      static/js/locations.js

2
langs/en/items.json

@ -10,8 +10,6 @@
"itemid": "Item ID",
"id": "ID",
"Edit Item": "Edit Item",
"Adding stock": "Adding stock",
"adding stock": "Adding stock for {item}",
"Removing stock": "Removing stock",
"removing stock": "Removing stock from {item}"
}

14
lib/getitemtable.php

@ -32,25 +32,25 @@ if ($VARS['order'][0]['dir'] == 'asc') {
$sortby = "ASC";
}
switch ($VARS['order'][0]['column']) {
case 2:
case 1:
$order = ["name" => $sortby];
break;
case 3:
case 2:
$order = ["catname" => $sortby];
break;
case 4:
case 3:
$order = ["locname" => $sortby];
break;
case 5:
case 4:
$order = ["code1" => $sortby];
break;
case 6:
case 5:
$order = ["code2" => $sortby];
break;
case 7:
case 6:
$order = ["qty" => $sortby];
break;
case 8:
case 7:
$order = ["want" => $sortby];
break;
// Note: We're not going to sort by assigned user. It's too hard. Maybe later.

26
pages.php

@ -24,19 +24,6 @@ define("PAGES", [
"static/js/items.js"
],
],
"locations" => [
"title" => "Locations",
"navbar" => true,
"icon" => "fas fa-map-marker",
"styles" => [
"static/css/datatables.min.css",
"static/css/tables.css"
],
"scripts" => [
"static/js/datatables.min.js",
"static/js/locations.js"
],
],
"categories" => [
"title" => "Categories",
"navbar" => true,
@ -50,6 +37,19 @@ define("PAGES", [
"static/js/categories.js"
],
],
"locations" => [
"title" => "Locations",
"navbar" => true,
"icon" => "fas fa-map-marker",
"styles" => [
"static/css/datatables.min.css",
"static/css/tables.css"
],
"scripts" => [
"static/js/datatables.min.js",
"static/js/locations.js"
],
],
"item" => [
"title" => "Item",
"navbar" => false

12
pages/categories.php

@ -14,9 +14,9 @@ redirectifnotloggedin();
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-pallet hidden-sm"></i> <?php $Strings->get('category'); ?></th>
<th data-priority="2"><i class="fas fa-hashtag hidden-sm"></i> <?php $Strings->get('item count'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</thead>
<tbody>
@ -30,11 +30,11 @@ redirectifnotloggedin();
?>
<tr>
<td></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editcat&id=<?php echo $cat['catid']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("edit"); ?></a>
</td>
<td><?php echo $cat['catname']; ?></td>
<td><?php echo $itemcount; ?></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editcat&id=<?php echo $cat['catid']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("edit"); ?></a>
</td>
</tr>
<?php
}
@ -43,9 +43,9 @@ redirectifnotloggedin();
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-pallet hidden-sm"></i> <?php $Strings->get('category'); ?></th>
<th data-priority="2"><i class="fas fa-hashtag hidden-sm"></i> <?php $Strings->get('item count'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</tfoot>
</table>
</table>

4
pages/items.php

@ -24,7 +24,6 @@ redirectifnotloggedin();
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-fw fa-box d-none d-md-inline"></i> <?php $Strings->get('name'); ?></th>
<th data-priority="7"><i class="fas fa-fw fa-pallet d-none d-md-inline"></i> <?php $Strings->get('category'); ?></th>
<th data-priority="4"><i class="fas fa-fw fa-map-marker d-none d-md-inline"></i> <?php $Strings->get('location'); ?></th>
@ -33,6 +32,7 @@ redirectifnotloggedin();
<th data-priority="3"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('qty'); ?></th>
<th data-priority="6"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('want'); ?></th>
<th data-priority="8"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('assigned to'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</thead>
<tbody>
@ -40,7 +40,6 @@ redirectifnotloggedin();
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-fw fa-box d-none d-md-inline"></i> <?php $Strings->get('name'); ?></th>
<th data-priority="7"><i class="fas fa-fw fa-pallet d-none d-md-inline"></i> <?php $Strings->get('category'); ?></th>
<th data-priority="4"><i class="fas fa-fw fa-map-marker d-none d-md-inline"></i> <?php $Strings->get('location'); ?></th>
@ -49,6 +48,7 @@ redirectifnotloggedin();
<th data-priority="3"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('qty'); ?></th>
<th data-priority="6"><i class="fas fa-fw fa-hashtag d-none d-md-inline"></i> <?php $Strings->get('want'); ?></th>
<th data-priority="8"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('assigned to'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</tfoot>
</table>

12
pages/locations.php

@ -15,10 +15,10 @@ redirectifnotloggedin();
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-map-marker"></i> <?php $Strings->get('location'); ?></th>
<th data-priority="2"><i class="fas fa-barcode"></i> <?php $Strings->get('code'); ?></th>
<th data-priority="3"><i class="fas fa-hashtag"></i> <?php $Strings->get('item count'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</thead>
<tbody>
@ -33,12 +33,12 @@ redirectifnotloggedin();
?>
<tr>
<td></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editloc&id=<?php echo $loc['locid']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("edit"); ?></a>
</td>
<td><?php echo $loc['locname']; ?></td>
<td><?php echo $loc['loccode']; ?></td>
<td><?php echo $itemcount; ?></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editloc&id=<?php echo $loc['locid']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("edit"); ?></a>
</td>
</tr>
<?php
}
@ -47,10 +47,10 @@ redirectifnotloggedin();
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-map-marker"></i> <?php $Strings->get('location'); ?></th>
<th data-priority="2"><i class="fas fa-barcode"></i> <?php $Strings->get('code'); ?></th>
<th data-priority="3"><i class="fas fa-hashtag"></i> <?php $Strings->get('item count'); ?></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
</tr>
</tfoot>
</table>
</table>

6
static/js/categories.js

@ -24,11 +24,11 @@ $('#cattable').DataTable({
orderable: false
},
{
targets: 1,
targets: 3,
orderable: false
}
],
order: [
[2, 'asc']
[1, 'asc']
]
});
});

10
static/js/items.js

@ -24,16 +24,16 @@ var itemtable = $('#itemtable').DataTable({
orderable: false
},
{
targets: 1,
targets: 8,
orderable: false
},
{
targets: 8,
targets: 9,
orderable: false
}
],
order: [
[2, 'asc']
[1, 'asc']
],
serverSide: true,
ajax: {
@ -49,7 +49,6 @@ var itemtable = $('#itemtable').DataTable({
json.items.forEach(function (row) {
json.data.push([
"",
"<span class='btn-group btn-group-sm'>" + row.viewbtn + " " + row.editbtn + " " + row.addstockbtn + " " + row.removestockbtn + "</span>"
row.name,
row.catname,
row.locname + " (" + row.loccode + ")",
@ -57,7 +56,8 @@ var itemtable = $('#itemtable').DataTable({
row.code2,
row.qty,
row.want,
row.username
row.username,
"<span class='btn-group btn-group-sm'>" + row.viewbtn + " " + row.editbtn + " " + row.addstockbtn + " " + row.removestockbtn + "</span>"
]);
});
return JSON.stringify(json);

6
static/js/locations.js

@ -24,11 +24,11 @@ $('#loctable').DataTable({
orderable: false
},
{
targets: 1,
targets: 4,
orderable: false
}
],
order: [
[2, 'asc']
[1, 'asc']
]
});
});
Loading…
Cancel
Save