From c9d9cd99eebea1d7e0c80757b70abbc3e6de9a00 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 12:51:30 +0000 Subject: [PATCH] Remove date fields and add job dump import Removed date fields from the job form and added a text area for importing job dumps. --- src/components/JobForm.tsx | 101 ++++++------------------------------- 1 file changed, 16 insertions(+), 85 deletions(-) diff --git a/src/components/JobForm.tsx b/src/components/JobForm.tsx index 60a95f5..570ff26 100644 --- a/src/components/JobForm.tsx +++ b/src/components/JobForm.tsx @@ -1,8 +1,10 @@ + import React, { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { IndJobStatusOptions, IndJobRecordNoId } from '@/lib/pbtypes'; import { IndJob } from '@/lib/types'; @@ -14,48 +16,23 @@ interface JobFormProps { onCancel: () => void; } -const formatDateForInput = (dateString: string | undefined | null): string => { - if (!dateString) return ''; - - // Create a date object in local timezone - const date = new Date(dateString); - - // Format to YYYY-MM-DD - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - - // Format to HH:MM - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - - // Combine into format required by datetime-local (YYYY-MM-DDTHH:MM) - return `${year}-${month}-${day}T${hours}:${minutes}`; -}; - const JobForm: React.FC = ({ job, onSubmit, onCancel }) => { const [formData, setFormData] = useState({ outputItem: job?.outputItem || '', outputQuantity: job?.outputQuantity || 0, - jobStart: formatDateForInput(job?.jobStart), - jobEnd: formatDateForInput(job?.jobEnd), - saleStart: formatDateForInput(job?.saleStart), - saleEnd: formatDateForInput(job?.saleEnd), status: job?.status || IndJobStatusOptions.Planned, projectedCost: job?.projectedCost || 0, projectedRevenue: job?.projectedRevenue || 0 }); + const [jobDump, setJobDump] = useState(''); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); onSubmit({ outputItem: formData.outputItem, outputQuantity: formData.outputQuantity, - jobStart: formData.jobStart || undefined, - jobEnd: formData.jobEnd || undefined, - saleStart: formData.saleStart || undefined, - saleEnd: formData.saleEnd || undefined, status: formData.status, projectedCost: formData.projectedCost, projectedRevenue: formData.projectedRevenue @@ -122,64 +99,6 @@ const JobForm: React.FC = ({ job, onSubmit, onCancel }) => { -
-
- - setFormData({ - ...formData, - jobStart: e.target.value - })} - className="bg-gray-800 border-gray-600 text-white" - /> -
-
- - setFormData({ - ...formData, - jobEnd: e.target.value - })} - className="bg-gray-800 border-gray-600 text-white" - /> -
-
- -
-
- - setFormData({ - ...formData, - saleStart: e.target.value - })} - className="bg-gray-800 border-gray-600 text-white" - /> -
-
- - setFormData({ - ...formData, - saleEnd: e.target.value - })} - className="bg-gray-800 border-gray-600 text-white" - /> -
-
-
@@ -209,6 +128,18 @@ const JobForm: React.FC = ({ job, onSubmit, onCancel }) => {
+
+ +