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>
<template>
@@ -410,6 +414,12 @@ const changeActivePhase = async (key) => {
>
+ Rechnung
</UButton>
<UButton
@click="invoiceDeliveryNotes"
v-if="type === 'projects'"
>
Lieferscheine abrechnen
</UButton>
</Toolbar>
<UTable

View File

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

View File

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

View File

@@ -208,6 +208,24 @@ const saveProfile = async () => {
/>
</UFormGroup>
</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">
<UFormGroup
label="Kleidergröße Oberteil"

View File

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

View File

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