Compare commits
3 Commits
58a2d2ad19
...
09e74f9eb6
Author | SHA1 | Date | |
---|---|---|---|
09e74f9eb6 | |||
720a969484 | |||
5524f14e1a |
@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="itemModifyModalStorageLocation" class="form-label">Select a storage location</label>
|
||||
<select class="form-select" id="itemModifyModalStorageLocation" name="storageLocation">
|
||||
<select class="form-select" id="itemModifyModalStorageLocation" name="storageLocationId">
|
||||
<option value=""><i>Do not assign a storage location</i></option>
|
||||
<% it.storeLocs.forEach(function(locs){ %>
|
||||
<option value="<%= locs.id %>"><%= locs.name %></option>
|
||||
|
@ -17,7 +17,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((item) => {
|
||||
if (item) {
|
||||
res.status(200).json(JSON.stringify(item));
|
||||
res.status(200).json(item);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Category does not exist' });
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ async function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Item does not exist' });
|
||||
}
|
||||
@ -117,7 +117,7 @@ async function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify({ total: itemCountFiltered, totalNotFiltered: itemCountNotFiltered, items: items }));
|
||||
res.status(200).json({ total: itemCountFiltered, totalNotFiltered: itemCountNotFiltered, items: items });
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Item does not exist' });
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ function get(req: Request, res: Response) {
|
||||
}
|
||||
})
|
||||
.then((items) => {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
})
|
||||
.catch((err) => {
|
||||
log.db.error(err);
|
||||
|
@ -21,7 +21,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'storageLocation does not exist' });
|
||||
}
|
||||
@ -40,7 +40,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'storageLocation does not exist' });
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'storageUnit does not exist' });
|
||||
}
|
||||
@ -43,7 +43,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((items) => {
|
||||
if (items) {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'storageUnit does not exist' });
|
||||
}
|
||||
|
@ -29,7 +29,9 @@ function get(req: Request, res: Response) {
|
||||
res.send(html);
|
||||
});
|
||||
} else {
|
||||
res.send('Item not found');
|
||||
Eta.renderFile(__path + '/src/frontend/errors/404.eta.html', item).then((html) => {
|
||||
res.status(404).send(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,9 +2,7 @@ function getDataForEdit(name) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: `/api/v1/categories?name=${name}`,
|
||||
success: function (data) {
|
||||
const result = JSON.parse(data);
|
||||
|
||||
success: function (result) {
|
||||
// Get elements inside the editCategoryModal
|
||||
const modal_categoryName = document.getElementById('editCategoryModalName');
|
||||
const modal_categoryDescription = document.getElementById('editCategoryModalDescription');
|
||||
|
@ -19,8 +19,7 @@ function getDataForEdit(id) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: `/api/v1/items?id=${id}`,
|
||||
success: function (data) {
|
||||
const result = JSON.parse(data);
|
||||
success: function (result) {
|
||||
|
||||
// Get elements inside the editCategoryModal
|
||||
const modal_itemName = document.getElementById('itemModifyModalName');
|
||||
@ -42,6 +41,7 @@ function getDataForEdit(id) {
|
||||
|
||||
// Select the correct option in the dropdown
|
||||
const modal_itemCategoryOptions = modal_itemCategory.options;
|
||||
modal_itemCategoryOptions[0].selected = true;
|
||||
for (let i = 0; i < modal_itemCategoryOptions.length; i++) {
|
||||
if (modal_itemCategoryOptions[i].value == result.categoryId) {
|
||||
modal_itemCategoryOptions[i].selected = true;
|
||||
@ -50,6 +50,7 @@ function getDataForEdit(id) {
|
||||
|
||||
// Select the correct option in the dropdown
|
||||
const modal_itemStatusOptions = modal_itemStatus.options;
|
||||
modal_itemStatusOptions[0].selected = true;
|
||||
for (let i = 0; i < modal_itemStatusOptions.length; i++) {
|
||||
if (modal_itemStatusOptions[i].value == result.statusId) {
|
||||
modal_itemStatusOptions[i].selected = true;
|
||||
@ -58,6 +59,7 @@ function getDataForEdit(id) {
|
||||
|
||||
// Select the correct option in the dropdown
|
||||
const modal_itemStorageLocationOptions = modal_itemStorageLocation.options;
|
||||
modal_itemStorageLocationOptions[0].selected = true;
|
||||
for (let i = 0; i < modal_itemStorageLocationOptions.length; i++) {
|
||||
if (modal_itemStorageLocationOptions[i].value == result.storageLocationId) {
|
||||
modal_itemStorageLocationOptions[i].selected = true;
|
||||
|
@ -68,8 +68,7 @@ function getDataForEdit(id) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: `/api/v1/storageUnits?id=${id}`,
|
||||
success: function (data) {
|
||||
const result = JSON.parse(data);
|
||||
success: function (result) {
|
||||
|
||||
// Get elements inside the editCategoryModal
|
||||
const modal_unitName = document.getElementById('storageUnitModalName');
|
||||
@ -107,8 +106,7 @@ function getDataForEditLoc(id) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: `/api/v1/storageLocations?id=${id}`,
|
||||
success: function (data) {
|
||||
const result = JSON.parse(data);
|
||||
success: function (result) {
|
||||
|
||||
// Get elements inside the editCategoryModal
|
||||
const modal_locationName = document.getElementById('storageLocationModalName');
|
||||
|
@ -108,8 +108,7 @@ function preFillDeleteModalNxt(id, route, name, requestIdent='id') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: `/api/v1/${route}?${requestIdent}=${id}`,
|
||||
success: function (data) {
|
||||
const result = JSON.parse(data);
|
||||
success: function (result) {
|
||||
|
||||
// Get elements inside the editCategoryModal
|
||||
const modal_categoryName = document.getElementById('deleteNamePlaceholder');
|
||||
|
@ -23,8 +23,7 @@ function loadPageData() {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function dataResponseHandler(res) {
|
||||
json = JSON.parse(res);
|
||||
function dataResponseHandler(json) {
|
||||
// console.log(json)
|
||||
totalNotFiltered = json.totalNotFiltered;
|
||||
total = json.total;
|
||||
|
@ -67,8 +67,7 @@ function handleSearchChange(e) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
let result = JSON.parse(data);
|
||||
success: function (result) {
|
||||
let htmlResult = ""
|
||||
result.forEach(element => {
|
||||
console.log(element);
|
||||
|
Loading…
Reference in New Issue
Block a user