mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix dark mode in item row and switch issue
This commit is contained in:
@ -30,7 +30,22 @@
|
|||||||
<template v-if="userStore.hasAbilities(ability)" #action>
|
<template v-if="userStore.hasAbilities(ability)" #action>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="flex items-center justify-center w-full px-2 py-2 bg-gray-200 border-none outline-none cursor-pointer "
|
class="
|
||||||
|
flex
|
||||||
|
items-center
|
||||||
|
justify-center
|
||||||
|
w-full
|
||||||
|
px-2
|
||||||
|
py-2
|
||||||
|
bg-gray-200
|
||||||
|
border-none
|
||||||
|
outline-none
|
||||||
|
cursor-pointer
|
||||||
|
dark:bg-gray-600/70
|
||||||
|
dark:backdrop-blur-xl
|
||||||
|
dark:shadow-glass
|
||||||
|
dark:hover:bg-gray-600/80
|
||||||
|
"
|
||||||
@click="openTaxModal"
|
@click="openTaxModal"
|
||||||
>
|
>
|
||||||
<BaseIcon name="CheckCircleIcon" class="h-5 text-primary-400" />
|
<BaseIcon name="CheckCircleIcon" class="h-5 text-primary-400" />
|
||||||
@ -53,7 +68,7 @@
|
|||||||
<BaseIcon
|
<BaseIcon
|
||||||
v-if="taxes.length && index !== taxes.length - 1"
|
v-if="taxes.length && index !== taxes.length - 1"
|
||||||
name="TrashIcon"
|
name="TrashIcon"
|
||||||
class="h-5 text-gray-700 cursor-pointer"
|
class="h-5 text-gray-700 dark:text-red-400 cursor-pointer"
|
||||||
@click="removeTax(index)"
|
@click="removeTax(index)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,10 +15,12 @@
|
|||||||
<thead
|
<thead
|
||||||
class="
|
class="
|
||||||
bg-white
|
bg-white
|
||||||
border border-gray-200 border-solid
|
border
|
||||||
|
border-gray-200
|
||||||
|
border-solid
|
||||||
dark:shadow-glass dark:border dark:border-white/10 dark:bg-gray-800/70
|
dark:shadow-glass dark:border dark:border-white/10 dark:bg-gray-800/70
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-left" :class="theadClass">
|
<th class="text-left" :class="theadClass">
|
||||||
<BaseContentPlaceholders v-if="isLoading">
|
<BaseContentPlaceholders v-if="isLoading">
|
||||||
@ -28,7 +30,19 @@
|
|||||||
{{ $tc('items.item', 2) }}
|
{{ $tc('items.item', 2) }}
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-right" :class="theadClass">
|
<th
|
||||||
|
class="
|
||||||
|
px-5
|
||||||
|
py-3
|
||||||
|
text-sm
|
||||||
|
not-italic
|
||||||
|
font-medium
|
||||||
|
leading-5
|
||||||
|
text-right text-gray-700
|
||||||
|
border-t border-b border-gray-200 border-solid
|
||||||
|
dark:text-white dark:border-white/10
|
||||||
|
"
|
||||||
|
>
|
||||||
<BaseContentPlaceholders v-if="isLoading">
|
<BaseContentPlaceholders v-if="isLoading">
|
||||||
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
||||||
</BaseContentPlaceholders>
|
</BaseContentPlaceholders>
|
||||||
@ -36,7 +50,19 @@
|
|||||||
{{ $t('invoices.item.quantity') }}
|
{{ $t('invoices.item.quantity') }}
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-left" :class="theadClass">
|
<th
|
||||||
|
class="
|
||||||
|
px-5
|
||||||
|
py-3
|
||||||
|
text-sm
|
||||||
|
not-italic
|
||||||
|
font-medium
|
||||||
|
leading-5
|
||||||
|
text-left text-gray-700
|
||||||
|
border-t border-b border-gray-200 border-solid
|
||||||
|
dark:text-white dark:border-white/10
|
||||||
|
"
|
||||||
|
>
|
||||||
<BaseContentPlaceholders v-if="isLoading">
|
<BaseContentPlaceholders v-if="isLoading">
|
||||||
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
||||||
</BaseContentPlaceholders>
|
</BaseContentPlaceholders>
|
||||||
@ -45,9 +71,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
v-if="store[storeProp].discount_per_item_enabled"
|
v-if="store[storeProp].discount_per_item === 'YES'"
|
||||||
class="text-left"
|
class="
|
||||||
:class="theadClass"
|
px-5
|
||||||
|
py-3
|
||||||
|
text-sm
|
||||||
|
not-italic
|
||||||
|
font-medium
|
||||||
|
leading-5
|
||||||
|
text-left text-gray-700
|
||||||
|
border-t border-b border-gray-200 border-solid
|
||||||
|
dark:text-white dark:border-white/10
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<BaseContentPlaceholders v-if="isLoading">
|
<BaseContentPlaceholders v-if="isLoading">
|
||||||
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
||||||
@ -56,7 +91,19 @@
|
|||||||
{{ $t('invoices.item.discount') }}
|
{{ $t('invoices.item.discount') }}
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-right" :class="theadClass">
|
<th
|
||||||
|
class="
|
||||||
|
px-5
|
||||||
|
py-3
|
||||||
|
text-sm
|
||||||
|
not-italic
|
||||||
|
font-medium
|
||||||
|
leading-5
|
||||||
|
text-right text-gray-700
|
||||||
|
border-t border-b border-gray-200 border-solid
|
||||||
|
dark:text-white dark:border-white/10
|
||||||
|
"
|
||||||
|
>
|
||||||
<BaseContentPlaceholders v-if="isLoading">
|
<BaseContentPlaceholders v-if="isLoading">
|
||||||
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
<BaseContentPlaceholdersText :lines="1" class="w-16 h-5" />
|
||||||
</BaseContentPlaceholders>
|
</BaseContentPlaceholders>
|
||||||
@ -116,7 +163,6 @@ import { useCompanyStore } from '@/scripts/admin/stores/company'
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
import Item from './CreateItemRow.vue'
|
import Item from './CreateItemRow.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
store: {
|
store: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -138,15 +184,8 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
theadClass: {
|
|
||||||
type: String,
|
|
||||||
default: `px-5 py-3 text-sm not-italic font-medium leading-5
|
|
||||||
text-gray-700 border-t border-b border-gray-200 border-solid dark:text-white dark:border-white/10`
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const companyStore = useCompanyStore()
|
const companyStore = useCompanyStore()
|
||||||
|
|
||||||
const defaultCurrency = computed(() => {
|
const defaultCurrency = computed(() => {
|
||||||
if (props.currency) {
|
if (props.currency) {
|
||||||
return props.currency
|
return props.currency
|
||||||
|
|||||||
@ -68,10 +68,8 @@
|
|||||||
</TransitionChild>
|
</TransitionChild>
|
||||||
<div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto">
|
<div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto">
|
||||||
<div class="flex items-center shrink-0 px-4 mb-10">
|
<div class="flex items-center shrink-0 px-4 mb-10">
|
||||||
<MainLogo
|
<img class="h-auto max-w-full w-36 hidden dark:block" :src="getDarkLogo"/>
|
||||||
class="block h-auto max-w-full w-36 text-primary-400"
|
<img class="h-auto max-w-full w-36 block dark:hidden" :src="getLightLogo"/>
|
||||||
alt="Crater Logo"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav
|
<nav
|
||||||
@ -167,8 +165,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import MainLogo from '@/scripts/components/icons/MainLogo.vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogOverlay,
|
DialogOverlay,
|
||||||
@ -183,6 +180,9 @@ import LightDarkSwitch from '@/scripts/components/LightDarkSwitcher.vue'
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
const getDarkLogo = computed(() => new URL('/img/logo-white.png', import.meta.url))
|
||||||
|
const getLightLogo = computed(() => new URL('/img/crater-logo.png', import.meta.url))
|
||||||
|
|
||||||
function hasActiveUrl(url) {
|
function hasActiveUrl(url) {
|
||||||
return route.path.indexOf(url) > -1
|
return route.path.indexOf(url) > -1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,7 @@ export const useGlobalStore = (useWindow = false) => {
|
|||||||
isAppLoaded: false,
|
isAppLoaded: false,
|
||||||
isSidebarOpen: false,
|
isSidebarOpen: false,
|
||||||
areCurrenciesLoading: false,
|
areCurrenciesLoading: false,
|
||||||
isDarkModeOn: false,
|
isDarkModeOn: localStorage.getItem('theme') === 'dark' || document.documentElement.classList.contains('dark'),
|
||||||
|
|
||||||
downloadReport: null,
|
downloadReport: null,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@ -24,14 +24,6 @@ import { useGlobalStore } from '@/scripts/customer/stores/global'
|
|||||||
|
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
const enabled = computed(
|
|
||||||
()=>
|
|
||||||
localStorage.getItem('theme') === 'dark' ||
|
|
||||||
document.documentElement.classList.contains('dark')
|
|
||||||
)
|
|
||||||
|
|
||||||
globalStore.isDarkModeOn = enabled.value
|
|
||||||
|
|
||||||
function onChange() {
|
function onChange() {
|
||||||
globalStore.isDarkModeOn = !globalStore.isDarkModeOn
|
globalStore.isDarkModeOn = !globalStore.isDarkModeOn
|
||||||
|
|
||||||
@ -43,7 +35,6 @@ function onChange() {
|
|||||||
localStorage.theme = 'light'
|
localStorage.theme = 'light'
|
||||||
document.documentElement.classList.remove('dark')
|
document.documentElement.classList.remove('dark')
|
||||||
document.documentElement.style.setProperty('color-scheme', 'light')
|
document.documentElement.style.setProperty('color-scheme', 'light')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -16,26 +16,22 @@ defineProps({
|
|||||||
|
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
const enabled = ref(
|
const enabled = computed({
|
||||||
localStorage.getItem('theme') === 'dark' ||
|
get: () => globalStore.isDarkModeOn,
|
||||||
document.documentElement.classList.contains('dark')
|
set: (value) => {
|
||||||
)
|
console.log(value)
|
||||||
|
if (value) {
|
||||||
globalStore.isDarkModeOn = enabled
|
localStorage.theme = 'dark'
|
||||||
|
document.documentElement.classList.add('dark')
|
||||||
function onChange(val) {
|
document.documentElement.style.setProperty('color-scheme', 'dark')
|
||||||
if (val) {
|
} else {
|
||||||
localStorage.theme = 'dark'
|
localStorage.theme = 'light'
|
||||||
document.documentElement.classList.add('dark')
|
document.documentElement.classList.remove('dark')
|
||||||
document.documentElement.style.setProperty('color-scheme', 'dark')
|
document.documentElement.style.setProperty('color-scheme', 'light')
|
||||||
globalStore.isDarkModeOn = true
|
}
|
||||||
} else {
|
globalStore.isDarkModeOn = value
|
||||||
localStorage.theme = 'light'
|
},
|
||||||
document.documentElement.classList.remove('dark')
|
})
|
||||||
document.documentElement.style.setProperty('color-scheme', 'light')
|
|
||||||
globalStore.isDarkModeOn = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -49,7 +45,6 @@ function onChange(val) {
|
|||||||
v-model="enabled"
|
v-model="enabled"
|
||||||
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 dark:ring-offset-gray-700"
|
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 dark:ring-offset-gray-700"
|
||||||
:class="[enabled ? 'bg-primary-600' : 'bg-gray-200']"
|
:class="[enabled ? 'bg-primary-600' : 'bg-gray-200']"
|
||||||
@update:modelValue="onChange"
|
|
||||||
>
|
>
|
||||||
<span class="sr-only">Use setting</span>
|
<span class="sr-only">Use setting</span>
|
||||||
<span
|
<span
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export const useGlobalStore = defineStore({
|
|||||||
companySlug: '',
|
companySlug: '',
|
||||||
mainMenu: null,
|
mainMenu: null,
|
||||||
enabledModules: [],
|
enabledModules: [],
|
||||||
isDarkModeOn: false
|
isDarkModeOn: localStorage.getItem('theme') === 'dark' || document.documentElement.classList.contains('dark')
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user