diff --git a/backend/controller/users.js b/backend/controller/users.js
index 1bd09c4..b03806e 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, darkModeBool) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[
uuidv4(),
req.body.username,
@@ -53,11 +54,9 @@ 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,
+ req.body.darkModeBool,
]);
return res.status(201).send({
message: "Registered!",
@@ -73,6 +72,32 @@ export const signUp = async (req, res, next) => {
}
};
+// Update user password to Database
+export const updatePasswordById = async (req, res, next) => {
+ try {
+ const id = req.body.id;
+ let sql = `UPDATE users SET password = ? WHERE id = ?`;
+ bcrypt.hash(req.body.password, 10, async (err, hash) => {
+ if (err) {
+ throw err;
+ return res.status(500).send({
+ message: err,
+ });
+ } else {
+ const results = await ownConn.query(sql, [hash, id]);
+ return res.status(200).send({
+ message: 'Password changed!',
+ });
+ }
+ });
+ }
+ catch (err) {
+ // Manage Errors
+ console.log("SQL error : ", err);
+ result(err, null);
+ }
+};
+
export const login = async (req, res, next) => {
try {
let sql = `SELECT * FROM users WHERE username = ?`;
@@ -161,6 +186,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/middleware/users.js b/backend/middleware/users.js
index 608006c..fe128c6 100644
--- a/backend/middleware/users.js
+++ b/backend/middleware/users.js
@@ -38,10 +38,7 @@ export const validateRegister = (req, res, next) => {
});
}
// password (repeat) must match
- if (
- !req.body.password_repeat ||
- req.body.password != req.body.password_repeat
- ) {
+ if (req.body.password != req.body.password_repeat) {
return res.status(400).send({
message: 'Both passwords must match',
});
diff --git a/backend/models/usersModel.js b/backend/models/usersModel.js
index 88dd055..321acaf 100644
--- a/backend/models/usersModel.js
+++ b/backend/models/usersModel.js
@@ -28,12 +28,11 @@ export const getUserById = async (id, result) => {
}
};
-// Update user to Database
-export const updateUserById = async (data, result) => {
+//get all selected users by full name
+export const getSelectedUsersByUser = async (selected, 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 = `SELECT * FROM users WHERE LOWER(fullName) LIKE '%${selected.toLowerCase()}%' ORDER BY fullName ASC`;
+ const results = await ownConn.execute(sql)
result(null, results);
}
catch (err) {
@@ -43,12 +42,28 @@ export const updateUserById = async (data, result) => {
}
};
+// Update user to Database
+export const updateUserById = async (data, result) => {
+ try {
+ const id = data.id;
+ let sql = `UPDATE users SET username = ?, fullName = ?, email = ?, phonenumber = ?, address = ?, city = ?, postcode = ?, adminBool = ?, technicianBool = ?, readerBool = ?, darkModeBool = ? WHERE id = ?`;
+ const results = await ownConn.query(sql, [data.username, data.fullName, data.email, data.phonenumber, data.address, data.city, data.postcode, data.adminBool, data.technicianBool, data.readerBool, data.darkModeBool, id]);
+ results.insertId = results.insertId.toString();
+ result(null, results);
+ }
+ catch (err) {
+ // Manage Errors
+ console.log("SQL error : ", err);
+ result(err, null);
+ }
+};
// Delete user to Database
export const deleteUserById = async (id, result) => {
try {
let sql = `DELETE FROM users WHERE id = ?`;
const results = await ownConn.query(sql, [id])
+ results.insertId = results.insertId.toString();
result(null, results);
}
catch (err) {
diff --git a/backend/routes/routes.js b/backend/routes/routes.js
index 34b52c5..05fbf96 100644
--- a/backend/routes/routes.js
+++ b/backend/routes/routes.js
@@ -108,11 +108,13 @@ import {
import {
signUp,
+ updatePasswordById,
login,
showUsers,
showUserById,
updateUser,
deleteUser,
+ showSelectedUsersByUser,
} from "../controller/users.js";
import * as userMiddleware from "../middleware/users.js";
@@ -602,12 +604,18 @@ router.delete("/issueVariantsByIssueSlipId/:id", deleteIssueVariantByIssueSlipId
// sign-up process
router.post('/signUp', userMiddleware.validateRegister, signUp);
+// update password process
+router.put('/updatePassword', updatePasswordById);
+
// login process
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/AssetSearch.vue b/components/AssetSearch.vue
index 61ee3b8..bc4fc34 100644
--- a/components/AssetSearch.vue
+++ b/components/AssetSearch.vue
@@ -4,20 +4,22 @@
{{ asset.assetName }}
-
-
+
+
-
+
-
-
+
+
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/components/CustomerSearch.vue b/components/CustomerSearch.vue
index e815ca9..01c34d6 100644
--- a/components/CustomerSearch.vue
+++ b/components/CustomerSearch.vue
@@ -9,16 +9,18 @@
-
-
+
+
+
\ No newline at end of file
diff --git a/components/IssueStateSearch.vue b/components/IssueStateSearch.vue
index 3550a00..63d792c 100644
--- a/components/IssueStateSearch.vue
+++ b/components/IssueStateSearch.vue
@@ -9,16 +9,18 @@
-
+
+
\ No newline at end of file
diff --git a/components/QuickAccess.vue b/components/QuickAccess.vue
index 790f614..cac2349 100644
--- a/components/QuickAccess.vue
+++ b/components/QuickAccess.vue
@@ -13,16 +13,49 @@
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/components/server/Accounting.vue b/components/server/Accounting.vue
index 0761593..9225982 100644
--- a/components/server/Accounting.vue
+++ b/components/server/Accounting.vue
@@ -350,13 +350,15 @@
diff --git a/components/server/Asset.vue b/components/server/Asset.vue
index 9450fc9..21dfba7 100644
--- a/components/server/Asset.vue
+++ b/components/server/Asset.vue
@@ -1,7 +1,7 @@
-
+
@@ -345,8 +367,8 @@ export default {
name: "Asset",
}
-
-
+
+
diff --git a/components/server/AssetTableNoCustomer.vue b/components/server/AssetTableNoCustomer.vue
deleted file mode 100644
index 3d04857..0000000
--- a/components/server/AssetTableNoCustomer.vue
+++ /dev/null
@@ -1,186 +0,0 @@
-
\ No newline at end of file
diff --git a/components/server/Customer.vue b/components/server/Customer.vue
index 9a78c59..c85b37a 100644
--- a/components/server/Customer.vue
+++ b/components/server/Customer.vue
@@ -44,29 +44,55 @@
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/components/server/CustomerDepartment.vue b/components/server/CustomerDepartment.vue
index 391db1f..d5d01dc 100644
--- a/components/server/CustomerDepartment.vue
+++ b/components/server/CustomerDepartment.vue
@@ -1,143 +1,193 @@
-
- Department name
-
-
-
-
+
+ Department name
+
+
-
+
+
-
-
-
-
+
\ No newline at end of file
diff --git a/components/server/CustomerDepartmentEmployeeList.vue b/components/server/CustomerDepartmentEmployeeList.vue
index fa2a48a..44b56cb 100644
--- a/components/server/CustomerDepartmentEmployeeList.vue
+++ b/components/server/CustomerDepartmentEmployeeList.vue
@@ -1,38 +1,81 @@
-
Employees:
- ID
- Name
- Job Title
- Pronouns
+
+ ID
+
+ Name
+
+ Job Title
+
+ Pronouns
- ...
- ...
- ...
- ...
+
+ ...
+
+ ...
+
+ ...
+
+ ...
-
-
-
+
+
-
\ No newline at end of file
diff --git a/components/server/CustomerDepartmentList.vue b/components/server/CustomerDepartmentList.vue
index f4942b0..404047e 100644
--- a/components/server/CustomerDepartmentList.vue
+++ b/components/server/CustomerDepartmentList.vue
@@ -18,9 +18,37 @@
-
-
-
-
\ No newline at end of file
diff --git a/components/server/CustomerEmployeeList.vue b/components/server/CustomerEmployeeList.vue
index 0e01e18..122be9e 100644
--- a/components/server/CustomerEmployeeList.vue
+++ b/components/server/CustomerEmployeeList.vue
@@ -3,35 +3,79 @@
Employees:
- ID
- Name
- Department / Job Title
- Pronouns
+
+ ID
+
+ Name
+
+ Department / Job Title
+
+ Pronouns
- ...
- ...
- ...
- ...
+
+ ...
+
+ ...
+
+ ...
+
+ ...
-
-
-
+
+
-
\ No newline at end of file
diff --git a/components/server/CustomerQuickAccess.vue b/components/server/CustomerQuickAccess.vue
index 662cfcd..8c09542 100644
--- a/components/server/CustomerQuickAccess.vue
+++ b/components/server/CustomerQuickAccess.vue
@@ -2,29 +2,60 @@
-
-
-
-
-
+
+
+
\ No newline at end of file
+}
+
\ No newline at end of file
diff --git a/components/server/Employee.vue b/components/server/Employee.vue
new file mode 100644
index 0000000..319d679
--- /dev/null
+++ b/components/server/Employee.vue
@@ -0,0 +1,498 @@
+
+
+ {{
+ employee.fullName }}
+
+
+
+
+
Username:
+
{{ employee.username }}
+
+
+
Registered:
+
{{ employee.registered }}
+
+
+
Last login:
+
{{ employee.lastLogin }}
+
+
+
+
+
+
City:
+
{{ employee.city }}
+
+
+
+
Phonenumber:
+
{{ employee.phonenumber }}
+
+
+
+
+
+
Postcode:
+
{{ employee.postcode }}
+
+
+
+
Email:
+
{{ employee.email }}
+
+
+
+
+
+
Address:
+
{{ employee.address }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/server/EmployeeGroups.vue b/components/server/EmployeeGroups.vue
new file mode 100644
index 0000000..95c394a
--- /dev/null
+++ b/components/server/EmployeeGroups.vue
@@ -0,0 +1,510 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/server/EmployeeTable.vue b/components/server/EmployeeTable.vue
new file mode 100644
index 0000000..d4f3632
--- /dev/null
+++ b/components/server/EmployeeTable.vue
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+ Name
+
+ Username
+ ID
+
+
+
+
+ {{ u.fullName }}
+
+
+
+
+ {{ u.username }}
+
+
+ {{ u.id }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/server/HardwareSpecifications.vue b/components/server/HardwareSpecifications.vue
index 307039c..18b5c66 100644
--- a/components/server/HardwareSpecifications.vue
+++ b/components/server/HardwareSpecifications.vue
@@ -1,7 +1,8 @@
- Hardware specifications:
+ Hardware specifications:
+
@@ -55,7 +56,8 @@
- Hardware specifications:
+ Hardware specifications:
+
@@ -101,16 +103,18 @@
-
+
@@ -213,9 +237,9 @@ onMounted(() => {
export default {
name: "HardwareSpecifications",
};
-
+
+
-
-->
\ No newline at end of file
diff --git a/components/server/IssueTable.vue b/components/server/IssueTable.vue
index 810b224..0ec64b5 100644
--- a/components/server/IssueTable.vue
+++ b/components/server/IssueTable.vue
@@ -25,7 +25,7 @@
{{ issue.name }}
@@ -53,6 +53,8 @@ import { computed } from 'vue';
// get accesss to the store
const store = useStore()
+const modeChanged = computed(() => store.state.updateDarkMode);
+
const goToChosenIssue = (id) => {
store.commit('setChosenIssue', id);
store.commit('changeToIssueItem');
@@ -62,7 +64,7 @@ const stateFilter = computed(() => store.state.filteredByCustomer);
const searchable = computed(() => store.state.searchable);
const issueSearchFilter = ref('');
-const darkMode = ref(true)
+const darkMode = ref('');
const issues = ref([]);
// update search term
@@ -113,7 +115,27 @@ const searchIssue = async () => {
watch(stateFilter, getIssues);
watch(searchable, updateSearchTerm);
+const getSession = async () => {
+ const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
+ if (loggedInUserDarkModeBool == 1) {
+ darkMode.value = true;
+ } else {
+ darkMode.value = false;
+ }
+}
+
+function getItem(item) {
+ if (process.client) {
+ return localStorage.getItem(item)
+ } else {
+ return undefined
+ }
+}
+
+watch(modeChanged, getSession)
+
onMounted(async () => {
+ getSession();
await getIssues();
});
@@ -178,9 +200,16 @@ export default {
#nuxt-link {
text-decoration: none;
+}
+
+.nuxt-link-darkmode {
color: white;
}
+.nuxt-link-lightmode {
+ color: #000;
+}
+
.issue-search {
display: flex;
align-items: center;
diff --git a/components/server/IssueVariant.vue b/components/server/IssueVariant.vue
index 9509387..4697949 100644
--- a/components/server/IssueVariant.vue
+++ b/components/server/IssueVariant.vue
@@ -8,8 +8,8 @@
Variant of:
-
{{ nameOfVariant }}
+
{{ nameOfVariant }}
@@ -59,6 +59,8 @@ import { useStore } from 'vuex';
import { computed } from 'vue';
const store = useStore();
+const modeChanged = computed(() => store.state.updateDarkMode);
+
const editable = computed(() => store.state.editable);
const chosenIssueId = computed(() => store.state.chosenIssueId);
const chosenIssueVariantId = computed(() => store.state.chosenIssueVariantId);
@@ -172,11 +174,30 @@ const getIssueById = async () => {
}
}
-watch(deleteBool, confirmDeleteIssueVariant);
+const getSession = async () => {
+ const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
+ if (loggedInUserDarkModeBool == 1) {
+ darkMode.value = true;
+ } else {
+ darkMode.value = false;
+ }
+}
-onMounted(() => {
- getIssueVariantById();
- getIssueById();
+function getItem(item) {
+ if (process.client) {
+ return localStorage.getItem(item)
+ } else {
+ return undefined
+ }
+}
+
+watch(deleteBool, confirmDeleteIssueVariant);
+watch(modeChanged, getSession)
+
+onMounted(async () => {
+ getSession();
+ await getIssueVariantById();
+ await getIssueById();
triggerBackendCallsWithDelay(getIssueVariants);
});
@@ -378,6 +399,13 @@ export default {
#nuxt-link {
text-decoration: none;
+}
+
+.nuxt-link-darkmode {
color: white;
}
+
+.nuxt-link-lightmode {
+ color: #000;
+}
\ No newline at end of file
diff --git a/components/server/IssueVariants.vue b/components/server/IssueVariants.vue
index 271ece5..b2ad4de 100644
--- a/components/server/IssueVariants.vue
+++ b/components/server/IssueVariants.vue
@@ -24,7 +24,7 @@
{{ issueVar.name }}
@@ -185,7 +185,7 @@ const newAmount = computed(() => store.state.newAmountII);
const newProperties = computed(() => store.state.newPropertiesII);
const chosenIssueId = computed(() => store.state.chosenIssueId);
-const darkMode = ref(true)
+const darkMode = ref('');
const addRow = ref(false);
const issueVariants = ref([])
const issue = ref({})
@@ -411,9 +411,27 @@ const getAllIssues = async () => {
}
}
-onMounted(() => {
- getIssueVariantsById();
- getIssueById();
+const getSession = async () => {
+ const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
+ if (loggedInUserDarkModeBool == 1) {
+ darkMode.value = true;
+ } else {
+ darkMode.value = false;
+ }
+}
+
+function getItem(item) {
+ if (process.client) {
+ return localStorage.getItem(item)
+ } else {
+ return undefined
+ }
+}
+
+onMounted(async () => {
+ getSession();
+ await getIssueVariantsById();
+ await getIssueById();
triggerBackendCallsWithDelay(getAllIssues);
});
@@ -739,6 +757,13 @@ th {
#nuxt-link {
text-decoration: none;
+}
+
+.nuxt-link-darkmode {
color: white;
}
+
+.nuxt-link-lightmode {
+ color: #000;
+}
\ No newline at end of file
diff --git a/components/server/MaintenanceVisitsInstance.vue b/components/server/MaintenanceVisitsInstance.vue
index 8ca9f50..a69a21e 100644
--- a/components/server/MaintenanceVisitsInstance.vue
+++ b/components/server/MaintenanceVisitsInstance.vue
@@ -69,12 +69,40 @@
-
+
-
-
+
+
-->
\ No newline at end of file
diff --git a/components/server/NetworkSpecifications.vue b/components/server/NetworkSpecifications.vue
index f19f193..227c58f 100644
--- a/components/server/NetworkSpecifications.vue
+++ b/components/server/NetworkSpecifications.vue
@@ -70,16 +70,18 @@
Save
-
+
-
-
+
+
+
-->
\ No newline at end of file
diff --git a/components/server/SoftwareSpecifications.vue b/components/server/SoftwareSpecifications.vue
index f8a39aa..9e6254c 100644
--- a/components/server/SoftwareSpecifications.vue
+++ b/components/server/SoftwareSpecifications.vue
@@ -14,7 +14,8 @@
Version
License
-
+
-
+
{{ item.software }}
@@ -80,15 +82,17 @@
-
+
@@ -185,9 +209,9 @@ onMounted(() => {
export default {
name: "SoftwareSpecifications",
};
-
-
-
+
+
+
-->
\ No newline at end of file
diff --git a/components/server/TemplateChecklist.vue b/components/server/TemplateChecklist.vue
index 560b4b7..f6547dd 100644
--- a/components/server/TemplateChecklist.vue
+++ b/components/server/TemplateChecklist.vue
@@ -42,16 +42,18 @@
- {{ todo.comments
- }}
- {{
+ todo.comments
+ }}
+ -
-
+
{{ newStepTodo }}
@@ -141,7 +143,7 @@
Save
-
+
@@ -428,9 +451,9 @@ onMounted(() => {
export default {
name: "TemplateChecklist",
};
-
-
-
+
+
+
\ No newline at end of file
diff --git a/components/server/UserAppearance.vue b/components/server/UserAppearance.vue
index 5ed77e9..4764b39 100644
--- a/components/server/UserAppearance.vue
+++ b/components/server/UserAppearance.vue
@@ -1,36 +1,142 @@
-
+
-
Mode:
-
Lightmode
-
-
Darkmode
+
Mode:
+
Lightmode
+
+
Darkmode
-
Language:
-
...
+
Language:
+
...
-
-
-
-
+
-
-
-
+
+
+
+
\ No newline at end of file
+ -->
\ No newline at end of file
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 b/documentation/Datenbankmodell.drawio
index 28b2cf5..d541929 100644
--- a/documentation/Datenbankmodell.drawio
+++ b/documentation/Datenbankmodell.drawio
@@ -1,11 +1,11 @@
-
+
-
+
-
+
@@ -19,21 +19,51 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -341,7 +371,7 @@
-
+
@@ -379,21 +409,18 @@
-
+
-
+
-
+
-
+
-
-
-
diff --git a/layouts/Actionbar.vue b/layouts/Actionbar.vue
index 9258f6d..ec1369f 100644
--- a/layouts/Actionbar.vue
+++ b/layouts/Actionbar.vue
@@ -1,126 +1,145 @@
-
-
+
+
-
+
-
- Search
+ Search
-
+
-
- Filter
+ Filter
-
+
-
- Instances
+ Instances
-
+
-
- Solutions
+ Solutions
-
+
-
- Attachments
+ Attachments
-
+
-
- Sell
+ Sell
-
+
-
- Archive
+ Archive
-
+
-
- New
+ New
-
+
-
- Instance
+ Instance
-
-
+
-
- Solution
+ Solution
-
-
- Edit
+ Edit
-
+
-
- Delete
+ Delete
@@ -128,10 +147,11 @@
diff --git a/layouts/Navigationbar.vue b/layouts/Navigationbar.vue
index 2988ba1..401e317 100644
--- a/layouts/Navigationbar.vue
+++ b/layouts/Navigationbar.vue
@@ -1,63 +1,102 @@
-