diff --git a/dashboards/roadmap-v2.html b/dashboards/roadmap-v2.html index e085f1a..189768d 100644 --- a/dashboards/roadmap-v2.html +++ b/dashboards/roadmap-v2.html @@ -538,9 +538,40 @@ max-height: 600px; overflow-y: auto; border: 1px solid var(--border); - border-radius: 10px; + border-radius: 10px 10px 0 0; } + .pagination-bar { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 16px; + background: #F8FAFC; + border: 1px solid var(--border); + border-top: none; + border-radius: 0 0 10px 10px; + font-size: 12px; + flex-wrap: wrap; + gap: 10px; + margin-bottom: 16px; + } + + .page-btn { + padding: 5px 12px; + border-radius: 6px; + border: 1px solid var(--border); + background: #fff; + font-size: 12px; + font-weight: 700; + cursor: pointer; + font-feature-settings: "tnum"; + transition: all 0.15s ease; + } + + .page-btn:hover { background: #F1F5F9; border-color: #CBD5E1; } + .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); } + .page-btn:disabled { opacity: 0.4; cursor: not-allowed; } + .kanban-grid { display: grid; grid-template-columns: repeat(4, 1fr); @@ -956,6 +987,20 @@ + +
+
+ نمایش در هر صفحه: + + +
+
+
@@ -1447,9 +1492,32 @@ if (room?.city) { const nc = document.getElementById('caganNowCount'); const nxc = document.getElementById('caganNextCount'); const lc = document.getElementById('caganLaterCount'); - if (nc) nc.textContent = `${nowCount} تسک`; - if (nxc) nxc.textContent = `${nextCount} تسک`; - if (lc) lc.textContent = `${laterCount} تسک`; + if (nc) nc.textContent = `${toFa(nowCount)} تسک`; + if (nxc) nxc.textContent = `${toFa(nextCount)} تسک`; + if (lc) lc.textContent = `${toFa(laterCount)} تسک`; + } + + // تبدیل اعداد به ارقام فارسی + function toFa(num) { + if (num === null || num === undefined) return ''; + const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; + return String(num).replace(/\d/g, d => persianDigits[parseInt(d, 10)]); + } + + let masterCurrentPage = 1; + let masterPageSize = 25; + + function changeMasterPageSize(val) { + masterPageSize = val === 'all' ? 'all' : parseInt(val, 10); + masterCurrentPage = 1; + renderMasterTable(); + } + + function setMasterPage(page) { + masterCurrentPage = page; + renderMasterTable(); + const el = document.getElementById('masterTableBody'); + if (el) el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } function renderMasterTable() { @@ -1481,14 +1549,54 @@ if (room?.city) { }); const fc = document.getElementById('filteredCountText'); - if (fc) fc.textContent = filtered.length; + if (fc) fc.textContent = toFa(filtered.length); + + const totalItems = filtered.length; + let displayItems = filtered; + let totalPages = 1; + + if (masterPageSize !== 'all') { + totalPages = Math.ceil(totalItems / masterPageSize) || 1; + if (masterCurrentPage > totalPages) masterCurrentPage = totalPages; + const startIdx = (masterCurrentPage - 1) * masterPageSize; + displayItems = filtered.slice(startIdx, startIdx + masterPageSize); + } + + // به‌روزرسانی نوار صفحه‌بندی + const paginationInfo = document.getElementById('masterPaginationInfo'); + const pageButtonsContainer = document.getElementById('masterPageButtons'); + if (paginationInfo && pageButtonsContainer) { + if (masterPageSize === 'all') { + paginationInfo.textContent = `نمایش همه ${toFa(totalItems)} تسک`; + pageButtonsContainer.innerHTML = ''; + } else { + const startNum = totalItems === 0 ? 0 : (masterCurrentPage - 1) * masterPageSize + 1; + const endNum = Math.min(masterCurrentPage * masterPageSize, totalItems); + paginationInfo.textContent = `نمایش ${toFa(startNum)} تا ${toFa(endNum)} از ${toFa(totalItems)} تسک (صفحه ${toFa(masterCurrentPage)} از ${toFa(totalPages)})`; + + let btnsHtml = ` + + `; + for (let p = 1; p <= totalPages; p++) { + if (p === 1 || p === totalPages || (p >= masterCurrentPage - 2 && p <= masterCurrentPage + 2)) { + btnsHtml += ``; + } else if (p === masterCurrentPage - 3 || p === masterCurrentPage + 3) { + btnsHtml += `...`; + } + } + btnsHtml += ` + + `; + pageButtonsContainer.innerHTML = btnsHtml; + } + } if (filtered.length === 0) { tbody.innerHTML = 'هیچ تسکی با فیلترهای انتخابی مطابقت ندارد.'; return; } - filtered.forEach(t => { + displayItems.forEach(t => { const tr = document.createElement('tr'); let prioClass = 'badge-medium'; @@ -1501,9 +1609,9 @@ if (room?.city) { else if (t.cagan_horizon === 'Next') horizonClass = 'badge-high'; tr.innerHTML = ` - ${t.key} + ${t.key} -
${t.summary}
+
${t.summary}
افق کاگان: ${t.cagan_horizon} | پیشنهاد: ${t.recommended_week}
👤 ${t.assignee} diff --git a/roadmap-v2.html b/roadmap-v2.html index e085f1a..189768d 100644 --- a/roadmap-v2.html +++ b/roadmap-v2.html @@ -538,9 +538,40 @@ max-height: 600px; overflow-y: auto; border: 1px solid var(--border); - border-radius: 10px; + border-radius: 10px 10px 0 0; } + .pagination-bar { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 16px; + background: #F8FAFC; + border: 1px solid var(--border); + border-top: none; + border-radius: 0 0 10px 10px; + font-size: 12px; + flex-wrap: wrap; + gap: 10px; + margin-bottom: 16px; + } + + .page-btn { + padding: 5px 12px; + border-radius: 6px; + border: 1px solid var(--border); + background: #fff; + font-size: 12px; + font-weight: 700; + cursor: pointer; + font-feature-settings: "tnum"; + transition: all 0.15s ease; + } + + .page-btn:hover { background: #F1F5F9; border-color: #CBD5E1; } + .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); } + .page-btn:disabled { opacity: 0.4; cursor: not-allowed; } + .kanban-grid { display: grid; grid-template-columns: repeat(4, 1fr); @@ -956,6 +987,20 @@ + +
+
+ نمایش در هر صفحه: + + +
+
+
@@ -1447,9 +1492,32 @@ if (room?.city) { const nc = document.getElementById('caganNowCount'); const nxc = document.getElementById('caganNextCount'); const lc = document.getElementById('caganLaterCount'); - if (nc) nc.textContent = `${nowCount} تسک`; - if (nxc) nxc.textContent = `${nextCount} تسک`; - if (lc) lc.textContent = `${laterCount} تسک`; + if (nc) nc.textContent = `${toFa(nowCount)} تسک`; + if (nxc) nxc.textContent = `${toFa(nextCount)} تسک`; + if (lc) lc.textContent = `${toFa(laterCount)} تسک`; + } + + // تبدیل اعداد به ارقام فارسی + function toFa(num) { + if (num === null || num === undefined) return ''; + const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; + return String(num).replace(/\d/g, d => persianDigits[parseInt(d, 10)]); + } + + let masterCurrentPage = 1; + let masterPageSize = 25; + + function changeMasterPageSize(val) { + masterPageSize = val === 'all' ? 'all' : parseInt(val, 10); + masterCurrentPage = 1; + renderMasterTable(); + } + + function setMasterPage(page) { + masterCurrentPage = page; + renderMasterTable(); + const el = document.getElementById('masterTableBody'); + if (el) el.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); } function renderMasterTable() { @@ -1481,14 +1549,54 @@ if (room?.city) { }); const fc = document.getElementById('filteredCountText'); - if (fc) fc.textContent = filtered.length; + if (fc) fc.textContent = toFa(filtered.length); + + const totalItems = filtered.length; + let displayItems = filtered; + let totalPages = 1; + + if (masterPageSize !== 'all') { + totalPages = Math.ceil(totalItems / masterPageSize) || 1; + if (masterCurrentPage > totalPages) masterCurrentPage = totalPages; + const startIdx = (masterCurrentPage - 1) * masterPageSize; + displayItems = filtered.slice(startIdx, startIdx + masterPageSize); + } + + // به‌روزرسانی نوار صفحه‌بندی + const paginationInfo = document.getElementById('masterPaginationInfo'); + const pageButtonsContainer = document.getElementById('masterPageButtons'); + if (paginationInfo && pageButtonsContainer) { + if (masterPageSize === 'all') { + paginationInfo.textContent = `نمایش همه ${toFa(totalItems)} تسک`; + pageButtonsContainer.innerHTML = ''; + } else { + const startNum = totalItems === 0 ? 0 : (masterCurrentPage - 1) * masterPageSize + 1; + const endNum = Math.min(masterCurrentPage * masterPageSize, totalItems); + paginationInfo.textContent = `نمایش ${toFa(startNum)} تا ${toFa(endNum)} از ${toFa(totalItems)} تسک (صفحه ${toFa(masterCurrentPage)} از ${toFa(totalPages)})`; + + let btnsHtml = ` + + `; + for (let p = 1; p <= totalPages; p++) { + if (p === 1 || p === totalPages || (p >= masterCurrentPage - 2 && p <= masterCurrentPage + 2)) { + btnsHtml += ``; + } else if (p === masterCurrentPage - 3 || p === masterCurrentPage + 3) { + btnsHtml += `...`; + } + } + btnsHtml += ` + + `; + pageButtonsContainer.innerHTML = btnsHtml; + } + } if (filtered.length === 0) { tbody.innerHTML = 'هیچ تسکی با فیلترهای انتخابی مطابقت ندارد.'; return; } - filtered.forEach(t => { + displayItems.forEach(t => { const tr = document.createElement('tr'); let prioClass = 'badge-medium'; @@ -1501,9 +1609,9 @@ if (room?.city) { else if (t.cagan_horizon === 'Next') horizonClass = 'badge-high'; tr.innerHTML = ` - ${t.key} + ${t.key} -
${t.summary}
+
${t.summary}
افق کاگان: ${t.cagan_horizon} | پیشنهاد: ${t.recommended_week}
👤 ${t.assignee}