fix: wrap long bid items within printable page width

This commit is contained in:
2026-09-06 15:12:10 +03:00
parent fb2c2b120e
commit 4d6d7009ca
4 changed files with 28 additions and 3 deletions
+2
View File
@@ -7,6 +7,7 @@ import {join} from 'node:path';
import {randomBytes} from 'node:crypto';
import {createServer as netServer} from 'node:net';
import {readyBid} from './fixtures/ready-bid.mjs';
import {printBidFixture} from './fixtures/print-bid.mjs';
import {preparationSummary} from '../src/services/preparationSummary.js';
const dir=mkdtempSync(join(tmpdir(),'ihaleist-browser-'));
process.env.AUTH_SECRET=randomBytes(32).toString('hex');
@@ -53,6 +54,7 @@ const qaTelegramStore=await import('../server/user-store.mjs');
const {createTelegramLinker}=await import('../server/telegram-link.mjs');
const qaTelegramLinker=createTelegramLinker(qaTelegramStore,()=>Date.now()+telegramClockOffset);
const ui=await createServer({server:{host:'127.0.0.1',port:0,proxy:{'/api':{target:'http://127.0.0.1:'+port}}},plugins:[{name:'qa-fixtures',configureServer(server){server.middlewares.use(async(req,res,next)=>{
if(req.url==='/qa-print-cetvel'){res.setHeader('Content-Type','text/html; charset=utf-8');res.end(printBidFixture().html);return;}
if(req.url==='/qa-responsive'){res.setHeader('Content-Type','text/html; charset=utf-8');res.end(`<html lang="tr"><h1>Yerel ekran boyutu testi</h1><p>Gerçek uygulama ayrı bir görünüm alanında yüklenir.</p><button data-width="390">390 piksel</button><button data-width="768">768 piksel</button><button data-width="1440">1440 piksel</button><pre id="metrics" aria-label="Görünüm ölçümleri"></pre><iframe title="İhaleist test görünümü" src="/" style="display:block;width:390px;height:900px;border:0"></iframe><script>document.querySelectorAll('button').forEach(button=>button.onclick=()=>document.querySelector('iframe').style.width=button.dataset.width+'px');setInterval(()=>{const doc=document.querySelector('iframe').contentDocument;if(!doc?.body)return;const width=doc.documentElement.clientWidth;const groups=[...doc.querySelectorAll('nav[aria-label="Çalışma alanları"] button')].map(el=>({label:el.textContent.trim(),left:Math.round(el.getBoundingClientRect().left),right:Math.round(el.getBoundingClientRect().right)}));document.getElementById('metrics').textContent=JSON.stringify({width,scrollWidth:doc.documentElement.scrollWidth,groups},null,2);},400);</script></html>`);return;}
if(req.url==='/qa-telegram-controls'){res.setHeader('Content-Type','text/html; charset=utf-8');res.end(`<html lang="tr"><h1>Yerel Telegram testi</h1><p>Gerçek Telegram mesajı gönderilmez.</p><button id="recover">Telegram durum hatasını kapat</button><button id="enable">Sentetik bağlamayı aç</button><button id="receive">Son kodu sentetik sohbete ulaştır</button><button id="expire">Kod süresini bitir</button><p role="status"></p><script>for(const mode of ['recover','enable','receive','expire'])document.getElementById(mode).onclick=async()=>{const r=await fetch('/qa-telegram-fixture?mode='+mode,{method:'POST'});document.querySelector('[role=status]').textContent=await r.text();};</script></html>`);return;}
if(req.url?.startsWith('/qa-telegram-fixture?')&&req.method==='POST'){
+10
View File
@@ -0,0 +1,10 @@
import {belgeYazdir,teklifCetveliHtml} from '../../src/services/bidDocs.js';
import {bidTotal} from '../../src/services/bidValidation.js';
export function printBidFixture() {
const rows=Array.from({length:100},(_,i)=>({name:`Kalem ${String(i+1).padStart(3,'0')} — Ölçüm, İğdır, Şırınga, Çözelti, tüp ve özgül laboratuvar test kiti ${i%7===0?'uzun teknik ürün açıklaması '.repeat(5):''}${i===49?'UZUNÜRÜNKODU'.repeat(12):''}`,quantity:'3 adet',birimFiyat:'125.335'}));
const form={idare:'QA İğdır Üniversitesi Sağlık Araştırma ve Uygulama Merkezi',isinAdi:'Sentetik 100 kalem Türkçe laboratuvar teklif cetveli',ikn:'QA/100',ihaleTarihi:'22.09.2026',firmaUnvan:'QA Ölçüm ve Sağlık Ürünleri',yetkiliAd:'QA Şule Çığ',yetkiliGorev:'Test Yetkilisi'};
let html='';
belgeYazdir('QA — 100 Kalem',teklifCetveliHtml(form,rows,bidTotal(rows)),{document:{open(){},write(value){html=value;},close(){}},focus(){}});
return {html,rows,total:bidTotal(rows)};
}