<!doctype html>
<html lang="en" translate="no" class="w-[640px] mx-auto md:w-full">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Revenue</title>
      <?php echo view('user/layout/head');?>
      <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/2.0.8/css/dataTables.dataTables.min.css">
      <link rel="stylesheet" href="https://cdn.datatables.net/v/bs4/dt-1.10.18/b-1.5.6/sc-2.0.0/sl-1.3.0/datatables.min.css">
   </head>
   <style>
      .nav-item
      {
      border:2px solid  rgba(140,98,10,1) !important;
      }
      .sam .active {
      background: linear-gradient(180deg, rgba(179,137,34,1) 0%, rgba(140,98,10,1) 50%, rgba(179,137,34,1) 100%, rgba(14,72,62,1) 100%) !important;
      border-radius: 0px !important;
      }
      .head {
      background: linear-gradient(180deg, rgba(179,137,34,1) 0%, rgba(140,98,10,1) 50%, rgba(179,137,34,1) 100%, rgba(14,72,62,1) 100%);
      color: #fff;
      border: 1px;
      }
      .dt-paging 
      {
      text-align:center ;
      margin-top:15px;
      }
      div.dt-container .dt-paging .dt-paging-button.disabled, div.dt-container .dt-paging .dt-paging-button.disabled:hover, div.dt-container .dt-paging .dt-paging-button.disabled:active {
      color: #fff !important;
      }
      div.dt-container .dt-paging .dt-paging-button {
      color: #fff !important;
      padding:0px 10px 0px 10px !important;
      }
      .dt-paging-button
      {
      font-size:20px !important;
      color:#fff !important;
      padding:0px 10px 0px 10px !important;
      }
      .dt-paging .current
      {
      border : 1px solid #e49a00 !important;
      /* border-radius : 20px !important; */
      background : #e49a00 !important;
      }
      .dt-empty
      {
      text-align:center !important;
      }

      .cards tbody tr {
      
      margin: 0.5rem !important;
      border: 0.0625rem solid rgba(0, 0, 0, .125);
      border-radius: .25rem;
      box-shadow: 0.25rem 0.25rem 0.5rem rgba(0, 0, 0, 0.25);
      
   }

   .cards tbody td {
      display: block;
   }

   .cards thead {
      display: none;
   }

   .cards td:before {
      content: attr(data-label);
      position: relative;
      float: left;
      color: #808080;
      min-width: 4rem;
      margin-left: 0;
      margin-right: 1rem;
      text-align: left;   
   }

   tr.selected td:before {
      color: #CCC;
   }

   .table .avatar {
      width: 50px;
   }

   .cards .avatar {
      width: 150px;
      height: 150px;
      margin: 15px;
   }

   table.dataTable td,table.dataTable th
   {
      font-size:14px;
      color:#fff !important;
   }
   .btn-group {
      border-radius: .375rem;
      float: right;
   }
   table.dataTable.table-sm .sorting::before, table.dataTable.table-sm .sorting_asc::before, table.dataTable.table-sm .sorting_desc::before {
      top:15px;
      margin-right:10px;
   }
   table.dataTable.table-sm .sorting::after, table.dataTable.table-sm .sorting_asc::after, table.dataTable.table-sm .sorting_desc::after {
      top: 15px;
      margin-right:10px;
   }
   </style>
   <body class="reg-overflow">
      <section class="dash-banner-bg banner-bg">
         <div class="container">
         <!---header start---->
         <?php echo view('user/layout/header');?>
         <!---header end---->
         <!---banner start---->
         <div class="row">
            <div class="col-lg-12">
               <?php 
                  use App\Libraries\MyEncrypt;
                  use App\Helpers\site_helper;
                  use App\Helpers\form_helper;
                  $this->db = db_connect();
                  $this->session = session();
                  $this->common_model = model('CommonModel');
                  helper('form_helper');
                  
                  
                  $id = 'NyYmemh5aXA=';
                          
                  $myencrypt = new MyEncrypt;
                  $coinid = $myencrypt->decode($id);
                  $user=$this->session->get('uusersid');
                  $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
                  $bal=str_replace(",","", $buy_bal);
                  
                  ?>
               <div class="dash-wrap">
                  <div class="title text-center py-1">
                     <h2 class="text-primary ">Trading Records</h2>
                  </div>
               
                  <div class="team-tab">
                     <ul class="nav sam d-flex justify-content-center ps-0" id="pills-tab" role="tablist">
                        <li class="nav-item" role="presentation">
                           <button class="nav-link active" id="pills-dep2-tab " data-bs-toggle="pill" data-bs-target="#pills-dep2"
                              type="button" role="tab" aria-controls="pills-dep2" aria-selected="true">
                              <div class="make-list">
                                 <div class="process">
                                    <span>All</span>
                                 </div>
                              </div>
                           </button>
                        </li>
                        <li class="nav-item" role="presentation">
                           <button class="nav-link" id="pills-dep3-tab " data-bs-toggle="pill" data-bs-target="#pills-dep3"
                              type="button" role="tab" aria-controls="pills-dep3" aria-selected="true">
                              <div class="make-list">
                                 <div class="process">
                                    <span>Buy</span>
                                 </div>
                              </div>
                           </button>
                        </li>

                        <li class="nav-item" role="presentation">
                           <button class="nav-link" id="pills-dep4-tab " data-bs-toggle="pill" data-bs-target="#pills-dep4"
                              type="button" role="tab" aria-controls="pills-dep4" aria-selected="true">
                              <div class="make-list">
                                 <div class="process">
                                    <span>Sell</span>
                                 </div>
                              </div>
                           </button>
                        </li>
                        
                     </ul>
                     <div class="tab-content" id="pills-tabContent">

                     <?php
                     $all_orders=array();
                     $i=0;
                     if ($sell_records) 
                     {
                        foreach ($sell_records as $key => $value) 
                        { 
                           $i++;
                           if (!empty($value)) 
                           {
                              if($value->subsell_status == 1)
                              {
                                    $buy_sell_status = 'SUB-SELL';
                                    $avg_trans_price = $value->live_price - $value->avg_price;
                              }
                              else
                              { 

                              if($value->description == "manual_buy"){
                                 $buy_sell_status = "Manual-Buy";
                              }else if($value->description == "manual_sell" ){
                                 $buy_sell_status = "Manual-Sell";
                              }else{
                                 if($value->type == 1)
                                    $buy_sell_status = "Buy";
                                 else
                                    $buy_sell_status = "Sell";
                           }
                              
                                 $avg_trans_price = $value->live_price;
                           }
                        }
                        if($value->type == 1)
                        $class = "success";
                        else
                        $class = "fail";

                        if($value->type == 2)
                        { 
                           $profit= $value->avg_price; 
                        }
                        else
                        { 
                           $profit='--';

                        }
                        $percentage='';
                        if($value->type == 2)
                        {
                           if($value->subsell_status == '1')
                           { 
                              $percentage= $value->profit_percentage;
                           }
                           else if($value->subsell_status == '' || $value->subsell_status == '0')
                           { 
                              $percentage=$value->profit_percentage; 
                           }
                           else
                           { 
                              $percentage='-';
                           }
                        }
                        else
                        { 
                        $percentage='-';
                        }
                  $all_orders[]=array("pair" =>$value->pair,"mode" =>$buy_sell_status,"time" => date('Y-m-d h:i:s',substr($value->time,0,-3)),"ordernumber" =>$value->order_id ,"quantity" => $value->quantity,"avarage" => $avg_trans_price,"profit" =>$profit ,"percentage" =>$percentage);
               }
            }



            $sell_orders=array();
            $i=0;

            if ($sell) 
            {

               foreach ($sell as $key => $value) 
               { 
                  $i++;
                 if(!empty($value)) 
                 {
                     if($value->subsell_status == 1)
                     {
                        $buy_sell_status = 'SUB-SELL';
                               $avg_trans_price = $value->live_price - $value->avg_price;
                     }
                     else
                     { 

                           if($value->description == "manual_buy"){
                              $buy_sell_status = "Manual-Buy";
                           }else if($value->description == "manual_sell" ){
                           $buy_sell_status = "Manual-Sell";
                           }else{
                           if($value->type == 1)
                                 $buy_sell_status = "Buy";
                           else
                                 $buy_sell_status = "Sell";
                        }
                           // if($sell['type'] == "TAKE_PROFIT_LIMIT" || $sell['type'] == "STOP_LOSS_LIMIT")
                           // $avg_trans_price = $value->avg_price;
                           // else
                           $avg_trans_price = $value->live_price;
                     }

                     if($value->type == 1)
                     $class = "success";
                     else
                     $class = "fail";

                     if($value->type == 2)
                     { 
                        $profit1= $value->avg_price; 
                     }
                     else
                     { 
                        $profit1='--';

                     }
                     $percentage1='';
                     if($value->type == 2)
                     {
                        if($value->subsell_status == '1')
                        { 
                           $percentage1= $value->profit_percentage;
                        }
                        else if($value->subsell_status == '' || $value->subsell_status == '0')
                        { 
                           $percentage1=$value->profit_percentage; 
                        }
                        else
                        { 
                           $percentage1='-';
                        }
                     }
                     else
                     { 
                        $percentage1='-';
                     }

                     $sell_orders[]=array("pair" =>$value->pair,"mode" =>$buy_sell_status,"time" => date('Y-m-d h:i:s',substr($value->time,0,-3)),"ordernumber" =>$value->order_id ,"quantity" => $value->quantity,"avarage" => $avg_trans_price,"profit" =>$profit1 ,"percentage" =>$percentage1);
               }
            }
         }



         $buy_orders=array();
            $i=0;
            if ($buy) 
            {

               foreach ($buy as $key => $value) 
               { 
                  $i++;
                 if(!empty($value)) 
                 {
                     if($value->subsell_status == 1)
                     {
                        $buy_sell_status = 'SUB-SELL';
                               $avg_trans_price = $value->live_price - $value->avg_price;
                     }
                     else
                     { 

                           if($value->description == "manual_buy"){
                              $buy_sell_status = "Manual-Buy";
                           }else if($value->description == "manual_sell" ){
                           $buy_sell_status = "Manual-Sell";
                           }else{
                           if($value->type == 1)
                                 $buy_sell_status = "Buy";
                           else
                                 $buy_sell_status = "Sell";
                        }
                           // if($sell['type'] == "TAKE_PROFIT_LIMIT" || $sell['type'] == "STOP_LOSS_LIMIT")
                           // $avg_trans_price = $value->avg_price;
                           // else
                           $avg_trans_price = $value->live_price;
                     }

                     if($value->type == 1)
                     $class = "success";
                     else
                     $class = "fail";

                     if($value->type == 2)
                     { 
                        $profit1= $value->avg_price; 
                     }
                     else
                     { 
                        $profit1='--';

                     }
                     $percentage1='';
                     if($value->type == 2)
                     {
                        if($value->subsell_status == '1')
                        { 
                           $percentage1= $value->profit_percentage;
                        }
                        else if($value->subsell_status == '' || $value->subsell_status == '0')
                        { 
                           $percentage1=$value->profit_percentage; 
                        }
                        else
                        { 
                           $percentage1='-';
                        }
                     }
                     else
                     { 
                        $percentage1='-';
                     }

                     $buy_orders[]=array("pair" =>$value->pair,"mode" =>$buy_sell_status,"time" => date('Y-m-d h:i:s',substr($value->time,0,-3)),"ordernumber" =>$value->order_id ,"quantity" => $value->quantity,"avarage" => $avg_trans_price,"profit" =>$profit1 ,"percentage" =>$percentage1);
               }
            }
         }


      ?>
                        
                        <div class="tab-pane fade show active  " id="pills-dep2" role="tabpanel" aria-labelledby="pills-dep2-tab">
                           <div class="search-bar my-2">
                              <form class="form-inline my-2 my-lg-0">
                                 <input class="form-control mr-sm-2" id="myInput" type="search" placeholder="Search username...." aria-label="Search">
                              </form>
                           </div>
                           <div class="table-responsive trans position-relative">
                           <table id="example2" class="table table-sm table-hover" cellspacing="0" width="100%">
                              <thead class="head">
                                 <tr>
                                    <th>Trading pair</th>
                                    <th>Mode</th>
                                    <th>Time</th>
                                    <th>Order Number</th>
                                    <th>Quantity</th>
                                    <th>Average buyin price</th>
                                    <th>Profit (USDT)</th>
                                    <th>Profit (%)</th>
                                 </tr>
                              </thead>
                           </table>
                           </div>
                        </div>
                        <div class="tab-pane fade" id="pills-dep3" role="tabpanel" aria-labelledby="pills-dep3-tab">
                           <div class="search-bar my-2">
                              <form class="form-inline my-2 my-lg-0">
                                 <input class="form-control mr-sm-2" id="myInput1" type="search" placeholder="Search username...." aria-label="Search">
                              </form>
                           </div>
                           <div class="table-responsive trans position-relative">
                           <table id="example3" class="table table-sm table-hover" cellspacing="0" width="100%">
                              <thead class="head">
                                 <tr>
                                    <th>Trading pair</th>
                                    <th>Mode</th>
                                    <th>Time</th>
                                    <th>Order Number</th>
                                    <th>Quantity</th>
                                    <th>Average buyin price</th>
                                    <th>Profit (USDT)</th>
                                    <th>Profit (%)</th>
                                 </tr>
                              </thead>
                           </table>
                           </div>
                        </div>

                        <div class="tab-pane fade" id="pills-dep4" role="tabpanel" aria-labelledby="pills-dep4-tab">
                           <div class="search-bar my-2">
                              <form class="form-inline my-2 my-lg-0">
                                 <input class="form-control mr-sm-2" id="myInput2" type="search" placeholder="Search username...." aria-label="Search">
                              </form>
                           </div>
                           <div class="table-responsive trans position-relative">
                           <table id="example4" class="table table-sm table-hover" cellspacing="0" width="100%">
                              <thead class="head">
                                 <tr>
                                    <th>Trading pair</th>
                                    <th>Mode</th>
                                    <th>Time</th>
                                    <th>Order Number</th>
                                    <th>Quantity</th>
                                    <th>Average buyin price</th>
                                    <th>Profit (USDT)</th>
                                    <th>Profit (%)</th>
                                 </tr>
                              </thead>
                           </table>
                           </div>
                        </div>
                     </div>
                     <!---banner end---->
                  </div>
               </div>
            </div>
            <?php echo view('user/layout/footer');?>
         </div>
      </section>
      <?php echo view('user/layout/footer-script');?>
      <script src="https://cdn.datatables.net/2.0.8/js/dataTables.min.js"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" type="text/javascript"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/v/bs4/dt-1.10.18/b-1.5.6/sc-2.0.0/sl-1.3.0/datatables.min.js" type="text/javascript"></script>
      <!-- <script src="http://demo.myslworld.com/ARM008/styles/web_style/js/jquery.dataTables.min.js"></script> -->
      <script>
       $(document).ready(function () {
   // Assuming originalData is populated from a server-side variable
   const originalData = <?php echo json_encode($all_orders); ?>;
   

   const formattedData = {
      data: originalData.map((item, index) => ({
         id: (index + 1).toString(),
         pair: item.pair,
         mode: item.mode,
         time: item.time,
         ordernumber: item.ordernumber,
         quantity: item.quantity,
         avarage: item.avarage,
         profit: item.profit,
         percentage: item.percentage,
      }))
   };

   var data_final = JSON.stringify(formattedData, null, 4);
   var dataObject = JSON.parse(data_final);

   var table = $('#example2').DataTable({
      'dom':
         "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'<'float-md-right ml-2'B>f>>" +
         "<'row'<'col-sm-12'tr>>" +
         "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
      'data': dataObject.data,
      'pagingType': 'full_numbers', // Pagination control style
      'searching': false, // Disable search feature
      'info': false, // Disable showing information about the table
      'lengthChange': false, // Disable the option to change page length
      'pageLength': 50, 
      'buttons': ['csv', {
         'text': '<i class="fa fa-id-badge fa-fw" aria-hidden="true"></i>',
         'action': function (e, dt, node) {
            $(dt.table().node()).toggleClass('cards');
            $('.fa', node).toggleClass(['fa-table', 'fa-id-badge']);
            dt.draw('page');
         },
         'className': 'btn-sm',
         'attr': {
            'title': 'Change views',
         }
      }],
      'select': 'single',
      'columns': [
         {
            'data': 'pair'
         },
         {
            'data': 'mode'
         },
         {
            'data': 'time',
            'class': 'text-right'
         },
         {
            'data': 'ordernumber',
            'class': 'text-right'
         },
         {
            'data': 'quantity'
         },
         {
            'data': 'avarage'
         },
         {
            'data': 'profit'
         },
         {
            'data': 'percentage'
         }
      ],
      'drawCallback': function (settings) {
         var api = this.api();
         var $table = $(api.table().node());

         if ($table.hasClass('cards')) {
            // Create an array of labels containing all table headers
            var labels = [];
            $('thead th', $table).each(function () {
               labels.push($(this).text());
            });

            // Add data-label attribute to each cell
            $('tbody tr', $table).each(function () {
               $(this).find('td').each(function (column) {
                  $(this).attr('data-label', labels[column]);
               });
            });

            var max = 0;
            $('tbody tr', $table).each(function () {
               max = Math.max($(this).height(), max);
            }).height(max);

         } else {
            // Remove data-label attribute from each cell
            $('tbody td', $table).each(function () {
               $(this).removeAttr('data-label');
            });

            $('tbody tr', $table).each(function () {
               $(this).height('auto');
            });
         }
      }
   })
   .on('select', function (e, dt, type, indexes) {
      var rowData = table.rows(indexes).data().toArray()
      $('#row-data').html(JSON.stringify(rowData));
   })
   .on('deselect', function () {
      $('#row-data').empty();
   });

   $('tbody', table.table().container()).attr('id', 'my-tbody');

   //sell records

   const originalData1 = <?php echo json_encode($buy_orders); ?>;
   

   const formattedData1 = {
      data: originalData1.map((item, index) => ({
         id: (index + 1).toString(),
         pair: item.pair,
         mode: item.mode,
         time: item.time,
         ordernumber: item.ordernumber,
         quantity: item.quantity,
         avarage: item.avarage,
         profit: item.profit,
         percentage: item.percentage,
      }))
   };

   var data_final1 = JSON.stringify(formattedData1, null, 4);
   var dataObject1 = JSON.parse(data_final1);

   var table = $('#example3').DataTable({
      'dom':
         "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'<'float-md-right ml-2'B>f>>" +
         "<'row'<'col-sm-12'tr>>" +
         "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
      'data': dataObject1.data,
      'pagingType': 'full_numbers', // Pagination control style
      'searching': false, // Disable search feature
      'info': false, // Disable showing information about the table
      'lengthChange': false, // Disable the option to change page length
      'pageLength': 50, 
      'buttons': ['csv', {
         'text': '<i class="fa fa-id-badge fa-fw" aria-hidden="true"></i>',
         'action': function (e, dt, node) {
            $(dt.table().node()).toggleClass('cards');
            $('.fa', node).toggleClass(['fa-table', 'fa-id-badge']);
            dt.draw('page');
         },
         'className': 'btn-sm',
         'attr': {
            'title': 'Change views',
         }
      }],
      'select': 'single',
      'columns': [
         {
            'data': 'pair'
         },
         {
            'data': 'mode'
         },
         {
            'data': 'time',
            'class': 'text-right'
         },
         {
            'data': 'ordernumber',
            'class': 'text-right'
         },
         {
            'data': 'quantity'
         },
         {
            'data': 'avarage'
         },
         {
            'data': 'profit'
         },
         {
            'data': 'percentage'
         }
      ],
      'drawCallback': function (settings) {
         var api = this.api();
         var $table = $(api.table().node());

         if ($table.hasClass('cards')) {
            // Create an array of labels containing all table headers
            var labels = [];
            $('thead th', $table).each(function () {
               labels.push($(this).text());
            });

            // Add data-label attribute to each cell
            $('tbody tr', $table).each(function () {
               $(this).find('td').each(function (column) {
                  $(this).attr('data-label', labels[column]);
               });
            });

            var max = 0;
            $('tbody tr', $table).each(function () {
               max = Math.max($(this).height(), max);
            }).height(max);

         } else {
            // Remove data-label attribute from each cell
            $('tbody td', $table).each(function () {
               $(this).removeAttr('data-label');
            });

            $('tbody tr', $table).each(function () {
               $(this).height('auto');
            });
         }
      }
   })
   .on('select', function (e, dt, type, indexes) {
      var rowData = table.rows(indexes).data().toArray()
      $('#row-data').html(JSON.stringify(rowData));
   })
   .on('deselect', function () {
      $('#row-data').empty();
   });

   $('tbody', table.table().container()).attr('id', 'my-tbody1');

   //sell records

   const originalData2 = <?php echo json_encode($sell_orders); ?>;
   

   const formattedData2 = {
      data: originalData2.map((item, index) => ({
         id: (index + 1).toString(),
         pair: item.pair,
         mode: item.mode,
         time: item.time,
         ordernumber: item.ordernumber,
         quantity: item.quantity,
         avarage: item.avarage,
         profit: item.profit,
         percentage: item.percentage,
      }))
   };

   var data_final2 = JSON.stringify(formattedData2, null, 4);
   var dataObject2 = JSON.parse(data_final2);

   var table = $('#example4').DataTable({
      'dom':
         "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'<'float-md-right ml-2'B>f>>" +
         "<'row'<'col-sm-12'tr>>" +
         "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
      'data': dataObject2.data,
      'pagingType': 'full_numbers', // Pagination control style
      'searching': false, // Disable search feature
      'info': false, // Disable showing information about the table
      'lengthChange': false, // Disable the option to change page length
      'pageLength': 50, 
      'buttons': ['csv', {
         'text': '<i class="fa fa-id-badge fa-fw" aria-hidden="true"></i>',
         'action': function (e, dt, node) {
            $(dt.table().node()).toggleClass('cards');
            $('.fa', node).toggleClass(['fa-table', 'fa-id-badge']);
            dt.draw('page');
         },
         'className': 'btn-sm',
         'attr': {
            'title': 'Change views',
         }
      }],
      'select': 'single',
      'columns': [
         {
            'data': 'pair'
         },
         {
            'data': 'mode'
         },
         {
            'data': 'time',
            'class': 'text-right'
         },
         {
            'data': 'ordernumber',
            'class': 'text-right'
         },
         {
            'data': 'quantity'
         },
         {
            'data': 'avarage'
         },
         {
            'data': 'profit'
         },
         {
            'data': 'percentage'
         }
      ],
      'drawCallback': function (settings) {
         var api = this.api();
         var $table = $(api.table().node());

         if ($table.hasClass('cards')) {
            // Create an array of labels containing all table headers
            var labels = [];
            $('thead th', $table).each(function () {
               labels.push($(this).text());
            });

            // Add data-label attribute to each cell
            $('tbody tr', $table).each(function () {
               $(this).find('td').each(function (column) {
                  $(this).attr('data-label', labels[column]);
               });
            });

            var max = 0;
            $('tbody tr', $table).each(function () {
               max = Math.max($(this).height(), max);
            }).height(max);

         } else {
            // Remove data-label attribute from each cell
            $('tbody td', $table).each(function () {
               $(this).removeAttr('data-label');
            });

            $('tbody tr', $table).each(function () {
               $(this).height('auto');
            });
         }
      }
   })
   .on('select', function (e, dt, type, indexes) {
      var rowData = table.rows(indexes).data().toArray()
      $('#row-data').html(JSON.stringify(rowData));
   })
   .on('deselect', function () {
      $('#row-data').empty();
   });

   $('tbody', table.table().container()).attr('id', 'my-tbody2');



});


$("#myInput").on("keyup", function() {
         var value = $(this).val().toLowerCase();
         $("#my-tbody tr").filter(function() {
         $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
         });
         });

$("#myInput1").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#my-tbody1 tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});

$("#myInput2").on("keyup", function() {
         var value = $(this).val().toLowerCase();
         $("#my-tbody2 tr").filter(function() {
         $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
         });
         });
      </script>
   </body>
</html>