Skip to content

Commit

Permalink
Merging Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ilofX committed Aug 3, 2020
1 parent c49ab88 commit f914926
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ app.use(session({
cookie: {
secure: false, //change to true with HTTPS
sameSite: true,
maxAge: 600000 // Time is in miliseconds
maxAge: 1000 * 60 * 60 * 2// Time is in miliseconds
},
}));

Expand Down
3 changes: 1 addition & 2 deletions public/js/dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ function sidenavEventsListeners() {
for (let i = 0; i < data.products.length; i++) {
let tr = tbody.insertRow();
tr.insertCell().appendChild(document.createTextNode(data.products[i].Name));
tr.insertCell().appendChild(document.createTextNode(data.products[i].Price + value));
tr.insertCell().appendChild(document.createTextNode(data.products[i].Price+value+" ("+data.products[i].shop+")"));
tr.insertCell().appendChild(document.createTextNode(data.products[i].LastUpdate.toString()));
//tr.insertCell().appendChild(document.createTextNode(data.products[i].Barcode));
tr.insertCell().innerHTML = '<a href="#" onclick="prodDetails(' + data.products[i].Barcode + ')"><i class="material-icons">read_more</i></a>';
}
} else {
Expand Down
8 changes: 8 additions & 0 deletions public/stylesheets/dashStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,12 @@ nav.top-nav {

.dropdown_offset {
top: 55px !important;
}

.scrollable{
overflow: auto;
}

.minWidth{
min-width: 600px;
}
5 changes: 3 additions & 2 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ router.get('/productslistcomplete', chechAuth, function (req, res, next) {
}
});

connection.query("SELECT product.Barcode, product.Name, sold.Price, sold.LastUpdate FROM product, sold WHERE product.Barcode = sold.ProductBarcode GROUP BY product.Barcode HAVING sold.Price = MIN(sold.Price)", function (err, result) {
connection.query("SELECT product.Barcode, product.Name, sold.Price, DATE_FORMAT(sold.LastUpdate,'%d-%m-%Y') AS LastUpdate, shop.Name AS 'shopName', shop.City FROM product, sold, shop WHERE sold.ShopID = shop.ID AND product.Barcode = sold.ProductBarcode GROUP BY product.Barcode HAVING sold.Price = MIN(sold.Price)", function (err, result) {
if (err) {
return res.json({
"status": false,
Expand All @@ -194,7 +194,8 @@ router.get('/productslistcomplete', chechAuth, function (req, res, next) {
'Barcode': result[i].Barcode,
'Name': result[i].Name,
'Price': result[i].Price,
'LastUpdate': result[i].LastUpdate
'LastUpdate': result[i].LastUpdate,
'shop': result[i].shopName + ", " + result[i].City
});
}
res.json(ris);
Expand Down
2 changes: 1 addition & 1 deletion routes/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ router.post('/login', redirectDash, function (req, res, next) {
], function (err, result) {
if (err) {
console.log("Query Error" + err);
res.json({
return res.json({
"status": false,
"message": err
});
Expand Down
20 changes: 10 additions & 10 deletions views/dash.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<div class="row">
<h2>Products List</h2>
</div>
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Name</th>
Expand All @@ -107,15 +107,15 @@
<div class="row">
<h2>Shops List</h2>
</div>
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Name</th>
<th>Location</th>
<th>Details</th>
</tr>
</thead>
<tbody id="sListTableBody"></tbody>
<tbody id="sListTableBody" class="scrollable minWidth"></tbody>
</table>
</div>
</div>
Expand Down Expand Up @@ -261,13 +261,13 @@
</div>
<div class="row">
<p>Details</p>
<table class="">
<table class="scrollable minWidth">
<tbody id="modalProdDetailsTableBody"></tbody>
</table>
</div>
<div class="row">
<p>Sold in</p>
<table class="striped">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Name</th>
Expand All @@ -292,13 +292,13 @@
</div>
<div class="row">
<p>Details</p>
<table class="responsive-table">
<table class="scrollable minWidth">
<tbody id="modalShopDetailsTableBody"></tbody>
</table>
</div>
<div class="row">
<p>Products Sold In This Shop</p>
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Barcode</th>
Expand All @@ -322,7 +322,7 @@
<h3>Select a Product From The List</h3>
</div>
<div class="row">
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Select</th>
Expand Down Expand Up @@ -350,7 +350,7 @@
<h3>Select a Shop From The List</h3>
</div>
<div class="row">
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Select</th>
Expand Down Expand Up @@ -378,7 +378,7 @@
<h3>List of Currently Active Api Keys</h3>
</div>
<div class="row">
<table class="striped responsive-table">
<table class="striped scrollable minWidth">
<thead>
<tr>
<th>Api Key</th>
Expand Down

0 comments on commit f914926

Please sign in to comment.