@extends('layouts.master')

@section('content')
<!-- Main content -->
<section class="content">
    <!-- Main row -->
    <div class="row">
        <div class="col-md-12">
            <section class="panel tasks-widget">
                <header class="panel-heading" style="height:40px;">
                    <div class="pull-left">
                        {{$title}}
                    </div>
                    <div>
                        <button class="btn btn-success btn-xs pull-right" data-toggle="modal" data-target=".add-modal">Upload file</button>
                    </div>
                </header>
                <div class="table-responsive project-list">

                @if(Session::has('msg'))
                    {{Session::get('msg')}}
                    {{"sdjflsdfjls"}}

                @endif
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th>
                                    Name
                                </th>
                                <th>
                                    Details
                                </th>
                                <th>
                                    Action
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                        @if($all)
                            @foreach($all as $info)
                            <tr>
                                <th>
                                    {{$info->name}}
                                </th>
                                <th>
                                    {{$info->details}}
                                </th>
                                <th>
                                    <a target="_blank" href="{{URL::asset("assets/document/files/$info->url")}}" class="btn btn-xs btn-success">Download</a>
                                    <a onclick="return confirm('Want to delete?')" href="{{url("admin/file_upload/$info->id")}}" class="btn btn-xs btn-danger" style="background-color:#FF6501;color:#fff;">X</a>
                                </th>
                            </tr>
                            @endforeach
                        @endif
                        </tbody>
                    </table>
                    <hr>
                    </hr>
                </div>
               
            </section>
        </div>
    </div>
</section>
<!-- row end -->
<!-- /.content -->


<!-- Modal Add Contract person -->
<div class="modal fade add-modal" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="gridSystemModalLabel">Add Address Book Info</h4>
      </div>
      <div class="modal-body">

        <form action="{{url('admin/file_upload')}}" method="POST" enctype="multipart/form-data">

            {{ csrf_field() }}
            <div class="form-group in-group">
                <label for="">Name</label>
                <input type="text" name="name" class="form-control" id="" placeholder="File name" >
            </div>
            <div class="form-group in-group">
                <label for="">Upload File</label>
                <input type="file" name="file" id="fileToUpload">
            </div>
            <div class="form-group in-group">
                <label for="">Details</label>
                <textarea type="text" name="details" class="form-control"></textarea>
            </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
      </form>  
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

@endsection


@section('script')

@endsection
