<div class="row">
    <?php if($event->accounttype=='PAID'): ?>
    <form action="#" method="POST" id="settingform">
        <div class="col-md-6">
            <div class="form-group">
                <input name="eventcode" type="hidden" required value="<?php echo e($event->eventcode); ?>">

                <label for="enablesms">Enable SMS</label>
                <input id="enablesms" class="form-control" name="enablesms" type="number" required value="<?php echo e($event->enable_sms); ?>">
            </div>

            <div class="form-group">
                <label for="smsunit">SMS Units</label>
                <input id="smsunit" class="form-control" name="smsunit" type="number" required value="<?php echo e($event->sms_unit); ?>">
            </div>

            <div class="form-group">
                <label for="allocation">Online Ticket Allocation</label>
                <input id="allocation" class="form-control" name="allocation" type="number" required value="<?php echo e($event->online_ticket_allocation); ?>">
            </div>

            <div class="form-group">
                <label for="epayment">ePayment Fee</label>
                <input id="epayment" class="form-control" name="epayment" type="number" required value="<?php echo e($event->epayment_rate); ?>">
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                <label for="seat">Seat Reserve</label>
                <input id="seat" class="form-control" name="seat" type="number" required value="<?php echo e($event->seat_reserve); ?>">
            </div>

            <div class="form-group">
                <label for="display">Display on Homepage</label>
                <input id="display" class="form-control" name="display" type="number" required value="<?php echo e($event->display); ?>">
            </div>

            <div class="form-group">
                <label for="hype">Hype/Advertise</label>
                <input id="hype" class="form-control" name="hype" type="number" required value="<?php echo e($event->hype); ?>">
            </div>

            <div class="form-group">
                <label for="promote">Promote on Social Medias</label>
                <input id="promote" class="form-control" name="promote" type="number" required value="<?php echo e($event->promote); ?>">
            </div>
            <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
            <div class="form-group">
                <div id="settingstatus"></div><br>
                <button class="btn btn-sm btn-success" type="submit" id="submitsetting">Save Changes</button>
            </div>
        </div>
    </form>
        <?php else: ?>
        <div class="col-md-6 col-md-offset-3">
            <br><br>
            <h3>No Advance Settings</h3>
            <br><br>
        </div>
    <?php endif; ?>
</div>

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

    $(document).ready(function () {
        $('#settingform').submit(function (e) {
            e.preventDefault();
            $('#settingstatus').html('Updating... Please wait');
            $('#submitsetting').prop('disabled', true);

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

        });
    });
</script>