@extends ('layouts.admin')
@section ('title')
SisVentas | Detalle Ventas
@endsection
@section ('contenido')
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Inicio</a></li>
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Ventas</a></li>
                    <li class="breadcrumb-item active">Ventas</li>
                </ol>
            </div>
            <h4 class="page-title">Administración de Ventas</h4>
        </div>
    </div>
</div>
<div class="row">
  <div class="col-lg-12">
    <div class="card">
      <div class="card-body">
        <div class="row mb-2">
          <div class="col-sm-8">
            <h4 class="header-title">Detalle de Venta</h4>
        </div>
        <div class="col-sm-4">
            <div class="text-sm-end">
              <a class="btn btn-primary" href="{{ route('venta.index') }}"><i class="mdi mdi-reply"></i> Ventas</a>
          </div>
      </div><!-- end col-->
  </div>
  <div class="tab-content">
      <div class="tab-pane show active" id="custom-styles-preview">
        <div class="row">
          <div class="col-lg-10">
            <div class="mb-3">
              <label for="cliente" class="form-label">Cliente:</label>
              <input type="text"  disabled name="cliente" class="form-control" value="{{$venta->nombre}}">
          </div>
      </div>
      <div class="col-lg-2">
        <div class="mb-3">
          <label for="print_show" class="form-label">Imprimir:</label>
          <p><button type="button" class="btn btn-danger" id="print_show"onclick="print()"><i class="mdi mdi-printer"></i> Imprimir</button></p>
      </div>
  </div>
  <div class="col-lg-4">
    <div class="mb-3">
      <label for="tipo_comprobante" class="form-label">Tipo de Comprobante</label>
      <input type="text"  disabled name="tipo_comprobante" class="form-control" value="{{$venta->tipo_comprobante}}">
  </div>
</div>
<div class="col-lg-3">
    <div class="mb-3">
      <label for="serie_comprobante" class="form-label">Serie del Comprobante:</label>
      <input type="text"  disabled name="serie_comprobante" class="form-control" value="{{$venta->serie_comprobante}}"> 
  </div>
</div>
<div class="col-lg-3">
    <div class="mb-3">
      <label for="descripcion" class="form-label">Numero del Comprobante:</label>
      <input type="text"  disabled name="numero_comprobante" class="form-control" value="{{$venta->num_comprobante}}">
  </div>
</div>
<div class="col-lg-2">
    <div class="mb-3">
      <label for="impuesto" class="form-label">Impuesto:</label>
      <input type="text"  disabled name="impuesto" class="form-control" value="{{$venta->impuesto}} %">
  </div>
</div>
</div>
<div class="row">
  <div class="table-responsive">
    <table class="table table-centered w-100 dt-responsive nowrap table-bordered table-condensed table-hover"> 
      <thead style="background-color:#727cf5; color: #FFFFFF">
        <tr>
          <th>Artículo</th>
          <th>Cantidad</th>
          <th>Precio Venta</th>
          <th>Descuento</th>
          <th>Subtotal</th>
      </tr>
  </thead>
  <tfoot>
    <tr>
        <th  colspan="4"><p align="right">TOTAL:</p></th>
        <th><p align="right">S/. {{$venta->total_venta}}</p></th>
    </tr>
    <tr>
        <th colspan="4"><p align="right">TOTAL IMPUESTO (18%):</p></th>
        <th><p align="right">S/. {{$venta->total_venta*$venta->impuesto/100}}</p></th>
    </tr>
    <tr>
        <th  colspan="4"><p align="right">TOTAL PAGAR:</p></th>
        <th><p align="right">S/. {{$venta->total_venta+($venta->total_venta*$venta->impuesto/100)}}</p></th>
    </tr>  
</tfoot>                        
<tbody>
    @foreach($detalles as $det)
    <tr>
        <td>{{$det->articulo}}</td>
        <td>{{$det->cantidad}}</td>
        <td>S/. {{$det->precio_venta}}</td>
        <td>S/. {{$det->descuento}}</td>
        <td align="right">S/. {{$det->cantidad*$det->precio_venta-$det->descuento}}</td>
    </tr>
    @endforeach 
</tbody>

</table>
</div>
</div>
</div> <!-- end preview-->
</div> <!-- end tab-content-->
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
</div>

@push ('scripts')
<script>
    $('#liVentas').addClass("sub active");
    $('#aVentas').addClass("active");
    $('#liVentass').addClass("active");
</script>
@endpush
@endsection