Fix creating bill items

This commit is contained in:
2025-07-04 16:44:06 +02:00
parent 6f60993621
commit 63f3db6197
4 changed files with 39 additions and 40 deletions

View File

@@ -2,10 +2,9 @@ import { useState, useEffect } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Plus, Factory, TrendingUp, Briefcase } from 'lucide-react';
import { IndTransactionResponse, IndJobRecord, IndTransactionRecord, IndTransactionRecordNoId } from '@/lib/pbtypes';
import { IndTransactionRecordNoId, IndJobRecordNoId, IndTransactionRecord } from '@/lib/pbtypes';
import * as jobService from '@/services/jobService';
import * as transactionService from '@/services/transactionService';
import * as billItemService from '@/services/billItemService';
import { formatISK } from '@/utils/priceUtils';
import JobCard from '@/components/JobCard';
import JobForm from '@/components/JobForm';
@@ -14,6 +13,7 @@ import TransactionTable from '@/components/TransactionTable';
import { IndJob } from '@/lib/types';
import { createJob } from '@/services/jobService';
// TODO: Bill of materials just does not work currently Fix this shit
// Extended job type for UI components
const Index = () => {
const [jobs, setJobs] = useState<IndJob[]>([]);
@@ -36,7 +36,7 @@ const Index = () => {
}
};
const handleCreateJob = async (jobData: Omit<IndJobRecord, 'id' | 'created' | 'updated'>) => {
const handleCreateJob = async (jobData: IndJobRecordNoId) => {
try {
const newJob = await createJob(jobData);
const jobWithRelations: IndJob = {
@@ -58,7 +58,7 @@ const Index = () => {
setShowJobForm(true);
};
const handleUpdateJob = async (jobData: Omit<IndJobRecord, 'id' | 'created' | 'updated'>) => {
const handleUpdateJob = async (jobData: IndJobRecordNoId) => {
if (!editingJob) return;
try {
@@ -114,7 +114,7 @@ const Index = () => {
}
};
const handleUpdateTransaction = async (transactionId: string, updates: Partial<IndTransactionResponse>) => {
const handleUpdateTransaction = async (transactionId: string, updates: Partial<IndTransactionRecord>) => {
if (!selectedJob) return;
try {