Changes in Document Creation, Calendar, Notifications, Settings

This commit is contained in:
2024-03-04 20:26:30 +01:00
parent 8e69cda09b
commit 8f444bd917
12 changed files with 315 additions and 71 deletions

View File

@@ -61,6 +61,9 @@ const tabItems = computed(() => {
const setupPage = () => {
if(route.params) {
if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id))
if(!itemInfo.value.deliveryDateType) itemInfo.value.deliveryDateType = "Lieferdatum"
}
if(route.query) {
@@ -165,6 +168,18 @@ const addPosition = (mode) => {
}
const editRowDescription = (row) => {
rowToEdit.value = row.description
showEditRowDescription.value = true
}
const showEditRowDescription = ref(false)
const rowToEdit = ref("")
const saveRowDescription = () => {
}
const removePosition = (id) => {
let rows = itemInfo.value.rows.filter(row => row.id !== id)
/*rows = rows.sort((a,b) => a.pos - b.pos)
@@ -185,7 +200,7 @@ const documentTotal = computed(() => {
let totalGross = 0
itemInfo.value.rows.forEach(row => {
if(row.mode === 'free' || row.mode === 'normal'){
if(row.mode !== 'pagebreak'){
console.log(row)
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2)
console.log(rowPrice)
@@ -222,8 +237,9 @@ const getDocumentData = () => {
let unit = dataStore.units.find(i => i.id === row.unit)
if(row.mode === 'free' || row.mode === 'normal') {
if(row.mode !== 'pagebreak') {
if(row.mode === 'normal') row.text = dataStore.getProductById(row.product).name
if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name
return {
...row,
@@ -323,6 +339,7 @@ const saveDocument = async () => {
project: itemInfo.value.project,
documentNumber: itemInfo.value.documentNumber,
documentDate: itemInfo.value.documentDate,
deliveryDateType: itemInfo.value.deliveryDateType,
info: {
},
@@ -595,22 +612,31 @@ setupPage()
<UFormGroup
label="Projekt:"
>
<USelectMenu
:options="dataStore.projects"
v-model="itemInfo.project"
value-attribute="id"
option-attribute="name"
searchable
searchable-placeholder="Suche..."
:search-attributes="['name']"
>
<template #label>
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
</template>
<template #option="{option: project}">
{{dataStore.getCustomerById(project.customer).name}} - {{project.name}}
</template>
</USelectMenu>
<InputGroup>
<USelectMenu
:options="dataStore.projects"
v-model="itemInfo.project"
value-attribute="id"
option-attribute="name"
searchable
searchable-placeholder="Suche..."
:search-attributes="['name']"
class="w-full"
>
<template #label>
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
</template>
<template #option="{option: project}">
{{dataStore.getCustomerById(project.customer).name}} - {{project.name}}
</template>
</USelectMenu>
<UButton
variant="outline"
v-if="itemInfo.project"
icon="i-heroicons-arrow-right-end-on-rectangle"
>Projekt</UButton>
</InputGroup>
</UFormGroup>
</div>
@@ -674,12 +700,13 @@ setupPage()
<tr>
<th></th>
<th>Pos.</th>
<th>Produkt / Leistung</th>
<th>Name</th>
<th>Menge</th>
<th>Einheit</th>
<th>Preis</th>
<th>Steuer</th>
<th>Rabatt</th>
<th>Beschreibung</th>
<th>Gesamt</th>
</tr>
</thead>
@@ -704,7 +731,7 @@ setupPage()
</td>
<td
v-if="row.mode === 'pagebreak'"
colspan="8"
colspan="9"
>
<UDivider/>
</td>
@@ -788,6 +815,7 @@ setupPage()
</USelectMenu>
</td>
<td
class="w-40"
v-if="row.mode !== 'pagebreak'"
>
<UInput
@@ -833,6 +861,37 @@ setupPage()
</template>
</UInput>
</td>
<td
class="w-40"
v-if="row.mode !== 'pagebreak'"
>
<UButton
icon="i-heroicons-document-text"
@click="showEditRowDescription = true"
/>
<UModal v-model="showEditRowDescription">
<UCard>
<template #header>
Beschreibung bearbeiten
</template>
<UTextarea
v-model="row.description"
>
</UTextarea>
<template #footer>
<UButton
@click="showEditRowDescription = false"
>
Speichern
</UButton>
</template>
</UCard>
</UModal>
</td>
<td
v-if="row.mode !== 'pagebreak'"
>