Many Changes

Introduced Plants
Some Polishing
Some Resources got Query Params
Extended GlobalSearch.vue
Removed Jobs
This commit is contained in:
2024-01-05 18:06:09 +01:00
parent 991cac18f2
commit 61793838bb
19 changed files with 1166 additions and 542 deletions

View File

@@ -36,7 +36,6 @@ export const useDataStore = defineStore('data', () => {
const movements = ref([])
const forms = ref([])
const contracts = ref([])
const jobs = ref([])
const formSubmits = ref([])
const contacts = ref([])
const vehicles = ref([])
@@ -50,6 +49,7 @@ export const useDataStore = defineStore('data', () => {
const absenceRequests = ref([])
const accounts = ref([])
const taxTypes = ref([])
const plants = ref([])
async function fetchData () {
fetchDocuments()
@@ -59,7 +59,6 @@ export const useDataStore = defineStore('data', () => {
await fetchTasks()
await fetchProjects()
await fetchTimes()
await fetchJobs()
await fetchCustomers()
await fetchContracts()
await fetchContacts()
@@ -81,6 +80,7 @@ export const useDataStore = defineStore('data', () => {
await fetchAbsenceRequests()
await fetchAccounts()
await fetchTaxTypes()
await fetchPlants()
loaded.value = true
}
@@ -101,7 +101,6 @@ export const useDataStore = defineStore('data', () => {
movements.value= []
forms.value= []
contracts.value= []
jobs.value= []
formSubmits.value= []
contacts.value= []
vehicles.value= []
@@ -115,6 +114,7 @@ export const useDataStore = defineStore('data', () => {
absenceRequests.value = []
accounts.value = []
taxTypes.value = []
plants.value = []
}
async function fetchOwnTenant () {
@@ -172,9 +172,6 @@ export const useDataStore = defineStore('data', () => {
async function fetchTimes () {
times.value = (await supabase.from("times").select()).data
}
async function fetchJobs () {
jobs.value = (await supabase.from("jobs").select()).data
}
async function fetchHistoryItems () {
historyItems.value = (await supabase.from("historyItems").select()).data
}
@@ -199,6 +196,9 @@ export const useDataStore = defineStore('data', () => {
async function fetchTaxTypes () {
taxTypes.value = (await supabase.from("taxTypes").select()).data
}
async function fetchPlants () {
plants.value = (await supabase.from("plants").select()).data
}
async function fetchDocuments () {
documents.value = (await supabase.from("documents").select()).data
@@ -383,8 +383,8 @@ export const useDataStore = defineStore('data', () => {
return customers.value.find(item => item.id === itemId)
})
const getJobById = computed(() => (itemId:string) => {
return jobs.value.find(item => item.id === itemId)
const getTaskById = computed(() => (itemId:string) => {
return tasks.value.find(item => item.id === itemId)
})
const getAbsenceRequestById = computed(() => (itemId:string) => {
@@ -399,17 +399,28 @@ export const useDataStore = defineStore('data', () => {
return accounts.value.find(item => item.id === accountId)
})
const getPlantById = computed(() => (plantId:string) => {
return plants.value.find(item => item.id === plantId)
})
const getProjectById = computed(() => (itemId:string) => {
let project = projects.value.find(project => project.id === itemId)
if(projects.value.find(i => i.id === itemId)) {
let project = projects.value.find(project => project.id === itemId)
let projectHours = 0
/*let projectHours = 0
let projectTimes = times.value.filter(time => time.projectId === itemId)
projectTimes.forEach(time => projectHours += time.duration)
project.projectHours = projectHours*/
return project
} else {
return null
}
let projectTimes = times.value.filter(time => time.projectId === itemId)
projectTimes.forEach(time => projectHours += time.duration)
project.projectHours = projectHours
return project
})
return {
@@ -428,7 +439,6 @@ export const useDataStore = defineStore('data', () => {
movements,
forms,
contracts,
jobs,
formSubmits,
contacts,
vehicles,
@@ -442,6 +452,7 @@ export const useDataStore = defineStore('data', () => {
absenceRequests,
accounts,
taxTypes,
plants,
//Functions
fetchData,
clearStore,
@@ -463,7 +474,6 @@ export const useDataStore = defineStore('data', () => {
fetchMovements,
fetchVehicles,
fetchTimes,
fetchJobs,
fetchHistoryItems,
fetchVendors,
fetchVendorInvoices,
@@ -471,6 +481,7 @@ export const useDataStore = defineStore('data', () => {
fetchNotifications,
fetchDocuments,
fetchAbsenceRequests,
fetchPlants,
addHistoryItem,
//Getters
getOpenTasksCount,
@@ -498,11 +509,12 @@ export const useDataStore = defineStore('data', () => {
getDocumentById,
getSpaceById,
getCustomerById,
getJobById,
getTaskById,
getAbsenceRequestById,
getProjectById,
getProfileById,
getAccountById,
getPlantById
}