<?php $this->load->view('site/layout'); ?>

<?php $this->load->view('site/navbar'); ?>
<link href="<?= base_url() ?>public/plugins/custom/rich_text_master/richtext.min.css" rel="stylesheet" type="text/css" />

<div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">

    <!-- begin:: Content Head -->
    <div class="kt-subheader  kt-grid__item" id="kt_subheader">
        <div class="kt-container  kt-container--fluid ">
            <div class="kt-subheader__main">
                <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a></h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <span class="kt-subheader__desc"><?php echo $this->lang->line('reply'); ?></span>
            </div>
        </div>
    </div>
</div>


<div class="kt-portlet kt-portlet--mobile">
    <?php if ($this->session->flashdata('success')) { ?>
        <div class="alert alert-success">
            <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
            <?= $this->session->flashdata('success') ?>
        </div>
    <?php } ?>

    <div class="kt-portlet__head kt-portlet__head--lg">
        <div class="kt-portlet__head-label">
            <span class="kt-portlet__head-icon">
                <i class="kt-font-brand flaticon2-line-chart"></i>
            </span>
            <h3 class="kt-portlet__head-title">
                <?php echo ($page_type == 'add' ? $this->lang->line('add') : $this->lang->line('edit')) . ' ' . $this->lang->line('reply'); ?>

            </h3>
        </div>
    </div>
    <div class="kt-portlet__body">

        <?php if (validation_errors()) { ?>
            <div class="alert alert-danger">
                <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
                <?php echo validation_errors(); ?>
            </div>
        <?php } ?>


        <?php
        if ($page_type == 'add') {
            echo form_open('knowledge_base/postaddreply');
        }
        if ($page_type == 'edit') {
            echo form_open('knowledge_base/updatereply');
        }
        ?>	

        <form method="post" id="edit-profile" class="form-horizontal">
            <?php if ($page_type == 'edit') { ?>
                <div class="form-group row">
                    <label for="example-text-input" class="col-2 col-form-label"><?php echo $this->lang->line('comment') ?> : </label>
                    <div class="col-10 mt-2">
                        <?php echo $comment[0]->comment_text; ?>
                    </div>
                </div>
            <?php } ?>

            <div class="form-group row">
                <label for="example-text-input" class="col-2 col-form-label"><?php echo $this->lang->line('reply') ?></label>
                <div class="col-10">

                    <textarea name="reply" required class="form-control" id="desc" rows="10" cols="80"><?php
                        if ($page_type == "edit") {
                            echo $reply[0]->reply_text;
                        }
                        ?></textarea>
                    <input type="hidden" name="comment_id" value="<?php echo $comment[0]->id; ?>">
                    <?php if ($page_type == "edit") { ?>
                        <input type="hidden" name="reply_id" value="<?php
                        if ($page_type == "edit") {
                            echo $reply[0]->id;
                        }
                        ?>">
                           <?php } ?>
                </div> <!-- /controls -->				
            </div> <!-- /control-group -->


            <br>   

            <div class="form-actions">

                <button type="submit" class="btn btn-primary"><?= $this->lang->line('save') ?></button> 

                <a href="<?php echo base_url('knowledge_base/commentreplies/') . $comment[0]->id; ?>" class="btn"><?= $this->lang->line('cancel') ?></a>

            </div> <!-- /form-actions -->


        </form>

    </div>



</div>


<?php $this->load->view('site/footer_2'); ?>
<script src="<?= base_url() ?>public/plugins/custom/rich_text_master/jquery.richtext.min.js"></script>

<script type="text/javascript">
    $("#desc").richText();
</script>