fix: withhold print action until bid validation finishes
This commit is contained in:
@@ -180,7 +180,7 @@ export const BidPackageBuilder = ({ results, tender: selectedTender, initialFocu
|
||||
if(initialDeadlineProblem)throw new Error(initialDeadlineProblem);
|
||||
if (!hazir) throw new Error('Kalem, miktar, birim, fiyat, firma ve geçerlilik süresindeki eksikleri giderin.');
|
||||
// Open during the click; async validation must not lose popup activation.
|
||||
printWindow.current = belgeYazdir('Dosya kontrolü', '<p>Belgeler kontrol ediliyor…</p>');
|
||||
printWindow.current = belgeYazdir('Dosya kontrolü', '<p role="status">Belgeler kontrol ediliyor…</p>', undefined, {pending:true});
|
||||
setPrinting(true);
|
||||
const linkedPortfolio=lotSelection.rows.some(row=>checks.products?.[row.priceKey]?.portfolioId);
|
||||
const readPortfolio=async()=>linkedPortfolio ? (await getAllUserData()).firma_profil?.scrapedCapabilities?.healthPortfolio || [] : [];
|
||||
|
||||
@@ -83,19 +83,19 @@ const STIL = `
|
||||
@media print { .yazdirma { display: none; } }
|
||||
`;
|
||||
|
||||
/** Belgeyi kendi penceresinde açıp yazdırma diyaloğunu tetikler. */
|
||||
export function belgeYazdir(baslik, govde, existingWindow) {
|
||||
/** Belgeyi kendi penceresinde açar; kullanıcı hazır belgeyi yazdırabilir. */
|
||||
export function belgeYazdir(baslik, govde, existingWindow, {pending = false} = {}) {
|
||||
const w = existingWindow || window.open('', '_blank', 'width=900,height=1000');
|
||||
if (!w) throw new Error('Tarayıcı yeni pencereyi engelledi. Açılır pencere iznini verip tekrar deneyin.');
|
||||
if(w.closed) throw new Error('Çıktı penceresi kapatıldı. Yeniden deneyin.');
|
||||
w.document.open();
|
||||
w.document.write(`<!doctype html><html lang="tr"><head><meta charset="utf-8">
|
||||
<title>${kacir(baslik)}</title><style>${STIL}</style></head><body>${govde}
|
||||
<div class="yazdirma" style="text-align:center;margin-top:10mm">
|
||||
${pending ? '' : `<div class="yazdirma" style="text-align:center;margin-top:10mm">
|
||||
<button onclick="window.print()" style="font:600 14px system-ui;padding:10px 22px;cursor:pointer">
|
||||
Yazdır / PDF olarak kaydet
|
||||
</button>
|
||||
</div></body></html>`);
|
||||
</div>`}</body></html>`);
|
||||
w.document.close();
|
||||
w.focus();
|
||||
return w;
|
||||
|
||||
Reference in New Issue
Block a user