diff --git a/backend/controller/users.js b/backend/controller/users.js
index 1bd09c4..d903489 100644
--- a/backend/controller/users.js
+++ b/backend/controller/users.js
@@ -10,6 +10,7 @@ import {
getUserById,
updateUserById,
deleteUserById,
+ getSelectedUsersByUser,
} from "../models/usersModel.js";
//insert user to databased
@@ -40,7 +41,7 @@ export const signUp = async (req, res, next) => {
minute: '2-digit'
};
const dateTimeString = currentTime.toLocaleString('de-DE', options);
- const results = ownConn.query(`INSERT INTO users(id, username, password, registered, fullName, email, phonenumber, address, city, postcode, adminBool, technician1Bool, technician2Bool, technicianMonitoringBool, merchantBool, internBool) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+ const results = ownConn.query(`INSERT INTO users(id, username, password, registered, fullName, email, phonenumber, address, city, postcode, adminBool, technicianBool, readerBool) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[
uuidv4(),
req.body.username,
@@ -53,11 +54,8 @@ export const signUp = async (req, res, next) => {
req.body.city,
req.body.postcode,
req.body.adminBool,
- req.body.technician1Bool,
- req.body.technician2Bool,
- req.body.technicianMonitoringBool,
- req.body.merchantBool,
- req.body.internBool,
+ req.body.technicianBool,
+ req.body.readerBool,
]);
return res.status(201).send({
message: "Registered!",
@@ -161,6 +159,18 @@ export const showUserById = (req, res) => {
});
};
+//get all selected users by user
+export const showSelectedUsersByUser = (req, res) => {
+ getSelectedUsersByUser(req.params.id, (err, results) => {
+ if (err) {
+ res.send(err);
+ } else {
+ res.json(results);
+ }
+ });
+};
+
+
// Update user
export const updateUser = (req, res) => {
const data = req.body;
diff --git a/backend/models/usersModel.js b/backend/models/usersModel.js
index 88dd055..03f8bf5 100644
--- a/backend/models/usersModel.js
+++ b/backend/models/usersModel.js
@@ -28,12 +28,26 @@ export const getUserById = async (id, result) => {
}
};
+//get all selected users by full name
+export const getSelectedUsersByUser = async (selected, result) => {
+ try {
+ let sql = `SELECT * FROM users WHERE LOWER(fullName) LIKE '%${selected.toLowerCase()}%' ORDER BY fullName ASC`;
+ const results = await ownConn.execute(sql)
+ result(null, results);
+ }
+ catch (err) {
+ // Manage Errors
+ console.log("SQL error : ", err);
+ result(err, null);
+ }
+};
+
// Update user to Database
export const updateUserById = async (data, result) => {
try {
const id = data.id;
- let sql = `UPDATE users SET username = ?, password = ?, fullName = ?, email = ?, phonenumber = ?, address = ?, city = ?, postcode = ?, adminBool = ?, technician1Bool = ?, technician2Bool = ?, technicianMonitoringBool = ?, merchantBool = ?, internBool = ? WHERE id = ?`;
- const results = await ownConn.query(sql, [data.username, data.password, data.fullName, data.email, data.phonenumber, data.address, data.city, data.postcode, data.adminBool, data.technician1Bool, data.technician2Bool, data.technicianMonitoringBool, data.merchantBool, data.internBool, id]);
+ let sql = `UPDATE users SET username = ?, password = ?, fullName = ?, email = ?, phonenumber = ?, address = ?, city = ?, postcode = ?, adminBool = ?, technicianBool = ?, readerBool = ? WHERE id = ?`;
+ const results = await ownConn.query(sql, [data.username, data.password, data.fullName, data.email, data.phonenumber, data.address, data.city, data.postcode, data.adminBool, data.technicianBool,, data.readerBool, id]);
result(null, results);
}
catch (err) {
diff --git a/backend/routes/routes.js b/backend/routes/routes.js
index 34b52c5..390f470 100644
--- a/backend/routes/routes.js
+++ b/backend/routes/routes.js
@@ -113,6 +113,7 @@ import {
showUserById,
updateUser,
deleteUser,
+ showSelectedUsersByUser,
} from "../controller/users.js";
import * as userMiddleware from "../middleware/users.js";
@@ -608,6 +609,9 @@ router.post('/login', login);
// get all users
router.get("/users", showUsers);
+// get all users by user
+router.get("/selectedUsersByUser/:id", showSelectedUsersByUser)
+
//get user by id
router.get("/user/:id", showUserById);
diff --git a/components/EmployeeSearch.vue b/components/EmployeeSearch.vue
new file mode 100644
index 0000000..4c0ff57
--- /dev/null
+++ b/components/EmployeeSearch.vue
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/server/EmployeeTable.vue b/components/server/EmployeeTable.vue
new file mode 100644
index 0000000..dc96de2
--- /dev/null
+++ b/components/server/EmployeeTable.vue
@@ -0,0 +1,228 @@
+
+
+
+
+
+ |
+ Name |
+
+ Username |
+ ID |
+
+
+ |
+
+ {{ u.fullName }}
+
+ |
+
+
+ {{ u.username }}
+
+ |
+ {{ u.id }} |
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/.$Datenbankmodell.drawio.bkp b/documentation/.$Datenbankmodell.drawio.bkp
index 35fa7fe..28b2cf5 100644
--- a/documentation/.$Datenbankmodell.drawio.bkp
+++ b/documentation/.$Datenbankmodell.drawio.bkp
@@ -1,6 +1,6 @@
-
+
-
+
@@ -395,7 +395,7 @@
-
+
@@ -421,33 +421,63 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -470,7 +500,7 @@
-
+
@@ -491,7 +521,7 @@
-
+
diff --git a/documentation/.$Datenbankmodell.drawio.dtmp b/documentation/.$Datenbankmodell.drawio.dtmp
new file mode 100644
index 0000000..78d9294
--- /dev/null
+++ b/documentation/.$Datenbankmodell.drawio.dtmp
@@ -0,0 +1,995 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/documentation/Datenbankmodell.drawio b/documentation/Datenbankmodell.drawio
index 28b2cf5..f60d6d9 100644
--- a/documentation/Datenbankmodell.drawio
+++ b/documentation/Datenbankmodell.drawio
@@ -1,6 +1,6 @@
-
+
-
+
@@ -341,7 +341,7 @@
-
+
@@ -379,21 +379,12 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
diff --git a/layouts/Navigationbar.vue b/layouts/Navigationbar.vue
index 2988ba1..321e168 100644
--- a/layouts/Navigationbar.vue
+++ b/layouts/Navigationbar.vue
@@ -60,6 +60,14 @@
Customers
+
+
+

+
+
+ Employees
+
+
@@ -96,6 +104,11 @@ const defaultIssueSlipPage = () => {
store.commit('changeToIssueSliplist')
}
+const defaultEmployeesPage = () => {
+ store.commit('resetStore');
+ store.commit('changeToEmployeelist')
+}
+
const ToggleSidebar = () => {
isExpanded.value = !isExpanded.value;
};
diff --git a/pages/employees.vue b/pages/employees.vue
new file mode 100644
index 0000000..fca000e
--- /dev/null
+++ b/pages/employees.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/vuex.js b/plugins/vuex.js
index 8efaf70..67ac762 100644
--- a/plugins/vuex.js
+++ b/plugins/vuex.js
@@ -128,6 +128,10 @@ const store = createStore({
newAmountII: '',
newPropertiesII: '',
chosenIssueVariantId: -1,
+
+ onEmployeelist: true,
+ onEmployee: false,
+ chosenEmployeeId: -1,
};
},
mutations: {
@@ -159,10 +163,6 @@ const store = createStore({
state.changedCustomerId = id
},
- refresh() {
- //
- },
-
// functions to change the asset pages
changeToAssetlist(state) {
state.onAssetlist = true
@@ -486,6 +486,42 @@ const store = createStore({
state.deleteIcon = true
},
+ // functions to change the user pages
+ changeToEmployeelist(state) {
+ state.onEmployeelist = true
+ state.onEmployee = false
+
+ state.addIcon = true
+ state.addSolutionIcon = false
+ state.solutionIcon = false
+ state.addInstanceIcon = false
+ state.filterIcon = true
+ state.searchIcon = false
+ state.instancesIcon = false
+ state.attachmentsIcon = false
+ state.sellIcon = false
+ state.archiveIcon = false
+ state.editIcon = false
+ state.deleteIcon = false
+ },
+ changeToEmployee(state) {
+ state.onEmployeelist = false
+ state.onEmployee = true
+
+ state.addIcon = false
+ state.addSolutionIcon = false
+ state.solutionIcon = false
+ state.addInstanceIcon = false
+ state.filterIcon = false
+ state.searchIcon = false
+ state.instancesIcon = false
+ state.attachmentsIcon = false
+ state.sellIcon = false
+ state.archiveIcon = false
+ state.editIcon = true
+ state.deleteIcon = true
+ },
+
// functions to update the asset
updateAssetComponent(state, asset) {
state.newAssetName = asset.assetName
@@ -556,7 +592,7 @@ const store = createStore({
state.newUserIS = is.user
state.newDeliveryAddressIS = is.deliveryAddress
},
-
+
// functions to update the accounting info component
updateOrderingInfoComponent(state, o) {
state.newOIs = o.ois
@@ -623,11 +659,16 @@ const store = createStore({
state.chosenIssueId = id
},
- // function to set the chosen issue variant
- setChosenIssueVariant(state, id) {
+ // function to set the chosen issue variant
+ setChosenIssueVariant(state, id) {
state.chosenIssueVariantId = id
},
+ // function to set the chosen user
+ setChosenEmployee(state, id) {
+ state.chosenEmployeeId = id
+ },
+
// function to reset the pages
resetStore(state) {
state.editable = false
@@ -732,6 +773,9 @@ const store = createStore({
state.newStateII = ''
state.newAmountII = ''
state.newPropertiesII = ''
+
+ // reset the employee page variables
+ state.chosenEmployeeId = -1
},
// functions to (undo) delete an asset
@@ -777,6 +821,10 @@ const store = createStore({
state.onIssueItemList = false
state.onIssueItemVariant = false
state.onIssueItem = true
+
+ // set the employee variables
+ state.onEmployeelist = false
+ state.onEmployee = true
},
},
});
diff --git a/server/api/getAllEmployees.ts b/server/api/getAllEmployees.ts
new file mode 100644
index 0000000..3d979e0
--- /dev/null
+++ b/server/api/getAllEmployees.ts
@@ -0,0 +1,23 @@
+import { employees, errorMsg } from "../middleware/employees";
+import { OutgoingMessage } from 'http';
+
+export default defineEventHandler(async (event) => {
+
+ const headers: Record[1]> = {
+ 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de',
+ 'Access-Control-Allow-Headers': 'authorization, content-type',
+ 'Access-Control-Allow-Methods': 'GET,HEAD,PUT,PATCH,POST,DELETE',
+ 'Access-Control-Allow-Credentials': 'true',
+ };
+ setResponseHeaders(event, headers)
+
+ if (!(errorMsg === '')) {
+ throw createError({
+ statusCode: 400,
+ statusMessage: errorMsg,
+ })
+ }
+
+ setResponseStatus(event, 200)
+ return employees
+})
diff --git a/server/api/getSelectedEmployeesByEmployee/[id].ts b/server/api/getSelectedEmployeesByEmployee/[id].ts
new file mode 100644
index 0000000..c8871ba
--- /dev/null
+++ b/server/api/getSelectedEmployeesByEmployee/[id].ts
@@ -0,0 +1,23 @@
+import { selectedEmployeesByEmployee, errorMsg } from "../../middleware/employees";
+import { OutgoingMessage } from 'http';
+
+export default defineEventHandler(async (event) => {
+
+ const headers: Record[1]> = {
+ 'Access-Control-Allow-Origin': 'https://tueitapp.tueit.de',
+ 'Access-Control-Allow-Headers': 'authorization, content-type',
+ 'Access-Control-Allow-Methods': 'OPTIONS,GET,HEAD,PUT,PATCH,POST,DELETE',
+ 'Access-Control-Allow-Credentials': 'true',
+ };
+ setResponseHeaders(event, headers)
+
+ if (!(errorMsg === '')) {
+ throw createError({
+ statusCode: 400,
+ statusMessage: errorMsg,
+ })
+ }
+
+ setResponseStatus(event, 200)
+ return selectedEmployeesByEmployee
+})
diff --git a/server/middleware/employees.ts b/server/middleware/employees.ts
new file mode 100644
index 0000000..d7fca46
--- /dev/null
+++ b/server/middleware/employees.ts
@@ -0,0 +1,271 @@
+import axios, { AxiosError } from 'axios';
+import serversideConfig from '../../serversideConfig';
+import https from 'https';
+
+let employees = [];
+let configItem = {};
+let errorMsg = '';
+let selectedEmployeesByEmployee = [];
+let configItemsFromCustomer = [];
+let selectedConfigItemsByAsset = [];
+
+export default defineEventHandler(async (event) => {
+
+ const agent = new https.Agent({
+ rejectUnauthorized: false,
+ });
+
+ const axiosInstance = axios.create({
+ headers: {
+ 'Content-Type': 'application/json',
+ Accept: "*",
+ },
+ httpsAgent: agent
+ });
+
+ if (event.path.startsWith("/api/getAllEmployees")) {
+ // get all users object from backend
+ try {
+ let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/users`);
+ employees = res.data;
+ } catch (err) {
+ if (axios.isAxiosError(err)) {
+ const axiosError = err as AxiosError;
+
+ if (axiosError.response) {
+ // Axios error
+ console.error(axiosError.response.data.message);
+ errorMsg = axiosError.response.data.message;
+ } else if (axiosError.request) {
+ console.log(err)
+ // If error was caused by the request
+ console.error(axiosError.request);
+ } else {
+ // Other errors
+ console.error('Error', axiosError.message);
+ }
+ } else {
+ // No AxiosError
+ console.error('Error', err);
+ }
+ }
+ }
+
+ // if (event.path.startsWith("/api/getConfigItem")) {
+ // // get all config items object from backend
+ // let itemId = null;
+ // const path = event._path;
+ // const pathSegments = path.split('/');
+ // itemId = pathSegments[pathSegments.length - 1];
+
+ // try {
+ // let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/configItem/${itemId}`);
+ // configItem = res.data;
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+
+ // if (event.path.startsWith("/api/getCIFromCustomer")) {
+ // // get all config items from a customer from backend
+ // let itemId = null;
+ // const path = event._path;
+ // const pathSegments = path.split('/');
+ // itemId = pathSegments[pathSegments.length - 1];
+
+ // try {
+ // let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/configItemByCustomerID/${itemId}`);
+ // configItemsFromCustomer = res.data;
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+
+ // if (event.path.startsWith("/api/updateConfigItem")) {
+ // const body = await readBody(event)
+ // // update the config item in the backend
+ // try {
+ // let res = await axiosInstance.put(`https://${serversideConfig.url}:${serversideConfig.port}/configItem`, body);
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // console.log(err)
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+
+ // if (event.path.startsWith("/api/addConfigItem")) {
+ // const body = await readBody(event)
+ // // add the config item in the backend
+ // try {
+ // let res = await axiosInstance.post(`https://${serversideConfig.url}:${serversideConfig.port}/configItems`, body);
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // console.log(err)
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+
+ // if (event.path.startsWith("/api/deleteConfigItem")) {
+ // let itemId = null;
+ // const path = event._path;
+ // const pathSegments = path.split('/');
+ // itemId = pathSegments[pathSegments.length - 1];
+
+ // // delete the config item in the backend
+ // try {
+ // let res = await axiosInstance.delete(`https://${serversideConfig.url}:${serversideConfig.port}/configItems/${itemId}`);
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // console.log(err)
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+
+ if (event.path.startsWith("/api/getSelectedEmployeesByEmployee")) {
+ // get selected employees object by employee from backend
+ let filteredEmployee = null;
+ const path = event._path;
+ const pathSegments = path.split('/');
+ filteredEmployee = pathSegments[pathSegments.length - 1];
+
+ try {
+ let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/selectedUsersByUser/${filteredEmployee}`);
+ selectedEmployeesByEmployee = res.data;
+ } catch (err) {
+ if (axios.isAxiosError(err)) {
+ const axiosError = err as AxiosError;
+
+ if (axiosError.response) {
+ // Axios error
+ console.error(axiosError.response.data.message);
+ errorMsg = axiosError.response.data.message;
+ } else if (axiosError.request) {
+ // If error was caused by the request
+ console.error(axiosError.request);
+ } else {
+ // Other errors
+ console.error('Error', axiosError.message);
+ }
+ } else {
+ // No AxiosError
+ console.error('Error', err);
+ }
+ }
+ }
+
+ // if (event.path.startsWith("/api/getSelectedConfigItemsByAsset")) {
+ // // get selected config items object by asset from backend
+ // let filteredAsset = null;
+ // const path = event._path;
+ // const pathSegments = path.split('/');
+ // filteredAsset = pathSegments[pathSegments.length - 1];
+
+ // try {
+ // let res = await axiosInstance.get(`https://${serversideConfig.url}:${serversideConfig.port}/selectedConfigItemsByAssetName/${filteredAsset}`);
+ // selectedConfigItemsByAsset = res.data;
+ // } catch (err) {
+ // if (axios.isAxiosError(err)) {
+ // const axiosError = err as AxiosError;
+
+ // if (axiosError.response) {
+ // // Axios error
+ // console.error(axiosError.response.data.message);
+ // errorMsg = axiosError.response.data.message;
+ // } else if (axiosError.request) {
+ // // If error was caused by the request
+ // console.error(axiosError.request);
+ // } else {
+ // // Other errors
+ // console.error('Error', axiosError.message);
+ // }
+ // } else {
+ // // No AxiosError
+ // console.error('Error', err);
+ // }
+ // }
+ // }
+})
+
+export { employees, configItem, selectedEmployeesByEmployee, selectedConfigItemsByAsset, configItemsFromCustomer, errorMsg };
\ No newline at end of file