05‐ Frontend Routes - mina-y-khalil/redeembooks-accounting-app GitHub Wiki

🖥️ Frontend Routes – React and Redux

This document defines the frontend page structure of the RedeemBooks Accounting App, built using React and Redux.
Routes are designed for multi-company accounting, supporting Owner, Manager, Staff, and Approver roles.


🔐 Auth Routes

Page URL Path Description
Signup /signup New user registration form with optional dummy autofill
Login /login User login form
Logout N/A Logout action handled globally with session cleanup
Demo Login N/A Button on login screen to access a pre-seeded demo user

🏠 Dashboard / Home

Page URL Path Description
Dashboard (Home) / Overview of company AP status, recent invoices, and balances
Company Selector /switch-company Switch between companies the user has access to

🏢 Company & User Management

Page URL Path Description
Company Settings /companies/:companyId/settings Edit company info and tax details
Manage Users /companies/:companyId/users View, invite, and manage company users
Assign Roles /companies/:companyId/roles Set Owner/Manager/Staff roles

👥 Approver Management

Page URL Path Description
Manage Approvers /companies/:companyId/approvers Assign or remove approvers
Approvals Dashboard /companies/:companyId/approvals List invoices pending approval for logged approver

🏬 Vendors

Page URL Path Description
Vendor List /companies/:companyId/vendors View all vendors with search and filter
Vendor Detail /vendors/:vendorId View vendor profile and invoice/payment history
Add Vendor /companies/:companyId/vendors/new Create new vendor
Edit Vendor /vendors/:vendorId/edit Update vendor information

🗂️ Categories

Page URL Path Description
Category List /companies/:companyId/categories Manage expense categories
Add Category /companies/:companyId/categories/new Create a new category
Edit Category /categories/:categoryId/edit Update category name or description

🧾 Invoices

Page URL Path Description
Invoice List /companies/:companyId/invoices View all invoices with filters (status, vendor)
Invoice Detail /invoices/:invoiceId View details, attachments, and status changes
Create Invoice /companies/:companyId/invoices/new Form to create a new invoice
Edit Invoice /invoices/:invoiceId/edit Modify invoice details
Approval Tab (Approvers) /approvals/pending Approvers’ view for approving/rejecting invoices

💵 Payments

Page URL Path Description
Payment List /companies/:companyId/payments View all payments for a company
Payment Detail /payments/:paymentId See payment info and linked invoice
Add Payment /invoices/:invoiceId/payments/new Record a full or partial payment
Edit Payment /payments/:paymentId/edit Update payment details

📦 AP Run / Payment Batches

Page URL Path Description
Batch List /companies/:companyId/batches View all AP run batches
Batch Detail /batches/:batchId Review batch invoices and total
Create Batch /companies/:companyId/batches/new Generate a new batch run for payments

💳 Bank Balances

Page URL Path Description
Balance List /companies/:companyId/balances View and manage bank balances
Add Balance Entry /companies/:companyId/balances/new Add a new balance record
Edit Balance /balances/:balanceId/edit Update an existing balance record

🕵️ Audit Logs

Page URL Path Description
Audit Trail /companies/:companyId/audit-logs View all changes for compliance and review

🔄 Detailed Frontend–Backend Mapping

Frontend Page (Route) Backend API Routes Called
Signup (/signup) POST /api/users/ → create user POST /api/companies/ → create company POST /api/user_companies/ → link user-company
Login (/login) POST /api/session/ → authenticate user
Dashboard (/) GET /api/companies/:companyId/invoices → recent invoices GET /api/companies/:companyId/balances → bank balances
Company Settings (/companies/:companyId/settings) GET /api/companies/:companyId → fetch company PUT /api/companies/:companyId → update company
Manage Users (/companies/:companyId/users) GET /api/companies/:companyId/users → list users POST /api/companies/:companyId/users → invite user
Manage Approvers (/companies/:companyId/approvers) GET /api/companies/:companyId/approvers POST /api/companies/:companyId/approvers DELETE /api/approvers/:id
Vendors List (/companies/:companyId/vendors) GET /api/companies/:companyId/vendors → fetch all vendors
Vendor Detail (/vendors/:vendorId) GET /api/vendors/:vendorId → fetch vendor GET /api/vendors/:vendorId/invoices → vendor invoices
Add/Edit Vendor POST /api/companies/:companyId/vendors → create PUT /api/vendors/:vendorId → update
Categories List (/companies/:companyId/categories) GET /api/companies/:companyId/categories
Add/Edit Category POST /api/companies/:companyId/categories PUT /api/categories/:categoryId
Invoices List (/companies/:companyId/invoices) GET /api/companies/:companyId/invoices GET /api/vendors/:vendorId (filter)
Invoice Detail (/invoices/:invoiceId) GET /api/invoices/:invoiceId → invoice details GET /api/vendors/:vendorId → vendor GET /api/payments?invoiceId=123
Create/Edit Invoice POST /api/companies/:companyId/invoices → create PUT /api/invoices/:invoiceId → update
Payments List (/companies/:companyId/payments) GET /api/companies/:companyId/payments
Payment Detail (/payments/:paymentId) GET /api/payments/:paymentId GET /api/invoices/:invoiceId (linked invoice)
Add/Edit Payment POST /api/invoices/:invoiceId/payments → create PUT /api/payments/:paymentId → update
Batch List (/companies/:companyId/batches) GET /api/companies/:companyId/batches
Batch Detail (/batches/:batchId) GET /api/batches/:batchId → batch details GET /api/batches/:batchId/invoices
Create Batch POST /api/companies/:companyId/batches
Bank Balances (/companies/:companyId/balances) GET /api/companies/:companyId/balances → list POST /api/companies/:companyId/balances PUT /api/balances/:balanceId
Audit Logs (/companies/:companyId/audit-logs) GET /api/companies/:companyId/audit-logs → fetch logs

⚙️ Route Logic

  • Routes are role-based:
    • Owner: Full access to all features
    • Manager: Limited admin rights (cannot delete company)
    • Staff: Can create invoices and payments but no approvals
    • Approver: Sees only pending approvals and related invoices
  • Redux state handles company selection, authentication, and invoice filters globally.