<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10 bodyitem">
    <fieldset>
        <p>&nbsp;</p>
        <div class="content">
            <ul id="onlineorderPageFormError" class="error_message_box"></ul>
            <!-- Session Flash Message!-->
            <?php $action = 'gkpos/online/save_common_page' ?>
            <?php echo form_open($action, array('id' => 'onlineorderPageForm', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal')); ?>
            <div class="form-group">
                <?php echo form_label('Orderpage Title', 'title', array('class' => 'col-sm-2 control-label required')); ?>
                <div class="col-sm-6">
                    <?php echo form_input(array('name' => 'title', 'id' => 'title', 'class' => 'form-control input-sm required', 'value' => isset($home[0]->title) ? $home[0]->title : '')) ?>
                </div>
            </div>
            <input type='hidden' name='slug' value='onlineorder'>
            <div class="form-group">
                <?php echo form_label('Orderpage content', 'content', array('class' => 'col-sm-2 control-label')) ?>
                <div class="col-sm-6">
                    <?php echo form_textarea(array('name' => 'content', 'rows' => 3, 'id' => 'desc', 'class' => 'form-control input-sm'), isset($home[0]->content) ? $home[0]->content : '') ?>
                </div>
            </div>  

            <hr/>
            <div class="form-group">
                <?php echo form_label('Meta Keywords', 'meta_keys', array('class' => 'col-sm-2 control-label')) ?>
                <div class="col-sm-6">
                    <?php echo form_input(array('name' => 'meta_keys', 'id' => 'meta_desc', 'class' => 'form-control input-sm', 'value' => isset($home[0]->meta_keys) ? $home[0]->meta_keys : '')) ?>
                </div>
            </div>
            <div class="form-group">
                <?php echo form_label('Meta Description', 'meta_keys', array('class' => 'col-sm-2 control-label')) ?>
                <div class="col-sm-6">
                    <?php echo form_textarea(array('name' => 'meta_desc', 'rows' => 3, 'id' => 'meta_desc', 'class' => 'form-control input-sm'), isset($home[0]->meta_desc) ? ($home[0]->meta_desc) : '') ?>
                </div>
            </div>  
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-6">
                    <input class="btn btn-block btn-danger round btn-sm" type="submit" name="submit_form" value="Save Online Order Page Information" onclick="saveOnlineorderPageInfo('onlineorderPageForm', 'onlineorderPageFormError')">
                </div>
            </div>
            <?php echo form_close(); ?>  
        </div>
    </fieldset>
</div>
<script type='text/javascript'>
    function saveOnlineorderPageInfo(formId, error_message_box) {
        
        $('#' + formId).validate({
            submitHandler: function () {
                var myform = document.getElementById(formId);
                var formdata = new FormData(myform);
                $.ajax({
                    url: $('#' + formId).attr('action'),
                    data: formdata,
                    cache: false,
                    processData: false,
                    contentType: false,
                    type: 'POST',
                    dataType: 'json',
                    beforeSend: function () {
                        $("#waitingAjaxLoading").show();
                    },
                    success: function (response) {
                        if (response.success) {
                            ALERT_TITLE = "Sucess!";
                            alert('Online order page content Successfully');
                        } else {
                            alert('Online order page saved failed')
                        }
                    },
                });
            },
            errorClass: "has-error",
            errorLabelContainer: "#" + error_message_box,
            wrapper: "li",
            highlight: function (e) {
                $(e).closest('.form-group').addClass('has-error');
            },
            unhighlight: function (e) {
                $(e).closest('.form-group').removeClass('has-error');
            },
            rules: {
                title: {
                    required: true
                }
            },
            messages: {
                title: "Page Title is a required Field"
            }
        });
    }
</script>