<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->format('l j M, Y - h:ia')); ?>

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

    <div class="col-md-12">
        <hr>
        <form action="<?php echo e(url('/acctupgrade')); ?>" 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>
                    <?php foreach($subs->all() as $sub): ?>
                        <option value="<?php echo e($sub->id); ?>"><?php echo e($sub->category); ?> Tips (<?php echo e($sub->planName); ?> - <?php echo e($sub->accessTime); ?>)</option>
                    <?php endforeach; ?>
                </select>
            </div>

            <div class="form-group">
                <label for="username">DATE SUBSCRIBED: *(YYYY-MM-DD)</label>
                <input class="form-control" name="datesub" type="text" value="<?php echo e(\Carbon\Carbon::now()); ?>" required>
            </div>

            <?php echo e(csrf_field()); ?>

            <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 url = $(this).attr('action');

            var dataString = $(this).serialize();
            $.ajax({
                type: "POST",
                url: url,
                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>