feat: PDF generation overhaul with shared utility and compact A4-optimized design#5
Draft
Copilot wants to merge 7 commits into
Draft
feat: PDF generation overhaul with shared utility and compact A4-optimized design#5Copilot wants to merge 7 commits into
Copilot wants to merge 7 commits into
Conversation
…nisations.js - Add utils/pdfGenerator.js with shared design tokens (colors, fonts, layout), turkishToAscii helper, smart layout selection (landscape if >5 cols or width >515px), createDoc/drawPageHeader/drawTableHeaders/drawTableRow/drawGroupHeader/ drawPageFooter/drawSignatureArea utility functions - Refactor /participants/export: uses utility, 8-col landscape, 40px margins, 20px row height, compact 60px header, white-on-blue table headers - Refactor /weighing-list: uses utility, 5-col portrait, compact design, signature area on same page - Refactor /all-weighing-list: uses utility, 5-col portrait, grouped by weight category, signature area on last page - Remove duplicate color/font/turkishToAscii definitions from route handlers Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/79e5a5f1-4088-42b5-bc9b-794d639427d8 Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/79e5a5f1-4088-42b5-bc9b-794d639427d8 Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance PDF generation for better readability and layout
feat: PDF generation overhaul with shared utility and compact A4-optimized design
May 2, 2026
- utils/pdfGenerator.js: add COMPACT_LAYOUT (30px margin, 15px rows, 28px header), drawCompactPageHeader, drawCompactTableHeaders, drawCompactRow, drawCompactGroupHeader, drawCompactSignature functions → 47 rows/page vs ~31 - routes/organisations.js: weighing-list + all-weighing-list use compact functions; import new compact utilities; signature on last page only - routes/tournamentMatches.js: add GET /:id/fixture-pdf (A4 landscape bracket tree with group labels A-H, match circles, winner names, score notes, results table, repechage section for double elimination)" Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/370528a9-6d92-49f5-867c-addbcf6f4c27 Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/370528a9-6d92-49f5-867c-addbcf6f4c27 Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
… judo bracket style) - Switch from landscape to portrait A4 - Remove all colored boxes - plain bold text header on white background - Match circles: white fill, black border (not gray) - Lines: thin black (0.6pt) everywhere - Refactored into drawBracketMatch() helper to avoid duplication - Player format: 'Name, City/Club' matching reference style - Score/notes shown centered below match circle in gray - Winner surname (bold) on output line after circle - Results table: plain black borders, no colored header row - Repechage section: same visual style as main bracket, light italic label" Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/c4ebb451-a50b-406e-a801-7454e27f1ff1 Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
- addNoteOnce: fix broken regex literals (\\s → \s inside /.../ literals) - processAdvancement: guard loser bracket rebuild so completed matches are not wiped on every GET request - createSingleEliminationBrackets: fix wrong nextMatchNumber formula for rounds 2+ (use roundStart-based indexing instead of broken Math.ceil(matchNumber/2)+totalMatches+pow formula) Agent-Logs-Url: https://github.com/mvtandas/kuras-backend/sessions/a00c39eb-9501-400c-82fd-f87da6216aab Co-authored-by: Xhanio57 <179158957+Xhanio57@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
addNoteOnce— regex literallerinde\\s→\sdüzeltmesi (satır 18-19)processAdvancement— tamamlanmış loser bracket maçları her GET'te siliniyordu →hasCompletedLoserMatchesguard eklendicreateSingleEliminationBrackets— Round 2+nextMatchNumberformülü yanlıştı (8 oyunculu brackette final maç numarası 7 yerine 8 veriyordu) →roundStarttabanlı doğru formüle geçildiOriginal prompt
PDF Oluşturma İyileştirmesi
Sorunlar:
Çözüm:
PDF Utility Dosyası Oluştur (
utils/pdfGenerator.js):Akıllı Layout Seçimi:
Font & Typography İyileştirmesi:
Sayfa Tasarrufu:
Uygulanacak Dosyalar:
routes/organisations.js- Tüm PDF endpoint'lerinde kullanroutes/tournamentMatches.js- Eğer varsaroutes/matAssignments.js- Eğer varsaÇıktılar:
The following is the prior conversation context from the user's chat exploration (may be truncated):
Assistant: ```bash
node -e "
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const User = require('./models/user');
const Role = require('./models/role');
const City = require('./models/city');
const Club = require('./models/club');
require('dotenv').config();
mongoose.connect(process.env.MONGO_URI).then(async () => {
const roles = ['Admin', 'Coach', 'Referee', 'Athlete', 'Representative'];
const cities = await City.find().limit(5);
const clubs = await Club.find().limit(5);
if (cities.length === 0 || clubs.length === 0) {
console.log('❌ Şehir veya Kulüp bulunamadı. Önce bunları oluştur!');
process.exit(1);
}
let createdCount = 0;
const usersToCreate = [];
for (const roleName of roles) {
const role = await Role.findOne({ name: roleName });
}
await User.insertMany(usersToCreate);
console.log('✅ ' + usersToCreate.length + ' test kullanıcısı başarıyla oluşturuldu!');
console.log('📊 Dağılım: Her rolden 100 kullanıcı (Toplam: 500)');
process.exit(0);
});
"
Bu komut:
Tamamlandıktan sonra test kullanıcılarını eklemek için: