Changes in Timetracking

Added Lieferscheine Button to EntityShow
DataType Changes
Fixed Loading Errors in createDocument
Added Telephone to profile show
This commit is contained in:
2025-01-02 14:04:55 +01:00
parent 595531683b
commit b877d5f91b
6 changed files with 89 additions and 37 deletions

View File

@@ -109,6 +109,10 @@ const changeActivePhase = async (key) => {
}) })
} }
const invoiceDeliveryNotes = () => {
router.push(`/createDocument/edit?type=invoices&linkedDocuments=[${props.item.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`)
}
</script> </script>
<template> <template>
@@ -410,6 +414,12 @@ const changeActivePhase = async (key) => {
> >
+ Rechnung + Rechnung
</UButton> </UButton>
<UButton
@click="invoiceDeliveryNotes"
v-if="type === 'projects'"
>
Lieferscheine abrechnen
</UButton>
</Toolbar> </Toolbar>
<UTable <UTable

View File

@@ -136,7 +136,7 @@ const setupPage = async () => {
itemInfo.value.rows.push(...[ itemInfo.value.rows.push(...[
{ {
id:uuidv4(), id:uuidv4(),
mode: "text", mode: "title",
text: doc.title text: doc.title
}, },
...doc.rows ...doc.rows
@@ -144,6 +144,16 @@ const setupPage = async () => {
}) })
itemInfo.value.rows.forEach(row => {
row.discountPercent = 0
setRowData(row)
})
setPosNumbers()
if(linkedDocuments.find(i => i.agriculture)){ if(linkedDocuments.find(i => i.agriculture)){
itemInfo.value.rows = itemInfo.value.rows.filter(i => i.key !== "dieselPos") itemInfo.value.rows = itemInfo.value.rows.filter(i => i.key !== "dieselPos")
@@ -155,6 +165,8 @@ const setupPage = async () => {
processDieselPosition() processDieselPosition()
} }
} }
if(route.query.linkedDocument) { if(route.query.linkedDocument) {
@@ -219,8 +231,10 @@ const setDocumentTypeConfig = (withTexts = false) => {
} }
if(withTexts) { if(withTexts) {
itemInfo.value.startText = texttemplates.value.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "startText").text itemInfo.value.startText = getTextTemplateByType(itemInfo.value.type).find(i => 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.endText = getTextTemplateByType(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 itemInfo.value.letterhead = letterheads.value[0].id
@@ -846,6 +860,17 @@ const closeDocument = async () => {
} }
const getTextTemplateByType = (type) => {
let finalType = type
if(type === "serialInvoices") {
finalType = "invoices"
}
return texttemplates.value.filter(i => i.documentType === finalType)
}
const setRowData = (row) => { const setRowData = (row) => {
console.log(row) console.log(row)
if(row.service) { if(row.service) {
@@ -894,7 +919,6 @@ const setRowData = (row) => {
</UDashboardNavbar> </UDashboardNavbar>
<UDashboardPanelContent> <UDashboardPanelContent>
{{itemInfo}}
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded"> <UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
<template #item="{item}"> <template #item="{item}">
<div v-if="item.label === 'Editor'"> <div v-if="item.label === 'Editor'">
@@ -1371,7 +1395,7 @@ const setRowData = (row) => {
label="Vorlage auswählen" label="Vorlage auswählen"
> >
<USelectMenu <USelectMenu
:options="dataStore.getTextTemplatesByDocumentType(itemInfo.type)" :options="getTextTemplateByType(itemInfo.type)"
v-model="itemInfo.startText" v-model="itemInfo.startText"
option-attribute="text" option-attribute="text"
value-attribute="text" value-attribute="text"
@@ -1888,7 +1912,7 @@ const setRowData = (row) => {
label="Vorlage auswählen" label="Vorlage auswählen"
> >
<USelectMenu <USelectMenu
:options="dataStore.getTextTemplatesByDocumentType(itemInfo.type)" :options="getTextTemplateByType(itemInfo.type)"
v-model="itemInfo.endText" v-model="itemInfo.endText"
option-attribute="text" option-attribute="text"
value-attribute="text" value-attribute="text"

View File

@@ -17,22 +17,29 @@ const toast = useToast()
const timeTypes = dataStore.getTimeTypes const timeTypes = dataStore.getTimeTypes
const timeInfo = ref({ const timeInfo = ref({
user: "", profile: "",
start: "", startDate: "",
end: null, endDate: null,
notes: null, notes: null,
projectId: null, project: null,
type: null type: null
}) })
const filterUser = ref(user.value.id || "") const filterUser = ref(profileStore.activeProfile.id || "")
const times = ref([])
const setup = async () => {
times.value = await useSupabaseSelect("times","*, profile(*)")
}
setup()
const filteredRows = computed(() => { const filteredRows = computed(() => {
let times = dataStore.times //let times = times.value
if(dataStore.hasRight('viewTimes')) { /*if(dataStore.hasRight('viewTimes')) {
if(filterUser.value !== "") { if(filterUser.value !== "") {
times = times.filter(i => i.user === filterUser.value) times = times.filter(i => i.user === filterUser.value)
} }
@@ -40,9 +47,9 @@ const filteredRows = computed(() => {
times = times.filter(i => i.user === user.value.id) times = times.filter(i => i.user === user.value.id)
} else { } else {
times = [] times = []
} }*/
return times return times.value
}) })
@@ -63,42 +70,34 @@ const columns = [
{ {
key:"state", key:"state",
label: "Status", label: "Status",
sortable:true
}, },
{ {
key: "user", key: "user",
label: "Benutzer", label: "Benutzer",
sortable:true
}, },
{ {
key:"start", key:"startDate",
label:"Start", label:"Start",
sortable:true },
{
key: "endDate",
label: "Ende",
}, },
{ {
key:"type", key:"type",
label:"Typ", label:"Typ",
sortable:true
},
{
key: "end",
label: "Ende",
sortable:true
}, },
{ {
key: "duration", key: "duration",
label: "Dauer", label: "Dauer",
sortable:true
}, },
{ {
key: "projectId", key: "project",
label: "Projekt", label: "Projekt",
sortable:true
}, },
{ {
key: "notes", key: "notes",
label: "Notizen", label: "Notizen",
sortable:true
} }
] ]
@@ -110,7 +109,7 @@ const configTimeMode = ref("create")
const startTime = async () => { const startTime = async () => {
console.log("started") console.log("started")
timeInfo.value.user = user.value.id timeInfo.value.profile = profileStore.activeProfile.id
timeInfo.value.start = new Date().toISOString() timeInfo.value.start = new Date().toISOString()
timeInfo.value.tenant = profileStore.currentTenant timeInfo.value.tenant = profileStore.currentTenant
@@ -124,7 +123,7 @@ const startTime = async () => {
} else if(data) { } else if(data) {
//timeInfo.value = data[0] //timeInfo.value = data[0]
await dataStore.fetchTimes() await dataStore.fetchTimes()
runningTimeInfo.value = dataStore.times.find(time => time.user === user.value.id && !time.end) runningTimeInfo.value = dataStore.times.find(time => time.profile === profileStore.activeProfile.id && !time.end)
} }
} }
@@ -155,8 +154,8 @@ const stopStartedTime = async () => {
} }
} }
if(dataStore.times.find(time => time.user == user.value.id && !time.end)) { if(times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end)) {
runningTimeInfo.value = dataStore.times.find(time => time.user == user.value.id && !time.end) runningTimeInfo.value = times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end)
} }
@@ -241,7 +240,6 @@ const setState = async (newState) => {
Erstellen Erstellen
</UButton> </UButton>
<USelectMenu <USelectMenu
v-if="dataStore.hasRight('viewTimes')"
:options="profileStore.profiles" :options="profileStore.profiles"
option-attribute="fullName" option-attribute="fullName"
value-attribute="id" value-attribute="id"

View File

@@ -208,6 +208,24 @@ const saveProfile = async () => {
/> />
</UFormGroup> </UFormGroup>
</InputGroup> </InputGroup>
<InputGroup class="w-full">
<UFormGroup
label="Festnetz Telefon"
class="w-60"
>
<UInput
v-model="itemInfo.fixedTel"
/>
</UFormGroup>
<UFormGroup
label="Handy"
class="flex-auto"
>
<UInput
v-model="itemInfo.mobileTel"
/>
</UFormGroup>
</InputGroup>
<InputGroup class="w-full"> <InputGroup class="w-full">
<UFormGroup <UFormGroup
label="Kleidergröße Oberteil" label="Kleidergröße Oberteil"

View File

@@ -36,6 +36,9 @@ const resources = {
}, },
confirmationOrders: { confirmationOrders: {
label: "Auftragsbestätigungen" label: "Auftragsbestätigungen"
},
deliveryNotes: {
label: "Lieferscheine"
} }
} }

View File

@@ -122,7 +122,7 @@ export const useDataStore = defineStore('data', () => {
numberRangeHolder: "customerNumber", numberRangeHolder: "customerNumber",
historyItemHolder: "customer", historyItemHolder: "customer",
supabaseSortColumn: "customerNumber", supabaseSortColumn: "customerNumber",
supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*)", supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), documents(*)",
filters: [], filters: [],
templateColumns: [ templateColumns: [
{ {
@@ -1296,8 +1296,7 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "projects", selectDataType: "projects",
selectOptionAttribute: "name", selectOptionAttribute: "name",
selectSearchAttributes: ['name'], selectSearchAttributes: ['name'],
}, },{
{
key: "profiles", key: "profiles",
label: "Beteiligte Benutzer", label: "Beteiligte Benutzer",
inputType: "select", inputType: "select",