@extends('layout.master')
@section('content')

<div class="row">
	<div class="col-md-12">
		<div class="card strpied-tabled-with-hover">
			<div class="card-header ">
				<div class="row">
					<div class="col-md-3">
						<h4 class="card-title">Recibos</h4>
						<p class="card-category">Recibos de Pago</p>
					</div>
					
					<div class="col-md-3">
						<form method="GET" action="{{ url('busqueda') }}">
							<input name="cliente" type="text" class="form-control" placeholder="Nombre del Cliente" required>
						
					</div>

					<div class="col-md-3">
						<button type="submit" class="form-control btn btn-primary btn-fill pull-right">Buscar</button>
					</div></form>
					
					<div class="col-md-3">
						<a href="{{ route('recibo.create') }}">
							<button class="btn btn-success btn-sm btn-fill pull-right">Nuevo Recibo</button>
						</a>
					</div>
				</div>
			</div>
			<div class="card-body table-full-width table-responsive">
				<table class="table table-hover table-striped">
					<thead>
						<th>Folio</th>
						<th>Fecha</th>
						<th>Cliente</th>
						<th>Cantidad</th>
						<th>Concepto</th>
						<th></th>
					</thead>
					<tbody>
						@foreach($r as $row)
							<tr>
								<td>#{{ $row->id }}</td>
								<td>{{ $row->fecha }}</td>
								<td>{{ $row->cliente }}</td>
								<td>${{ number_format($row->cantidad, 2) }}</td>
								<td>{{ $row->concepto }}</td>
								<td>
									<a href="{{ url('generar_recibo/'.$row->id) }}" target="_blank">
										<button class="btn btn-danger btn-xs btn-fill">
											Generar Recibo
										</button>
									</a>
								</td>
							</tr>
						@endforeach
					</tbody>
				</table>
				<div class="d-flex justify-content-center mt-3">
					{{ $r->links('pagination::bootstrap-4') }}
				</div>
			</div>
		</div>
	</div>
</div>

@endsection