fix: preserve Turkish decimal prices and verify preparation persistence

This commit is contained in:
2026-09-06 08:50:18 +03:00
parent b94ab97241
commit 311344306b
8 changed files with 387 additions and 10 deletions
+5 -4
View File
@@ -1,5 +1,5 @@
import React, { useState, useMemo } from 'react';
import { bidRowTotal, validateBidRows, roundMoney } from '../services/bidValidation';
import { bidRowTotal, validateBidRows, roundMoney, parseBidPrice } from '../services/bidValidation';
import { sourceRows, bidSourceSnapshot, restoreBidPrices } from '../services/bidSource';
import { PreparationChecks } from './PreparationChecks';
import { preparationBlockers, documentKey } from '../services/preparationChecks';
@@ -91,7 +91,7 @@ export const BidPackageBuilder = ({ results, tender: selectedTender }) => {
else setHata('Taslak kaydedilemedi. Tekrar deneyin.');
};
const toplam = teklifTuru === 'goturu' ? (Number(goturuBedel) || 0) : kalemToplami;
const toplam = teklifTuru === 'goturu' ? (parseBidPrice(goturuBedel) || 0) : kalemToplami;
const eksikler = ALANLAR.filter((a) => a.zorunlu && !String(firma[a.k] || '').trim());
const kalemEksik = teklifTuru === 'birim' && validateBidRows(satirlar).length > 0;
@@ -246,7 +246,7 @@ export const BidPackageBuilder = ({ results, tender: selectedTender }) => {
</span>
<input
value={goturuBedel}
onChange={(e) => setGoturuBedel(e.target.value.replace(/[^\d.]/g, ''))}
onChange={(e) => setGoturuBedel(e.target.value)}
placeholder="0"
className="w-full sm:w-64 text-sm font-bold px-3 py-2 rounded-lg border border-slate-300"
/>
@@ -254,6 +254,7 @@ export const BidPackageBuilder = ({ results, tender: selectedTender }) => {
) : kalemler.length > 0 ? (
<div className="space-y-2">
<h5 className="font-extrabold text-xs text-slate-900">Kalem fiyatlandırma</h5>
<p className="text-xs text-slate-500">Ondalık fiyatı 125,50 veya 125.50 biçiminde yazın; binlik ayırıcı kullanmayın.</p>
<div className="overflow-x-auto">
<table className="w-full text-xs min-w-[520px]">
<thead>
@@ -278,7 +279,7 @@ export const BidPackageBuilder = ({ results, tender: selectedTender }) => {
<input
value={fiyatlar[r.priceKey] ?? ''}
onChange={(e) =>
setFiyatlar((o) => ({ ...o, [r.priceKey]: e.target.value.replace(/[^\d.]/g, '') }))}
setFiyatlar((o) => ({ ...o, [r.priceKey]: e.target.value }))}
placeholder={r.estimatedUnitPrice != null ? String(r.estimatedUnitPrice) : '0'}
className="w-28 text-xs text-right px-2 py-1 rounded border border-slate-300"
/>