@extends('layouts.app')

@section('title', __('master.list'))

@section('content')
<h1 class="page-header">
    <div class="pull-right">
        @can('create', new fullMstr)
            {{ link_to_route('masters.create', __('master.create'), [], ['class' => 'btn btn-success']) }}
        @endcan
    </div>
    {{ __('master.list') }}
    <small>{{ __('app.total') }} : {{ $mstrCollections->total() }} {{ __('master.master') }}</small>
</h1>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default table-responsive">
            <div class="panel-heading">
                {{ Form::open(['method' => 'get', 'class' => 'form-inline']) }}
                {!! FormField::text('q', ['label' => __('master.search'), 'placeholder' => __('master.search_text'), 'class' => 'input-sm']) !!}
                {{ Form::submit(__('master.search'), ['class' => 'btn btn-sm']) }}
                {{ link_to_route('masters.index', __('app.reset')) }}
                {{ Form::close() }}
            </div>
            <table class="table table-condensed table-hover">
                <thead>
                    <tr>
                        <th class="text-center">{{ __('app.table_no') }}</th>
                        <th>{{ __('master.title') }}</th>
                        <th>{{ __('master.description') }}</th>
                        <th class="text-center">{{ __('app.action') }}</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($mstrCollections as $key => $singleMstr)
                    <tr>
                        <td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
                        <td>{{ $singleMstr->title_link }}</td>
                        <td>{{ $singleMstr->description }}</td>
                        <td class="text-center">
                            @can('view', $singleMstr)
                                {{ link_to_route(
                                    'masters.show',
                                    __('app.show'),
                                    [$singleMstr],
                                    ['class' => 'btn btn-default btn-xs', 'id' => 'show-master-' . $singleMstr->id]
                                ) }}
                            @endcan
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
            <div class="panel-body">{{ $mstrCollections->appends(Request::except('page'))->render() }}</div>
        </div>
    </div>
</div>
@endsection
