diff --git a/allowedStaticPaths.json b/allowedStaticPaths.json index c299d03..257b0b1 100644 --- a/allowedStaticPaths.json +++ b/allowedStaticPaths.json @@ -10,7 +10,9 @@ "/@popperjs/core/dist/umd/popper.min.js.map", "/bootstrap/dist/js/bootstrap.bundle.min.js.map", "/bootstrap-icons/font/fonts/bootstrap-icons.woff", - "/tsparticles-confetti/tsparticles.confetti.bundle.min.js" + "/tsparticles-confetti/tsparticles.confetti.bundle.min.js", + "/bootstrap-table/dist/bootstrap-table.min.js", + "/bootstrap-table/dist/bootstrap-table.min.css" ], "debugMode": false } diff --git a/package-lock.json b/package-lock.json index cf0034f..2bd8769 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "body-parser": "^1.20.2", "bootstrap": "^5.3.0-alpha3", "bootstrap-icons": "^1.10.5", + "bootstrap-table": "^1.22.1", "csv": "^6.2.11", "eta": "^2.0.1", "express": "^4.18.2", @@ -1299,6 +1300,14 @@ } ] }, + "node_modules/bootstrap-table": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.22.1.tgz", + "integrity": "sha512-Nw8p+BmaiMDSfoer/p49YeI3vJQAWhudxhyKMuqnJBb3NRvCRewMk7JDgiN9SQO3YeSejOirKtcdWpM0dtddWg==", + "peerDependencies": { + "jquery": "3" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", diff --git a/package.json b/package.json index 2c4d53b..67990e5 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "body-parser": "^1.20.2", "bootstrap": "^5.3.0-alpha3", "bootstrap-icons": "^1.10.5", + "bootstrap-table": "^1.22.1", "csv": "^6.2.11", "eta": "^2.0.1", "express": "^4.18.2", diff --git a/src/assets/helper.ts b/src/assets/helper.ts index a7311ad..1f4a535 100644 --- a/src/assets/helper.ts +++ b/src/assets/helper.ts @@ -88,6 +88,26 @@ export function parseIntRelation(data: string, relation_name: string = 'id', doN }`); } -export function parseIntOrUndefined(data: string) { + +/** + * Function to parse a string into a number or return undefined if it is not a number + * + * @export + * @param {string || any} data + * @returns {object} + */ +export function parseIntOrUndefined(data: any) { return isNaN(parseInt(data)) ? undefined : parseInt(data); } + +/** + * A function to create a sortBy compatible object from a string + * + * @export + * @param {string} SortField + * @param {string} Order + * @returns {object} + */ +export function parseDynamicSortBy(SortField: string, Order: string){ + return JSON.parse(`{ "${SortField}": "${Order}" }`); +} diff --git a/src/frontend/items.eta.html b/src/frontend/items.eta.html index 674e5f6..84da31c 100644 --- a/src/frontend/items.eta.html +++ b/src/frontend/items.eta.html @@ -93,13 +93,13 @@ Create new item -
SKU | -Name | -Status | -Actions | +SKU | +Name | +Status | +Actions |
---|---|---|---|---|---|---|---|
- <% if (user.SKU == null) { %> - No SKU assigned - <% } else { %> <%= user.SKU %> <% } %> | -<%= user.name %> | - <% if(user.status == "normal") { %> - -<%= user.status %> | - <% } else if(user.status == "stolen") { %> -<%= user.status %> | - <% } else if(user.status == "lost") { %> -<%= user.status %> | - <% } else if(user.status == "borrowed") { %> -<%= user.status %> | - <% } %> -- - - | -