<?php
if ($person_draft_video_management || $person_pending_video_management || $person_active_video_management) {

}
?>
<div class="col-sm-8">
    <div class="row ">
        <div class="col-sm-12 ">
            <div class="col-sm-12">
                <a href="<?php echo base_url() . 'user/add-video-course'; ?>"> <span class="pull-right">Add Video Course</span></a>
            </div>
            <div class="col-sm-12">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#draft_course">Draft(<span id="total_draft"></span>)</a></li>
                    <li><a data-toggle="tab" href="#submission_course">Submissions (<span id="total_submission"></span>)</a></li>
                    <li><a data-toggle="tab" href="#active_course">Active(<span id="total_active"></span>)</a></li>
                </ul>
            </div>

            <div class="col-sm-12" >
                <div class="tab-content">
                    <div id="draft_course" class="tab-pane fade in active">
                        <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                            <div class="col-sm-6">Video Course Title</div>
                            <div class="col-sm-3">Price</div>
                            <div class="col-sm-3">Action</div>
                        </div>
                        <div class="col-sm-12"><br></div> 
                        <?php
                        $i = 0;
                        if (!$person_draft_video_management) {
                            echo '<h4 >You have no Draft Video Course.</h4>';
                        } else {
                            foreach ($org_resource_person as $value) {
                                foreach ($person_draft_video_management[$value->person_id] as $v_video_management) {
                                    ?>
                                    <div class="col-sm-12 <?php
                                    if ($i % 2 == 0) {
                                        echo 'gray';
                                    } else {
                                        echo 'white';
                                    }
                                    ?> text-center">

                                        <div class="col-sm-6" style="padding-top: 10px ">
                                            <a href="<?php echo base_url() . $v_video_management->url; ?>"><?php echo $v_video_management->video_course_title; ?></a>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <?php
                                            $course_price = $v_video_management->video_course_price;
                                            $type = $v_video_management->video_course_type;
                                            $currency = $v_video_management->video_course_price_currency;
                                            if ($type == 1) {
                                                if ($currency == 1) {
                                                    echo 'BDT ' . $course_price . ' / USD ' . $fx->toForeign($course_price);
                                                } else if ($currency == 2) {
                                                    echo 'BDT ' . $fx->toForeign($course_price) . ' / USD ' . $course_price;
                                                }
                                            } else {
                                                echo 'Free';
                                            }
                                            ?>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <a href="<?php echo base_url() . 'edit-video-management/' . $v_video_management->url ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <a href="javascript:void(0)" 
                                               onclick="checkForDelete('<?php echo base_url() . 'delete-video-course' ?>', '<?php echo $v_video_management->url; ?>')">
                                                <i class="fa fa-trash-o" title="Delete"></i>
                                            </a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <?php if ($v_video_management->video_course_type == 1) { ?>
                                                <a href="<?php echo base_url() . 'video-course/' . $v_video_management->url; ?>"><i class="fa  fa-th" title="Details"></i></a>&nbsp;&nbsp;&nbsp;
                                                <span>&nbsp;&nbsp;</span>
                                            <?php } ?>
                                                
                                            <!--<a href="sell_status.html"><i class="fa  fa-line-chart" title="Sell Status"></i></a>-->
                                            <a href="<?php echo base_url()?>video-ordering"><i class="fa fa-exchange" title="Video Ordering"></i></a>
                                        </div>
                                    </div>

                                    <div class="col-sm-12"><br></div> 


                                    <?php
                                    $i++;
                                }
                            }
                        }
                        ?>
                        <script>
                            document.getElementById('total_draft').innerHTML = '<?php echo $i; ?>';
                        </script>
                    </div>

                    <div id="submission_course" class="tab-pane fade">
                        <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                            <div class="col-sm-6">Video Course Title</div>
                            <div class="col-sm-3">Price</div>
                            <div class="col-sm-3">Action</div>
                        </div>
                        <div class="col-sm-12"><br></div> 
                        <?php
                        $j = 0;
                        if (!$person_pending_video_management) {
                            echo '<h4 >You have no Submission Video Course.</h4>';
                        } else {
                            foreach ($org_resource_person as $value) {
                                foreach ($person_pending_video_management[$value->person_id] as $v_video_management) { //Submitted Video
                                    ?>
                                    <div class="col-sm-12 <?php
                                    if ($i % 2 == 0) {
                                        echo 'gray';
                                    } else {
                                        echo 'white';
                                    }
                                    ?> text-center">

                                        <div class="col-sm-6" style="padding-top: 10px ">
                                            <a href="<?php echo base_url() . $v_video_management->url; ?>"><?php echo $v_video_management->video_course_title; ?></a>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <?php
                                            $course_price = $v_video_management->video_course_price;
                                            $type = $v_video_management->video_course_type;
                                            $currency = $v_video_management->video_course_price_currency;
                                            if ($type == 1) {
                                                if ($currency == 1) {
                                                    echo 'BDT ' . $course_price . ' / USD ' . $fx->toForeign($course_price);
                                                } else if ($currency == 2) {
                                                    echo 'BDT ' . $fx->toForeign($course_price) . ' / USD ' . $course_price;
                                                }
                                            } else {
                                                echo 'Free' /* . $v_video_management->video_course_type */;
                                            }
                                            ?>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <a href="<?php echo base_url() . 'edit-video-management/' . $v_video_management->url ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <a href="javascript:void(0)" 
                                               onclick="checkForDelete('<?php echo base_url() . 'delete-video-course' ?>', '<?php echo $v_video_management->url; ?>')">
                                                <i class="fa fa-trash-o" title="Delete"></i>
                                            </a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <?php if ($v_video_management->video_course_type == 1) { ?>
                                                <a href="<?php echo base_url() . 'video-course/' . $v_video_management->url; ?>"><i class="fa  fa-th" title="Details"></i></a>&nbsp;&nbsp;&nbsp;
                                                <span>&nbsp;&nbsp;</span>
                                            <?php } ?>
                                            <!--<a href="sell_status.html"><i class="fa  fa-line-chart" title="Sell Status"></i></a>-->
                                            <a href="<?php echo base_url()?>video-ordering"><i class="fa fa-exchange" title="Video Ordering"></i></a>
                                        </div>
                                    </div>
                                    <div class="col-sm-12"><br></div> 

                                    <?php
                                    $j++;
                                }
                            }
                        }
                        ?>
                        <script>
                            document.getElementById('total_submission').innerHTML = '<?php echo $j; ?>';
                        </script>
                    </div>

                    <div id="active_course" class="tab-pane fade">
                        <div class="col-sm-12 gray_ttc text-center" style="border-bottom: 2px solid #8CC73F;padding-top: 10px;padding-bottom: 10px;font-weight: bold">
                            <div class="col-sm-6">Video Course Title</div>
                            <div class="col-sm-3">Price</div>
                            <div class="col-sm-3">Action</div>
                        </div>
                        <div class="col-sm-12"><br></div> 
                        <?php
                        if (!$person_active_video_management) {
                            echo '<h4 >You have no Active Video Course.</h4>';
                        } else {
                            $k = 0;
                            foreach ($org_resource_person as $value) {
                                foreach ($person_active_video_management[$value->person_id] as $v_video_management) {
                                    ?>
                                    <div class="col-sm-12 <?php
                                    if ($i % 2 == 0) {
                                        echo 'gray';
                                    } else {
                                        echo 'white';
                                    }
                                    ?> text-center">

                                        <div class="col-sm-6" style="padding-top: 10px ">
                                            <a href="<?php echo base_url() . $v_video_management->url; ?>"><?php echo $v_video_management->video_course_title; ?></a>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <?php
                                            $course_price = $v_video_management->video_course_price;
                                            $type = $v_video_management->video_course_type;
                                            $currency = $v_video_management->video_course_price_currency;
                                            if ($type == 1) {
                                                if ($currency == 1) {
                                                    echo 'BDT ' . $course_price . ' / USD ' . $fx->toForeign($course_price);
                                                } else if ($currency == 2) {
                                                    echo 'BDT ' . $fx->toForeign($course_price) . ' / USD ' . $course_price;
                                                }
                                            } else {
                                                echo 'Free';
                                            }
                                            ?>
                                        </div>

                                        <div class="col-sm-3" style="padding-top: 10px">
                                            <a href="<?php echo base_url() . 'edit-video-management/' . $v_video_management->url ?>"><i class="fa fa-edit" title="Edit"></i></a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <a href="javascript:void(0)" 
                                               onclick="checkForDelete('<?php echo base_url() . 'delete-video-course' ?>', '<?php echo $v_video_management->url; ?>')">
                                                <i class="fa fa-trash-o" title="Delete"></i>
                                            </a>&nbsp;&nbsp;&nbsp;
                                            <span>&nbsp;&nbsp;</span>
                                            <?php if ($v_video_management->video_course_type == 1) { ?>                                            
                                                <a href="<?php echo base_url() . 'video-course/' . $v_video_management->url; ?>"><i class="fa  fa-th" title="Details"></i></a>&nbsp;&nbsp;&nbsp;
                                                <span>&nbsp;&nbsp;</span>                                            
                                            <?php } ?>
                                                
                                            <a href="<?php echo base_url()?>video-ordering"><i class="fa fa-exchange" title="Video Ordering"></i></a>
                                            <span>&nbsp;&nbsp;</span>
                                    <!--<a href="sell_status.html"><i class="fa  fa-line-chart" title="Sell Status"></i></a>-->
                                        </div>
                                    </div>
                                    <div class="col-sm-12"><br></div> 


                                    <?php
                                    $k++;
                                }
                            }
                        }
                        ?>

                        <script>
                            document.getElementById('total_active').innerHTML = '<?php echo $k; ?>';
                        </script>
                    </div>

                </div>

            </div>

        </div><!-- /.row gray -->


    </div>

</div>
<script type="text/javascript" src="<?php echo base_url()?>front_end_resource/video_course/video_course.js">
</script>