Add pagination and Persian digits to Master Explorer
This commit is contained in:
parent
0b357de103
commit
0b836fb4ce
2 changed files with 232 additions and 16 deletions
|
|
@ -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 @@
|
|||
<tbody id="masterTableBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- نوار صفحهبندی جدول جامع -->
|
||||
<div class="pagination-bar" id="masterPaginationBar">
|
||||
<div style="display:flex;align-items:center;gap:8px;">
|
||||
<span>نمایش در هر صفحه:</span>
|
||||
<select id="masterPageSizeSelect" class="select-input" style="padding:4px 8px;font-size:11px;" onchange="changeMasterPageSize(this.value)">
|
||||
<option value="25">۲۵ تسک</option>
|
||||
<option value="50">۵۰ تسک</option>
|
||||
<option value="100">۱۰۰ تسک</option>
|
||||
<option value="all">نمایش همه (۱۴۵ تسک)</option>
|
||||
</select>
|
||||
<span id="masterPaginationInfo" style="color:var(--text-muted);margin-right:10px;"></span>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:6px;" id="masterPageButtons"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -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 = `
|
||||
<button class="page-btn" ${masterCurrentPage <= 1 ? 'disabled' : ''} onclick="setMasterPage(${masterCurrentPage - 1})">قبلی</button>
|
||||
`;
|
||||
for (let p = 1; p <= totalPages; p++) {
|
||||
if (p === 1 || p === totalPages || (p >= masterCurrentPage - 2 && p <= masterCurrentPage + 2)) {
|
||||
btnsHtml += `<button class="page-btn ${p === masterCurrentPage ? 'active' : ''}" onclick="setMasterPage(${p})">${toFa(p)}</button>`;
|
||||
} else if (p === masterCurrentPage - 3 || p === masterCurrentPage + 3) {
|
||||
btnsHtml += `<span style="padding:0 4px;color:var(--text-muted);">...</span>`;
|
||||
}
|
||||
}
|
||||
btnsHtml += `
|
||||
<button class="page-btn" ${masterCurrentPage >= totalPages ? 'disabled' : ''} onclick="setMasterPage(${masterCurrentPage + 1})">بعدی</button>
|
||||
`;
|
||||
pageButtonsContainer.innerHTML = btnsHtml;
|
||||
}
|
||||
}
|
||||
|
||||
if (filtered.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" style="text-align:center;padding:24px;color:var(--text-muted);">هیچ تسکی با فیلترهای انتخابی مطابقت ندارد.</td></tr>';
|
||||
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 = `
|
||||
<td style="font-weight:800;color:var(--primary);font-feature-settings:'tnum';">${t.key}</td>
|
||||
<td style="font-weight:800;color:var(--primary);font-feature-settings:'tnum';"><bdi>${t.key}</bdi></td>
|
||||
<td>
|
||||
<div style="font-weight:700;color:var(--text);line-height:1.4;">${t.summary}</div>
|
||||
<div style="font-weight:700;color:var(--text);line-height:1.4;"><bdi>${t.summary}</bdi></div>
|
||||
<div style="font-size:11px;color:var(--text-muted);margin-top:2px;">افق کاگان: ${t.cagan_horizon} | پیشنهاد: ${t.recommended_week}</div>
|
||||
</td>
|
||||
<td><span class="assignee-chip">👤 ${t.assignee}</span></td>
|
||||
|
|
|
|||
124
roadmap-v2.html
124
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 @@
|
|||
<tbody id="masterTableBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- نوار صفحهبندی جدول جامع -->
|
||||
<div class="pagination-bar" id="masterPaginationBar">
|
||||
<div style="display:flex;align-items:center;gap:8px;">
|
||||
<span>نمایش در هر صفحه:</span>
|
||||
<select id="masterPageSizeSelect" class="select-input" style="padding:4px 8px;font-size:11px;" onchange="changeMasterPageSize(this.value)">
|
||||
<option value="25">۲۵ تسک</option>
|
||||
<option value="50">۵۰ تسک</option>
|
||||
<option value="100">۱۰۰ تسک</option>
|
||||
<option value="all">نمایش همه (۱۴۵ تسک)</option>
|
||||
</select>
|
||||
<span id="masterPaginationInfo" style="color:var(--text-muted);margin-right:10px;"></span>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:6px;" id="masterPageButtons"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -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 = `
|
||||
<button class="page-btn" ${masterCurrentPage <= 1 ? 'disabled' : ''} onclick="setMasterPage(${masterCurrentPage - 1})">قبلی</button>
|
||||
`;
|
||||
for (let p = 1; p <= totalPages; p++) {
|
||||
if (p === 1 || p === totalPages || (p >= masterCurrentPage - 2 && p <= masterCurrentPage + 2)) {
|
||||
btnsHtml += `<button class="page-btn ${p === masterCurrentPage ? 'active' : ''}" onclick="setMasterPage(${p})">${toFa(p)}</button>`;
|
||||
} else if (p === masterCurrentPage - 3 || p === masterCurrentPage + 3) {
|
||||
btnsHtml += `<span style="padding:0 4px;color:var(--text-muted);">...</span>`;
|
||||
}
|
||||
}
|
||||
btnsHtml += `
|
||||
<button class="page-btn" ${masterCurrentPage >= totalPages ? 'disabled' : ''} onclick="setMasterPage(${masterCurrentPage + 1})">بعدی</button>
|
||||
`;
|
||||
pageButtonsContainer.innerHTML = btnsHtml;
|
||||
}
|
||||
}
|
||||
|
||||
if (filtered.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" style="text-align:center;padding:24px;color:var(--text-muted);">هیچ تسکی با فیلترهای انتخابی مطابقت ندارد.</td></tr>';
|
||||
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 = `
|
||||
<td style="font-weight:800;color:var(--primary);font-feature-settings:'tnum';">${t.key}</td>
|
||||
<td style="font-weight:800;color:var(--primary);font-feature-settings:'tnum';"><bdi>${t.key}</bdi></td>
|
||||
<td>
|
||||
<div style="font-weight:700;color:var(--text);line-height:1.4;">${t.summary}</div>
|
||||
<div style="font-weight:700;color:var(--text);line-height:1.4;"><bdi>${t.summary}</bdi></div>
|
||||
<div style="font-size:11px;color:var(--text-muted);margin-top:2px;">افق کاگان: ${t.cagan_horizon} | پیشنهاد: ${t.recommended_week}</div>
|
||||
</td>
|
||||
<td><span class="assignee-chip">👤 ${t.assignee}</span></td>
|
||||
|
|
|
|||
Loading…
Reference in a new issue