@extends('layouts.layout')

@section('content')


<div class="form-group row add">
  <div class="container">
      @if(Session::has('success'))
        <div class="alert-box success">
          <h2>{!! Session::get('success') !!}</h2>
        </div>
      @endif
      <div class="form-group">
        
        {!! Form::open(array('url'=>'upload/uploadFiles','method'=>'POST', 'files'=>true)) !!}
        {!! Form::file('images[]', array('multiple'=>true)) !!}
          <p>{!!$errors->first('images')!!}</p>
          @if(Session::has('error'))
            <p>{!! Session::get('error') !!}</p>
          @endif
        {!! Form::submit('Submit', array('class'=>'btn btn-lg btn-primary col-md-4')) !!}
        {!! Form::close() !!}
      </div>
    </div>



    <br><br><br>
     
    <table class="table" style="color: black">
    <tr class="success">
    <th>No.</th>
    <th>Original FileName</th>
    <th>Actions</th>
    </tr>

    

    <?php $no=1; ?>

    @foreach($uploads as $upload)

    <tr style="background-color: #E1E1E1">
    <td>{{$no++}}</td>
    <td>{{$upload->original_filename}}</td>
   

    <td>
    <form class="" action="{{route('upload.destroy', $upload->id)}}" method="post">
    <input class="w3-btn" type="hidden" name="_method" value="delete">
    <input class="w3-btn" type="hidden" name="_token" value="{{ csrf_token() }}">
  

  
  
     
          
            
            <a href="uploads/{{$upload->original_filename}}" download="{{$upload->original_filename}}">
              <button type="button" class="btn btn-primary"><i class="fa fa-cloud-download" style="width: 80px;">
                Download
              </i></button> 
            </a>
            
          
          
    
    

    <input type="submit" class="btn btn-danger" onclick="return confirm('Are you sure to delete this data');" name="name" value="delete">
    </form>
    </td>

    </tr>

    @endforeach

    </table>
   {!! $uploads->links() !!}
    </div>



  @endsection