<?php
$user_id = $this->session->userdata('user_id');
?>
<div class="col-sm-12 gray_ttc text-left" style="border-bottom: 2px solid #8CC73F;padding: 10px 0 10px 0;font-weight: bold">
    <div class="col-sm-7" style="padding: 10px">Note / Alert</div>
    <div class="col-sm-3" style="padding: 10px">Date</div>
    <div class="col-sm-2" style="padding: 10px">Action</div>
</div>
<div class="col-sm-12"><br></div>

<div id="main_post_value">
    <?php
    foreach ($note_alert as $note_alert_value) {
        ?>
        <div class="col-sm-12 gray text-left" id="post_value<?php echo $note_alert_value->post_id ?>">
            <div class="col-sm-7" style="padding: 10px 20px 0 10px  ">
                <p>
                    <span class="text-justify" id="post_detail<?php echo $note_alert_value->post_id ?>"
                    <?php
                    if ($note_alert_value->post_type == 2) {
                        echo 'style="color:#a70b0c;"';
                    }
                    ?> >
                              <?php
                              $function_name = 'viewDetails(&quot;' . base_url('post/view_post_details/' . $note_alert_value->post_id . '/post') . '&quot;,&quot;post_detail&quot;,&quot;' . $note_alert_value->post_id . '&quot;)';
                              echo $this->tt_post->get_post_data($note_alert_value->post_details, 150, $function_name);
                              ?>
                    </span>
                    <?php
                    if ($note_alert_url[$note_alert_value->post_id]) {
                        $url_value = explode("URL: ", $note_alert_url[$note_alert_value->post_id][0]->post_comment_url_info);
                        ?>
                        <a style="padding-left: 30px;" href="<?php echo $url_value[1]; ?>" target="_blank">
                            <i class="fa-external-link-square" title="<?php
                            echo $url_value[1];
                            ?>"></i>
                        </a>
                        <?php
                    }
                    ?>
                </p>
            </div>
            <div class="col-sm-3" style="padding: 10px 0 0 0  ">
                <?php
                echo $this->utility_model->date_time_format_with_offset($note_alert_value->post_date_time);
                ?>
            </div>
            <div class="col-sm-2" style="padding: 10px 0 0 0" id="note_alert_action<?php echo $note_alert_value->post_id ?>">
                <?php
                if ($note_alert_value->posted_by == $user_id) {
                    if ($note_alert_value->post_status == 1) {
                        ?>
                        <a href="javascript:void(0)" onclick="changePostStatus('<?php echo base_url() . 'post/change_post_status/' . $note_alert_value->post_id . '/inactive' ?>', 'note_alert', '<?php echo $note_alert_value->post_id ?>')">
                            <i class="fa fa-user-times " title="Inactive"></i>
                        </a>&nbsp;
                    <?php } else { ?>
                        <a href="javascript:void(0)" onclick="changePostStatus('<?php echo base_url() . 'post/change_post_status/' . $note_alert_value->post_id . '/active' ?>', 'note_alert', '<?php echo $note_alert_value->post_id ?>')">
                            <i class="fa fa-user-plus " title="Active"></i>
                        </a>&nbsp;
                    <?php } ?>


                    <a href="<?php echo base_url() . 'user/edit-post/' . $this->utility_model->encode_id($note_alert_value->post_id, '/', 'Tt'); ?>" target="_blank">
                        <i class="fa fa-edit" aria-hidden="true" title="edit"></i>
                    </a>&nbsp;


                    <a href="javascript:void(0)" onclick="changePostDelete('<?php echo base_url() . 'post/change_post_status/' . $note_alert_value->post_id . '/delete' ?>', 'note_alert', '<?php echo $note_alert_value->post_id ?>')" >
                        <i class="fa fa-trash-o" title="Delete"></i>
                    </a>&nbsp;

                    <a href="<?php echo base_url() . 'view-content/' . $this->utility_model->encode_id($note_alert_value->post_id, '/', 'Tt') . '/1'; ?>">
                        <i class="fa fa-th" title="View"></i>
                    </a>&nbsp;
                    <?php
                } else {
                    ?>
                    <a href="<?php echo base_url() . 'view-content/' . $this->utility_model->encode_id($note_alert_value->post_id, '/', 'Tt') . '/1'; ?>">
                        <i class="fa fa-th" title="View"></i>
                    </a>&nbsp;
                    <?php
                }
                ?>
            </div>
        </div>
        <?php
    }
    ?>
</div>

<?php
echo $pagination_link;
?>