# SALES_REPORT_DETAIL_PREVIEW_API_REQUIRED

## Context

FE sekarang memiliki tombol **Detail** untuk preview data bergaya Excel tanpa download.
Preview ini mengikuti filter tanggal/type/search dan menampilkan urutan tanggal terbaru.

## Required Backend Update

Untuk performa dan akurasi data multi-item, BE direkomendasikan menyediakan endpoint detail preview yang langsung mengembalikan item-level rows.

### Endpoint recommendation

- `GET /api/v1/reports/sales/detail-preview`

### Query params

- `start_date` (required)
- `end_date` (required)
- `type` (optional)
- `search` (optional)
- `page` / `per_page` (optional)

### Required response shape

```json
{
  "items": [
    {
      "sale_id": "uuid",
      "bill_no": "BJ...",
      "created_at": "2026-03-09T13:30:00Z",
      "item_code": "SDRWC020003",
      "barcode": "92111069019504",
      "name": "SAPPHIRE TROPICAL",
      "brand": "RYCROFT",
      "gender": "WOMEN",
      "function": "FLIPFLOP",
      "size": "36",
      "collection": "2025 Q4",
      "sell_price": 349000,
      "qty_sale": 2,
      "total_sales": 698000
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 100,
    "total": 1
  }
}
```

## Notes

- `item_code` dan `barcode` harus string.
- Data harus sudah urut `created_at DESC` di BE agar konsisten.
- Jika endpoint ini belum tersedia, FE fallback ke report + receipt detail per transaksi (lebih berat).

## Acceptance Criteria

1. Klik tombol Detail menampilkan semua item terjual sesuai filter.
2. Data multi-item tampil lengkap (tidak hanya satu item).
3. Urutan tanggal konsisten dari terbaru ke terlama.

