@extends('admin.admin-master')
@section('content')
<div>&nbsp; </div>
@if (Session::has('message'))
<span class="alert {{Session::get('class')}}">
    {{Session::get('message')}}
</span>
@endif
<div>&nbsp; </div>

<h3><i class="fa fa-lightbulb-o"></i> Guess the number  </h3>
<div>&nbsp; </div>
<!--- Main Panel --->
<?php
$number = explode(',', $settings->guess_number);
$start = isset($number[0]) ? $number[0] : '';
$end = isset($number[1]) ? $number[1] : '';

?>
<div class="col-md-12">
  @if (Session::has('msg'))
  <span class="alert {{Session::get('class')}}">
      {{Session::get('msg')}}
  </span>
  @endif
  <div>&nbsp; </div>
  <div class="">
    <form action="" method="POST">
      <i class="fa fa-bullhorn"></i> Tips : Set minimum and maximum value for generating RANDOM guess number  !
      <br>
      <br>
      <div class="col-md-3">
        <label>  On / Off :   </label>
        <i style="cursor:pointer;" class="fa {{($settings->guess_number_status==1)?'fa-toggle-on':'fa-toggle-off'}} fa-2x guess-on-off"></i>
      </div>
      <div class="col-md-9"></div>
     <div class="clearfix">&nbsp;</div>
      <div class="col-md-3">
        <label>Minimum value : </label>
        <input type="text" name="start" class="form-control input-sm" required value="{{$start}}">
      </div>
      <div class="col-md-9"></div>
      <div class="clearfix">&nbsp;</div>
      <div class="col-md-3">
        <label>Maximum value : </label>
        <input type="text" name="end" class="form-control input-sm" required value="{{$end}}">
      </div>
      <div class="col-md-9"></div>
        <div class="clearfix">&nbsp;</div>
      <div class="col-md-3">
        <div class="clearfix">&nbsp;</div>
        <button class="btn btn-sm btn-info btn-block" type="submit"> <i class="fa fa-save"></i> Save </button>
      </div>
      <div class="col-md-9"></div>
    </form>
  </div>
</div>
<script>
  $('.guess-on-off').click(function(){
    var toggle = $(this);
      $.get('/admin/guess-number-setting?action=guess_number_status').done(function(e){
       if(e.status==1){
         toggle.removeClass('fa-toggle-off'); toggle.addClass('fa-toggle-on');
           $.notify('Guess the number is activated !','success'); // Success Notify JS
       }else {
       toggle.removeClass('fa-toggle-on');  toggle.addClass('fa-toggle-off');
         $.notify('Guess the number is deactivated '); // Notify JS
          }
      });
  });
</script>

@stop
