# ngauge-reports

Reports module for NGauge — bestsellers, turnover-by-day, and generic named report generation.

## Features
- Hosts report endpoints previously served by `v1/ReportsController`
- Wraps `backend\models\Reportsbe` via a service layer
- Registers direct v1 compatibility routes for `/v1/reports/*`

## Installation

```bash
composer require portalpeople/ngauge-reports
```

## Configuration

### 1. Register in app config (`backend/config/main.php`)

```php
return [
    'bootstrap' => ['ngauge-reports'],
    'modules' => [
        'ngauge-reports' => [
            'class' => 'PortalPeople\\reports\\Module',
        ],
    ],
];
```

### 2. Set params in `params.php` or `params-local.php`

```php
return [
    'plugins' => [
        'ngauge-reports' => [
            'enabled' => true,
        ],
    ],
];
```

## Endpoints

- `POST /v1/reports/validate` — AJAX form validation
- `POST /v1/reports/report` — Run a named report
- `POST /v1/reports/bestsellers` — Bestsellers report
- `POST /v1/reports/turnoverbyday` — Turnover by day report

## Dependencies

This module requires NGauge_Base's `backend\models\Reportsbe` to be available at runtime.
It must be installed into a NGauge_Base application — it cannot run standalone.
