# M3: Loans Workflow

## Narrative Goal
Implement the complete loan (prestamo) lifecycle: request → pending → approve/reject → dispatch → return.

## Definition of Done
The Loans module is complete when:
- Users can create loan requests
- Supervisors can approve/reject requests
- Admins can dispatch approved loans
- Stock is automatically adjusted on dispatch and return
- Full loan history is maintained

## Milestone Issues

| Issue | Title | Priority | Labels |
|-------|-------|----------|--------|
| #134 | Create TransactionService | High | type:feature,module:api |
| #135 | Create TransactionsApiController | High | type:feature,module:api |
| #136 | Create StoreTransactionRequest | High | type:feature,module:api |
| #137 | Implement loan request creation | High | type:feature,module:api |
| #138 | Implement approve transaction action | High | type:feature,module:api |
| #139 | Implement reject transaction action | High | type:feature,module:api |
| #140 | Implement dispatch transaction action | High | type:feature,module:api |
| #141 | Implement return transaction action | High | type:feature,module:api |
| #142 | Add stock adjustment logic on dispatch | High | type:feature,module:api |
| #143 | Add stock restoration logic on return | High | type:feature,module:api |
| #144 | Create LoanController (web) | High | type:feature,module:ui |
| #145 | Create loan request form view | High | type:feature,module:ui |
| #146 | Create loan list view (by status) | High | type:feature,module:ui |
| #147 | Create loan detail view | Medium | type:feature,module:ui |
| #148 | Create approve/reject actions in UI | High | type:feature,module:ui |
| #149 | Create dispatch action in UI | High | type:feature,module:ui |
| #150 | Create return form in UI | High | type:feature,module:ui |
| #151 | Add loan status indicators | Medium | type:feature,module:ui |
| #152 | Create TransactionPolicy | High | type:feature,module:auth |
| #153 | Write unit tests for TransactionService | High | type:testing |

**Total Issues:** 20


## Implementation Progress

| Status | Count |
|--------|-------|
| ✅ Completed | 18 |
| ⚠️ Partial | 0 |
| ❌ Pending | 2 |

**Progress:** 90% completed

**Updated:** 2026-03-19 (Services layer added)


## Implementation Progress

| Status | Count |
|--------|-------|
| ✅ Completed | 17 |
| ⚠️ Partial | 0 |
| ❌ Pending | 3 |

**Progress:** 85% completed

**Updated:** 2026-03-19
