@extends('admin.admin-master') 
@section('content')
<div>&nbsp; </div>
<div>&nbsp; </div>
<h3><i class="fa fa-cog"></i> Quiz Settings  </h3>
<div>&nbsp; </div>
<div class="col-md-12">
    <div class="col-md-6">
        <!-- Form Name -->
        {{Form::open(array('url'=>'/admin/save-quiz-setting',
                    'method'=>'POST',
                    'id'=>'save_quiz_setting_form',
                    ))}}
        <!-- Text input-->
        <div class="control-group">
            <label class="control-label" for="textinput">Active Group :</label>
            <?php
            $listOfValue = array();
            $listOfValue[0] = 'Select group';
            ?>
            @foreach($quiz_group as $op)
            <?php

            $listOfValue[$op->group_id] = $op->group_name;
            ?>
            @endforeach
            {{Form::select('quiz_group',$listOfValue,$setting->default_group,array('id'=>'quiz_group','class'=>'form-control input-sm'))}}
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="dtp_input1" class="control-label">Active From</label>
                    <div class="input-group date form_datetime" data-date="{{date('Y-m-d H:i:s')}}" data-date-format="dd MM yyyy - HH:ii p" data-link-field="dtp_input1">
                        <input class="form-control input-sm" size="16" type="text" value="{{isset($setting->publish_from)?$setting->publish_from:''}}" readonly>
                        <span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
                    </div>
                    <input type="hidden" id="dtp_input1" name="from_date" value="{{$setting->publish_from}}"><br/>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="dtp_input2" class="control-label">To</label>
                    <div class="input-group date form_datetime" data-date="{{date('Y-m-d H:i:s')}}" data-date-format="dd MM yyyy - HH:ii p" data-link-field="dtp_input2">
                        <input class="form-control input-sm" size="16" type="text" value="{{isset($setting->publish_to)?$setting->publish_to:''}}" readonly>
                        <span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
                    </div>
                    <input type="hidden" id="dtp_input2" name="to_date" value="{{isset($setting->publish_to)?$setting->publish_to:''}}"><br/>
                </div>
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <label>
            {{Form::checkbox('random_options',1,($setting->random_options==1)?'checked':'')}}
            Show options randomly
        </label>
        <div class="clearfix">&nbsp;</div>
        <!-- Button -->
        {{Form::button('<i class="fa fa-cog"></i> Save settings ',array('class'=>'btn btn-sm btn-info','id'=>'save_quiz_setting' ))}}
        <span id="group_loader"></span>
        {{Form::close()}}
        <!----//  End form------>
        <div class="clearfix">&nbsp;</div>
        <hr>
        <h4><i class="fa fa-facebook-f"></i> Custom share text </h4>
        <hr>
        <p><b><i class="fa fa-bullhorn"></i> Tips : </b> Please keep unchanged <b>{name} , {score}</b>   </p>

        {{Form::open(array('url'=>'/admin/save-custom-text','method'=>'POST' , 'id'=>'custom_text_form'))}}
        <label class="control-label" for="textinput">OG:Facebook Share text :</label>
        {{Form::text('custom_share_text' ,  isset($custom_facebook_text->custom_share_text)?$custom_facebook_text->custom_share_text:''  , array('class'=>'form-control input-sm','placeholder'=>'{name} got {score} points , Do you want to bid this score?'))}}
        <div class="clearfix">&nbsp;</div>
        <label class="control-label" for="textinput">OG:Details :</label>
        {{Form::textarea('custom_details_text', isset($custom_facebook_text->custom_details_text)?$custom_facebook_text->custom_details_text:'' ,array('class'=>'form-control input-sm'))}}
        <div class="clearfix">&nbsp;</div>
        {{Form::button('<i class="fa fa-save"></i> Save ', array('class'=>'btn btn-sm btn-info' , 'type'=>'button' , 'id'=>'save_custom_text', ))}}
        {{Form::close()}}
    </div>
    <div class="visible-sm visible-xs">&nbsp</div>
    <div class="col-md-6">
        <b style="color:red"> <i class="fa fa-warning"></i> Note: </b> Same schedule range for the same group is not allowed. <br>

        <h3>Quiz group schedule :</h3>
       <table class="table table-condensed table-responsive">
            <tr>
                <th>Group name</th>
                <th>Start date</th>
                <th>End date</th>
                <th>Action</th>
            </tr>
            @foreach($schedule_quiz as $sch)
            <tr>
                <td>{{$sch->group_name}}</td>
                <td>{{Util::getdate($sch->start_date,'d M,Y h:i a')}}</td>
                <td>{{Util::getdate($sch->end_date,'d M,Y h:i a')}}</td>
                <td><button class="btn btn-sm btn-danger schedule-delete" data-toggle="tooltip" data-placement="bottom" title="Delete schedule" schedule_id="{{$sch->schedule_id}}"><i class="fa fa-close"></i></button></td>
            </tr>
            @endforeach
        </table>
        <center>{{$schedule_quiz->links()}}</center>
    </div>
</div>
@stop
