Add LineItem CSV import and fix Unit API
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { ref, watch, HTMLAttributes, onUpdated } from 'vue'
|
||||
import draggable from 'vuedraggable';
|
||||
import { cn, toCurrency } from '@/lib/utils';
|
||||
import { LineItem } from '@/types';
|
||||
import { LineItem, Unit } from '@/types';
|
||||
import { newLineItem } from '@/types/index.d'
|
||||
import { Table, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from '@/components/ui/table';
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"
|
||||
@@ -20,6 +20,7 @@ import { GrowingTextarea } from '@/components/ui/growing-textarea';
|
||||
const props = defineProps<{
|
||||
isLoading?: boolean,
|
||||
lineItems: LineItem[] | undefined,
|
||||
units: Unit[],
|
||||
stickyTop: number | string,
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
@@ -29,7 +30,6 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const isLoading = ref(props.isLoading || false)
|
||||
const units = ref(['Stück', 'Stunden', 'Tage', 'pauschal'])
|
||||
const items = ref((props.lineItems ?? []).slice().sort(function (a, b) { return a.position - b.position })) // items only uses props.lineItems as the initial value;
|
||||
|
||||
onUpdated(() => {
|
||||
@@ -165,15 +165,15 @@ const recalculatePositions = () => {
|
||||
|
||||
<!-- Einh. -->
|
||||
<TableCell class="w-1/8 text-center">
|
||||
<Select v-model="element.unit">
|
||||
<Select v-model="element.unitId">
|
||||
<SelectTrigger
|
||||
class="shadow-none bg-transparent p-1 h-7! dark:bg-transparent hover:bg-background/66 dark:hover:bg-background/66 border-none w-full">
|
||||
<SelectValue placeholder="Einheit" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="unit in units" :value="unit">
|
||||
{{ unit }}
|
||||
<SelectItem v-for="unit in units" :value="unit.id">
|
||||
{{ unit.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
|
||||
Reference in New Issue
Block a user