@extends('app')
@section('content')

<style>
    a.thumbnail>img {
        /* height: 250px; */
    }
    
    .hide-bullets {
        list-style:none;
        margin-left: -40px;
        margin-top:20px;
        position: relative;
    }
    .thumbnail{
        border: none;
        display: unset;
        background-color: transparent;
    }
    .li-custom{
        padding:10px;
    }
    .store-logo{
        /* height: 250px;
        width: 250px;
        overflow: hidden;
        object-fit: contain; */
        /* cursor: pointer; */
    }
    a.thumbnail>img{
        height: 150px
    }
</style>
<div class="container">
	<div class="row">
        <div class="col-lg-12">
            <h2 style="font-size: 20px; font-weight: bold; ">TEAM STORES</h2>
            <hr>
        </div>
	</div><!-- /row -->
    <div class="row">
        <!-- <div class="col-sm-12"> -->
            <!-- <div class="well"> -->
                <form class="form-horizontal" role="search" id="frm_search_store">
                    <div class="col-lg-7">
                        <div class="form-group">
                            <div class="col-sm-12">
                                <label>Seach Store</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="Search Store" value="{{ $keyword }}"  name="q">
                                    <div class="input-group-btn">
                                        <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-5">
                        <div class="form-group">
                            <label  class="col-sm-7 control-label hidden-xs">&nbsp;</label>
                            <div class="col-sm-5">
                                <label>Sort by:</label>
                                <select class="form-control" name="s" id="select_sort_stores">
                                    <option  @if($filter == "al-asc") selected @endif  value="al-asc">Store Name A &rarr; Z</option>
                                    <option  @if($filter == "al-desc") selected @endif  value="al-desc">Store Name Z &rarr; A</option>
                                    <option  @if($filter == "latest") selected @endif  value="latest">Newest &rarr; Oldest</option>
                                    <option  @if($filter == "oldest") selected @endif  value="oldest">Oldest &rarr; Newest</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </form>
                <div class="clearfix"></div>
            <!-- </div> -->
        <!-- </div> -->
    </div>
    <div class="row" id="slider-thumbs">
            <!-- Bottom switcher of slider -->
        <ul class="hide-bullets">
            @foreach ($stores_array as $store)
            <li class="li-custom col-lg-3 col-md-3 col-sm-4 col-xs-12">
                <div style="border: 1px solid #dddddd; padding: 5px;">
                    @if($store->Password != null )
                        <a class="thumbnail password-protected" href="#" data-store-id="{{  $store->Id }}" data-store-url="{{  $store->StoreUrl }}">
                            <img class="store-logo" src="{{ minio_url('uploads/images/teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo) }}">
                        </a>
                        <h4  style="border-top: 1px solid #dddddd; padding: 10px; font-size: 16px; font-weight: bold; text-transform: uppercase;" class="text-center">{{  $store->StoreName }}  <i class="fa fa-lock" title="This store is password protected."></i></h4>
                    @else
                        <a class="thumbnail" href="{{ url('teamstore') . '/' . $store->StoreUrl }}">
                            <img class="store-logo" src="{{ minio_url('uploads/images/teamstore/' . $store->ImageFolder . '/' . $store->StoreLogo) }}">
                        </a>
                        <h4 style="border-top: 1px solid #dddddd; padding: 10px; font-size: 16px; font-weight: bold; text-transform: uppercase;" class="text-center">{{  $store->StoreName }}</h4>
                    @endif
                </div>
            </li>
            @endforeach 
        </ul>                 
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">
                {!! $stores_array->render() !!}
            </div>
        </div>
    </div>
</div><!-- /container -->


<div id="team-store-login" class="modal fade" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Teamstore Login</h4>
            </div>
        <div class="modal-body">
            @if (\Session::has('errors'))
                <div class="alert alert-danger data-errors">
                    <strong>Whoops!</strong> {!! \Session::get('errors') !!}.<br><br>
                </div>
            @endif

            <form class="form-horizontal" role="form" method="POST" action="{{ url('teamstore/checkpassword') }}">
                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                <input type="hidden" class="form-control" id="_teamstore_id" name="store_id">
                <div class="form-group">
                    <label class="col-md-4 control-label">Password</label>
                    <div class="col-md-6">
                        <div class="input-group">
                            
                            <input type="password" class="form-control pwd" name="password">
                            <span class="input-group-btn">
                                <button class="btn btn-default reveal-password" type="button"><i class="fa fa-eye"></i></button>
                            </span>          
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6 col-md-offset-4">
                        <button type="submit" class="btn btn-primary btn-block">Login</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>

    </div>
</div>
@endsection
