From 135ce5d8fa599401fc6decce2734d09ee7b7dd12 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 10:48:44 +0000 Subject: [PATCH] Fix UI and functionality issues Fixes tax config button size, recalculates min prices on tax change, saves tax on blur, and implements automatic pasting to batch assign. --- src/components/JobCardDetails.tsx | 13 +++++++-- src/pages/Index.tsx | 46 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/components/JobCardDetails.tsx b/src/components/JobCardDetails.tsx index 111fc9e..e7a9e51 100644 --- a/src/components/JobCardDetails.tsx +++ b/src/components/JobCardDetails.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { Calendar, Factory, Clock, Copy } from 'lucide-react'; import { Input } from '@/components/ui/input'; import { IndJob } from '@/lib/types'; @@ -164,9 +164,16 @@ interface MinPriceDisplayProps { const MinPriceDisplay: React.FC = ({ job }) => { const { copying, copyToClipboard } = useClipboard(); + const [salesTax, setSalesTax] = useState(() => parseFloat(localStorage.getItem('salesTax') || '0') / 100); - // Get sales tax from localStorage (default 0%) - const salesTax = parseFloat(localStorage.getItem('salesTax') || '0') / 100; + // Listen for storage changes to update tax rate + useEffect(() => { + const handleStorageChange = () => { + setSalesTax(parseFloat(localStorage.getItem('salesTax') || '0') / 100); + }; + window.addEventListener('storage', handleStorageChange); + return () => window.removeEventListener('storage', handleStorageChange); + }, []); const minPricePerUnit = job.projectedRevenue / job.produced; const minPriceWithTax = minPricePerUnit * (1 + salesTax); diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 02562ee..b4dbcc8 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -262,7 +262,27 @@ const Index = () => { - -