@extends('backend.layouts.master')
@section('title',' Module Group Management')

@push('css')

@endpush
<!-- page content -->
@section('content')
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            @if(Session::has('success'))
                <div class="alert alert-success">
                    {{ Session::get('success') }}
                </div>
            @endif
            @if(Session::has('error_message'))
                <div class="alert alert-danger">
                    {{ Session::get('error') }}
                </div>
            @endif
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Manage Module Group 
                                <a href="{{route('module_group.create')}}" class="btn btn-xs btn-primary">New Module Group</a>
                            </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                        <div class="row search-section">
								<form action="{{route('module_group.list')}}" id="searchForm" method="Get">
									<div class="col-sm-2">
										<select class="form-control" name="show" id="show">
											<option value="{{$module->count()}}">{{$module->count()}}</option>
											<option value="10">10</option>
											<option value="25">25</option>
											<option value="50">50</option>
											<option value="100">100</option>
											<option value="250">250</option>
											<option value="500">500</option>
										</select>
									</div>
									<div class="col-sm-7"></div>
									<div class="col-sm-3">
										<div class="input-group">
											<input type="text" id="myInput" class="form-control" placeholder="Search">
											<span class="input-group-btn">
												<button type="button" class="btn btn-primary">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span></button>
											</span>
										</div>
									</div>
								</form> 
							</div>
                            <table class="table table-responsive table-bordered table-condensed">
                                <thead>
                                <tr class="bg-primary">
                                    <th>SL</th>
                                    <th>Module Name</th>
                                    <th>Module Key</th>
                                    <th>Module URL</th>
                                    <th>Module Rank</th>
                                    <th>View Sidebar</th>
                                  <!--  <th>created_date</th>
                                    <th>updated_date</th>-->
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $i=1 ?>
                                @foreach($module as $m)
                                    <tr>
                                        <th> {{$i++}}</th>
                                        <td> {{$m->name}}</td>
                                        <td> {{$m->module_key}}</td>
                                        <td> {{$m->module_url}}</td>
                                        <td> {{$m->module_rank}}</td>
                                        <td>
                                            @if($m->view_sidebar == 1)
                                                <span class="label label-success"> Yes </span>
                                            @else
                                                <span class="label label-danger"> No </span>
                                            @endif
                                        </td>
                                        <!--<td> {{$m->created_at}}</td>
                                        <td> {{$m->updated_at}}</td>-->
                                        <td>
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <a href="{{route('module_group.edit',$m->id)}}" class="btn btn-xs btn-warning "><i class="fa fa-pencil"></i></a>
                                                </div>
                                                @can('module-group-delete')
                                                <div class="col-md-5">
                                                    <form action="" method="post">
                                                        <input type="hidden" name="_method" value="DELETE">
                                                        {{ csrf_field()}}
                                                        <button class="btn btn-xs btn-danger" type="submit" onclick= "return confirm('are you sure to delete?')"><i class="fa fa-trash-o"></i> </button>
                                                    </form>
                                                </div>
                                                @endcan
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="text-center">
                                {{$module->links()}}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
@endsection

@section('script')

@endsection