<div class="modal-header">
    <div class="modal-title" style="color: #FFF">
        <div class="col-lg-11 col-md-11 col-sm-11"><?php echo $this->lang->line('gkpos_add_cce_fee') ?></div>
        <div class="col-lg-1 col-md-1 col-sm-1 close" data-dismiss="modal" aria-label="Close" style="cursor: default"><i class="fa fa-close" aria-hidden="true"></i></div>
    </div>
</div>
<div class="modal-body">
    <form class="form-horizontal" id="gkposTableShiftForm">
        <div class="pin-calculatorbg collection-pin-calculatorbg">
            <div id="TableNumber">
                <input type="hidden" id="ccFeeOrderId" name="ccFeeOrderId" class="form-control">
                <?php $currentCcFee = $this->Orders_Model->get_cc_fee($this->Orders_Model->get_current_orderid()); ?>
                <input style="width: 50%; margin: 0 auto" type="text" id="ccFee" name="cc_fee" class="form-control" value="<?php $currentCcFee > 0 ? print $currentCcFee : print $this->config->item('gk_cc_fee') ?> ">
                <ul>
                    <li class="ccfeenumkey" style="padding: 10px 20px; line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key1') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key2') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key3') ?></li>
                </ul>
                <ul>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key4') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px; "><?php echo $this->lang->line('gkpos_numpad_key5') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key6') ?></li>
                </ul>
                <ul>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key7') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key8') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key9') ?></li>
                </ul>
                <ul>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key0') ?></li>
                    <li class="ccfeenumkey" style="padding: 10px 20px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key_dot') ?></li>
                    <li class="ccfeebtnkey" style="padding: 10px 5px;line-height: 50px;"><?php echo $this->lang->line('gkpos_numpad_key_clr') ?></li>
                </ul>
            </div>
        </div>
        <a href="javascript:void(0)" class="btn btn-block btn-danger round btn-sm" style="width: 50%; margin: 0 auto;height: 45px;" onclick="saveCCFee()"><?php echo $this->lang->line('gkpos_numpad_key_enter') ?></a>
    </form>
</div>

<script>
    function saveCCFee() {
        var ccFee = $.trim($('#ccFee').val());
        if (!parseFloat(ccFee)) {
            alert('Invalid Credit Card Fee');
        } else {
            $.ajax({
                url: '<?php echo site_url('gkpos/orders/add_cc_fee') ?>',
                data: {
                    id: $('#ccFeeOrderId').val(),
                    cc_fee: parseFloat(ccFee)
                },
                type: 'POST',
                dataType: 'json',
                success: function (response) {
                    if (response.success) {
                        $('#addCCFee').modal('hide');
                        $(".modal").removeClass("in");
                        $('#menuListArea').html('');
                        loadCart(response.order_id, 0);
                    } else {
                        alert(response.message);
                    }
                }
            });
        }
    }
    function setCcFeeNumkeys(inputFiledId) {
        jQuery('.ccfeenumkey').click(function (event) {
            
            var numBox = document.getElementById(inputFiledId);
            numBox.value = numBox.value + this.innerHTML;
            event.stopPropagation();
        });
        $('.ccfeebtnkey').click(function (event) {
            
            document.getElementById(inputFiledId).value = '';
            event.stopPropagation();
        });
    }
</script>