Restructuring
This commit is contained in:
@@ -10,24 +10,9 @@ const profileStore = useProfileStore()
|
|||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const toast = useToast()
|
|
||||||
|
|
||||||
const availableDocuments = ref([])
|
|
||||||
const setup = async () => {
|
|
||||||
let filetype = (await supabase.from("filetags").select().eq("tenant",profileStore.currentTenant).eq("incomingDocumentType","invoices").single()).data.id
|
|
||||||
console.log(filetype)
|
|
||||||
let ids = (await supabase.from("files").select("id").eq("tenant",profileStore.currentTenant).eq("type", filetype)).data.map(i => i.id)
|
|
||||||
availableDocuments.value = await useFiles().selectSomeDocuments(ids)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
setup()
|
|
||||||
|
|
||||||
|
|
||||||
//let currentDocument = ref(null)
|
|
||||||
//Working
|
//Working
|
||||||
const mode = ref(route.params.mode || "show")
|
const mode = ref(route.params.mode || "show")
|
||||||
const useNetMode = ref(false)
|
|
||||||
|
|
||||||
const itemInfo = ref({
|
const itemInfo = ref({
|
||||||
vendor: 0,
|
vendor: 0,
|
||||||
@@ -56,19 +41,16 @@ const itemInfo = ref({
|
|||||||
|
|
||||||
const currentDocument = ref(null)
|
const currentDocument = ref(null)
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
if((mode.value === "show" || mode.value === "edit" ) && route.params.id){
|
if((mode.value === "show") && route.params.id){
|
||||||
itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*)")
|
itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*), vendor(*)")
|
||||||
currentDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
currentDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
||||||
}
|
}
|
||||||
console.log(itemInfo.value)
|
loading.value = false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const setState = async (newState) => {
|
const setState = async (newState) => {
|
||||||
if(mode.value === 'show') {
|
if(mode.value === 'show') {
|
||||||
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
|
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
|
||||||
@@ -95,7 +77,7 @@ setupPage()
|
|||||||
</UButton>
|
</UButton>
|
||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UDashboardPanelContent>
|
<UDashboardPanelContent v-if="!loading">
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex justify-between mt-5"
|
class="flex justify-between mt-5"
|
||||||
@@ -111,7 +93,7 @@ setupPage()
|
|||||||
<p>Status: {{itemInfo.state}}</p>
|
<p>Status: {{itemInfo.state}}</p>
|
||||||
<p>Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}</p>
|
<p>Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}</p>
|
||||||
<p>Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}</p>
|
<p>Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}</p>
|
||||||
<p v-if="itemInfo.vendor">Lieferant: <nuxt-link :to="`/standardEntity/vendors/show/${itemInfo.vendor}`">{{dataStore.getVendorById(itemInfo.vendor).name}}</nuxt-link></p>
|
<p v-if="itemInfo.vendor">Lieferant: <nuxt-link :to="`/standardEntity/vendors/show/${itemInfo.vendor}`">{{itemInfo.vendor.name}}</nuxt-link></p>
|
||||||
<p>Bezahlt: {{itemInfo.paid ? "Ja" : "Nein"}}</p>
|
<p>Bezahlt: {{itemInfo.paid ? "Ja" : "Nein"}}</p>
|
||||||
<p>Beschreibung: {{itemInfo.description}}</p>
|
<p>Beschreibung: {{itemInfo.description}}</p>
|
||||||
|
|
||||||
@@ -130,6 +112,7 @@ setupPage()
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</UDashboardPanelContent>
|
</UDashboardPanelContent>
|
||||||
|
<UProgress class="mt-3 mx-3" v-else animation="carousel"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user