<form action="{{route('/ajaxVIPGameUpdate')}}/{{$game->id}}/{{$datain}}" method="POST" id="updateForm">
    <div class="container-fluid">
        <div class="col-xs-12">
            <div class="col-md-5 col-xs-12" style="background: whitesmoke; padding: 15px;">
                <div class="form-group col-xs-12">
                    <input type="text" name="teamOne" class="form-control" placeholder="TEAM ONE *" value="{{$game->teamOne}}" required>
                    <input type="hidden" value="{{$game->gameType}}" name="gameType" required>
                </div>
                <div class="form-group col-md-6 col-xs-12">
                    <label for="team1odd">FORM</label>
                    <input type="text" name="teamOneForm" placeholder="eg. WWWLD" class="form-control" value="{{$game->teamOneForm}}" maxlength="5">
                </div>
                <div class="form-group col-md-6 col-xs-12">
                    <label for="team1odd">ODDS</label>
                    <input type="text" name="teamOneOdds" placeholder="eg. 1.5" class="form-control" value="{{$game->teamOneOdds}}">
                </div>
            </div>

            <div class="col-md-2 col-xs-12" style="margin: 10px 0px; background: grey; border-radius: 0px 0px 8px 8px;"><center><span style="padding: 5px 10px; background: grey; color: white; border-radius: 100px; margin-top: -30px;">VS</span></center>
                <br>
                {{--<div class="form-group">--}}
                    {{--<input class="form-control" name="drawOdd" type="text" value="{{$game->drawOdd}}" placeholder="DRAW ODD">--}}
                {{--</div>--}}
                <div class="form-group">
                    <input class="form-control" name="gameDate" id="matchdate" type="text" placeholder="MATCH DATE *" value="{{$game->gameDate}}" required>
                </div>
                <div class="form-group">
                    <input class="form-control" name="gameTime" id="matchtime" type="text" placeholder="MATCH TIME *" value="{{$game->gameTime}}" required>
                </div>
                <div class="form-group">
                    <select name="league" class="form-control select2" required>
                        @foreach($allleagues->all() as $leagues)
                            <option value="{{$leagues->code}}" @if($game->league==$leagues->code) selected @endif>{{$leagues->code}}</option>
                        @endforeach
                    </select>
                </div>
            </div>

            <div class="col-md-5 col-xs-12" style="background: whitesmoke; padding: 15px;">
                <div class="form-group col-xs-12">
                    <input type="text" name="teamTwo" class="form-control" placeholder="TEAM TWO *" value="{{$game->teamTwo}}" required>
                </div>

                <div class="form-group col-md-6 col-xs-12">
                    <label for="team1odd">FORM</label>
                    <input type="text" name="teamTwoForm" placeholder="eg. WWWLD" class="form-control" value="{{$game->teamTwoForm}}" maxlength="5">
                </div>
                <div class="form-group col-md-6 col-xs-12">
                    <label for="team1odd">ODDS</label>
                    <input type="text" name="teamTwoOdds" placeholder="eg. 1.5" class="form-control" value="{{$game->teamTwoOdds}}">
                </div>
            </div>
        </div>
    </div>
    <hr>
    <div class="container-fluid">
        <h4 class="text-danger">PREMIUM VIP TIPS</h4>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group col-md-4 bg-danger" style="padding: 10px;">
                    <div class="row">
                        <div class="col-sm-4">
                            <label>MULTIBET 1</label>
                            <select name="multiBetOne" class="form-control">
                                <option value="Yes" @if($game->multiBetOne=='Yes') selected @endif>Yes</option>
                                <option value="No" @if($game->multiBetOne=='No') selected @endif>No</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <label>TIP</label>
                            <input type="text" name="multiBetOneTip" value="{{$game->multiBetOneTip}}" class="form-control">
                        </div>
                        <div class="col-sm-4">
                            <label>ODD</label>
                            <input type="text" name="multiBetOneOdds" value="{{$game->multiBetOneOdds}}" class="form-control">
                        </div>
                    </div>
                </div>

                <div class="form-group col-md-4 bg-success" style="padding: 10px;">
                    <div class="row">
                        <div class="col-sm-4">
                            <label>MULTIBET 2</label>
                            <select name="multiBetTwo" class="form-control">
                                <option value="Yes" @if($game->multiBetTwo=='Yes') selected @endif>Yes</option>
                                <option value="No" @if($game->multiBetTwo=='No') selected @endif>No</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <label>TIP</label>
                            <input type="text" name="multiBetTwoTip" value="{{$game->multiBetTwoTip}}" class="form-control">
                        </div>
                        <div class="col-sm-4">
                            <label>ODD</label>
                            <input type="text" name="multiBetTwoOdds" value="{{$game->multiBetTwoOdds}}" class="form-control">
                        </div>
                    </div>
                </div>

                <div class="form-group col-md-4 bg-danger" style="padding: 10px;">
                    <div class="row">
                        <div class="col-sm-4">
                            <label>MULTIBET 3</label>
                            <select name="multiBetThree" class="form-control">
                                <option value="Yes" @if($game->multiBetThree=='Yes') selected @endif>Yes</option>
                                <option value="No" @if($game->multiBetThree=='No') selected @endif>No</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <label>TIP</label>
                            <input type="text" name="multiBetThreeTip" value="{{$game->multiBetThreeTip}}" class="form-control">
                        </div>
                        <div class="col-sm-4">
                            <label>ODD</label>
                            <input type="text" name="multiBetThreeOdds" value="{{$game->multiBetThreeOdds}}" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="container-fluid">
        <hr>
        <div class="form-group col-md-6 bg-danger" style="padding: 10px;">
            <div class="row">
                <div class="col-sm-12"><h4>SUPER VIP TIPS</h4></div>
                <div class="col-sm-4">
                    <label>SUPER TIP</label>
                    <select name="super" class="form-control">
                        <option value="Yes" @if($game->super=='Yes') selected @endif>Yes</option>
                        <option value="No" @if($game->super=='No') selected @endif>No</option>
                    </select>
                </div>
                <div class="col-sm-4">
                    <label>PREDICTION</label>
                    <input type="text" name="superTip" value="{{$game->superTip}}" class="form-control">
                </div>
                <div class="col-sm-4">
                    <label>ODD</label>
                    <input type="text" name="superOdds" value="{{$game->superOdds}}" class="form-control">
                </div>
            </div>
        </div>

        <div class="form-group col-md-6 bg-success" style="padding: 10px;">
            <div class="row">
                <div class="col-sm-12"><h4>SUPER VIP TIPS</h4></div>
                <div class="col-sm-6">
                    <label>HT/FT</label>
                    <select name="HTFT" class="form-control">
                        <option value="1/1" @if($game->HTFT=='1/1') selected @endif>1/1</option>
                        <option value="1/X" @if($game->HTFT=='1/X') selected @endif>1/X</option>
                        <option value="1/2" @if($game->HTFT=='1/2') selected @endif>1/2</option>
                        <option value="X/1" @if($game->HTFT=='X/1') selected @endif>X/1</option>
                        <option value="X/2" @if($game->HTFT=='X/2') selected @endif>X/2</option>
                        <option value="X/X" @if($game->HTFT=='X/X') selected @endif>X/X</option>
                        <option value="2/1" @if($game->HTFT=='2/1') selected @endif>2/1</option>
                        <option value="2/2" @if($game->HTFT=='2/2') selected @endif>2/2</option>
                        <option value="2/X" @if($game->HTFT=='2/X') selected @endif>2/X</option>
                        <option value="No" @if($game->HTFT=='No') selected @endif>No</option>
                    </select>
                </div>
                <div class="col-sm-6">
                    <label>ODD</label>
                    <input type="text" name="HTFTOdds" value="{{$game->HTFTOdds}}" class="form-control">
                </div>
            </div>
        </div>

        <div class="form-group col-md-12" style="padding: 10px;">
            <div class="row">
                <div class="col-sm-12">
                    <h4 class="text-danger">JACKPOT VIP TIPS</h4>
                </div>
                <div class="form-group col-md-6 bg-success" style="padding: 10px;">
                    <div class="row">
                        <div class="col-sm-4">
                            <label class="text-primary">MEGA JACKPOT</label>
                            <select name="mega" class="form-control">
                                <option value="Yes" @if($game->mega=='Yes') selected @endif>Yes</option>
                                <option value="No" @if($game->mega=='No') selected @endif>No</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <label>TIP</label>
                            <input type="text" name="megaTip" value="{{$game->megaTip}}" class="form-control">
                        </div>
                        <div class="col-sm-4">
                            <label>ODD</label>
                            <input type="text" name="megaOdds" value="{{$game->megaOdds}}" class="form-control">
                        </div>
                    </div>
                </div>

                <div class="form-group col-md-6 bg-danger" style="padding: 10px;">
                    <div class="row">
                        <div class="col-sm-4">
                            <label class="text-primary">MIDWEEK JACKPOT</label>
                            <select name="midWeek" class="form-control">
                                <option value="Yes" @if($game->midWeek=='Yes') selected @endif>Yes</option>
                                <option value="No" @if($game->midWeek=='No') selected @endif>No</option>
                            </select>
                        </div>
                        <div class="col-sm-4">
                            <label>TIP</label>
                            <input type="text" name="midWeekTip" value="{{$game->midWeekTip}}" class="form-control">
                        </div>
                        <div class="col-sm-4">
                            <label>ODD</label>
                            <input type="text" name="midWeekOdds" value="{{$game->midWeekOdds}}" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="row">
        {!! csrf_field() !!}
        <div class="col-sm-12">
            <div id="settingstatus" class="col-xs-6"></div>
            <div class="form-group col-sm-12">
                <button class="btn btn-md btn-success" name="submit" id="submitsetting">UPDATE PREDICTION</button>
            </div>
        </div>

    </div>
</form>

<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    $(document).ready(function () {
        $('#updateForm').submit(function (e) {
            e.preventDefault();
            $('#submitsetting').prop('disabled', true).html("UPDATING PREDICTION");
            var url = $(this).attr('action');

            var dataString = $(this).serialize();
            console.log(dataString);
            $.ajax({
                type: "POST",
                url: url,
                data: dataString,
                dataType: "JSON",
                success: function(data){
                    if (data.status == 1) {
                        $('#submitsetting').prop('disabled', false).html("UPDATE PREDICTION");
                        swal(data.encounters, '', 'warning');
                    }
                    else{
                        swal(data.encounters, '', 'success');
                        $('#updategame').modal('hide');
                    }
                }
            });

        });
    });
</script>