@extends('layouts.dashboard')

@section('content')

<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
      <div class="container-full">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <div class="d-flex align-items-center">
                <div class="me-auto">
                    <h3 class="page-title">Reports</h3>
                    <div class="d-inline-block align-items-center">
                        <nav>
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="mdi mdi-home-outline"></i></a></li>
                                <li class="breadcrumb-item" aria-current="page">Reports</li>
                                <li class="breadcrumb-item active" aria-current="page">Order Reports</li>
                            </ol>
                        </nav>
                    </div>
                </div>
                
            </div>
        </div>

        <!-- Main content -->
        <section class="content">
          <div class="row">

            <div class="col-12">

             <div class="box">
                @include('layouts.flash-message')
                <!-- /.box-header -->
                <div class="box-body">
                    <form class="form" action="{{ route('admin.report.order.download') }}" method="post">
					@csrf
                    <div class="row">
                        <div class="col-md-4"></div>
                        <div class="col-md-2"></div>
                        <div class="col-md-4">
                            <div class="form-group">
            
            					<div class="input-group">
            					  <div class="input-group-addon">
            						<i class="fa fa-calendar"></i>
            					  </div>
            					  <input type="text" class="form-control pull-right" id="reservation" name="data_range" required>
            					</div>
            					<!-- /.input group -->
        				    </div>
                        </div>
                        <div class="col-md-2">
                            <input type="submit" name="submit" class="btn btn-primary" value="Download Report" style="padding: 6px 15px;">
                        </div>
                        
                    </div>
                    </form>
                    
                    <div class="table-responsive">
                      <table id="example1" class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>S No</th>
                                <th>Order ID</th>
                                <th>Amount</th>
                                <th>Order Type</th>
                                <th>Status</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if($reports)
                            @foreach($reports as $key => $value)
                            <tr>
                                <td>{{ $key + 1}}</td>
                                <td>{{ $value->order_id }}</td>
                                <td>{{ $value->total_discount_amount }}</td>
                                <td>
                                    @if($value->discount_type == 2)
                                        Extra Income Plan
                                    @else
                                        Discount Plan
                                    @endif
                                </td>
                                <td>{{ $value->status }}</td>
                                <td>
                                    <a href="{{ url('/public/invoice/') }}/Amirdham-#000022.pdf"> Download</a>
                                    <a href="{{ route('order.invoice', $value->id) }}" class="btn btn-success" style="padding: 4px 12px;margin: 0px 4px;"><i class="ti-download text-white"></i></a>
                                </td>
                            </tr>
                            @endforeach
                            @endif
                        </tbody>
                      </table>
                    </div>
                </div>
                <!-- /.box-body -->
              </div>
              <!-- /.box -->

            </div>
            <!-- /.col -->
          </div>
          <!-- /.row -->
        </section>
        <!-- /.content -->
      
      </div>
  </div>
  <!-- /.content-wrapper -->

@endsection