diff --git a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/ComparisonMatrix.tsx b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/ComparisonMatrix.tsx index e7d151d..5385052 100644 --- a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/ComparisonMatrix.tsx +++ b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/ComparisonMatrix.tsx @@ -80,7 +80,6 @@ export function ComparisonMatrix({ matrix, currencyRates, isRestrictedView, adat
void adata.checkSupplier(s.id)} /> - {s.isNoOffer && Без КП} {currency !== 'KZT' && {currency}}
diff --git a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/MatrixRowView.tsx b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/MatrixRowView.tsx index dae0f20..69cf9bb 100644 --- a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/MatrixRowView.tsx +++ b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/MatrixRowView.tsx @@ -74,7 +74,7 @@ export function MatrixRowView({ pos, posIndex, matrix, currencyRates, isRestrict } const rate = isForeign ? (currencyRates.find(r => r.code === currency)?.rateToKzt ?? 1) : 1; - const qty = item.quantity ?? ((s.isNoOffer || s.isExtraSupplier) && pos.quantity ? pos.quantity : undefined); + const qty = item.quantity ?? (s.isExtraSupplier && pos.quantity ? pos.quantity : undefined); const price = item.pricePerUnit; const totalInCurrency = (price ?? 0) * (qty ?? 0); const priceKzt = (price ?? 0) * rate; diff --git a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/Step3ComparisonTable.module.scss b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/Step3ComparisonTable.module.scss index b55c7ad..5922478 100644 --- a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/Step3ComparisonTable.module.scss +++ b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/Step3ComparisonTable.module.scss @@ -213,16 +213,6 @@ white-space: nowrap; } -.noOfferTag { - font-size: 11px; - background: $danger-bg; - color: $danger; - padding: 1px 7px; - border-radius: 10px; - white-space: nowrap; - font-weight: 600; -} - .deleteSupplierBtn { width: 20px; height: 20px; diff --git a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/useStep3Matrix.ts b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/useStep3Matrix.ts index e1f885d..afbf0c6 100644 --- a/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/useStep3Matrix.ts +++ b/src/webparts/ctFormsPortal/forms/ct/components/Step3ComparisonTable/useStep3Matrix.ts @@ -290,9 +290,13 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { }, []); const suppliersWithOffer = useMemo(() => [ - ...suppliers.map(s => ({ ...s, isExtraSupplier: false as const, isNoOffer: !s.hasOffer })), + // Поставщики без КП с Шага 2 (hasOffer:false) в таблицу сравнения не попадают — сравнивать + // у них нечего. Ручной ввод цен остаётся за поставщиками, добавленными на самом Шаге 3 (extras). + ...suppliers + .filter(s => s.hasOffer !== false) + .map(s => ({ ...s, isExtraSupplier: false as const })), ...extraSuppliers.map(es => ({ - id: es.id, name: es.name, hasOffer: true as const, isExtraSupplier: true as const, isNoOffer: false as const, + id: es.id, name: es.name, hasOffer: true as const, isExtraSupplier: true as const, // spId/bin известны сразу для поставщиков, добавленных из «База данных поставщиков» // (см. handleAddSupplierFromDatabase) — без этого useAdataCheck не увидит их БИН. spId: es.spId, bin: es.bin, @@ -343,10 +347,10 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { const rate = currency !== 'KZT' ? (currencyRates.find(r => r.code === currency)?.rateToKzt ?? 1) : 1; - // For noOffer/extra suppliers quantity may be undefined in edits (user only entered price). + // For extra suppliers quantity may be undefined in edits (user only entered price). // Fall back to the position's own quantity so totalWithExtraKzt stays non-zero and the // offer is included in filteredComputed → persisted in offersForSession → restored on remount. - const posQtyFallback = (s.isNoOffer || s.isExtraSupplier) ? (pos.quantity || undefined) : undefined; + const posQtyFallback = s.isExtraSupplier ? (pos.quantity || undefined) : undefined; items.forEach(item => result.push(computeOffer( { ...item, @@ -694,20 +698,6 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { extraOfferIds[es.id] = offerId; } - const noOfferSupSpIds: Record = {}; - const noOfferOfferIds: Record = {}; - for (const s of suppliers.filter(sup => !sup.hasOffer)) { - const hasData = computedOffers.some(o => o.supplierId === s.id && o.totalWithExtraKzt > 0); - if (!hasData) continue; - if (s.spId) { - noOfferSupSpIds[s.id] = s.spId; - continue; - } - const { spId, offerId } = await service.saveManualSupplierWithKp(s.name); - noOfferSupSpIds[s.id] = spId; - noOfferOfferIds[s.id] = offerId; - } - const extraPosSpIds: Record = {}; for (const ep of extraPositions) { if (ep.spId) { @@ -735,7 +725,7 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { const offersToSave = computedOffers .filter(o => o.totalWithExtraKzt > 0) .map(o => { - const supSpId = extraSupSpIds[o.supplierId] ?? noOfferSupSpIds[o.supplierId]; + const supSpId = extraSupSpIds[o.supplierId]; const posSpId = extraPosSpIds[o.positionId]; const existingSup = suppliers.find(s => s.id === o.supplierId); const existingPos = selectedPositions.find(p => p.id === o.positionId); @@ -761,7 +751,6 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { : (existingPos?.spId ? String(existingPos.spId) : o.positionId), offerId: originalOffer?.offerId ?? (extraOfferIds[o.supplierId] !== undefined ? String(extraOfferIds[o.supplierId]) : undefined) - ?? (noOfferOfferIds[o.supplierId] !== undefined ? String(noOfferOfferIds[o.supplierId]) : undefined) ?? (kpFileOfferId !== undefined ? String(kpFileOfferId) : undefined), ...(kmVal !== undefined ? { deliveryDistanceKm: kmVal } : {}), }; @@ -784,7 +773,6 @@ export function useStep3Matrix(args: UseStep3MatrixArgs) { ...suppliers.map(s => ({ ...s, status: supplierStatuses[s.id] ?? s.status, - ...(noOfferSupSpIds[s.id] !== undefined ? { spId: noOfferSupSpIds[s.id] } : {}), })), // Move extras into suppliers (with React ID kept as `id` — required so formData.offers // entries with React IDs still match sup.id on remount). Skip extras that are already in