From 61793838bb32271c8de82002bb96041c99028b48 Mon Sep 17 00:00:00 2001 From: flfeders Date: Fri, 5 Jan 2024 18:06:09 +0100 Subject: [PATCH] Many Changes Introduced Plants Some Polishing Some Resources got Query Params Extended GlobalSearch.vue Removed Jobs --- spaces/app.vue | 11 +- spaces/components/GlobalSearch.vue | 24 +- spaces/components/noAutoLoad/BlockEditor.vue | 64 +++ .../noAutoLoad/EditorJsOwn.client.vue | 53 ++ spaces/nuxt.config.ts | 2 +- spaces/pages/contacts/[mode]/[[id]].vue | 6 + spaces/pages/customers/[mode]/[[id]].vue | 14 + spaces/pages/employees/timetracking.vue | 38 +- spaces/pages/plants/[mode]/[[id]].vue | 185 ++++++ spaces/pages/{jobs => plants}/index.vue | 19 +- spaces/pages/projects/[mode]/[[id]].vue | 528 ++++++++++++++++++ .../{[id].vue => [mode]/deprecated.vue} | 0 spaces/pages/projects/index.vue | 158 ++---- spaces/pages/tasks.vue | 324 ----------- .../pages/{jobs => tasks}/[mode]/[[id]].vue | 113 ++-- spaces/pages/tasks/index.vue | 113 ++++ spaces/pages/vendorinvoices/index.vue | 2 +- spaces/pages/vendors/[mode]/[[id]].vue | 8 + spaces/stores/data.ts | 46 +- 19 files changed, 1166 insertions(+), 542 deletions(-) create mode 100644 spaces/components/noAutoLoad/BlockEditor.vue create mode 100644 spaces/components/noAutoLoad/EditorJsOwn.client.vue create mode 100644 spaces/pages/plants/[mode]/[[id]].vue rename spaces/pages/{jobs => plants}/index.vue (69%) create mode 100644 spaces/pages/projects/[mode]/[[id]].vue rename spaces/pages/projects/{[id].vue => [mode]/deprecated.vue} (100%) delete mode 100644 spaces/pages/tasks.vue rename spaces/pages/{jobs => tasks}/[mode]/[[id]].vue (50%) create mode 100644 spaces/pages/tasks/index.vue diff --git a/spaces/app.vue b/spaces/app.vue index e3607ea..e861dd1 100644 --- a/spaces/app.vue +++ b/spaces/app.vue @@ -115,16 +115,16 @@ const navLinks = [ to: "/projects", icon: "i-heroicons-clipboard-document-check" }, - { - label: "Jobs", - to: "/jobs", - icon: "i-heroicons-square-3-stack-3d" - }, { label: "Verträge", to: "/contracts", icon: "i-heroicons-clipboard-document" }, + { + label: "Anlagen", + to: "/plants", + icon: "i-heroicons-clipboard-document" + }, ] }, { @@ -525,7 +525,6 @@ const items = [ display: flex; flex-direction: row; flex-wrap: wrap; - height: 85vh; overflow-y: scroll; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ diff --git a/spaces/components/GlobalSearch.vue b/spaces/components/GlobalSearch.vue index 3558064..d19d393 100644 --- a/spaces/components/GlobalSearch.vue +++ b/spaces/components/GlobalSearch.vue @@ -23,7 +23,7 @@ const actions = [ { id: 'new-customer', label: 'Kunde hinzufügen', - icon: 'i-heroicons-document-plus', + icon: 'i-heroicons-user-group', to: "/customers/create" , }, { @@ -35,9 +35,21 @@ const actions = [ { id: 'new-contact', label: 'Ansprechpartner hinzufügen', - icon: 'i-heroicons-user', + icon: 'i-heroicons-user-group', to: "/contacts/create" , }, + { + id: 'new-task', + label: 'Aufgabe hinzufügen', + icon: 'i-heroicons-rectangle-stack', + to: "/tasks/create" , + }, + { + id: 'new-plant', + label: 'Anlage hinzufügen', + icon: 'i-heroicons-clipboard-document', + to: "/plants/create" , + }, { id: 'new-product', label: 'Artikel hinzufügen', @@ -67,6 +79,14 @@ const groups = computed(() => key: "products", label: "Artikel", commands: dataStore.products.map(item => { return {id: item.id, label: item.name, to: `/products/show/${item.id}`}}) + },{ + key: "tasks", + label: "Aufgaben", + commands: dataStore.tasks.map(item => { return {id: item.id, label: item.name, to: `/tasks/show/${item.id}`}}) + },{ + key: "plants", + label: "Anlagen", + commands: dataStore.plants.map(item => { return {id: item.id, label: item.name, to: `/plants/show/${item.id}`}}) } ].filter(Boolean)) diff --git a/spaces/components/noAutoLoad/BlockEditor.vue b/spaces/components/noAutoLoad/BlockEditor.vue new file mode 100644 index 0000000..3b42300 --- /dev/null +++ b/spaces/components/noAutoLoad/BlockEditor.vue @@ -0,0 +1,64 @@ + + + + + \ No newline at end of file diff --git a/spaces/components/noAutoLoad/EditorJsOwn.client.vue b/spaces/components/noAutoLoad/EditorJsOwn.client.vue new file mode 100644 index 0000000..ca6069b --- /dev/null +++ b/spaces/components/noAutoLoad/EditorJsOwn.client.vue @@ -0,0 +1,53 @@ + + + + + \ No newline at end of file diff --git a/spaces/nuxt.config.ts b/spaces/nuxt.config.ts index 0e43e18..054a3b1 100644 --- a/spaces/nuxt.config.ts +++ b/spaces/nuxt.config.ts @@ -32,7 +32,7 @@ export default defineNuxtConfig({ }, vite: { optimizeDeps: { - include: ["@editorjs/editorjs"], + include: ["@editorjs/editorjs", "dayjs"], }, }, ui: { diff --git a/spaces/pages/contacts/[mode]/[[id]].vue b/spaces/pages/contacts/[mode]/[[id]].vue index 10a2de8..ac37ff7 100644 --- a/spaces/pages/contacts/[mode]/[[id]].vue +++ b/spaces/pages/contacts/[mode]/[[id]].vue @@ -30,7 +30,13 @@ const setupPage = () => { if(mode.value === "edit") itemInfo.value = currentContact + if(mode.value === "create") { + let query = route.query + if(query.customer) itemInfo.value.customer = Number(query.customer) + if(query.vendor) itemInfo.value.vendor = Number(query.vendor) + + } } diff --git a/spaces/pages/customers/[mode]/[[id]].vue b/spaces/pages/customers/[mode]/[[id]].vue index ab9b755..c36413c 100644 --- a/spaces/pages/customers/[mode]/[[id]].vue +++ b/spaces/pages/customers/[mode]/[[id]].vue @@ -112,6 +112,20 @@ setupPage() {{currentCustomer.name}} + + + + Projekt + + + + Ansprechpartner + + + + Kundennummer: {{currentCustomer.customerNumber}}
{ - - - - - { - - - - - @@ -380,12 +348,12 @@ const format = (date) => { + - diff --git a/spaces/pages/plants/[mode]/[[id]].vue b/spaces/pages/plants/[mode]/[[id]].vue new file mode 100644 index 0000000..765ab6c --- /dev/null +++ b/spaces/pages/plants/[mode]/[[id]].vue @@ -0,0 +1,185 @@ + + + + + \ No newline at end of file diff --git a/spaces/pages/jobs/index.vue b/spaces/pages/plants/index.vue similarity index 69% rename from spaces/pages/jobs/index.vue rename to spaces/pages/plants/index.vue index ab45c1a..e838bcc 100644 --- a/spaces/pages/jobs/index.vue +++ b/spaces/pages/plants/index.vue @@ -1,12 +1,12 @@ + + + + Ansprechpartner + + + Information:
Straße + Hausnummer: {{currentItem.infoData.street}}
diff --git a/spaces/stores/data.ts b/spaces/stores/data.ts index 149ee7f..caaee29 100644 --- a/spaces/stores/data.ts +++ b/spaces/stores/data.ts @@ -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 }