diff --git a/backend/controller/users.js b/backend/controller/users.js index 3614c65..b03806e 100644 --- a/backend/controller/users.js +++ b/backend/controller/users.js @@ -41,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, technicianBool, readerBool) 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, @@ -56,6 +56,7 @@ export const signUp = async (req, res, next) => { req.body.adminBool, req.body.technicianBool, req.body.readerBool, + req.body.darkModeBool, ]); return res.status(201).send({ message: "Registered!", diff --git a/backend/models/usersModel.js b/backend/models/usersModel.js index 41fd66b..321acaf 100644 --- a/backend/models/usersModel.js +++ b/backend/models/usersModel.js @@ -46,8 +46,8 @@ export const getSelectedUsersByUser = async (selected, result) => { 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 = ? 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, 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); } 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 +} + +watch(modeChanged, getSession) + +onMounted(async () => { + await getSession(); +}); + + + + + \ 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 + \ 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/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 @@
-
Notes:
+
Notes:
...
- - - - - + + + \ 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 @@ - - - - + \ 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 @@ - - - - + + - \ 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:
- - - - + + + + - - - - + + + +
IDNameDepartment / Job TitlePronouns + 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 @@

Quick Access

- - + + - +
- - - - - + + + \ No newline at end of file +} + \ No newline at end of file diff --git a/components/server/Employee.vue b/components/server/Employee.vue index 7b38a4a..319d679 100644 --- a/components/server/Employee.vue +++ b/components/server/Employee.vue @@ -138,12 +138,14 @@ import { useStore } from 'vuex'; import { computed } from 'vue'; const store = useStore(); +const modeChanged = computed(() => store.state.updateDarkMode); + const editable = computed(() => store.state.editable); const chosenEmployeeId = computed(() => store.state.chosenEmployeeId); const deleteBool = computed(() => store.state.deleteBool); const addBool = computed(() => store.state.new); -const darkMode = ref(true); +const darkMode = ref(''); const employee = ref({}); const newUsername = ref(''); @@ -287,8 +289,28 @@ const validatePostcode = (postcode) => { watch(deleteBool, confirmDeleteEmployee); -onMounted(() => { - getEmployeeById(); +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 () => { + await getSession(); + await getEmployeeById(); }); diff --git a/components/server/EmployeeGroups.vue b/components/server/EmployeeGroups.vue index 6e59e50..95c394a 100644 --- a/components/server/EmployeeGroups.vue +++ b/components/server/EmployeeGroups.vue @@ -48,13 +48,15 @@ @@ -223,6 +244,13 @@ th { #nuxt-link { text-decoration: none; +} + +.nuxt-link-darkmode { color: white; } + +.nuxt-link-lightmode { + color: #000; +} 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 @@ - + @@ -213,9 +237,9 @@ onMounted(() => { export default { name: "HardwareSpecifications", }; - + + - \ 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 +} + +watch(modeChanged, getSession) + +onMounted(async () => { + await getSession(); +}); + + + + + \ No newline at end of file diff --git a/pages/home.vue b/pages/home.vue index bc40e21..edfb10e 100644 --- a/pages/home.vue +++ b/pages/home.vue @@ -2,7 +2,7 @@
-
Home
+
Home
@@ -13,18 +13,46 @@ - - - + + +