@extends('web.base')
@section('content')


@if( $result_prize->status=='win')

    @push('js')

    <script>
        $(document).ready(function(){
        Swal.fire({
            icon: 'success',
            title: '{{str_replace(array("\r", "\n"), '', Nfs::content("notif_win")["title"])}}',
            html:'<p>{{str_replace(array("\r", "\n"), '', Nfs::content("notif_win")["description"])}}<p><br>'+
                '<b>code   : {{ $result_draw->voucher}}</b><br><br>' +
                '<b>member  : {{ $result_draw->member}}</b><br><br>' +
                '<b>prize  : {{ $result_prize->label }}</b>',
            footer: '<a href="{{url("/")}}">kembali ke menu</a>'
        })
    })
    </script>

        
    @endpush

@else


        @push('js')

        <script>
             $(document).ready(function(){
                Swal.fire({
                    icon: 'warning',
                    title: '{{str_replace(array("\r", "\n"), '', Nfs::content("notif_lose")["title"])}}',
                    text: '{{str_replace(array("\r", "\n"), '', Nfs::content("notif_lose")["description"])}}',
                    footer: '<a href="{{url("/")}}">kembali ke menu</a>'
                })
            })
        </script>
            
        @endpush

@endif

<a style="border-radius: 10px" class="mt2 btn btn-lg btn-primary btn-block form-submit" href="{{url('/')}}">Back To Home</a>

@if($result_prize->status=='win')
<audio autoplay="true" loop src="{{Fibonanci::content()['music_win']}}">
    Update your browser. Your browser does not support HTML audio
  </audio>
  <div class="hidden">
      <audio id="spinAudio" src="{{Fibonanci::content()['music_win']}}"></audio>
  </div>
@else

<audio autoplay="true" loop src="{{Fibonanci::content()['music_lose']}}">
    Update your browser. Your browser does not support HTML audio
  </audio>
  <div class="hidden">
      <audio id="spinAudio" src="{{Fibonanci::content()['music_lose']}}"></audio>
  </div>

@endif

@push('js')
  <script type="text/javascript">
      @if($result_prize->status=='win')
          confetti.start();
      @endif

      spinToResult("{{ $result_draw->rotation }}");
  </script>

@endpush



@endsection