implemented mode change
This commit is contained in:
@ -3,7 +3,8 @@
|
||||
<div id="content-header">
|
||||
<router-link to="/maintenanceVisits" class="button" id="maintenanceVisits-button"
|
||||
@click="defaultMasterChecklistPage()">
|
||||
<h1 :class="[darkMode ? 'h1-darkmode' : 'h1-lightmode']" id="active-page-name">Maintenance visits</h1>
|
||||
<h1 :class="[loggedInUserDarkModeBoolean ? 'h1-darkmode' : 'h1-lightmode']" id="active-page-name">Maintenance
|
||||
visits</h1>
|
||||
</router-link>
|
||||
|
||||
|
||||
@ -23,7 +24,8 @@
|
||||
|
||||
<router-link to="/productionOrders" class="button" id="productionOrders-button"
|
||||
@click="defaultMasterChecklistPage()">
|
||||
<h1 :class="[darkMode ? 'h1-darkmode' : 'h1-lightmode']" id="page-name">Production orders</h1>
|
||||
<h1 :class="[loggedInUserDarkModeBoolean ? 'h1-darkmode' : 'h1-lightmode']" id="page-name">Production orders
|
||||
</h1>
|
||||
</router-link>
|
||||
</div>
|
||||
<div id="content-body">
|
||||
@ -42,11 +44,9 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import CustomerSearch from "../components/CustomerSearch.vue";
|
||||
import MaintenanceVisitsTemplateTable from "../components/server/MaintenanceVisitsTemplateTable.vue";
|
||||
// import MaintenanceVisitsTemplateTableNoCustomer from "../components/server/MaintenanceVisitsTemplateTableNoCustomer.vue";
|
||||
import MaintenanceVisitsTemplate from "../components/server/MaintenanceVisitsTemplate.vue";
|
||||
import TemplateChecklistMVT from "../components/server/TemplateChecklistMVT.vue";
|
||||
import TemplateSearch from "../components/TemplateSearch.vue";
|
||||
@ -57,23 +57,45 @@ import { useStore } from 'vuex';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const store = useStore();
|
||||
const modeChanged = computed(() => store.state.updateDarkMode);
|
||||
const onTemplatelist = computed(() => store.state.onTemplatelist);
|
||||
// const onCustomerTemplatelist = computed(() => store.state.onCustomerTemplatelist);
|
||||
const onTemplate = computed(() => store.state.onTemplate);
|
||||
const onInstancelist = computed(() => store.state.onInstancelist);
|
||||
const onInstance = computed(() => store.state.onInstance);
|
||||
const loggedInUserDarkModeBoolean = ref('');
|
||||
|
||||
definePageMeta({
|
||||
layout: 'default',
|
||||
title: 'Maintenance Visits'
|
||||
})
|
||||
|
||||
const darkMode = ref(true)
|
||||
|
||||
const defaultMasterChecklistPage = () => {
|
||||
store.commit('resetStore');
|
||||
store.commit('changeToTemplatelist')
|
||||
}
|
||||
|
||||
const getSession = async () => {
|
||||
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
|
||||
if (loggedInUserDarkModeBool == 1) {
|
||||
loggedInUserDarkModeBoolean.value = true;
|
||||
} else {
|
||||
loggedInUserDarkModeBoolean.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getItem(item) {
|
||||
if (process.client) {
|
||||
return localStorage.getItem(item)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
watch(modeChanged, getSession)
|
||||
|
||||
onMounted(async () => {
|
||||
await getSession();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user