<div class="container-fluid">
    <br>
    <div class="col-sm-4">
        <?php if($user->passport!=NULL): ?>
            <img src="<?php echo e($path1); ?><?php echo e($user->passport); ?>" class="img-rounded" style="max-height: 120px;">
        <?php elseif($user->avatar!=NULL): ?>
            <img src="<?php echo e($user->avatar); ?>" class="img-rounded" style="max-height: 120px;">
        <?php else: ?>
            <img src="<?php echo e($path); ?>user.png" class="img-rounded" style="max-height: 120px;">
        <?php endif; ?>
    </div>
    <div class="col-sm-8">
        <h4><?php echo e($user->full_name); ?> <br> <small><?php echo e($user->email); ?> <br>
            <?php if($user->subscription_status==NULL || $user->subscription_status=='0'): ?>
            <span class="text-danger">NOT CURRENTLY SUBSCRIBED</span>
            <?php else: ?>
                <span class="text-success">CURRENTLY SUBSCRIBED</span><br>
                <b>EXPIRY DATE: </b> <?php echo e($user->next_due_date); ?>

            <?php endif; ?>
            </small></h4>
    </div>

    <div class="col-md-12">
        <hr>
        <form action="#" method="POST" id="acctupgradeform">
            <div class="form-group">
                <input name="userid" type="hidden" required value="<?php echo e($user->id); ?>">

                <label for="type">SUBSCRIPTION TYPE</label>
                <select class="form-control" name="type" id="type" required>
                    <option value="">- SELECT SUBSCRIPTION TYPE -</option>
                    <option value="Silver">Silver Plan (1 Week)</option>
                    <option value="Gold">Gold Plan (1 Month)</option>
                    <option value="Platinum">Platinum Plan (3 Months)</option>
                    <option value="Multi-Platinum">Multi-Platinum Plan (6 Months)</option>
                    <option value="Diamond">Diamond Plan (1 Year)</option>
                </select>
            </div>

            <div class="form-group">
                <label for="username">DATE SUBSCRIBED: *(YYYY-MM-DD)</label>
                <input class="form-control" name="datesub" type="text" value="0000-00-00" required>
            </div>

            <div class="form-group">
                <label for="email">EXPIRY DATE: *(YYYY-MM-DD)</label>
                <input class="form-control" name="subexpiry" type="text" value="0000-00-00" required>
            </div>

            <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
            <div class="form-group">
                <div id="upgradestatus"></div><br>
                <button class="btn btn-md btn-success" type="submit" id="upgradebtn">Save Changes</button>
            </div>
        </form>
    </div>

</div>

<?php /*<script>*/ ?>
    <?php /*AnyTime.picker( "datee",*/ ?>
            <?php /*{ format: "%Y-%m-%d", firstDOW: 1 } );*/ ?>

    <?php /*AnyTime.picker( "dateee",*/ ?>
            <?php /*{ format: "%Y-%m-%d", firstDOW: 1 } );*/ ?>

    <?php /*$("#matchtime").AnyTime_picker(*/ ?>
            <?php /*{ format: "%h:%i %p", firstDOW: 1 } );*/ ?>
<?php /*</script>*/ ?>

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

    $(document).ready(function () {

        $('#acctupgradeform').submit(function (e) {
            e.preventDefault();
            $('#upgradestatus').html('Upgrading Account... Please wait');
            $('#upgradebtn').prop('disabled', true);

            var dataString = $(this).serialize();
            $.ajax({
                type: "POST",
                url: "acctupgrade",
                data: dataString,
                dataType: "JSON",
                success: function(data){
                    if (data.status == 1) {
                        $('#upgradebtn').prop('disabled', false);
                        $('#upgradestatus').html(data.encounters);
                    }
                    else{
                        alert(data.encounters);
                        $('#upgradebtn').prop('disabled', false);
                        $('#upgradestatus').html('');
                        $('#acctupgradeform')[0].reset();
                        $('#upgradeuser').modal('hide');
                    }
                }
            });
        });

    });
</script>