# Jira Sprint Planning & Execution

## Project: Others Accounts

**Project Key:** AMS (Suggested)  
**Project Type:** Team-managed or Company-managed  
**Project Lead:** [Your Name]  
**Start Date:** [Add Date]

---

## Epic 1: Authentication & User Management

### Epic Summary
Implement secure user authentication, registration, and role-based access control.

### User Stories

#### Story 1.1: User Registration
- **Key:** AMS-1
- **Title:** As a new user, I want to register an account so I can access the application
- **Story Points:** 5
- **Priority:** High
- **Description:** 
  - Implement registration form with validation
  - Create user record in database
  - Hash and store password securely
  - Redirect to login after successful registration
- **Acceptance Criteria:**
  - [ ] Registration form accepts name, email, password
  - [ ] Password confirmation validation works
  - [ ] Duplicate email validation prevents re-registration
  - [ ] Success message redirects to login page
  - [ ] Invalid input shows validation errors

#### Story 1.2: User Login
- **Key:** AMS-2
- **Title:** As a user, I want to log in so I can access my account
- **Story Points:** 5
- **Priority:** High
- **Description:**
  - Create login form with email and password
  - Validate credentials against database
  - Create session/token upon successful login
- **Acceptance Criteria:**
  - [ ] Login form accepts email and password
  - [ ] Correct credentials redirect to dashboard
  - [ ] Incorrect credentials show error message
  - [ ] Session persists across page navigation
  - [ ] Logout clears session

#### Story 1.3: Role-Based Access Control (Admin Filter)
- **Key:** AMS-3
- **Title:** As admin, I want role-based protection so only authorized users access features
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Implement `LsValidUser:admin` middleware
  - Protect all account, receive, and payment routes
  - Redirect non-admin users to dashboard
- **Acceptance Criteria:**
  - [ ] Non-admin users cannot access management pages
  - [ ] Admin users can access all features
  - [ ] Middleware is applied to all protected routes
  - [ ] Unauthorized access logs a message

---

## Epic 2: Accounts Management

### Epic Summary
Build account creation, editing, deletion, and listing functionality with duplicate validation and balance tracking.

### User Stories

#### Story 2.1: Create Account
- **Key:** AMS-4
- **Title:** As an admin, I want to create a new account so I can track business relationships
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Create modal form for account entry
  - Validate all required fields
  - Check for duplicates (name + sector)
  - Save to `accounts_setup` table
- **Acceptance Criteria:**
  - [ ] Account form has all required fields
  - [ ] Form validates account name, sector, mobile
  - [ ] Duplicate account (name + sector) shows error
  - [ ] Successful creation returns JSON response
  - [ ] Account appears in DataTable immediately

#### Story 2.2: Edit Account
- **Key:** AMS-5
- **Title:** As an admin, I want to edit account details so I can keep information current
- **Story Points:** 5
- **Priority:** Medium
- **Description:**
  - Load account edit modal with existing data
  - Validate updated fields
  - Update database record
- **Acceptance Criteria:**
  - [ ] Edit modal prefills existing account data
  - [ ] Duplicate validation ignores current account
  - [ ] Changes save without page reload
  - [ ] Success message confirms update

#### Story 2.3: Delete Account
- **Key:** AMS-6
- **Title:** As an admin, I want to delete an account so I can remove obsolete records
- **Story Points:** 3
- **Priority:** Medium
- **Description:**
  - Add delete button to account row
  - Confirm deletion
  - Remove from database
- **Acceptance Criteria:**
  - [ ] Delete button is visible in DataTable
  - [ ] Confirmation dialog appears before deletion
  - [ ] Account is removed from database
  - [ ] DataTable updates without reload

#### Story 2.4: Account DataTable Listing
- **Key:** AMS-7
- **Title:** As an admin, I want to view all accounts in a searchable list so I can find and manage them
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Implement server-side DataTable
  - Support search, sort, and pagination
  - Display account details (name, sector, mobile, balance, status)
- **Acceptance Criteria:**
  - [ ] DataTable loads with 10 rows per page
  - [ ] Search filters by name, sector, mobile
  - [ ] Sorting works on sortable columns
  - [ ] Pagination works correctly
  - [ ] Status badge shows Active/Inactive

#### Story 2.5: Account Balance Lookup
- **Key:** AMS-8
- **Title:** As an admin, I want to check account balance so I can see financial standing
- **Story Points:** 5
- **Priority:** Medium
- **Description:**
  - Fetch balance from receives and payments
  - Calculate: opening_balance + receives - payments
  - Return JSON with balance details
- **Acceptance Criteria:**
  - [ ] Balance endpoint returns accurate total
  - [ ] Calculation includes opening balance
  - [ ] Receives and payments are summed correctly

---

## Epic 3: Receive Management

### Epic Summary
Implement receive entry creation, editing, deletion, and invoice auto-generation.

### User Stories

#### Story 3.1: Create Receive Entry
- **Key:** AMS-9
- **Title:** As an admin, I want to record a receive transaction so I can track income
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Create receive modal form
  - Auto-generate or manually enter invoice number
  - Link to account with category filter (Receive/Both)
  - Save to `account_receive` table
- **Acceptance Criteria:**
  - [ ] Receive form loads with account dropdown
  - [ ] Only Receive-capable accounts appear in dropdown
  - [ ] Invoice number auto-populates or accepts manual entry
  - [ ] Amount field accepts decimal values
  - [ ] Form validates required fields
  - [ ] Successful creation returns JSON success

#### Story 3.2: Edit Receive Entry
- **Key:** AMS-10
- **Title:** As an admin, I want to edit receive entries so I can correct mistakes
- **Story Points:** 5
- **Priority:** Medium
- **Acceptance Criteria:**
  - [ ] Edit modal shows existing receive data
  - [ ] All fields are editable
  - [ ] Duplicate invoice validation excludes current record
  - [ ] Update saves without page reload

#### Story 3.3: Delete Receive Entry
- **Key:** AMS-11
- **Title:** As an admin, I want to delete receive entries so I can remove incorrect records
- **Story Points:** 3
- **Priority:** Medium
- **Acceptance Criteria:**
  - [ ] Delete button confirmed with dialog
  - [ ] Entry removed from database
  - [ ] DataTable refreshes immediately

#### Story 3.4: Auto-Generate Invoice Number
- **Key:** AMS-12
- **Title:** As a user, I want invoice numbers to auto-generate so data entry is faster
- **Story Points:** 3
- **Priority:** Medium
- **Description:**
  - Fetch last invoice number
  - Increment by 1
  - Suggest in form (allow override)
- **Acceptance Criteria:**
  - [ ] Next invoice number is fetched from endpoint
  - [ ] Increments correctly
  - [ ] User can override with manual entry

#### Story 3.5: Receive DataTable with Remarks Preview
- **Key:** AMS-13
- **Title:** As an admin, I want to view all receives in a list with remarks so I can see transaction details
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Server-side DataTable for receives
  - Show invoice, date, account, amount, remarks (truncated with expand)
  - Support search, sort, pagination
- **Acceptance Criteria:**
  - [ ] DataTable displays receives with proper columns
  - [ ] Remarks truncated to 10 words with expand option
  - [ ] Search filters by invoice, amount, account name
  - [ ] Sorting on sortable columns
  - [ ] Pagination works

---

## Epic 4: Payment Management

### Epic Summary
Implement payment entry creation, editing, deletion, and invoice auto-generation (mirror of Receives).

### User Stories

#### Story 4.1: Create Payment Entry
- **Key:** AMS-14
- **Title:** As an admin, I want to record a payment transaction so I can track expenses
- **Story Points:** 8
- **Priority:** High
- **Acceptance Criteria:**
  - [ ] Payment form with account dropdown (Payment/Both categories)
  - [ ] Auto-generated invoice number
  - [ ] Amount field accepts decimals
  - [ ] Form validation on required fields
  - [ ] JSON success response

#### Story 4.2: Edit Payment Entry
- **Key:** AMS-15
- **Title:** As an admin, I want to edit payment entries so I can correct mistakes
- **Story Points:** 5
- **Priority:** Medium
- **Acceptance Criteria:**
  - [ ] Edit modal loads with existing data
  - [ ] All fields editable
  - [ ] Duplicate invoice validation excludes current record

#### Story 4.3: Delete Payment Entry
- **Key:** AMS-16
- **Title:** As an admin, I want to delete payment entries so I can remove incorrect records
- **Story Points:** 3
- **Priority:** Medium
- **Acceptance Criteria:**
  - [ ] Confirmation dialog before deletion
  - [ ] Entry removed from database
  - [ ] DataTable refreshes

#### Story 4.4: Payment DataTable Listing
- **Key:** AMS-17
- **Title:** As an admin, I want to view all payments in a searchable list so I can manage transactions
- **Story Points:** 8
- **Priority:** High
- **Acceptance Criteria:**
  - [ ] Server-side DataTable with search, sort, pagination
  - [ ] Columns: invoice, date, account, amount, remarks
  - [ ] Remarks expandable preview

---

## Epic 5: Account Reports

### Epic Summary
Build account transaction reports with date range filtering and balance calculations.

### User Stories

#### Story 5.1: Date Range Report Filter
- **Key:** AMS-18
- **Title:** As an admin, I want to filter reports by date range so I can see specific periods
- **Story Points:** 5
- **Priority:** High
- **Description:**
  - Create report filter form with start/end date
  - Allow account selection or "All Accounts"
- **Acceptance Criteria:**
  - [ ] Date picker for start and end dates
  - [ ] Account dropdown with "All" option
  - [ ] Form validates date range
  - [ ] Submit fetches data

#### Story 5.2: Generate Account Transaction Report
- **Key:** AMS-19
- **Title:** As an admin, I want to view transactions for an account in a date range so I can verify activity
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Fetch receives and payments for date range
  - Calculate opening and closing balance
  - Sort by date and invoice number
- **Acceptance Criteria:**
  - [ ] Report shows receives and payments merged
  - [ ] Opening balance calculated correctly
  - [ ] Closing balance shows accurate total
  - [ ] Transactions sorted by date
  - [ ] All required fields displayed

#### Story 5.3: Print/Export Report
- **Key:** AMS-20
- **Title:** As an admin, I want to print or export reports so I can share and archive
- **Story Points:** 5
- **Priority:** Low
- **Description:**
  - Integrate barryvdh/laravel-dompdf for PDF export
  - Add print button
- **Acceptance Criteria:**
  - [ ] PDF export works with report data
  - [ ] Print preview displays correctly

---

## Epic 6: UI/UX & Frontend

### Epic Summary
Build responsive views, modal dialogs, and improve user experience.

### User Stories

#### Story 6.1: Responsive Blade Layout
- **Key:** AMS-21
- **Title:** As a user, I want the interface to work on all devices so I can access from anywhere
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Build main layout with header, sidebar, footer
  - Use Tailwind CSS for responsive design
  - Implement mobile menu
- **Acceptance Criteria:**
  - [ ] Layout responsive on mobile, tablet, desktop
  - [ ] Sidebar collapses on mobile
  - [ ] Navigation works on all screen sizes

#### Story 6.2: AJAX Modal Forms
- **Key:** AMS-22
- **Title:** As a user, I want forms in modals so I can work without page reloads
- **Story Points:** 8
- **Priority:** High
- **Description:**
  - Create reusable modal component for forms
  - Load forms via AJAX
  - Handle form submission and response
- **Acceptance Criteria:**
  - [ ] Modals open without page reload
  - [ ] Form submission via AJAX
  - [ ] Success/error messages display in modal
  - [ ] Modal closes on success

#### Story 6.3: Success/Error Notifications
- **Key:** AMS-23
- **Title:** As a user, I want feedback on actions so I know if they succeeded
- **Story Points:** 3
- **Priority:** Medium
- **Description:**
  - Integrate php-flasher for flash messages
  - Display success/error toasts
- **Acceptance Criteria:**
  - [ ] Success message shows after create/update/delete
  - [ ] Error messages display validation errors
  - [ ] Toasts auto-dismiss after 5 seconds

---

## Epic 7: Testing & Quality Assurance

### Epic Summary
Implement unit tests and ensure application stability.

### User Stories

#### Story 7.1: Unit Tests for Controllers
- **Key:** AMS-24
- **Title:** As a developer, I want unit tests so I can ensure features work correctly
- **Story Points:** 13
- **Priority:** Medium
- **Description:**
  - Write tests for Account, Receive, Payment controllers
  - Test CRUD operations
  - Test validation
- **Acceptance Criteria:**
  - [ ] All controller tests pass
  - [ ] Coverage above 70%
  - [ ] Tests can be run with `php artisan test`

#### Story 7.2: Integration Tests
- **Key:** AMS-25
- **Title:** As a developer, I want integration tests so I can verify end-to-end flows
- **Story Points:** 13
- **Priority:** Medium
- **Description:**
  - Test user workflows
  - Test role-based access
- **Acceptance Criteria:**
  - [ ] User registration and login flow passes
  - [ ] Admin access control works

---

## Sprint Template

### Sprint [#]: [Name]
**Duration:** 2 weeks  
**Sprint Goal:** [Goal Statement]  
**Start Date:** [Date]  
**End Date:** [Date]

#### Sprint Stories
| Story | Title | Points | Assignee | Status |
|-------|-------|--------|----------|--------|
| AMS-X | ... | 5 | @user | To Do |

#### Sprint Metrics
- **Planned Points:** 40
- **Completed Points:** 0
- **Velocity:** 0
- **Burndown:** [Link to chart]

---

## Priority & Estimation Guide

### Priority Levels
- **High:** Core functionality, blocking other work
- **Medium:** Important features, not blocking
- **Low:** Nice-to-have, low impact

### Story Points
- 1 = Very simple, < 1 hour
- 3 = Simple, 1-2 hours
- 5 = Medium, 2-4 hours
- 8 = Complex, 4-8 hours
- 13 = Very complex, 1-2 days
- 21+ = Too large, needs breakdown

---

## Dependencies & Blockers

| Blocker | Description | Resolution |
|---------|-------------|-----------|
| DB Schema | Need migrations finalized | Complete migrations first |
| Auth Setup | Sanctum configuration | Configure before Story 1.2 |

---

## Team & Roles

| Role | Name | Email |
|------|------|-------|
| Project Lead | [Your Name] | [Email] |
| Backend Developer | [Name] | [Email] |
| Frontend Developer | [Name] | [Email] |
| QA / Tester | [Name] | [Email] |

---

## Release Plan

### Version 1.0 (MVP)
- Epics 1-4 (Auth, Accounts, Receives, Payments)
- Target Date: [Date]

### Version 1.1 (Reports & Polish)
- Epic 5 (Reports)
- Epic 6 (UI/UX enhancements)
- Target Date: [Date]

### Version 1.2 (Quality)
- Epic 7 (Tests)
- Bug fixes and performance optimization
- Target Date: [Date]

---

## How to Use This in Jira

1. **Create Project:** Set up project with key "AMS"
2. **Create Epics:** Add each Epic 1-7 as an Epic issue type
3. **Create Stories:** Add each User Story under corresponding Epic
4. **Assign Points:** Set Story Points in custom field
5. **Create Sprints:** Use sprint template above
6. **Plan Sprints:** Drag stories into sprints by priority
7. **Track Progress:** Use burndown chart and velocity metrics
8. **Iterate:** At end of sprint, review and plan next sprint

---

## Additional Resources

- **Confluence Page:** [Link to project documentation]
- **GitHub/GitLab:** [Link to repository]
- **Design Mockups:** [Link to Figma or design tool]
- **API Documentation:** [Link to API docs]
