Skip to content

Feature/t151 integrate approval buttons UI - #42

Merged
ThienlocTran merged 6 commits into
devfrom
feature/T151-Integrate-Approval-Buttons-UI
Jul 16, 2026
Merged

ThienlocTran merged 6 commits into
devfrom
feature/T151-Integrate-Approval-Buttons-UI

Conversation

@25ThienNgoc

@25ThienNgoc 25ThienNgoc commented Jul 11, 2026 •

Copy link
Copy Markdown
Collaborator

check và merge code giúp tui nha

Summary by CodeRabbit

  • Tính năng mới
    • Thêm màn hình “Phiếu xuất chờ duyệt” có phân trang, xem nhanh và điều hướng sang trang chi tiết.
    • Thêm màn hình chi tiết phiếu xuất chờ duyệt, hiển thị sản phẩm, cảnh báo vượt tồn và trạng thái xử lý; người có quyền có thể phê duyệt.
  • Cải tiến
    • Nâng cấp bảng dữ liệu: hỗ trợ cấu hình chữ hiển thị khi rỗng và bật/tắt khả năng bấm dòng để xem chi tiết.
    • Cập nhật điều hướng/quyền truy cập và nội dung trong trang chi tiết theo loại phiếu; tối ưu hiển thị sidebar theo vai trò.
    • Cải thiện trạng thái tải/lỗi và giao diện trên màn hình nhỏ.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@25ThienNgoc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6a59c232-f1b2-466a-9ae3-549ab4f9f8da

📥 Commits

Reviewing files that changed from the base of the PR and between df46945 and 28e6679.

📒 Files selected for processing (3)
  • src/components/AppSidebar.vue
  • src/router/index.js
  • src/views/PendingExportApprovalsView.vue
📝 Walkthrough

Walkthrough

Changes

Luồng phê duyệt phiếu xuất

Layer / File(s) Summary
Chuẩn hóa và gọi API phê duyệt
src/services/stockOutApprovalService.js
Bổ sung API lấy danh sách, chi tiết và phê duyệt; chuẩn hóa dữ liệu phân trang, phiếu và lỗi.
Danh sách và chi tiết nhanh
src/views/PendingExportApprovalsView.vue, src/components/DataTable.vue
Thêm danh sách phân trang, chi tiết nhanh, điều hướng theo dòng và sự kiện row-click.
Chi tiết và thao tác phê duyệt
src/components/StockOutApprovalDetail.vue
Hiển thị chi tiết, kiểm tra quyền/trạng thái, cảnh báo vượt tồn và thực hiện phê duyệt.
Định tuyến và tích hợp trang chi tiết
src/router/index.js, src/views/StockDocumentDetailView.vue
Đăng ký route mới, cập nhật quyền truy cập và thay màn hình chờ bằng chi tiết phiếu xuất.
Thành phần bảng và điều hướng theo vai trò
src/components/AppSidebar.vue, src/components/DataTable.vue
Cập nhật lọc mục sidebar theo vai trò và hỗ trợ hàng có thể bấm trong bảng.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Tiêu đề nêu đúng thay đổi chính: tích hợp UI nút duyệt cho phiếu xuất chờ duyệt.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/T151-Integrate-Approval-Buttons-UI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/DataTable.vue`:
- Around line 27-32: Thêm prop Boolean `clickable` với giá trị mặc định `false`
cho component DataTable, rồi chỉ áp dụng class `clickable-row` và xử lý `@click`
trong vòng lặp `<tr>` khi prop này được bật. Giữ nguyên việc emit `row-click` và
trạng thái hiển thị không tương tác mặc định khi `clickable` là `false`.

In `@src/components/StockOutApprovalDetail.vue`:
- Around line 75-78: Trong luồng xử lý duyệt của StockOutApprovalDetail, bỏ lời
gọi loadDetail() sau approveExportReceipt(). Gán kết quả receipt đã normalize từ
approveExportReceipt() vào receipt.value, rồi lấy mã phiếu từ kết quả đó để tạo
actionMessage, giữ nguyên fallback về props.receiptId khi cần.

In `@src/router/index.js`:
- Line 69: Keep the ADMIN/MANAGER frontend guard for /pending-export-approvals
as a UX-only restriction, and ensure backend authorization independently
validates these roles for GET /api/export-receipts/pending-approval and PUT
/api/export-receipts/:id/approve on every request; do not treat the route guard
as a security boundary.

In `@src/services/stockOutApprovalService.js`:
- Around line 6-11: Configure a finite timeout on the Axios instance created as
exportReceiptClient, using the project’s established timeout constant or an
appropriate bounded duration. Keep the existing baseURL and headers unchanged so
requests such as approveExportReceipt cannot wait indefinitely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7c541f87-95ff-4021-8f79-e228762b36a7

📥 Commits

Reviewing files that changed from the base of the PR and between fadc594 and 8b411c8.

📒 Files selected for processing (7)
  • src/components/AppSidebar.vue
  • src/components/DataTable.vue
  • src/components/StockOutApprovalDetail.vue
  • src/router/index.js
  • src/services/stockOutApprovalService.js
  • src/views/PendingExportApprovalsView.vue
  • src/views/StockDocumentDetailView.vue

Comment thread src/components/DataTable.vue
Comment thread src/components/StockOutApprovalDetail.vue Outdated
Comment thread src/router/index.js
function canAccessRoute(path, role) {
if (path === '/employees' || path === '/users') return role === 'ADMIN'
if (path === '/approvals') return role === 'ADMIN' || role === 'MANAGER'
if (path === '/approvals' || path === '/pending-export-approvals') return role === 'ADMIN' || role === 'MANAGER'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔵 Trivial

Frontend guard chỉ hỗ trợ UX, không thay thế authorization backend.

Phân quyền ADMIN/MANAGER cho /pending-export-approvals đúng theo luồng duyệt. Tuy nhiên, route guard ở frontend chỉ ẩn/hiện trang để UX tốt hơn — backend vẫn phải kiểm tra quyền trên mỗi API (GET /api/export-receipts/pending-approval, PUT /api/export-receipts/:id/approve). Nếu backend không kiểm tra, user có thể gọi API trực tiếp bỏ qua guard.

As per path instructions: "Nhắc rõ frontend guard chỉ hỗ trợ UX, không thay thế authorization ở backend."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/router/index.js` at line 69, Keep the ADMIN/MANAGER frontend guard for
/pending-export-approvals as a UX-only restriction, and ensure backend
authorization independently validates these roles for GET
/api/export-receipts/pending-approval and PUT /api/export-receipts/:id/approve
on every request; do not treat the route guard as a security boundary.

Source: Path instructions

Comment thread src/services/stockOutApprovalService.js
@25ThienNgoc

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@25ThienNgoc
25ThienNgoc force-pushed the feature/T151-Integrate-Approval-Buttons-UI branch from e3d244c to df46945 Compare July 11, 2026 14:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/AppSidebar.vue`:
- Around line 27-35: Update the visibleItems computed in AppSidebar to derive
the role from the reactive useAuthStore state, using currentRole or currentUser
instead of getCurrentRoleCode(). Preserve the existing ADMIN, MANAGER, and
approval visibility rules while ensuring the list recomputes after login,
logout, or account changes.

In `@src/router/index.js`:
- Around line 67-72: Update canAccessRoute to add an explicit /import-excel
check that permits only the ADMIN role, before the fallback return true. Keep
all existing route rules unchanged.

In `@src/views/PendingExportApprovalsView.vue`:
- Around line 167-182: Cập nhật thuộc tính :disabled của các nút phân trang
trong PendingExportApprovalsView để kết hợp isLoading với hasPreviousPage và
hasNextPage tương ứng, đảm bảo cả hai nút bị vô hiệu hóa trong khi dữ liệu đang
tải.
- Around line 209-211: Update the empty-state text in PendingExportApprovalsView
so it instructs users to click the request code to open the quick detail view,
rather than implying that clicking any row opens quick details. Preserve the
existing behavior where clicking a row uses goToDetail for page navigation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 579bf999-ecc0-4137-8f94-7ab0f1cb5daa

📥 Commits

Reviewing files that changed from the base of the PR and between 8b411c8 and df46945.

📒 Files selected for processing (7)
  • src/components/AppSidebar.vue
  • src/components/DataTable.vue
  • src/components/StockOutApprovalDetail.vue
  • src/router/index.js
  • src/services/stockOutApprovalService.js
  • src/views/PendingExportApprovalsView.vue
  • src/views/StockDocumentDetailView.vue

Comment thread src/components/AppSidebar.vue
Comment thread src/router/index.js
Comment thread src/views/PendingExportApprovalsView.vue
Comment thread src/views/PendingExportApprovalsView.vue
@ThienlocTran
ThienlocTran merged commit be811fb into dev Jul 16, 2026
1 check passed
@ThienlocTran
ThienlocTran deleted the feature/T151-Integrate-Approval-Buttons-UI branch July 31, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants