<?php
//$this->load->library('ForeignExchange');
//$fx = new ForeignExchange('BDT', 'USD');
?>
<div class="col-sm-10">

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

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

            <div class="col-sm-6 col-sm-offset-3">

                <form action="#" method="post">
                    <div class="input-group">
                        <input type="text" class="form-control"  placeholder="Search ..." aria-describedby="basic-addon1">
                        <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                    </div>
                </form>

            </div>
        </div>

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

    <div class="row ">
        <div class="col-sm-12 ">

            <div class="col-sm-12 ">
                <div class="col-sm-12 gray_ttc">

                    <div class="course-detail-tab margin-zero">
                        <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
                            <li class="<?php
                            if ($active_tab == 'virtual_classroom_feature') {
                                echo 'active';
                            } else {
                                echo '';
                            }
                            ?>">

                                <a href="#education_v" data-toggle="tab">Virtual Classroom Feature</a></li>

                            <li class="<?php
                            if ($active_tab == 'online_exam_feature') {
                                echo 'active';
                            } else {
                                echo '';
                            }
                            ?>"><a href="#work" data-toggle="tab" >Online Exam Feature</a></li>
                            <li class="<?php
                            if ($active_tab == 'explore_expert_resume_feature') {
                                echo 'active';
                            } else {
                                echo '';
                            }
                            ?>"><a href="#browse" data-toggle="tab">Explore Expert Resume Feature</a></li>

                        </ul>
                        <div id="my-tab-content" class="tab-content ">

                            <!-- Virtual Classroom Feature tab-->
                            <div class="tab-pane <?php
                            if ($active_tab == 'virtual_classroom_feature') {
                                echo 'active';
                            } else {
                                echo '';
                            }
                            ?>" id="education_v">
                                <div class="tab-content panel-body">

                                    <div class="col-sm-12 text-right">
                                        <a href="<?php echo base_url() ?>super_admin_virtual_classroom/add-virtual-classroom-feature" class="btn btn-sm btn-success ">Add Virtual Classroom Feature</a>
                                    </div> 

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

                                    <?php echo $add_virtual_classroom_feature; ?>

                                    <div class="col-sm-12"><br></div>
                                    <?php if ($all_virtual_classroom_feature) { ?>
                                        <div class="col-sm-12 padding-zero" >

                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">

                                                <div class="col-sm-2">Class in a time</div>
                                                <div class="col-sm-2">Class per day</div>
                                                <div class="col-sm-1">Attendees Number</div>
                                                <div class="col-sm-2">Type</div>
                                                <div class="col-sm-1">Storage</div>
                                                <div class="col-sm-2">Price</div>
                                                <div class="col-sm-2">Action</div>
                                            </div>
                                            <div class="col-sm-12"><br></div> 
                                            <?php
                                            foreach ($all_virtual_classroom_feature as $value) {
                                                $id = $feature_id = $value->feature_price_id;
                                                ?>
                                                <div id="actions_for<?php echo $id; ?>">
                                                    <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;" >

                                                        <div class="col-sm-2"><?php echo $value->virtual_classroom_number; ?></div>
                                                        <div class="col-sm-2" ><?php echo $value->virtual_classroom_per_day; ?></div>
                                                        <div class="col-sm-1" ><?php echo $value->virtual_classroom_attendees_number; ?></div>
                                                        <div class="col-sm-2" ><?php
                                                            if ($value->virtual_classroom_type == 1) {
                                                                echo 'Live Broadcasting';
                                                            } else {
                                                                echo 'Live Broadcasting and Recording';
                                                            }
                                                            ?> 
                                                        </div>
                                                        <div class="col-sm-1" ><?php echo $value->feature_price_storage; ?></div>

                                                        <div class="col-sm-2" >
                                                            <?php
                                                            if ($value->feature_price_status != 3) {
                                                                if ($value->feature_price_talhatraining == 1) {
                                                                    echo 'TT feature';
                                                                } else {
                                                                    //$fx = new ForeignExchange('BDT', 'USD');
                                                                    $currency_type = $value->feature_price_currency;
                                                                    //$USD_price = fmtMoney($fx->toForeign($value->virtual_classroom_price));
                                                                    //$USD_price = $this->tt_currency->set($value->virtual_classroom_price, 'BDT', 'USD')->convert_currency()->get();
                                                                    $BDT_price = $value->virtual_classroom_price;
                                                                    //echo 'BDT ' . $BDT_price . '/ USD' . $USD_price;
                                                                    echo 'BDT ' . $BDT_price;
                                                                }
                                                            } else {
                                                                echo 'Free';
                                                            }
                                                            ?>
                                                        </div>

                                                        <div class="col-sm-2" >
                                                            <?php
                                                            $encrypt_feature_price_id = $this->encrypt->encode($value->feature_price_id);
                                                            $feature_id = str_replace("/", "%F2", $encrypt_feature_price_id);
                                                            ?>
                                                            <a href="<?php echo base_url() . 'super_admin_virtual_classroom/edit-virtual-classroom-feature-set-id/' . $feature_id; ?>" > 
                                                                <i class="fa fa-edit" title="Edit"></i>
                                                            </a>

                                                            <?php
                                                            $status = $value->feature_price_status;
                                                            switch ($status) {
                                                                case 0: // inactive
                                                                    ?>
                                                                    <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-active/' . $id; ?>', 'Active', '<?php echo 'actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-plus" title="Active"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <?php if (!$feature_holding_user[$id]) { ?>
                                                                        <a href="javascript:;" 
                                                                           onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'actions_for' . $id; ?>')"> 
                                                                            <i class="fa fa-trash" title="Delete"></i>
                                                                        </a>&nbsp;&nbsp;
                                                                    <?php } ?>

                                                                    <?php
                                                                    break;
                                                                case 1: // active
                                                                    ?>
                                                                    <?php if ($value->feature_price_talhatraining == 1 || !$feature_holding_user[$id]) { ?>
                                                                        <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-inactive/' . $id; ?>', 'Inactive', '<?php echo 'actions_for' . $id; ?>')">
                                                                            <i class="fa  fa-user-times" title="Inactive"></i>
                                                                        </a>&nbsp;&nbsp;
                                                                    <?php } ?>

                                                                    <?php if (!$feature_holding_user[$id]) { ?>
                                                                        <a href="javascript:;" 
                                                                           onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'actions_for' . $id; ?>')"> 
                                                                            <i class="fa fa-trash" title="Delete"></i>
                                                                        </a>&nbsp;&nbsp;
                                                                    <?php } ?>

                                                                    <?php
                                                                    break;
                                                                case 3: // free
                                                                    ?>
                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;
                                                                    <?php
                                                                    break;
                                                                default:
                                                                    break;
                                                            }
                                                            ?>

                                                        </div>

                                                    </div>

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


                                        </div>
                                    <?php } else { ?>
                                        <div class="col-sm-12 padding-zero" >
                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">
                                                You didn't add any Virtual Classroom feature
                                            </div>
                                        </div>
                                    <?php } ?>


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

                                </div>   
                            </div>

                            <!-- work tab -->
                            <div class="tab-pane <?php
                            if ($active_tab === 'online_exam_feature') {
                                echo 'active';
                            } else {
                                echo '';
                            }
                            ?>" id="work">
                                <div class="tab-content panel-body">

                                    <div class="col-sm-12 text-right">
                                        <a href="<?php echo base_url() ?>super_admin_virtual_classroom/add-online-exam-feature" class="btn btn-sm btn-success ">Add Online Exam Feature</a>
                                    </div>

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

                                    <?php echo $add_online_exam_feature; ?>

                                    <div class="col-sm-12"><br></div>
                                    <?php if ($all_online_exam_feature) { ?>
                                        <div class="col-sm-12 padding-zero" >
                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">
                                                <div class="col-sm-4">Number Of Online Exam Per Month</div>
                                                <div class="col-sm-6">Monthly price</div>
                                                <div class="col-sm-2">Action</div>
                                            </div>
                                            <div class="col-sm-12"><br></div>

                                            <?php
                                            foreach ($all_online_exam_feature as $value) {
                                                $id = $feature_id = $value->feature_price_id;
                                                ?>
                                                <div id="online_actions_for<?php echo $value->feature_price_id; ?>">
                                                    <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;" >
                                                        <div class="col-sm-4 text-center">
                                                            <?php echo $value->online_exam_feature_number; ?>
                                                        </div>
                                                        <div class="col-sm-6">
                                                            <?php
                                                            if ($value->feature_price_status != 3) {
                                                                //$fx = new ForeignExchange('BDT', 'USD');
                                                                $currency_type = $value->feature_price_currency;
                                                                //$USD_price = fmtMoney($fx->toForeign($value->online_exam_feature_price));
                                                                //$USD_price = $this->tt_currency->set($value->online_exam_feature_price, 'BDT', 'USD')->convert_currency()->get();
                                                                $BDT_price = $value->online_exam_feature_price;
                                                                //echo 'BDT ' . $BDT_price . '/ USD' . $USD_price;
                                                                echo 'BDT ' . $BDT_price;
                                                            } else {
                                                                echo 'Free';
                                                            }
                                                            ?>
                                                        </div>

                                                        <div class="col-sm-2" >
                                                            <?php
                                                            $encrypt_feature_price_id = $this->encrypt->encode($value->feature_price_id);
                                                            $feature_id = str_replace("/", "%F2", $encrypt_feature_price_id);
                                                            ?>
                                                            <a href="<?php echo base_url() . 'super_admin_virtual_classroom/edit-online-exam-feature-set-id/' . $feature_id; ?>" > 
                                                                <i class="fa fa-edit" title="Edit"></i> 
                                                            </a>

                                                            <?php
                                                            $status = $value->feature_price_status;
                                                            switch ($status) {
                                                                case 0:
                                                                    ?>
                                                                    <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-active/' . $id; ?>', 'Active', '<?php echo 'online_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-plus" title="Active"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-archive/' . $id; ?>', 'Archive', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-archive" title="Archive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <?php
                                                                    break;
                                                                case 1:
                                                                    ?>
                                                                    <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-inactive/' . $id; ?>', 'Inactive', '<?php echo 'online_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-times" title="Inactive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-archive/' . $id; ?>', 'Archive', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-archive" title="Archive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <?php
                                                                    break;
                                                                case 2:
                                                                    ?>

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-active/' . $id; ?>', 'Active', '<?php echo 'online_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-plus" title="Active"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;  

                                                                    <?php
                                                                    break;
                                                                case 3:
                                                                    ?>

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'online_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp; 

                                                                    <?php
                                                                    break;
                                                                default:
                                                                    break;
                                                            }
                                                            ?>
                                                        </div>

                                                    </div>


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

                                        </div>
                                    <?php } else { ?>
                                        <div class="col-sm-12 padding-zero" >
                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">
                                                You didn't add any Online Exam feature
                                            </div>
                                        </div>
                                    <?php } ?>

                                    <div class="col-sm-12"><br></div>
                                </div>   
                            </div>
                            <!-- /.work tab -->




                            <!-- Browser Information tab -->
                            <div class="tab-pane


                                 <?php
                                 if ($active_tab === 'explore_expert_resume_feature') {
                                     echo 'active';
                                 } else {
                                     echo '';
                                 }
                                 ?>


                                 " id="browse">
                                <div class="tab-content panel-body">

                                    <div class="col-sm-12 text-right">
                                        <a href="<?php echo base_url() ?>super_admin_virtual_classroom/add-explore-expert-resume-feature" class="btn btn-sm btn-success ">Add Explore Expert Resume Feature</a>
                                    </div> 

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

                                    <?php echo $add_explore_expert_resume; ?>

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



                                    <?php if ($all_explore_expert_resume_feature) { ?>
                                        <div class="col-sm-12 padding-zero" >
                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">

                                                <div class="col-sm-4">Explore expert resume per day</div>
                                                <div class="col-sm-4">Explore expert resume price</div>
                                                <!--<div class="col-sm-3">Feature price storage</div>-->
                                                <div class="col-sm-4 text-left">Action</div>
                                            </div>
                                            <div class="col-sm-12"><br></div> 

                                            <?php foreach ($all_explore_expert_resume_feature as $value) { ?>
                                                <div  id="explore_actions_for<?php echo $value->feature_price_id; ?>">
                                                    <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;">

                                                        <div class="col-sm-4"><?php echo $value->explore_expert_resume_per_day; ?></div>

                                                        <div class="col-sm-4">
                                                            <?php
                                                            if ($value->feature_price_status != 3) {
                                                                //$fx = new ForeignExchange('BDT', 'USD');
                                                                $currency_type = $value->feature_price_currency;
                                                                //$USD_price = fmtMoney($fx->toForeign($value->explore_expert_resume_price));
                                                                //$USD_price = $this->tt_currency->set($value->explore_expert_resume_price, 'BDT', 'USD')->convert_currency()->get();
                                                                $BDT_price = $value->explore_expert_resume_price;
                                                                //echo 'BDT ' . $BDT_price . '/ USD' . $USD_price;
                                                                echo 'BDT ' . $BDT_price;
                                                            } else {
                                                                echo 'Free';
                                                            }
                                                            ?>
                                                        </div>

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <!--<div class="col-sm-3"><?php // echo $value->feature_price_storage;                                                                           ?></div>-->

                                                        <div class="col-sm-4 text-left">
                                                            <?php
                                                            $encrypt_feature_price_id = $this->encrypt->encode($value->feature_price_id);
                                                            $feature_id = str_replace("/", "%F2", $encrypt_feature_price_id);
                                                            ?>
                                                            <a href="<?php echo base_url() . 'super_admin_virtual_classroom/edit-explore-expert-resume-feature-set-id/' . $feature_id; ?>" > 
                                                                <i class="fa fa-edit" title="Edit"></i>
                                                            </a>

                                                            <?php
                                                            $status = $value->feature_price_status;
                                                            $id = $value->feature_price_id;
                                                            switch ($status) {
                                                                case 0:
                                                                    ?>
                                                                    <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-active/' . $id; ?>', 'Active', '<?php echo 'explore_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-plus" title="Active"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-archive/' . $id; ?>', 'Archive', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-archive" title="Archive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <?php
                                                                    break;
                                                                case 1:
                                                                    ?>
                                                                    <a href="javascript:;" onclick="return checkForAction('<?php echo base_url() . 'make-feature-inactive/' . $id; ?>', 'Inactive', '<?php echo 'explore_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-times" title="Inactive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-archive/' . $id; ?>', 'Archive', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-archive" title="Archive"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <?php
                                                                    break;
                                                                case 2:
                                                                    ?>

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-active/' . $id; ?>', 'Active', '<?php echo 'explore_actions_for' . $id; ?>')">
                                                                        <i class="fa  fa-user-plus" title="Active"></i>
                                                                    </a>&nbsp;&nbsp;

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp;  

                                                                    <?php
                                                                    break;
                                                                case 3:
                                                                    ?>

                                                                    <a href="javascript:;" 
                                                                       onclick="return checkForAction('<?php echo base_url() . 'make-feature-delete/' . $id; ?>', 'Delete', '<?php echo 'explore_actions_for' . $id; ?>')"> 
                                                                        <i class="fa fa-trash" title="Delete"></i>
                                                                    </a>&nbsp;&nbsp; 

                                                                    <?php
                                                                    break;
                                                                default:
                                                                    break;
                                                            }
                                                            ?>

                                                        </div>

                                                    </div>

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

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

                                        </div>
                                    <?php } else { ?>
                                        <div class="col-sm-12 padding-zero" >
                                            <div class="col-sm-12 gray_ttc text-left" style="padding: 5px;font-weight: bold">
                                                You didn't add any Explore Expert Resume feature
                                            </div>
                                        </div>
                                    <?php } ?>
                                </div>   
                            </div>
                            <!-- /.browser information  tab -->

                        </div>
                    </div>

                </div>
            </div>
        </div>


        <div class="col-sm-12 "><br></div>
        <div class="col-sm-12 ">
            <div class="col-sm-12 ">
                <div class="col-sm-12 gray" style="padding: 10px">
                    <label><a href="dashboard.html">Dashboard</a> ->> Feature Price Management <?php // echo $this->session->userdata('profile_id');                                                           ?></label>
                </div>
            </div>
        </div>
    </div>


</div>

<script>

    function checkForAction(url, action, objID) { // check for Active Inactives
//        alert(objID);
//        _(objID).innerHTML = '';
        swal({
            title: "",
            text: "Are you sure you want to " + action + " this Feature?",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: '#DD6B55',
            confirmButtonText: 'Yes',
            cancelButtonText: "No",
            closeOnConfirm: true,
            closeOnCancel: true
        },
        function (isConfirm) {
            if (isConfirm) {
                var fpm_action_xhr = create_xmlhttp();
                var serverPage = url;
                fpm_action_xhr.open("GET", serverPage);
                fpm_action_xhr.onreadystatechange = function ()
                {
                    if (fpm_action_xhr.readyState == 4 && fpm_action_xhr.status == 200)
                    {
                        var result = fpm_action_xhr.responseText;
                        if (result == '2') { //not_deletable_feature
                            show_message("This feature is already taken by any user ");
                        } else {
                            _(objID).innerHTML = result;
                        }
                    }
                };
                fpm_action_xhr.send(null);
            }
        });
    }


    function show_message(message) {
        swal({
            title: "",
            text: message,
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: '#DD6B55',
            confirmButtonText: 'OK',
            cancelButtonText: "",
            closeOnConfirm: true,
            closeOnCancel: true
        },
        function (isConfirm) {
            if (isConfirm) {
            }
        });
    }

</script>