@extends('admin.admin-master') 
@section('content')
<div>&nbsp; </div>
<div>&nbsp; </div>
<h3><i class="fa fa-cubes"></i> Manage Quiz Group  </h3>
<div>&nbsp; </div>
<!--- Add new group --->
<div class="col-md-12">
    <div class="col-md-6">
        <fieldset>
            <!-- Form Name -->
            {{Form::open(array('url'=>'/admin/save-new-group','method'=>'POST', 'id'=>'save_group_form'))}}
            <legend> Add Group </legend>
            <!-- Text input-->
            <label class="control-label" for="textinput"> Group Image:</label>
            <img src="http://placehold.it/600x350" id="poll_img" class="img-responsive">
            {{Form::hidden('home_page_slider[]','',array('id'=>'file_name','name'=>'image_path'))}}
             <div>&nbsp; </div>
            <a data-toggle="tooltip" data-placement="bottom" title="" class="btn btn-sm btn-default" href="javascript:void(0)" id="load-meadia" data-original-title="Add image"> <i class="fa fa-image"></i> Choose Image </a>
            <div>&nbsp; </div>
            <div class="control-group">
                <label class="control-label" for="textinput"> Group :</label>
                <div class="controls">
                    {{Form::text('group_name','', array('id'=>'groupinput','placeholder'=>'Group name','class'=>'form-control input-sm'))}}
                </div>

                <div class="controls">
                  {{Form::checkbox('is_public',1, array('id'=>'groupinput','placeholder'=>'Group name','class'=>'form-control input-sm'))}}  <b>Public </b>
                </div>
            </div>
            <div class="clearfix">&nbsp;</div>
            <!-- Button -->
            <div class="row">
                <div class="col-md-6">
                 <span id="group_loader"></span>
                </div>
                <div class="col-md-3">
                    {{Form::button('Reset',array('class'=>'btn btn-sm btn-default  btn-block','type'=>'reset'))}}
                </div>
                <div class="col-md-3">
                    {{Form::button('<i class="fa fa-save"></i> Save',array('class'=>'btn btn-sm btn-info  btn-block','type'=>'button','id'=>'save_group'))}}
                </div>
            </div>
            {{Form::close()}}
            <!--// Form Name -->
        </fieldset>
    </div>
    <?php $status = array(0 => 'Inactive', 1 => 'Active', 2 => ''); ?>
    <div class="col-md-6">
        <fieldset>
            <legend> Group List : </legend>
            <table class="table table-responsive table-condensed">
                <tr><th> Group </th>
                    <th> Status </th>
                    <th> Public </th>
                    <th class="text-center"> Action </th>
                </tr>
                @foreach($group_list as $gl)
                <tr><td class="id_{{$gl->group_id}}"> {{$gl->group_name}} </td>
                    <td> <span class="label {{($gl->status==1)?'label-success':'label-danger'}}">{{$status[$gl->status]}}</span></td>
                    <td> <span class="label {{($gl->is_public==1)?'label-info':'label-warning'}}">{{($gl->is_public==1)?'Public':'No'}}</span></td>
                    <td class="text-center">
                        {{Form::button('<span class="" data-toggle="tooltip" data-placement="bottom" title="Edit group"><i class="fa fa-edit"></i></span>',array('class'=>'btn btn-info btn-sm edit_group','type'=>'button','path'=>'/admin/edit-group/'.$gl->group_id,'data-toggle'=>'modal','data-target'=>'#myGroup' ))}}
                        {{Form::button('<span class=""><i class="fa fa-times"></i></span>',array('class'=>'btn btn-danger btn-sm delete_group','type'=>'button','path'=>'/admin/edit-group/'.$gl->group_id,'data-toggle'=>'tooltip','title'=>'Delete','data-placement'=>'bottom','data-group-id'=>$gl->group_id ))}}
                    </td>
                </tr>
                @endforeach
            </table>
            <center>
                {{$group_list->links()}}
            </center>
        </fieldset>
    </div>
</div>
<!--- End Add new group --->
<!-- Modal -->
<div class="modal fade" id="myGroup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <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="myModalLabel">Update group</h4>
            </div>
            <div class="modal-body group-form">
            </div>
            <p class="">&nbsp;</p>
        </div>
    </div>
</div>
<!---// Modal ------->
<!-- Modal -->
<div class="modal fade" id="MediaLib" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <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="myModalLabel">Image Library</h4>
            </div>
            <div class="modal-body group-form mediaLibBody">
            </div>
            <p class="">&nbsp;</p>
        </div>
    </div>
</div>
<!---// Modal ------->
@stop
