Skip to content

Commit

Permalink
fix : sendestimate price
Browse files Browse the repository at this point in the history
  • Loading branch information
sw326 committed Sep 11, 2024
1 parent 81e0376 commit 3a1a62a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/partners/SendEstimate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ const SendEstimate: React.FC = () => {
getEstimateList(),
getCommissionList(),
]);
const selectedEstimate = estimates.find((e) => e.id === estimateId);
const selectedEstimate = estimates.find(e => e.id === estimateId);
setEstimate(selectedEstimate || null);

if (selectedEstimate) {
const selectedCommission = commissions.find(
(c) => c.id === selectedEstimate.commissionId,
c => c.id === selectedEstimate.commissionId,
);
setCommission(selectedCommission || null);
// Initialize finalPrice with the estimate's tmpPrice
setFinalPrice(selectedEstimate.tmpPrice || 0);
}
} catch (error) {
console.error('Error fetching estimate and commission:', error);
Expand All @@ -53,7 +55,7 @@ const SendEstimate: React.FC = () => {
const updatedEstimate: Partial<Estimate> = {
...estimate,
tmpPrice: finalPrice,
status: 'CONTACT', // 상태를 CONTACT로 설정
status: 'CONTACT',
};

await updateEstimate(estimate.id, updatedEstimate);
Expand Down Expand Up @@ -103,7 +105,7 @@ const SendEstimate: React.FC = () => {
type="number"
id="finalPrice"
value={finalPrice}
onChange={(e) => setFinalPrice(parseFloat(e.target.value))}
onChange={e => setFinalPrice(Number(e.target.value))}
className="w-full border rounded-md py-2 px-3 text-gray-700"
required
/>
Expand Down

0 comments on commit 3a1a62a

Please sign in to comment.