Introduced OwnAccounts
Introduced CostCentres Rebuild Added EntityModalButtons to IncomingInvoice Create
This commit is contained in:
@@ -31,6 +31,7 @@ const allocatedIncomingInvoices = ref([])
|
||||
const createddocuments = ref([])
|
||||
|
||||
const accounts = ref([])
|
||||
const ownaccounts = ref([])
|
||||
|
||||
const loading = ref(true)
|
||||
const setup = async () => {
|
||||
@@ -46,6 +47,7 @@ const setup = async () => {
|
||||
const incominginvoices = (await useSupabaseSelect("incominginvoices","*, statementallocations(*), vendor(id,name)")).filter(i => i.state === "Gebucht")
|
||||
|
||||
accounts.value = (await supabase.from("accounts").select()).data
|
||||
ownaccounts.value = (await supabase.from("ownaccounts").select()).data
|
||||
|
||||
openDocuments.value = documents.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== useSum().getCreatedDocumentSum(i,createddocuments.value).toFixed(2))
|
||||
openDocuments.value = openDocuments.value.map(i => {
|
||||
@@ -118,6 +120,7 @@ const saveAllocations = async () => {
|
||||
|
||||
const showAccountSelection = ref(false)
|
||||
const accountToSave = ref("")
|
||||
const ownAccountToSave = ref("")
|
||||
|
||||
const selectAccount = (id) => {
|
||||
accountToSave.value = id
|
||||
@@ -376,6 +379,24 @@ setup()
|
||||
@click="removeAllocation(item.id)"
|
||||
/>
|
||||
</UCard>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
v-for="item in itemInfo.statementallocations.filter(i => i.ownaccount)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>{{ownaccounts.find(i => i.id === item.ownaccount).number}} - {{ownaccounts.find(i => i.id === item.ownaccount).name}}</span>
|
||||
<span class="font-semibold text-nowrap">{{displayCurrency(item.amount)}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
class="mr-3"
|
||||
@click="removeAllocation(item.id)"
|
||||
/>
|
||||
</UCard>
|
||||
<UCard
|
||||
class="mt-5"
|
||||
:ui="{ring: itemInfo.statementallocations.find(i => i.cd_id === item.cd_id) ? 'ring-primary-500' : 'ring-gray-200 dark:ring-gray-800'}"
|
||||
@@ -452,77 +473,124 @@ setup()
|
||||
|
||||
<div class="w-2/5 mx-auto">
|
||||
<div class="px-2">
|
||||
<UDivider class="my-3">Ohne Beleg buchen</UDivider>
|
||||
<UDivider class="my-3">Buchungssumme</UDivider>
|
||||
|
||||
<InputGroup class="mt-3 w-full">
|
||||
<USelectMenu
|
||||
class="w-full"
|
||||
:options="accounts"
|
||||
value-attribute="id"
|
||||
option-attribute="label"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
v-model="accountToSave"
|
||||
searchable
|
||||
:search-attributes="['number','label']"
|
||||
>
|
||||
<template #label>
|
||||
<span v-if="accountToSave">{{accounts.find(i => i.id === accountToSave).number}} - {{accounts.find(i => i.id === accountToSave).label}}</span>
|
||||
<span v-else>Kein Konto ausgewählt</span>
|
||||
</template>
|
||||
<template #option="{option}">
|
||||
{{option.number}} - {{option.label}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UInput
|
||||
<UInput
|
||||
v-model="manualAllocationSum"
|
||||
type="number"
|
||||
step="0.01"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||
</template>
|
||||
</UInput>
|
||||
<UButton
|
||||
@click="showAccountSelection = true"
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
variant="outline"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-check"
|
||||
:disabled="!accountToSave"
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, account: accountToSave })"
|
||||
/>
|
||||
<UButton
|
||||
@click="accountToSave = ''"
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
/>
|
||||
</InputGroup>
|
||||
<UModal
|
||||
v-model="showAccountSelection"
|
||||
>
|
||||
<UCard>
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||
Konto auswählen
|
||||
</h3>
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAccountSelection = false" />
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
v-for="selectableAccount in accounts"
|
||||
variant="outline"
|
||||
class="m-3"
|
||||
@click="selectAccount(selectableAccount.id)"
|
||||
>
|
||||
{{selectableAccount.label}}
|
||||
</UButton>
|
||||
</UCard>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||
</template>
|
||||
</UInput>
|
||||
|
||||
<UDivider class="my-3">Ohne Beleg buchen</UDivider>
|
||||
|
||||
<UFormGroup
|
||||
label="Buchungskonten"
|
||||
class="mt-3"
|
||||
>
|
||||
<InputGroup class="mt-3 w-full">
|
||||
<USelectMenu
|
||||
class="w-full"
|
||||
:options="accounts"
|
||||
value-attribute="id"
|
||||
option-attribute="label"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
v-model="accountToSave"
|
||||
searchable
|
||||
:search-attributes="['number','label']"
|
||||
>
|
||||
<template #label>
|
||||
<span v-if="accountToSave">{{accounts.find(i => i.id === accountToSave).number}} - {{accounts.find(i => i.id === accountToSave).label}}</span>
|
||||
<span v-else>Kein Konto ausgewählt</span>
|
||||
</template>
|
||||
<template #option="{option}">
|
||||
{{option.number}} - {{option.label}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
@click="showAccountSelection = true"
|
||||
icon="i-heroicons-magnifying-glass"
|
||||
variant="outline"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-check"
|
||||
:disabled="!accountToSave"
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, account: accountToSave })"
|
||||
/>
|
||||
<UButton
|
||||
@click="accountToSave = ''"
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
/>
|
||||
</InputGroup>
|
||||
<UModal
|
||||
v-model="showAccountSelection"
|
||||
>
|
||||
<UCard>
|
||||
<template #header>
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
|
||||
Konto auswählen
|
||||
</h3>
|
||||
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showAccountSelection = false" />
|
||||
</div>
|
||||
</template>
|
||||
<UButton
|
||||
v-for="selectableAccount in accounts"
|
||||
variant="outline"
|
||||
class="m-3"
|
||||
@click="selectAccount(selectableAccount.id)"
|
||||
>
|
||||
{{selectableAccount.label}}
|
||||
</UButton>
|
||||
</UCard>
|
||||
|
||||
</UModal>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="zusätzliche Buchungskonten"
|
||||
class="mt-3"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<USelectMenu
|
||||
class="w-full"
|
||||
:options="ownaccounts"
|
||||
value-attribute="id"
|
||||
option-attribute="label"
|
||||
:ui-menu="{ width: 'min-w-max' }"
|
||||
v-model="ownAccountToSave"
|
||||
searchable
|
||||
:search-attributes="['number','label']"
|
||||
>
|
||||
<template #label>
|
||||
<span v-if="ownAccountToSave">{{ownaccounts.find(i => i.id === ownAccountToSave).number}} - {{ownaccounts.find(i => i.id === ownAccountToSave).name}}</span>
|
||||
<span v-else>Kein Konto ausgewählt</span>
|
||||
</template>
|
||||
<template #option="{option}">
|
||||
{{option.number}} - {{option.name}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
variant="outline"
|
||||
icon="i-heroicons-check"
|
||||
:disabled="!ownAccountToSave"
|
||||
@click="saveAllocation({bs_id: itemInfo.id, amount: manualAllocationSum, ownaccount: ownAccountToSave })"
|
||||
/>
|
||||
<UButton
|
||||
@click="accountToSave = ''"
|
||||
icon="i-heroicons-x-mark"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
/>
|
||||
</InputGroup>
|
||||
</UFormGroup>
|
||||
|
||||
|
||||
</UModal>
|
||||
|
||||
<UDivider
|
||||
class="my-3"
|
||||
|
||||
Reference in New Issue
Block a user