<div class="modal-header">
    <div class="modal-title">
        <div class="col-lg-12 col-md-12 col-sm-12" style="color: #ffffff;"><h4>Type Your Kitchen Text For This Order</h4></div>
    </div>
</div>
<div class="modal-body">
    <form class="form-horizontal" id="kitchenTextForm">
        <div class="pin-calculatorbg collection-pin-calculatorbg">
            <input type="hidden" name="order_id" value="<?php echo $ktcOrderId ?>">
            <textarea id="kitchenDeliveryNote" name="delivery_note" style="width: 100%; height: 100px; border-radius: 10px; border: 2px solid #ff0000"></textarea>
        </div>
        <div></div>
        <a href="javascript:void(0)" class="form-submit-button mainsystembg2 waiting-bg img-responsive delivery-info-submit-btn" onclick="sendKitchenNote()"><?php echo $this->lang->line('gkpos_numpad_key_enter') ?></a>
    </form>
</div>
<script>
    function sendKitchenNote() {
        var txt = $.trim($('textarea#kitchenDeliveryNote').val());
        if (!txt || txt === null) {
            alert('You need to provide some texts');
        } else {
            var myform = document.getElementById('kitchenTextForm');
            var formdata = new FormData(myform);
            $.ajax({
                url: '<?php echo site_url('gkpos/orders/send_kitchen_note') ?>',
                data: formdata,
                cache: false,
                processData: false,
                contentType: false,
                type: 'POST',
                dataType: 'json',
                success: function (output) {
                    if (output.success) {
                        ALERT_TITLE='Success!'
                        alert(output.message);
                        getBaseAjaxPage('<?php echo site_url('gkpos/orders/indexajax/'); ?>' + output.order_id);
                    } else {
                        alert(output.message);
                    }
                }
            });
        }
    }
</script>