<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10 bodyitem">
    <div class="row no-padding">
        <?php echo form_open('gkpos/settings/save_printer/', array('id' => 'printer_form', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal')); ?>
        <fieldset>
            <div class="form-group form-group-sm">	
                <label for="radio-inline" class="col-lg-5 col-md-5 col-sm-5 col-xs-5 control-label text-uppercase required"><?php echo $this->lang->line('gkpos_print_guestbill_from_browser_directly') ?></label>
                <div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
                    <label class="radio-inline text-uppercase required"><input type="radio" name="gk_guest_bill_from_browser" id="gk_discount_applied1" value="yes" <?php ($this->config->item('gk_guest_bill_from_browser') == "yes") ? print "checked" : '' ?> ><?php echo $this->lang->line('gkpos_yes') ?></label>
                    <label class="radio-inline text-uppercase required"><input type="radio" name="gk_guest_bill_from_browser" id="gk_discount_applied2" value="no" <?php ($this->config->item('gk_guest_bill_from_browser') == "no") ? print "checked" : '' ?> ><?php echo $this->lang->line('gkpos_no') ?></label>
                </div>
            </div>
            <div class="form-group form-group-sm">	
                <?php echo form_label($this->lang->line('gkpos_bill_printer'), 'gk_billprinter', array('class' => 'control-label col-lg-4 col-md-4 col-sm-4 col-xs-4 text-uppercase required')); ?>
                <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon" style="background-color: #FF0000;"><a href="#"><i class="fa fa-table" aria-hidden="true"></i></a></span>

                        <input name="gk_billprinter" class="form-control required"  type="text" id="gk_billprinter" value="<?php echo $this->config->item('gk_billprinter') ?>">

                    </div>
                </div>
            </div>
            <div class="form-group form-group-sm">	
                <?php echo form_label($this->lang->line('gkpos_kitchen_printer'), 'giftcard_title', array('class' => 'control-label col-lg-4 col-md-4 col-sm-4 col-xs-4 text-uppercase required')); ?>
                <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
                    <div class="input-group">
                        <span class="input-group-addon" style="background-color: #FF0000;"><a href="#"><i class="fa fa-table" aria-hidden="true"></i></a></span>
                        <input name="gk_ktcprinter" class="form-control required"  type="text" id="gk_ktcprinter" value="<?php echo $this->config->item('gk_ktcprinter') ?>">

                    </div>
                </div>
            </div>
            <div class="form-group form-group-md">	
                <div class="col-md-offset-4 col-md-8">
                    <ul id="printer_form_error_message_box" class="error_message_box"></ul>
                    <?php
                    echo form_submit(array(
                        'name' => 'submit_form',
                        'id' => 'submit_form',
                        'value' => $this->lang->line('gkpos_numpad_key_enter'),
                        'class' => 'btn btn-block btn-danger round btn-sm'));
                    ?>
                </div>
            </div>
        </fieldset>
        <?php echo form_close(); ?>
    </div>
    <script type='text/javascript'>
        $(document).ready(function () {
            keyboard('clientsCTA1');
            keyboard('clientsCTA');
            $('#printer_form').validate({
                submitHandler: function () {
                    var myform = document.getElementById('printer_form');
                    var formdata = new FormData(myform);
                    $.ajax({
                        url: $('#printer_form').attr('action'),
                        data: formdata,
                        cache: false,
                        processData: false,
                        contentType: false,
                        type: 'POST',
                        dataType: 'json',
                        success: function (response) {
                            if (response.success) {
                                ALERT_TITLE = "Success!";
                                alert(response.message);

                            } else {
                                ALERT_TITLE = "Error!";
                                alert(response.message);
                            }
                        }
                    });
                },
                errorClass: "has-error",
                errorLabelContainer: "#printer_form_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: {
                    gk_guest_bill_from_browser: "required",
                    gk_billprinter: "required",
                    gk_ktcprinter: "required"
                },
                messages: {
                    gk_guest_bill_from_browser: "Please specify from where Guest bill to Print",
                    gk_billprinter: "Please mention your billprinter name from pritner list",
                    gk_ktcprinter: "Please mention your kitchen printer name from printer list"

                }
            });
        });
    </script>
</div>

<script>
    function updateGiftcard(voucher_id, url, action) {
        $.ajax({
            url: url,
            data: {
                id: voucher_id,
                action: action
            },
            dataType: 'json',
            type: "POST",
            success: function (output) {
                if (output.success) {
                    getSettingPage('<?php echo site_url("gkpos/settings/giftcard") ?>', 'Giftcard');
                } else {
                    set_feedback(output.message, 'alert alert-dismissible alert-danger', false);
                }

            },
        });
    }
    function showTotalAndVat() {
        $('#showTotoalAndVat').show();
    }
</script>