<div class="col-sm-10 " >
    <div class="col-sm-12 gray_ttc " >
        <div class="col-sm-12 h3 text-center">
            Edit Topic
            <hr>
            <br>
        </div>
        <?php
//        formID2 , 
//        echo validation_errors();
        $url = 'admin/edit-topic/'.$topic_info->topic_id;
        echo form_open($url, 'class="cmxform" id="formID3" name="editTopicForm"');
        ?>
        <div class="form-group col-sm-12">
            <?php
            if ($all_topic) {
                ?>
                <div class="form-group col-sm-6">
                    <div class="input-group ">
                        <select data-errormessage-value-missing="Parent Topic is required!"  
                                class="form-control" 
                                name="parent_topic_id" 
                                id="parent_topic_id">
                            <option value="">Select Parent Topic</option>
                            <?php
                            foreach ($all_topic as $topic_value) {
                                echo '<option value="' . $topic_value->topic_id . '">' . $topic_value->topic_name . '</option>';
                            }
                            ?>
                        </select>
                        <span class="input-group-addon" id="basic-addon1" title="Please Select Parent Topic"><i class="fa fa-list"></i></span>
                    </div>
                    <script>
                        document.forms['editTopicForm'].elements['parent_topic_id'].value = '<?php echo (set_value('parent_topic_id')) ? set_value('parent_topic_id') : $topic_info->parent_topic_id; ?>';
                    </script>
                </div>
            <?php } ?>


            <div class="form-group col-sm-6">
                <div class="input-group">
                    <input type="text" 
                           placeholder="Please type Topic Name"
                           class="form-control validate[required,custom[topicNameExists]] text-input"
                           id="topic_name"
                           name="topic_name"
                           value="<?php echo (set_value('topic_name')) ? set_value('topic_name') : $topic_info->topic_name; ?>" >
                    <span class="input-group-addon" id="basic-addon1" title="Please type Topic Name"><i class="fa fa-book"></i></span>
                </div>
                <input type="hidden" id="topic_name_exists" value="">
                <input type="hidden" id="checkTopicNameUrl" value="<?php echo base_url() . 'admin/check-topic-name' ?>">
                <input type="hidden" id="topicID" value="<?php echo $topic_info->topic_id; ?>">
                <div class="col-sm-12" id="topic_name_error" style="color: red"><?php echo form_error('topic_name'); ?></div>
            </div>
        </div>




        <div class="col-sm-12"><br></div>
        <div class="col-sm-12">
            <div class="form-group col-sm-12">
                <label class="col-sm-1 text-left padding-zero" for="topic_status"> Status : &nbsp;</label>
                <div class="radio radio-success col-sm-11 margin-zero" >
                    <input type="radio"
                           data-errormessage-value-missing="Please Select Topic Status" 
                           class="validate[required]" 
                           name="topic_status" 
                           id="published" 
                           value="1">
                    <label for="published">Active</label>
                    <span style="margin-right: 30px"></span>
                    <input type="radio" 
                           data-errormessage-value-missing="Please Select Topic Status" 
                           class="validate[required]" 
                           name="topic_status" 
                           id="unpublished" 
                           value="2">
                    <label for="unpublishded">Inactive</label>
                    <span style="margin-right: 30px"></span>
                    <input type="radio"
                           data-errormessage-value-missing="Please Select Topic Status" 
                           class="validate[required]" 
                           name="topic_status" 
                           id="archived" 
                           value="3">
                    <label for="archived">Archived</label>
                    <span style="margin-right: 30px"></span>
                    <input type="radio" 
                           data-errormessage-value-missing="Please Select Topic Status" 
                           class="validate[required]" 
                           name="topic_status" 
                           id="pending" 
                           value="4">
                    <label for="pending">Pending</label>
                    <span style="margin-right: 30px"></span>
                    <input type="radio" 
                           data-errormessage-value-missing="Please Select Topic Status" 
                           class="validate[required]" 
                           name="topic_status" 
                           id="approved" 
                           value="5">
                    <label for="approved">Approved</label>

                    <script>
                        document.forms['editTopicForm'].elements['topic_status'].value = '<?php echo (set_value('topic_status')) ? set_value('topic_status') : $topic_info->topic_status; ?>';
                    </script>
                    <span style="color: red;"><?php echo form_error('topic_status'); ?></span>
                </div>
            </div>
        </div>


        <div class="form-group col-sm-12">
            <div id="submit_status"></div>
            <div class="checkbox col-sm-12">
                <center> 
                    <button type="submit" id="submit" class="btn btn-default" >Update Topic</button>
                </center>
            </div>
        </div>
        <?php echo form_close(); ?>
    </div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>back_end_resource/topic/topic.js"></script>
