From b465f4a75aeed5f1bc8134c785acfbd374df4b8c Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sat, 21 Dec 2024 22:33:42 +0100 Subject: [PATCH] Introduced ProfileStore Corrected All Links to DataStore --- RechteDoku.xlsx | Bin 0 -> 11833 bytes app.vue | 2 - components/DocumentDisplay.vue | 3 +- components/DocumentUpload.vue | 3 +- components/EntityList.vue | 3 +- components/HelpSlideover.vue | 17 +- components/HistoryDisplay.vue | 14 +- components/MainNav.vue | 19 +- components/ProfileDropdown.vue | 15 +- components/ProfileSelection.vue | 8 +- components/UserDropdown.vue | 13 +- components/displayIncomeAndExpenditure.vue | 5 +- composables/useNumberRange.js | 5 +- composables/usePrintLabel.js | 3 +- composables/useRole.js | 4 +- composables/useSupabase.js | 19 +- layouts/default.vue | 386 +---------------- pages/absenceRequests/[mode]/[[id]].vue | 7 +- pages/absenceRequests/index.vue | 3 +- pages/banking/index.vue | 3 +- pages/banking/statements/[mode]/[[id]].vue | 3 +- pages/chat.vue | 9 +- pages/chats/create.vue | 8 +- pages/chats/show/[id].vue | 26 +- pages/communication/historyItems/index.vue | 3 +- pages/contacts/[mode]/[[id]].vue | 22 +- pages/contracts/[mode]/[[id]].vue | 7 +- pages/createDocument/edit/[[id]].vue | 46 +-- pages/createDocument/index.vue | 4 - pages/createDocument/show/[id].vue | 3 +- pages/customers/[mode]/[[id]].vue | 23 +- .../{ => deprecated}/users/[mode]/[[id]].vue | 5 +- pages/{ => deprecated}/users/index.vue | 0 pages/documents.vue | 5 +- pages/email/index.vue | 3 +- pages/email/new.vue | 3 +- pages/employees/timetracking.vue | 15 +- pages/events/[mode]/[[id]].vue | 3 +- pages/index.vue | 5 +- pages/inventory/index.vue | 17 +- pages/login.vue | 6 +- pages/plants/[mode]/[[id]].vue | 7 +- pages/products/[mode]/[[id]].vue | 3 +- pages/profiles/index.vue | 3 +- pages/profiles/show/[id].vue | 13 +- pages/projects/[mode]/[[id]].vue | 29 +- pages/services/[mode]/[[id]].vue | 3 +- pages/settings/banking/index.vue | 5 +- pages/settings/emailAccounts.vue | 3 +- pages/settings/index.vue | 5 +- pages/settings/labels/[mode]/[[id]].vue | 3 +- pages/settings/numberRanges.vue | 6 +- pages/settings/ownfields.vue | 6 - pages/settings/tenant.vue | 9 +- pages/spaces/[mode]/[[id]].vue | 2 +- pages/tasks/[mode]/[[id]].vue | 7 +- pages/tasks/index.vue | 3 +- pages/vehicles/[mode]/[[id]].vue | 7 +- pages/vendors/[mode]/[[id]].vue | 23 +- pages/workingtimes/[mode]/[[id]].vue | 5 +- pages/workingtimes/evaluate/[id].vue | 9 +- pages/workingtimes/index.vue | 31 +- stores/data.js | 387 +++--------------- stores/profile.js | 150 +++++++ 64 files changed, 508 insertions(+), 959 deletions(-) create mode 100644 RechteDoku.xlsx rename pages/{ => deprecated}/users/[mode]/[[id]].vue (98%) rename pages/{ => deprecated}/users/index.vue (100%) create mode 100644 stores/profile.js diff --git a/RechteDoku.xlsx b/RechteDoku.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c81d02140204a0677522b324ed2b24d4fcad41e3 GIT binary patch literal 11833 zcmeHtWmH`0(skn&g1cKFxLa^{hu{Q<;O-6$!QEXG+=IKjyL<59&et<@?>jS@`~LoZ zy!Z54=d823_g;OTQ@g63s#1`KfJ6sC17HCF00|%;a{PxK7yytA1puG{V8OM7ZLA%Q ztsV7L+-!{<83g?q6I-L zN8(K_Kp1_=K`}?|_3K<7NAzKpC4f~lPZG1*I(uA<;KjH399Kq??Obp4oZHV_IrZKO zi{df4bq9&Io2nGGPlIX^Gde>2J4g589E1tFRh5xy_)CmKJjM(-!hYw}*h-M5h&v*} zX^?g()VW}V%XmQzisgu5UZ+?$WpY@;m&HpU-7lko8=lMK$D9(JU$wNMOYX^R zVSk6NJX+5Z8Rz;)>gyim$6f2-o3&)hna^miG^u*h04u(#{4&Eoy}>g@4rj~Np|8R^ z*+@wOtJrO)Udy&R8B;hhizCdkkNy?YCUfub01p6oeT4uh{7tEKs*Ge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527IYSxtJ0Wcb`S;`m+a6LZ+LIk@W za_j3ym(OUz!7;Rj;dGwVBEmCe`7(u_m{b17<5C0$2tDR2!wU0r8(xeIbndakJnb>A z#8((%9b;QXg&~u~5V)8ZA`hHlG6AEcp+2zxf3W_jP{C*WZk- zsoi1pD&YXl*ep;2QQUj(BMV6~yHadIr517=IKf9Z<%RXbIbbS;m;Lyw8AbKVUSl$w zm{%Y+k2)B_J}(ROgu1ZO8Bu?Q$#ilI7;FM-??0^Dx6yZ{8sA>euCT$p4^HRcFM03g zef#j+w9p@p6%3pXl&<{e0oi}Q$A4e{!?>)1^xp~oKDYO8;BVJrkXZgQ#rG@l*IA}N zq2r*0>X*r;U%`JLp!gFC03^Zx4*p-pDSqYowSE34)8?E1`4j(WrvJ+FYlq}d77P;Jsb zpuc9ezcT!qto+H)O8z^;-%^)f(SMKde_{cEJ_-QfAMyTI_}~5WU*Y0Ze}VtYTPsLI Ufh-IFcmw)Cf{c`i=C`~52S9u9*Z=?k literal 0 HcmV?d00001 diff --git a/app.vue b/app.vue index cec450a..cab9291 100644 --- a/app.vue +++ b/app.vue @@ -6,8 +6,6 @@ const tenants = (await supabase.from("tenants").select()).data const dataStore = useDataStore() const viewport = useViewport() -console.log("1.") - /*watch(viewport.breakpoint, (newBreakpoint, oldBreakpoint) => { console.log('Breakpoint updated:', oldBreakpoint, '->', newBreakpoint) })*/ diff --git a/components/DocumentDisplay.vue b/components/DocumentDisplay.vue index 5411188..e506a33 100644 --- a/components/DocumentDisplay.vue +++ b/components/DocumentDisplay.vue @@ -3,6 +3,7 @@ const toast = useToast() const supabase = useSupabaseClient() const dataStore = useDataStore() +const profileStore = useProfileStore() const router = useRouter() const props = defineProps({ documentData: { @@ -61,7 +62,7 @@ const createVendorInvoice = async () => { .from("incominginvoices") .insert([{ document: documentData.id, - tenant: dataStore.currentTenant + tenant: profileStore.currentTenant }]) .select() if(vendorInvoiceError) { diff --git a/components/DocumentUpload.vue b/components/DocumentUpload.vue index 9f806a3..a7ba1bb 100644 --- a/components/DocumentUpload.vue +++ b/components/DocumentUpload.vue @@ -12,6 +12,7 @@ const props = defineProps({ const {type, elementId} = props const dataStore = useDataStore() +const profileStore = useProfileStore() const tags = dataStore.getDocumentTags const uploadModalOpen = ref(false) @@ -19,7 +20,7 @@ const uploadInProgress = ref(false) const fileUploadFormData = ref({ tags: ["Dokument"], project: null, - tenant: dataStore.currentTenant + tenant: profileStore.currentTenant }) const openModal = () => { diff --git a/components/EntityList.vue b/components/EntityList.vue index b5ba3c7..8dcdc40 100644 --- a/components/EntityList.vue +++ b/components/EntityList.vue @@ -46,6 +46,7 @@ defineShortcuts({ const router = useRouter() const dataStore = useDataStore() +const profileStore = useProfileStore() const dataType = dataStore.dataTypes[type] @@ -81,7 +82,7 @@ const filteredRows = computed(() => { } else if(useRole().checkRight(type)){ console.log("Only Righty to show Own") console.log(tempItems) - tempItems = tempItems.filter(item => item.profiles.includes(dataStore.activeProfile.id)) + tempItems = tempItems.filter(item => item.profiles.includes(profileStore.activeProfile.id)) } else { console.log("No Right to Show") tempItems = [] diff --git a/components/HelpSlideover.vue b/components/HelpSlideover.vue index a635fde..2c273b6 100644 --- a/components/HelpSlideover.vue +++ b/components/HelpSlideover.vue @@ -4,6 +4,7 @@ const { metaSymbol } = useShortcuts() const shortcuts = ref(false) const dataStore = useDataStore() +const profileStore = useProfileStore() const query = ref('') const supabase = useSupabaseClient() const toast = useToast() @@ -101,12 +102,12 @@ const filteredCategories = computed(() => { const contactRequestData = ref({ source: "helpSlideover", - tenant: dataStore.currentTenant, + tenant: profileStore.currentTenant, message: "", title: "", - contactName: dataStore.activeProfile.fullName, - contactTel: dataStore.activeProfile.phoneMobile || dataStore.activeProfile.phoneHome, - contactMail: dataStore.activeProfile.email, + contactName: profileStore.activeProfile.fullName, + contactTel: profileStore.activeProfile.phoneMobile || profileStore.activeProfile.phoneHome, + contactMail: profileStore.activeProfile.email, contactType: "Hilfe", currentPath: router.currentRoute }) @@ -125,12 +126,12 @@ const addContactRequest = async () => { const resetContactRequest = () => { contactRequestData.value = { source: "helpSlideover", - tenant: dataStore.currentTenant, + tenant: profileStore.currentTenant, message: "", title: "", - contactName: dataStore.activeProfile.fullName, - contactTel: dataStore.activeProfile.phoneMobile || dataStore.activeProfile.phoneHome, - contactMail: dataStore.activeProfile.email, + contactName: profileStore.activeProfile.fullName, + contactTel: profileStore.activeProfile.phoneMobile || profileStore.activeProfile.phoneHome, + contactMail: profileStore.activeProfile.email, contactType: "Hilfe" } } diff --git a/components/HistoryDisplay.vue b/components/HistoryDisplay.vue index 774b1b3..feab0fd 100644 --- a/components/HistoryDisplay.vue +++ b/components/HistoryDisplay.vue @@ -14,7 +14,7 @@ const props = defineProps({ } }) const { metaSymbol } = useShortcuts() -const dataStore = useDataStore() +const profileStore = useProfileStore() const user = useSupabaseUser() const supabase = useSupabaseClient() const toast = useToast() @@ -79,13 +79,13 @@ const addHistoryItemData = ref({ const addHistoryItem = async () => { console.log(addHistoryItemData.value) - addHistoryItemData.value.createdBy = dataStore.activeProfile.id + addHistoryItemData.value.createdBy = profileStore.activeProfile.id addHistoryItemData.value[type] = elementId const {data,error} = await supabase .from("historyitems") - .insert([{...addHistoryItemData.value, tenant: dataStore.currentTenant}]) + .insert([{...addHistoryItemData.value, tenant: profileStore.currentTenant}]) .select() if(error) { @@ -100,9 +100,9 @@ const addHistoryItem = async () => { let rawUsername = i[1] return { - tenant: dataStore.currentTenant, + tenant: profileStore.currentTenant, profile: profiles.find(x => x.username === rawUsername).id, - initiatingProfile: dataStore.activeProfile.id, + initiatingProfile: profileStore.activeProfile.id, title: "Sie wurden im Logbuch erwähnt", link: `/${type}s/show/${elementId}`, message: addHistoryItemData.value.text @@ -198,11 +198,11 @@ const renderText = (text) => { :src="colorMode.value === 'light' ? '/Logo.png' : '/Logo_Dark.png' " />

-

{{dataStore.getProfileById(item.createdBy) ? dataStore.getProfileById(item.createdBy).fullName : ""}}

+

{{profileStore.getProfileById(item.createdBy) ? profileStore.getProfileById(item.createdBy).fullName : ""}}

FEDEO Bot


{{dayjs(item.created_at).format("DD.MM.YY HH:mm")}} diff --git a/components/MainNav.vue b/components/MainNav.vue index 8a4c3c3..9bbea02 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -1,13 +1,10 @@ \ No newline at end of file diff --git a/components/ProfileSelection.vue b/components/ProfileSelection.vue index 01dbb63..49ce1f3 100644 --- a/components/ProfileSelection.vue +++ b/components/ProfileSelection.vue @@ -1,6 +1,6 @@ @@ -84,6 +84,7 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const router = useRouter() const templateColumns = [ diff --git a/pages/banking/index.vue b/pages/banking/index.vue index 5476542..51b5f87 100644 --- a/pages/banking/index.vue +++ b/pages/banking/index.vue @@ -20,6 +20,7 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const router = useRouter() const supabase = useSupabaseClient() @@ -27,7 +28,7 @@ const bankstatements = ref([]) const setupPage = async () => { - bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq('tenant', dataStore.currentTenant).order("date", {ascending:false})).data + bankstatements.value = (await supabase.from("bankstatements").select("*, statementallocations(*)").eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data } diff --git a/pages/banking/statements/[mode]/[[id]].vue b/pages/banking/statements/[mode]/[[id]].vue index 6acb7b1..57a42f6 100644 --- a/pages/banking/statements/[mode]/[[id]].vue +++ b/pages/banking/statements/[mode]/[[id]].vue @@ -14,6 +14,7 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() const mode = ref(route.params.mode || "show") @@ -132,7 +133,7 @@ const saveAllocations = async () => { const saveAllocation = async (allocation) => { const {data,error} = await supabase.from("statementallocations").insert({ ...allocation, - tenant: dataStore.currentTenant + tenant: profileStore.currentTenant }).select() if(data) { diff --git a/pages/chat.vue b/pages/chat.vue index 64c8685..421b901 100644 --- a/pages/chat.vue +++ b/pages/chat.vue @@ -11,6 +11,7 @@ const supabase = useSupabaseClient() const user = useSupabaseUser() const dataStore = useDataStore() +const profileStore = useProfileStore() const selectedChat = ref({}) const messageText = ref("") @@ -24,8 +25,8 @@ const messageText = ref("") @click="selectedChat = chat" > @@ -49,13 +50,13 @@ const messageText = ref("") {{message.text}}
-const dataStore = useDataStore() +const profileStore = useProfileStore() const supabase = useSupabaseClient() const profiles = ref([]) @@ -10,14 +10,14 @@ const selectedProfiles = ref([]) const setup = async () => { profiles.value = await useSupabaseSelect("profiles") - selectedProfiles.value = [dataStore.activeProfile.id] + selectedProfiles.value = [profileStore.activeProfile.id] } setup() const createChat = async () => { const {data,error} = await supabase.from("chats").insert({ - tenant: dataStore.currentTenant, + tenant: profileStore.currentTenant, name: itemInfo.value.name }).select() @@ -105,7 +105,7 @@ const createChat = async () => { :search-attributes="['fullName']" > diff --git a/pages/chats/show/[id].vue b/pages/chats/show/[id].vue index ee17f99..2b480d6 100644 --- a/pages/chats/show/[id].vue +++ b/pages/chats/show/[id].vue @@ -13,17 +13,17 @@ defineShortcuts({ }) const itemInfo = ref({}) -const dataStore = useDataStore() +const profileStore = useProfileStore() const supabase = useSupabaseClient() const setup = async () => { itemInfo.value = await useSupabaseSelectSingle("chats",useRoute().params.id,"*, profiles(*), chatmessages(*)") - let unseenMessages = itemInfo.value.chatmessages.filter(i => !i.seenBy.includes(dataStore.activeProfile.id)) + let unseenMessages = itemInfo.value.chatmessages.filter(i => !i.seenBy.includes(profileStore.activeProfile.id)) for await (const message of unseenMessages){ - await supabase.from("chatmessages").update({seenBy: [...message.seenBy, dataStore.activeProfile.id]}).eq("id",message.id) + await supabase.from("chatmessages").update({seenBy: [...message.seenBy, profileStore.activeProfile.id]}).eq("id",message.id) } @@ -34,11 +34,11 @@ const messageText = ref("") const sendMessage = async () => { if(messageText.value.length > 0) { const message = { - origin: dataStore.activeProfile.id, + origin: profileStore.activeProfile.id, destinationchat: itemInfo.value.id, text: messageText.value, - tenant: dataStore.currentTenant, - seenBy: [dataStore.activeProfile.id] + tenant: profileStore.currentTenant, + seenBy: [profileStore.activeProfile.id] } const {data,error} = await supabase.from("chatmessages").insert(message) @@ -49,11 +49,11 @@ const sendMessage = async () => { //Reset messageText.value = "" //Create Notifications - let notifications = itemInfo.value.profiles.filter(i => i.id !== dataStore.activeProfile.id).map(i => { + let notifications = itemInfo.value.profiles.filter(i => i.id !== profileStore.activeProfile.id).map(i => { return { - tenant: dataStore.currentTenant, + tenant: profileStore.currentTenant, profile: i.id, - initiatingProfile: dataStore.activeProfile.id, + initiatingProfile: profileStore.activeProfile.id, title: `Sie haben eine neue Nachricht im Chat ${itemInfo.value.name}`, link: `/chats/show/${itemInfo.value.id}`, message: message.text @@ -88,13 +88,13 @@ const sendMessage = async () => {
diff --git a/pages/communication/historyItems/index.vue b/pages/communication/historyItems/index.vue index 968cf1c..8c81f86 100644 --- a/pages/communication/historyItems/index.vue +++ b/pages/communication/historyItems/index.vue @@ -3,6 +3,7 @@ import dayjs from "dayjs" const supabase = useSupabaseClient() const dataStore = useDataStore() +const profileStore = useProfileStore() const router = useRouter() @@ -10,7 +11,7 @@ const items = ref([]) const setup = async () => { - items.value = (await supabase.from("historyitems").select().like('text',`%@${dataStore.activeProfile.username}%`)/*.textSearch("text", `'@${dataStore.activeProfile.username}'`)*/.order("created_at")).data + items.value = (await supabase.from("historyitems").select().like('text',`%@${profileStore.activeProfile.username}%`)/*.textSearch("text", `'@${profileStore.activeProfile.username}'`)*/.order("created_at")).data } const navigateToHistoryItem = (item) => { diff --git a/pages/contacts/[mode]/[[id]].vue b/pages/contacts/[mode]/[[id]].vue index e4fc1d1..65f491f 100644 --- a/pages/contacts/[mode]/[[id]].vue +++ b/pages/contacts/[mode]/[[id]].vue @@ -23,6 +23,7 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() const toast = useToast() @@ -33,7 +34,8 @@ const openTab = ref(0) //Working const mode = ref(route.params.mode || "show") const itemInfo = ref({ - active: true + active: true, + profiles: [profileStore.activeProfile.id] }) const oldItemInfo = ref({}) @@ -300,6 +302,23 @@ setupPage() + + + + + @@ -307,6 +326,7 @@ setupPage() v-model="itemInfo.notes" /> + diff --git a/pages/contracts/[mode]/[[id]].vue b/pages/contracts/[mode]/[[id]].vue index 3524ff6..a9eb614 100644 --- a/pages/contracts/[mode]/[[id]].vue +++ b/pages/contracts/[mode]/[[id]].vue @@ -24,6 +24,7 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() const toast = useToast() @@ -215,7 +216,7 @@ setupPage() Eigene Felder: - {{dataStore.ownTenant.ownFields.contracts.find(i => i.key === fieldKey).label}} + {{profileStore.ownTenant.ownFields.contracts.find(i => i.key === fieldKey).label}} {{itemInfo.ownFields[fieldKey]}} @@ -491,14 +492,14 @@ setupPage()
Eigene Felder diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 5551f94..eb4a76d 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -5,6 +5,7 @@ import {useNumberRange} from "~/composables/useNumberRange.js"; import { v4 as uuidv4 } from 'uuid'; const dataStore = useDataStore() +const profileStore = useProfileStore() const user = useSupabaseUser() const route = useRoute() const router = useRouter() @@ -37,7 +38,7 @@ const itemInfo = ref({ deliveryDateType: "Lieferdatum", dateOfPerformance: null, paymentDays: 7, - createdBy: dataStore.activeProfile.id, + createdBy: profileStore.activeProfile.id, title: null, description: null, startText: null, @@ -45,7 +46,7 @@ const itemInfo = ref({ rows: [ ], - contactPerson: dataStore.activeProfile.id, + contactPerson: profileStore.activeProfile.id, contactPersonName: null, contactTel: null, contactEMail: null, @@ -74,6 +75,7 @@ const servicecategories = ref([]) const selectedServicecategorie = ref(null) const customers = ref([]) const contacts = ref([]) +const texttemplates = ref([]) const loaded = ref(false) const setupPage = async () => { @@ -87,6 +89,7 @@ const setupPage = async () => { productcategories.value = (await useSupabaseSelect("productcategories","*")) customers.value = (await useSupabaseSelect("customers","*","customerNumber")) contacts.value = (await useSupabaseSelect("contacts","*")) + texttemplates.value = (await useSupabaseSelect("texttemplates","*")) if(productcategories.value.length > 0) selectedProductcategorie.value = productcategories.value[0].id if(servicecategories.value.length > 0) selectedServicecategorie.value = servicecategories.value[0].id @@ -216,8 +219,8 @@ const setDocumentTypeConfig = (withTexts = false) => { } if(withTexts) { - itemInfo.value.startText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "startText").text - itemInfo.value.endText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "endText").text + itemInfo.value.startText = texttemplates.value.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "startText").text + itemInfo.value.endText = texttemplates.value.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "endText").text } itemInfo.value.letterhead = letterheads.value[0].id @@ -310,7 +313,7 @@ const addPosition = (mode) => { discountPercent: 0 } - itemInfo.value.rows.push({...rowData, ...dataStore.ownTenant.extraModules.includes("agriculture") ? {agriculture: {}}: {}}) + itemInfo.value.rows.push({...rowData, ...profileStore.ownTenant.extraModules.includes("agriculture") ? {agriculture: {}}: {}}) } else if(mode === 'normal'){ itemInfo.value.rows.push({ @@ -334,7 +337,7 @@ const addPosition = (mode) => { } //Push Agriculture Holder only if Module is activated - itemInfo.value.rows.push({...rowData, ...dataStore.ownTenant.extraModules.includes("agriculture") ? {agriculture: {}}: {}}) + itemInfo.value.rows.push({...rowData, ...profileStore.ownTenant.extraModules.includes("agriculture") ? {agriculture: {}}: {}}) } else if(mode === "pagebreak") { itemInfo.value.rows.push({ id: uuidv4(), @@ -373,7 +376,7 @@ const removePosition = (id) => { const getRowMargin = (row) => { if(row.mode === "normal" && row.product) { - let purchasePrice = dataStore.getProductById(row.product).purchasePrice || 0 + let purchasePrice = products.value.find(i => i.id === row.product).purchasePrice || 0 return row.price - purchasePrice } else { return 0 @@ -530,9 +533,9 @@ const getDocumentData = () => { let customerData = dataStore.getCustomerById(itemInfo.value.customer) let contactData = dataStore.getContactById(itemInfo.value.contact) - let businessInfo = dataStore.ownTenant.businessInfo + let businessInfo = profileStore.ownTenant.businessInfo - if(dataStore.ownTenant.extraModules.includes("agriculture")) { + if(profileStore.ownTenant.extraModules.includes("agriculture")) { itemInfo.value.rows.forEach(row => { if(row.agriculture && row.agriculture.dieselUsage) { row.agriculture.description = `${row.agriculture.dieselUsage} L Diesel zu ${renderCurrency(row.agriculture.dieselPrice)}/L verbraucht ${row.description ? "\n" + row.description : ""}` @@ -555,7 +558,7 @@ const getDocumentData = () => { } if(!['pagebreak','title','text'].includes(row.mode)) { - if(row.mode === 'normal') row.text = dataStore.getProductById(row.product).name + if(row.mode === 'normal') row.text = products.value.find(i => i.id === row.product).name if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name @@ -630,7 +633,7 @@ const getDocumentData = () => { const showDocument = ref(false) const uri = ref("") const generateDocument = async () => { - const ownTenant = dataStore.ownTenant + const ownTenant = profileStore.ownTenant const path = letterheads.value.find(i => i.id === itemInfo.value.letterhead).path @@ -717,7 +720,7 @@ const saveDocument = async (state) => { setDocumentTypeConfig(false) } - if(dataStore.ownTenant.extraModules.includes("agriculture")) { + if(profileStore.ownTenant.extraModules.includes("agriculture")) { itemInfo.value.rows.forEach(row => { if(row.agriculture && row.agriculture.dieselUsage) { row.agriculture.description = `${row.agriculture.dieselUsage} L Diesel zu ${renderCurrency(row.agriculture.dieselPrice)}/L verbraucht ${row.description ? "\n" + row.description : ""}` @@ -1193,7 +1196,7 @@ setupPage() label="Ansprechpartner:" > @@ -1514,9 +1517,6 @@ setupPage() - { let amountPaid = 0 item.statementallocations.forEach(allocation => amountPaid += allocation.amount) - console.log(item.documentNumber) - console.log(amountPaid) - console.log(calculateDocSum(item)) - return Number(amountPaid.toFixed(2)) === Number(calculateDocSum(item)) } diff --git a/pages/createDocument/show/[id].vue b/pages/createDocument/show/[id].vue index eae1a75..00bd902 100644 --- a/pages/createDocument/show/[id].vue +++ b/pages/createDocument/show/[id].vue @@ -12,6 +12,7 @@ defineShortcuts({ const supabase = useSupabaseClient() const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() @@ -26,7 +27,7 @@ const setupPage = async () => { } - currentTenant.value = (await supabase.from("tenants").select().eq("id",dataStore.currentTenant).single()).data + currentTenant.value = (await supabase.from("tenants").select().eq("id",profileStore.currentTenant).single()).data console.log(currentTenant.value) } diff --git a/pages/customers/[mode]/[[id]].vue b/pages/customers/[mode]/[[id]].vue index fbe2abb..74310b6 100644 --- a/pages/customers/[mode]/[[id]].vue +++ b/pages/customers/[mode]/[[id]].vue @@ -23,10 +23,9 @@ defineShortcuts({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() -const toast = useToast() -const id = ref(route.params.id ? route.params.id : null ) const openTab = ref(0) @@ -39,7 +38,8 @@ const itemInfo = ref({ country: "Deutschland" }, active: true, - isCompany: true + isCompany: true, + profiles: [profileStore.activeProfile.id] }) const oldItemInfo = ref({}) @@ -356,6 +356,23 @@ setupPage() v-model="itemInfo.infoData.ustid" /> + + + + + diff --git a/pages/users/[mode]/[[id]].vue b/pages/deprecated/users/[mode]/[[id]].vue similarity index 98% rename from pages/users/[mode]/[[id]].vue rename to pages/deprecated/users/[mode]/[[id]].vue index a4d2b19..08f498a 100644 --- a/pages/users/[mode]/[[id]].vue +++ b/pages/deprecated/users/[mode]/[[id]].vue @@ -11,6 +11,7 @@ definePageMeta({ const dataStore = useDataStore() +const profileStore = useProfileStore() const supabase = useSupabaseClient() const route = useRoute() const router = useRouter() @@ -81,7 +82,7 @@ const filteredTimes = computed(() => { //Functions const setupPage = () => { if(mode.value === "show" || mode.value === "edit"){ - currentItem = dataStore.getProfileById(useRoute().params.id) + currentItem = profileStore.getProfileById(useRoute().params.id) } itemInfo.value = currentItem @@ -337,7 +338,7 @@ setupPage()
{{dayjs(row.end).format("HH:mm")}}
@@ -339,14 +340,14 @@ const setState = async (newState) => { label="Benutzer:" > @@ -444,7 +445,7 @@ const setState = async (newState) => { >{{row.state}}