
<form action="<?php echo e(route('/addResult')); ?>" method="POST" id="addresultform">
    <div class="container-fluid">
        <div class="col-xs-12">
            <input type="hidden" name="id" value="<?php echo e($game->id); ?>">
            <div class="col-md-5 col-xs-12" style="background: whitesmoke; padding: 15px;">
                <h1 class="text-center"><?php echo e($game->teamOne); ?></h1><hr>

                <div class="form-group col-md-12 col-xs-12">
                    <label for="score1">SCORE/GOAL(S)</label>
                    <input type="number" name="score1" class="form-control" required maxlength="5" min="0" value="<?php echo e($game->teamOneScore); ?>">
                </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="matchdate" id="matchdate" type="text" placeholder="MATCH DATE" required value="<?php echo e($game->gameDate); ?>" disabled>
                </div>
                <div class="form-group">
                    <input class="form-control" name="matchtime" id="matchtime" type="text" placeholder="MATCH TIME" required value="<?php echo e($game->gameTime); ?>" disabled>
                </div>
            </div>

            <div class="col-md-5 col-xs-12" style="background: whitesmoke; padding: 15px;">
                <h1 class="text-center"><?php echo e($game->teamTwo); ?></h1><hr>

                <div class="form-group col-md-12 col-xs-12">
                    <label for="score2">SCORE/GOAL(S)</label>
                    <input type="number" name="score2" class="form-control" required maxlength="5" min="0" value="<?php echo e($game->teamTwoScore); ?>">
                </div>

            </div>
        </div>
    </div>
    <hr>
    <div class="col-sm-12">
        <div class="form-group col-sm-6">
            <label for="">CORNER RESULT</label>
            <input type="text" name="cornerResult" class="form-control" value="<?php echo e($game->cornerResult); ?>">
        </div>
        <div class="form-group col-sm-6">
            <label>SELECT POTENTIAL PREDICTION</label>
            <select name="potential" class="form-control">
                <option value="">Select here...</option>
                <option value="<?php echo e($game->FTRecommendation); ?>" <?php if($game->testimonialValue==$game->FTRecommendation): ?> selected <?php endif; ?>><b>Full-Time Recommendation</b> : <?php echo e($game->FTRecommendation); ?></option>
                <?php if($game->regularTips=='Yes'): ?><option value="<?php echo e($game->regularTipsValue); ?>"  <?php if($game->testimonialValue==$game->regularTipsValue): ?> selected <?php endif; ?>><b>Regular Tips</b> : <?php echo e($game->regularTipsValue); ?></option> <?php endif; ?>
                <?php if($game->customTips=='Yes'): ?><option value="<?php echo e($game->customTipsValue); ?>"   <?php if($game->testimonialValue==$game->customTipsValue): ?> selected <?php endif; ?>><b>Custom Tips</b> : <?php echo e($game->customTipsValue); ?></option> <?php endif; ?>
                <?php if($game->weekendTips=='Yes'): ?><option value="<?php echo e($game->weekendTipsValue); ?>"   <?php if($game->testimonialValue==$game->weekendTipsValue): ?> selected <?php endif; ?>><b>Weekend Tips</b> : <?php echo e($game->weekendTipsValue); ?></option> <?php endif; ?>
                <option value="<?php echo e($game->oneFiveGoals); ?>"   <?php if($game->testimonialValue==$game->oneFiveGoals): ?> selected <?php endif; ?>><b>Over 1.5</b> : <?php echo e($game->oneFiveGoals); ?></option>
                <option value="<?php echo e($game->doubleChance); ?>" <?php if($game->testimonialValue==$game->doubleChance): ?> selected <?php endif; ?>><b>Double Chance</b> : <?php echo e($game->doubleChance); ?></option>
                <option value="<?php echo e($game->twoFiveGoals); ?>" <?php if($game->testimonialValue==$game->twoFiveGoals): ?> selected <?php endif; ?>><b>2.5 Goals</b> : <?php echo e($game->twoFiveGoals); ?></option>
                <option value="<?php echo e($game->HTResults); ?>" <?php if($game->testimonialValue==$game->HTResults): ?> selected <?php endif; ?>><b>Halftime Results</b> : <?php echo e($game->HTResults); ?></option>
                <option value="<?php echo e($game->overZeroFiveHT); ?>" <?php if($game->testimonialValue==$game->overZeroFiveHT): ?> selected <?php endif; ?>><b>Over 0.5 HT</b> : <?php echo e($game->overZeroFiveHT); ?></option>
                <option value="<?php echo e($game->underOneFiveHT); ?>" <?php if($game->testimonialValue==$game->underOneFiveHT): ?> selected <?php endif; ?>><b>Under 1.5 HT</b> : <?php echo e($game->underOneFiveHT); ?></option>
                <option value="<?php echo e($game->BTTS); ?>" <?php if($game->testimonialValue==$game->BTTS): ?> selected <?php endif; ?>><b>BTTS/GG</b> : <?php echo e($game->BTTS); ?></option>
                <option value="<?php echo e($game->HTFT); ?>" <?php if($game->testimonialValue==$game->HTFT): ?> selected <?php endif; ?>><b>Halftime/Fulltime</b> : <?php echo e($game->HTFT); ?></option>
                <option value="<?php echo e($game->matchCorners); ?>" <?php if($game->testimonialValue==$game->matchCorners): ?> selected <?php endif; ?>><b>Match Corners</b> : <?php echo e($game->matchCorners); ?></option>
                <option value="<?php echo e($game->fullTimeDraw); ?>" <?php if($game->testimonialValue==$game->fullTimeDraw): ?> selected <?php endif; ?>><b>Fulltime Draws</b> : <?php echo e($game->fullTimeDraw); ?></option>
                <option value="<?php echo e($game->homeAwayScore); ?>" <?php if($game->testimonialValue==$game->homeAwayScore): ?> selected <?php endif; ?>><b>Home/Away to Score</b> : <?php echo e($game->homeAwayScore); ?></option>
                <option value="<?php echo e($game->drawNoBet); ?>" <?php if($game->testimonialValue==$game->drawNoBet): ?> selected <?php endif; ?>><b>Draw No Bet</b> : <?php echo e($game->drawNoBet); ?></option>
            </select>
        </div>
    </div>
    <div class="container-fluid">
        <?php echo csrf_field(); ?>


        <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">SAVE & CLOSE</button>
        </div>

    </div>
</form>

<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $(document).ready(function () {
        $('#addresultform').submit(function (e) {
            e.preventDefault();
            $('#submitsetting').prop('disabled', true).html('SAVING RESULT');
            var url = $(this).attr('action');
            var dataString = $(this).serialize();
            $.ajax({
                type: "POST",
                url: url,
                data: dataString,
                dataType: "JSON",
                success: function(data){
                    if (data.status == 1) {
                        $('#submitsetting').prop('disabled', false).html('SAVE RESULT');
                        swal(data.encounters, '', 'warning');
                    }
                    else{
                        swal(data.encounters, '', 'success');
                        $('#pred<?php echo e($game->id); ?>').css({'background':'lightgreen', 'color':'darkgreen'});
                        $('#addresult').modal('hide');
                    }
                }
            });

        });
    });
</script>