<?php 
include('view/new_header_file.php');
?>

<link rel="stylesheet" type="text/css" href="node_modules/css-toggle-switch/dist/toggle-switch.css">





      <div class="container">
         <div class="row sm-gutters">
           <!--  <div class="col-md-6 col-lg-6 col-xl-6 col-xxl-12">
              
                     <div class="tab-content crypt-tab-content">
                        <div role="tabpanel" class="tab-pane active" id="usd">
                        	<h3 style="text-align: center;">Account Details</h3>
                        
                        </div>
                     </div>
                  
              
            </div> -->
              <?php 
                          include('view/screener.view.php');
                          ?>
        </div>
    </div>




<?php
include('view/new_footer_file.php');
?>


<script type="text/javascript">
  

      setInterval(function(){

          var getjsonvalue = '<?=$forjscurrange; ?>';

          var json_array_screener = JSON.parse(getjsonvalue);


          for (var i = 0; i < json_array_screener.length; i++) {
                var elem = json_array_screener[i];
            

                           $.ajax({
                            type: 'POST',
                            url: 'controller/screener.controller.php', 
                            data: {cur:elem},
                            success: function(res){
                               var result = JSON.parse(res);
                               var getelement = result.elem;
                               var bidvalue = result.bid;
                               var askvalue = result.ask;
                               var chg = result.chg;
                               var chgp = result.chgp;
                               var maxbid = result.maxbid;
                               var maxask = result.maxask;
                               var rating = result.rating;

                               $ratingvalue = '';

                               if (rating == 'buy') {

                                  ratingvalue = '<i class="fa fa-chevron-up" style="color:green;font-weight:700;"><span style="margin-left:5px;font-size:16px;font-weight:700;">Buy</span></i>';
                               }else if (rating == 'strongbuy') {
                                ratingvalue = '<i class="fa fa-chevron-up" style="color:green;font-weight:700;"><span style="margin-left:5px;font-size:16px;font-weight:700;">Strong Buy</span></i>';
                               }else if (rating == 'sell') {
                                ratingvalue = '<i class="fa fa-chevron-down" style="color:red;font-weight:700;"><span style="margin-left:5px;font-size:16px;font-weight:700;">Sell</span></i>';
                               }else if (rating == 'strongsell') {
                                ratingvalue = '<i class="fa fa-chevron-down" style="color:red;font-weight:700;"><span style="margin-left:5px;font-size:16px;font-weight:700;">Strong Sell</span></i>';
                               }

                              var changevalue = "";
                              var changevalueper = "";

                               if (chg < 0) {

                                changevalue = "<span style='color:red;font-weight:700;'>"+chg+"</span>";
                               }else{
                                changevalue = "<span style='color:green;font-weight:700;'>"+chg+"</span>";
                               }


                               if (chgp < 0) {

                                changevalueper = "<span style='color:red;font-weight:700;'>"+chgp+"%</span>";
                               }else{

                                changevalueper = "<span style='color:green;font-weight:700;'>"+chgp+"%</span>";
                               }


                               var lastvaluebid = $("#"+getelement+"_last").html(bidvalue);
                               var lastvaluebid = $("#"+getelement+"_chg").html(changevalue);
                               var lastvaluebid = $("#"+getelement+"_chg2").html(changevalueper);
                               var lastvaluebid = $("#"+getelement+"_bid").html(bidvalue);
                               var lastvaluebid = $("#"+getelement+"_ask").html(askvalue);
                               var lastvaluebid = $("#"+getelement+"_high").html(maxbid);
                               var lastvaluebid = $("#"+getelement+"_low").html(maxask);
                               var lastvaluebid = $("#"+getelement+"_rating").html(ratingvalue);

                            }

                            });

          }





         }, 6000);


</script>

