Skip to content

Feature/t224 pending approvals UI - #62

Merged
ThienlocTran merged 6 commits into
devfrom
feature/T224-pending-approvals-ui
Jul 31, 2026
Merged

ThienlocTran merged 6 commits into
devfrom
feature/T224-pending-approvals-ui

Conversation

@25ThienNgoc

@25ThienNgoc 25ThienNgoc commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

check và merge code giúp tui

Summary by CodeRabbit

  • Tính năng mới

    • Cải thiện thanh điều hướng với nhóm menu, mục con, trạng thái đang chọn và hỗ trợ cuộn.
    • Bổ sung lọc phiếu phê duyệt theo kho, trạng thái và loại phiếu nhập/xuất.
    • Cho phép xem chi tiết, lịch sử, duyệt hoặc từ chối phiếu trực tiếp.
    • Hiển thị rõ loại phiếu, nhãn trạng thái và lý do từ chối.
  • Cải tiến giao diện

    • Cập nhật bố cục responsive cho màn hình nhỏ.
    • Bổ sung kiểu hiển thị cho bộ lọc, thông báo và chi tiết phiếu.
    • Cải thiện trạng thái khóa thao tác và thông báo lỗi xác thực.
  • Sửa lỗi

    • Ngăn kết quả tải cũ ghi đè dữ liệu mới.
    • Cải thiện xử lý lỗi và kiểm tra trạng thái khi thao tác phê duyệt.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 82ad3216-4ee2-44c1-a9c9-139d9accdaac

📥 Commits

Reviewing files that changed from the base of the PR and between 750f676 and e9e2dac.

📒 Files selected for processing (1)
  • src/views/ApprovalsView.vue

📝 Walkthrough

Walkthrough

Sidebar chuyển sang menu theo section và quyền truy cập. Màn hình phê duyệt hỗ trợ phiếu nhập, phiếu xuất, lọc theo kho và trạng thái, cùng luồng xem, duyệt và từ chối.

Changes

Điều hướng sidebar

Layer / File(s) Summary
Menu theo section và quyền truy cập
src/components/AppSidebar.vue
Menu được nhóm theo section. visibleSections lọc mục bằng canAccessRoute và loại bỏ nhóm rỗng. Giao diện cập nhật trạng thái hover và active.
Cuộn và bố cục responsive
src/components/AppSidebar.vue, src/style.css
Sidebar hỗ trợ cuộn dọc. Ở màn hình rộng tối đa 1023px, bố cục ứng dụng chuyển sang dạng cột và app-main bỏ padding-left.

Quy trình phê duyệt

Layer / File(s) Summary
Chuẩn hóa dữ liệu và thao tác phê duyệt
src/views/ApprovalsView.vue, src/services/exportReceiptService.js, src/services/importReceiptService.js
Màn hình xử lý phiếu nhập và phiếu xuất theo kho, cấp phê duyệt và loại phiếu. Các service truyền thêm bộ lọc warehouse. Luồng tải, xem chi tiết, duyệt và từ chối gọi service tương ứng.
Bộ lọc, modal và hiển thị trạng thái
src/views/ApprovalsView.vue
Giao diện hiển thị loại phiếu, trạng thái, lý do từ chối và thông tin đã chuẩn hóa. Modal chỉ cho phép thao tác khi phiếu ở trạng thái chờ duyệt. Bố cục hỗ trợ responsive.

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

Possibly related PRs

Suggested reviewers: tonfa137206, thienloctran

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Tiêu đề mô tả đúng thay đổi chính: bổ sung giao diện xử lý các phiếu chờ duyệt T224.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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/T224-pending-approvals-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: 6

🤖 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/views/ApprovalsView.vue`:
- Around line 566-595: Remove one of the duplicate approve/reject action groups
in the detail modal: either the “Tác vụ duyệt nhanh” card around
`handleApprove`/`openRejectModal` or the `modal-foot` controls around the same
handlers. Preserve a single pending-approval action location and its existing
`isPendingApproval` condition and behavior.
- Around line 95-114: Move warehouse filtering to the server-backed approval
fetches: pass filters.warehouse to getPendingApprovals and
getPendingExportReceipts, source warehouseOptions from the warehouse API rather
than current-page receipts, and make totalElements reflect or be hidden while
filtered. In the documentType change handler, reset filters.warehouse to an
empty value and page to 0 so the new document type does not inherit the previous
warehouse filter.
- Around line 87-90: Cập nhật statusLabels để CHO_DUYET_CAP_1 và CHO_DUYET_CAP_2
có nhãn riêng, lần lượt thể hiện “Chờ cấp 1” và “Chờ cấp 2”, để badge bảng và
modal chi tiết phản ánh đúng cấp phê duyệt.
- Around line 281-285: Cập nhật thông báo lỗi trong nhánh catch của luồng từ
chối thuộc ApprovalsView để dùng đúng loại phiếu đang được xử lý, tránh luôn
hiển thị “phiếu nhập” khi từ chối phiếu xuất. Giữ nguyên việc đặt
rejectState.submitting, xử lý rejectState.error và chuyển hướng 401.
- Around line 66-75: Update the columns definition in ApprovalsView so the
supplierName column label is dynamic: use “Khách hàng” (or the established
equivalent) when documentType is “out”, and retain “Nhà cung cấp” for other
document types.
- Around line 496-515: Gate both Approve and Reject buttons in the row action
markup with isPendingApproval(row.status) in addition to the existing
running-state check. Add the same early-return guard to openRejectModal before
its existing modal/API flow, while preserving handleApprove’s current behavior
and the remaining modal logic.
🪄 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: 83e8733c-2813-4bbb-b68c-6fdb4b17e327

📥 Commits

Reviewing files that changed from the base of the PR and between f13a14e and ee188c0.

📒 Files selected for processing (3)
  • src/components/AppSidebar.vue
  • src/style.css
  • src/views/ApprovalsView.vue

Comment thread src/views/ApprovalsView.vue Outdated
Comment thread src/views/ApprovalsView.vue
Comment thread src/views/ApprovalsView.vue Outdated
Comment thread src/views/ApprovalsView.vue
Comment thread src/views/ApprovalsView.vue
Comment thread src/views/ApprovalsView.vue Outdated

@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: 2

🤖 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/views/ApprovalsView.vue`:
- Around line 101-104: Update fetchPendingApprovals and its filter-triggering
flow to maintain an incrementing request token, capturing the token for each
request and applying receipts.value only when it still matches the latest token.
Ensure stale responses cannot overwrite results after documentType, warehouse,
or status changes, and preserve the corresponding document type with each
displayed row so confirmApprove and confirmReject cannot act on an ID using a
later documentType.value.
- Around line 101-104: Update the onMounted initialization in ApprovalsView so
the independent loadWarehouseOptions and fetchPendingApprovals calls execute
concurrently via Promise.all, while preserving both operations’ completion
before the mount callback finishes.
🪄 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: b5364cfa-0733-4769-a296-4197f994f82d

📥 Commits

Reviewing files that changed from the base of the PR and between ee188c0 and d9c863f.

📒 Files selected for processing (3)
  • src/services/exportReceiptService.js
  • src/services/importReceiptService.js
  • src/views/ApprovalsView.vue

Comment thread src/views/ApprovalsView.vue

@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: 1

🤖 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/views/ApprovalsView.vue`:
- Around line 193-199: Update openDetail to capture receipt.documentType in a
local type value and create a request token before awaiting the detail request;
use both captured values when building and applying the response. Only update
detailState when the token is still current, and increment the token in
closeDetail to invalidate pending requests when the modal closes.
🪄 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: 26e8f9b8-b64a-4813-8fcb-cf3ed538e6fb

📥 Commits

Reviewing files that changed from the base of the PR and between d9c863f and 750f676.

📒 Files selected for processing (1)
  • src/views/ApprovalsView.vue

Comment thread src/views/ApprovalsView.vue Outdated
@ThienlocTran
ThienlocTran merged commit 70ad2f1 into dev Jul 31, 2026
1 check passed
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