@extends('admin/layouts/default')
{{-- Page title --}}
@section('title')
Consortia Organization Lists
@parent
@stop
{{-- page level styles --}}
@section('header_styles')
<link href="{{ asset('assets/css/pages/tables.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('assets/vendors/select2/css/select2.min.css') }}" type="text/css" rel="stylesheet">
<link href="{{ asset('assets/vendors/select2/css/select2-bootstrap.css') }}" rel="stylesheet">
<!-- end of page level css-->
@stop
{{-- Page content --}}
@section('content')
<section class="content-header">
    <!--section starts-->
    <h1>Year Wise Consortia Access List</h1>
    <ol class="breadcrumb">
        <li>
            <a href="{{ route('admin.dashboard') }}">
                <i class="livicon" data-name="home" data-size="18" data-loop="true"></i>
                Dashboard
            </a>
        </li>
        <li class="active">Consortia Access List</li>
    </ol>
</section>
<!--section ends-->
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN SAMPLE TABLE PORTLET-->
            <div class="portlet box primary">
                <div class="portlet-title">
                    <div class="caption">
                        <i class="livicon" data-name="responsive" data-size="16" data-loop="true" data-c="#fff" data-hc="white"></i>
                        Consortia Access List
                    </div>
                </div>
                <div class="portlet-body table-responsive">
                    <form action="{{ route('consortia_organization.index') }}" method="Get" enctype="multipart/form-data">
                        @csrf
                        <div class="form-row">
                            <div class="form-group col-md-6">
                                <select class="form-control select2" id="access_organization_id" name="access_organization_id" required>
                                    <option selected="true" value="" disabled="disabled" hidden>Select Consortia Organization</option>
                                    @foreach($consortia_organization as $organization)
                                    <option value="{{$organization->access_organization_id}}" @isset($param) @if($param['access_organization_id']==$organization->access_organization_id) selected @endif @endisset>{{$organization->organization_name}}</option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="form-group col-md-4">
                                <select class="form-control select2" id="year_id" name="year_id" required>
                                    <option selected="true" value="" disabled="disabled" hidden>Select Year</option>
                                    @foreach($year_list as $year)
                                    <option value="{{$year->id}}" @isset($param) @if($param['year_id']==$year->id) selected @endif @endisset>{{$year->year}}</option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="form-group col-md-2">
                                <button type="submit" class="btn btn-primary" name="frm_search" value="true">
                                    <span class="glyphicon glyphicon-search"></span> Search
                                </button>
                                <a href="{{route('consortia_organization.index')}}" class="btn btn-default">
                                    <span class="glyphicon glyphicon-repeat"></span>&nbsp;Reset</a>
                            </div>
                        </div>
                        <div class="form-row">
                            <div class="form-group col-md-12">
                            <button type="submit" class="btn btn-success" name="export" value="eureka">
                                    <span class="glyphicon glyphicon-export"></span> Export Eureka Usage Report
                                </button>
                                <button type="submit" class="btn btn-success m-l-5" name="export" value="combine">
                                    <span class="glyphicon glyphicon-export"></span> Export Combine Usage Report
                                </button>
                            </div>
                        </div>
                    </form>

                    <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>Username</th>
                                <th>Organization Name</th>
                                <th>Country</th>
                                <th>Found</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if(!empty($users_list))
                            @foreach($users_list as $user)
                            <tr>
                                <td>{{$user->name}}</td>
                                <td>{{$user->organization_name}}</td>
                                <td>{{$user->printable_name}}</td>
                                @if($user->total != 0)
                                <td>YES</td>
                                @else
                                <td>NO</td>
                                @endif
                                @endforeach
                                @else
                            <tr>
                                <td colspan="4">
                                    <center>Empty</center>
                                </td>
                            </tr>
                            @endif
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- END SAMPLE TABLE PORTLET-->
        </div>
    </div>
</section>
@stop

{{-- page level scripts --}}
@section('footer_scripts')
<script src="{!! asset('assets/vendors/select2/js/select2.js') !!}"></script>
<script src="{!! asset('js/filter.js') !!}"></script>
<script>
    $("#access_organization_id").select2({
        theme: "bootstrap",
        placeholder: "Select Consortia Organization",
        width: '100%',
        height: '50px'
    });
    $("#year_id").select2({
        theme: "bootstrap",
        placeholder: "Select Year",
        width: '100%',
        height: '50px'
    });
</script>
@stop