@extends('layouts.app')
@section('title', __('nav.reports'))
@section('content')
<h1 class="h4">{{ $type }}</h1>
<form class="row g-2 mb-3">
<div class="col-md-3"><input class="form-control" type="date" name="from" value="{{ request('from') }}"></div>
<div class="col-md-3"><input class="form-control" type="date" name="to" value="{{ request('to') }}"></div>
<div class="col-md-2"><button class="btn btn-outline-secondary">{{ __('messages.filter') }}</button></div>
<div class="col-md-4 text-end">
<a class="btn btn-sm btn-outline-success" href="{{ route('reports.excel',$type) }}?{{ http_build_query(request()->query()) }}">{{ __('messages.excel') }}</a>
<a class="btn btn-sm btn-outline-danger" href="{{ route('reports.pdf',$type) }}?{{ http_build_query(request()->query()) }}">PDF</a>
<a class="btn btn-sm btn-outline-secondary" href="{{ route('reports.print',$type) }}?{{ http_build_query(request()->query()) }}">{{ __('messages.print') }}</a>
</div>
</form>
<div class="card"><div class="table-responsive"><table class="table mb-0">
<thead><tr><th>#</th><th>{{ __('messages.details') }}</th><th>{{ __('messages.total') }}</th></tr></thead>
<tbody>@forelse($rows as $row)
<tr><td>{{ $row->id }}</td><td>{{ $row->sale_number ?? $row->payment_number ?? $row->invoice_number ?? $row->phone_number ?? $row->name }}</td><td>{{ isset($row->total) ? money($row->total) : (isset($row->amount) ? money($row->amount) : '') }}</td></tr>
@empty<tr><td colspan="3">{{ __('messages.no_results') }}</td></tr>@endforelse</tbody></table></div>
<div class="card-body">{{ $rows->links() }}</div></div>
@endsection
