From 3f88f6b821550e884b646f601a0130e68e6d789a Mon Sep 17 00:00:00 2001 From: "selina.mail" Date: Mon, 25 Mar 2024 23:23:37 +0100 Subject: [PATCH] implemented mode change --- backend/controller/users.js | 3 +- backend/models/usersModel.js | 4 +- components/AssetSearch.vue | 46 ++- components/CustomerSearch.vue | 29 +- components/Dashboard.vue | 41 ++- components/EmployeeSearch.vue | 274 ++++++++++-------- components/IssueStateSearch.vue | 29 +- components/LoginForm.vue | 23 +- components/QuickAccess.vue | 34 ++- components/TemplateSearch.vue | 45 ++- components/server/Accounting.vue | 28 +- components/server/Asset.vue | 40 ++- components/server/AssetSolutionList.vue | 57 +++- components/server/AssetTable.vue | 41 ++- components/server/Customer.vue | 118 ++++++-- components/server/CustomerDepartment.vue | 248 +++++++++------- .../server/CustomerDepartmentEmployeeList.vue | 140 +++++++-- components/server/CustomerDepartmentList.vue | 32 +- components/server/CustomerEmployee.vue | 117 ++++++-- components/server/CustomerEmployeeList.vue | 139 +++++++-- components/server/CustomerQuickAccess.vue | 53 +++- components/server/CustomerTable.vue | 54 +++- components/server/Employee.vue | 28 +- components/server/EmployeeGroups.vue | 29 +- components/server/EmployeeTable.vue | 38 ++- components/server/HardwareSpecifications.vue | 44 ++- components/server/InstanceChecklist.vue | 44 ++- components/server/Issue.vue | 27 +- components/server/IssueSlip.vue | 31 +- components/server/IssueSlipTable.vue | 32 +- components/server/IssueTable.vue | 33 ++- components/server/IssueVariant.vue | 40 ++- components/server/IssueVariants.vue | 35 ++- .../server/MaintenanceVisitsInstance.vue | 38 ++- .../server/MaintenanceVisitsInstanceTable.vue | 46 ++- .../server/MaintenanceVisitsTemplate.vue | 29 +- .../server/MaintenanceVisitsTemplateTable.vue | 47 ++- components/server/NetworkSpecifications.vue | 34 ++- components/server/OrderingInformation.vue | 30 +- .../server/ProductionOrdersInstance.vue | 43 ++- .../server/ProductionOrdersInstanceTable.vue | 44 ++- .../server/ProductionOrdersTemplate.vue | 31 +- .../server/ProductionOrdersTemplateTable.vue | 42 ++- components/server/SoftwareSpecifications.vue | 44 ++- components/server/Solution.vue | 29 +- components/server/SolutionChecklist.vue | 31 +- components/server/SolutionTable.vue | 35 ++- components/server/TemplateChecklist.vue | 55 +++- components/server/TemplateChecklistMVT.vue | 51 +++- components/server/UserAccount.vue | 59 ++-- components/server/UserAppearance.vue | 142 +++++++-- components/server/UserProfile.vue | 95 +++--- documentation/Datenbankmodell.drawio | 9 +- layouts/Actionbar.vue | 105 ++++--- layouts/Navigationbar.vue | 213 ++++++++++---- layouts/PageHeader.vue | 16 +- layouts/default.vue | 37 ++- layouts/empty.vue | 36 ++- pages/assets.vue | 33 ++- pages/customers.vue | 56 +++- pages/employees.vue | 227 ++++++++------- pages/home.vue | 34 ++- pages/index.vue | 46 ++- pages/issueItems.vue | 63 ++-- pages/issueSlips.vue | 38 ++- pages/login.vue | 31 +- pages/maintenanceVisits.vue | 38 ++- pages/productionOrders.vue | 37 ++- pages/settings.vue | 65 +++-- pages/solutions.vue | 33 ++- plugins/vuex.js | 8 +- 71 files changed, 3020 insertions(+), 1006 deletions(-) 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 @@ - - - + + +