implemented mode change

This commit is contained in:
2024-03-25 23:23:37 +01:00
parent 45a4b58f26
commit 3f88f6b821
71 changed files with 3020 additions and 1006 deletions

View File

@ -1,7 +1,7 @@
<template>
<section v-if="!addBool" :class="['information', darkMode ? 'section-darkmode' : 'section-lightmode']">
<h2 v-if="!editable" :class="['asset-name', darkMode ? 'h2-darkmode' : 'h2-lightmode']">{{
item.assetName }}</h2>
item.assetName }}</h2>
<input v-if="editable" v-model="item.assetName" @change="updateConfigItem()"
:class="['data', 'asset-name-input', darkMode ? 'h2-darkmode' : 'h2-lightmode', darkMode ? 'h2-input-darkmode' : 'h2-input-lightmode', 'input']">
<div class="asset-data">
@ -144,7 +144,7 @@
</div>
</section>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js';
@ -153,12 +153,15 @@ import { useStore } from 'vuex';
import { computed } from 'vue';
const store = useStore();
const modeChanged = computed(() => store.state.updateDarkMode);
const editable = computed(() => store.state.editable);
const chosenAssetId = computed(() => store.state.chosenAssetId);
const deleteBool = computed(() => store.state.deleteBool);
const addBool = computed(() => store.state.new);
const darkMode = ref(true);
const darkMode = ref('');
const item = ref({});
const customer = ref({});
const configItems = ref([]);
@ -331,11 +334,30 @@ const triggerBackendCallsWithDelay = async (fetchDataFunc) => {
}, 1500);
}
watch(deleteBool, confirmDeleteAsset);
const getSession = async () => {
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
if (loggedInUserDarkModeBool == 1) {
darkMode.value = true;
} else {
darkMode.value = false;
}
}
onMounted(() => {
getItemById();
getConfigItems();
function getItem(item) {
if (process.client) {
return localStorage.getItem(item)
} else {
return undefined
}
}
watch(deleteBool, confirmDeleteAsset);
watch(modeChanged, getSession)
onMounted(async () => {
await getSession();
await getItemById();
triggerBackendCallsWithDelay(getConfigItems);
triggerBackendCallsWithDelay(getCustomers);
});
</script>
@ -345,8 +367,8 @@ export default {
name: "Asset",
}
</script>
<style scoped>
.information {
display: flex;