Fixed Accounts for new Backend
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {useSupabaseSelect} from "~/composables/useSupabase.js";
|
|
||||||
|
|
||||||
defineShortcuts({
|
defineShortcuts({
|
||||||
'/': () => {
|
'/': () => {
|
||||||
@@ -11,16 +10,14 @@ defineShortcuts({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const profileStore = useProfileStore()
|
|
||||||
const tempStore = useTempStore()
|
const tempStore = useTempStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const supabase = useSupabaseClient()
|
|
||||||
|
|
||||||
const items = ref([])
|
const items = ref([])
|
||||||
const dataLoaded = ref(false)
|
const dataLoaded = ref(false)
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
items.value = (await supabase.from("accounts").select("*").order("number", {ascending:true})).data
|
items.value = await useEntities("accounts").selectSpecial()
|
||||||
|
|
||||||
items.value = await Promise.all(items.value.map(async (i) => {
|
items.value = await Promise.all(items.value.map(async (i) => {
|
||||||
let renderedAllocationsTemp = await renderedAllocations(i.id)
|
let renderedAllocationsTemp = await renderedAllocations(i.id)
|
||||||
@@ -40,8 +37,8 @@ const setupPage = async () => {
|
|||||||
|
|
||||||
const renderedAllocations = async (account) => {
|
const renderedAllocations = async (account) => {
|
||||||
|
|
||||||
let statementallocations = (await supabase.from("statementallocations").select("*, bs_id(*)").eq("account", account).eq("tenant",profileStore.currentTenant).order("created_at",{ascending: true})).data
|
let statementallocations = (await useEntities("statementallocations").select("*, bs_id(*)")).filter(i => i.account === account)
|
||||||
let incominginvoices = (await useSupabaseSelect("incominginvoices", "*, vendor(*)")).filter(i => i.accounts.find(x => x.account === account))
|
let incominginvoices = (await useEntities("incominginvoices").select("*, vendor(*)")).filter(i => i.accounts.find(x => x.account === account))
|
||||||
|
|
||||||
let tempstatementallocations = statementallocations.map(i => {
|
let tempstatementallocations = statementallocations.map(i => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -3,19 +3,17 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {useSupabaseSelect} from "~/composables/useSupabase.js";
|
import {useSupabaseSelect} from "~/composables/useSupabase.js";
|
||||||
|
|
||||||
const supabase = useSupabaseClient()
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const profileStore = useProfileStore()
|
|
||||||
|
|
||||||
const itemInfo = ref(null)
|
const itemInfo = ref(null)
|
||||||
const statementallocations = ref([])
|
const statementallocations = ref([])
|
||||||
const incominginvoices = ref([])
|
const incominginvoices = ref([])
|
||||||
|
|
||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
itemInfo.value = (await supabase.from("accounts").select("*").eq("id",route.params.id).single()).data
|
itemInfo.value = (await useEntities("accounts").selectSpecial("*")).find(i => i.id === Number(route.params.id))
|
||||||
statementallocations.value = (await supabase.from("statementallocations").select("*, bs_id(*)").eq("account", route.params.id).eq("tenant",profileStore.currentTenant).order("created_at",{ascending: true})).data
|
statementallocations.value = (await useEntities("statementallocations").select("*, bs_id(*)")).filter(i => i.account === Number(route.params.id))
|
||||||
incominginvoices.value = (await useSupabaseSelect("incominginvoices", "*, vendor(*)")).filter(i => i.accounts.find(x => x.account == route.params.id))
|
incominginvoices.value = (await useEntities("incominginvoices").select("*, vendor(*)")).filter(i => i.accounts.find(x => x.account === Number(route.params.id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
setup()
|
setup()
|
||||||
|
|||||||
Reference in New Issue
Block a user