<style>
  .table-container {
      height: 400px; /* Set the desired height for the table container */
      overflow-y: auto; /* Enable vertical scrolling */
  }

  .table thead th {
      position: sticky;
      top: 0;
      background-color: white; /* Set the desired background color for the header */
  }
</style>


<div class="table-responsive">
    <div>
        <table class="table align-items-center table-dark">
            <thead class="thead-dark">
                <tr>
                    <th scope="col">
                        Details
                    </th>
                    <th scope="col">
                        Criteria
                    </th>

                    <th scope="col">Score</th>

                </tr>
            </thead>
            <tbody class="list">
                {% for key, value in employeelist.items() %} 
                <tr>
                    <td class="budget">
                        {{key}}
                    </td>
                    <td class="status">
                        <span>
                            <i class="bg-warning"></i>{{value[1]}}
                        </span>
                    </td>
                    <th scope="row" class="name">   
                        <div class="media align-items-center">
                            {% if key == "Black List 201 Users" %}
                            <div class="media-body">
                              {% if length202 == 1 or length202 == 0 %}
                              <span class="mb-0 text-sm" style="color: green;">No Users</span>
                              {% else %}
                                <u><a data-id="{{client}}" class="black202" style="cursor: pointer;">
                                    <span class="mb-0 text-sm" style="color: red;">{{length202}}</span></a></u>
                              {% endif %}     
                            </div>
                            {% elif key == "Black List 404 Users" %}
                            <div class="media-body">
                              {% if length404 == 1 or length404 == 0 %}
                              <span class="mb-0 text-sm" style="color: green;">No Users</span>
                              {% else %}
                                <u><a data-id="{{client}}" class="black404" style="cursor: pointer;">
                                    <span class="mb-0 text-sm" style="color: red;">{{length404}}</span></a></u>
                              {% endif %}
                            </div>
                          
                            {% elif key == "Users with No Storage Buckets" %}
                            <div class="media-body">
                              {% if muxCount == 0 %}
                              <span class="mb-0 text-sm" style="color: green;">No Users</span>
                              {% elif muxCount == 1 or muxCount == 2 or muxCount == 3 %}
                                     <u> <a data-id="{{client}}" class="storageBuckets" style="cursor: pointer;">
                                <span class="mb-0 text-sm" style="font-weight: bold; color: green;" >{{muxCount}}</span></a>   </u>

                              {% else %}
                              <u> <a data-id="{{client}}" class="storageBuckets" style="cursor: pointer;">
                                <span class="mb-0 text-sm" style="font-weight: bold; color: red;" >{{muxCount}}</span></a>   </u>
                              {% endif %}

                            </div>


			{% elif key == "Users OneDrive Storage Exceeded" %}
                            <div class="media-body">
                              {% if value[0] == 0 %}
                              <span class="mb-0 text-sm" style="color: green;">No Users</span>
                      
                              {% else %}
                              <u> <a data-id="{{client}}" class="oneDriveStorage" style="cursor: pointer;">
                                <span class="mb-0 text-sm" style="font-weight: bold; color: red;" >{{value[0]}}</span></a>   </u>
                              {% endif %}

                            </div>

                            {% elif key == "License Validity" %}
                            <div class="media-body">
                              {% if period < 604800000 %}
                                <span class="mb-0 text-sm" style="color: red;">{{value[0]}}</span>
                              {% else %}
                                <span class="mb-0 text-sm" style="color: green;">{{value[0]}}</span>
                              {% endif %}
                            </div>
                            

                            {% elif key == "Last Mongo Backup" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>

                            
                            {% elif key == "Last Nightly Restart" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>

                            {% elif key == "Users storage buckets exceeds limit" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>
                            

                            
                            {% elif key == "WiredTiger Cache Size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>

                            
                            {% elif key == "File Upload Size Limit" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>
                            
                            {% elif key == "RAM Size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0] |round(2)}}%</span>
                              
                            </div>
                            {% elif key == "/upload folder size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0] | round(2)}}%</span>
                              
                            </div>
                            
                            {% elif key == "/tmp-chunk folder size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]|round(2)}} GB</span>
                              
                            </div>


                            {% elif key == "/f folder size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>

                            
                            {% elif key == "/patch folder size" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>
                            
                            {% elif key == "/sync-upload folder size" %}
                            <div class="media-body">
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                            </div>
                            

                            {% elif key == "Dedup Backup Policy" %}
                            <div class="media-body">
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0] | capitalize_first_letter}}</span>
                            </div>

                            {% elif key == "Swap Space" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>

                            {% elif key == "AAD Auth token expiry" %}
                            <div class="media-body">
                              
                                <span class="mb-0 text-sm" style="color: {{value[2]}};">{{value[0]}}</span>
                              
                            </div>
                            
                            
                            {% else %}
                            <div class="media-body">
                              {% set finalValue = value[0]|int %}
                              {% if finalValue < 70 %}
                                <span class="mb-0 text-sm" style="color: red;">{{value[0]}}%</span>
                              {% else %}
                                <span class="mb-0 text-sm" style="color: green;">{{value[0]}}%</span>
                              {% endif %}
                            
                            </div>
                            {% endif %}
                        </div>
                    </th>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

</div>

<div class="modal fade" id="balckfourModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <a href="/download404/{{client}}" class="btn btn-icon btn-3 btn-primary">
          <span class="btn-inner--icon"><i class="ni ni-cloud-download-95"></i></span>
            <span class="btn-inner--text modal-title">Export Black List 404 Users</span>
          </a>

          <a class="close" id="back404more" aria-label="Close" style="cursor: pointer;">
            <span aria-hidden="true">&times;</span>
          </a>
        
      </div>
      <div class="blackFour">
        ...
      </div>
    
    </div>
  </div>
</div>


<div class="modal fade" id="storageBuckets" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <a href="/cloudBucketDown/{{client}}" class="btn btn-icon btn-3 btn-primary">
          <span class="btn-inner--icon"><i class="ni ni-cloud-download-95"></i></span>
            <span class="btn-inner--text modal-title">Export Users having no buckets</span>
          </a>

          <a class="close" id="usersNoBuckets" aria-label="Close" style="cursor: pointer;">
            <span aria-hidden="true">&times;</span>
          </a>
        
      </div>
      <div class="usersBuckets">
        ...
      </div>
    
    </div>
  </div>
</div>


<div class="modal fade" id="onedriveStore" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
	 <a href="/oneDriveBucketDown/{{client}}" class="btn btn-icon btn-3 btn-primary">
          <span class="btn-inner--icon"><i class="ni ni-cloud-download-95"></i></span>
            <span class="btn-inner--text modal-title">Export OneDrive Storage Exceeded</span>
          </a>
          <a class="close" id="onedriveNoStore" aria-label="Close" style="cursor: pointer;">
            <span aria-hidden="true">&times;</span>
          </a>
        
      </div>
      <div class="oneDriveeeee">
        ...
      </div>
    
    </div>
  </div>
</div>





<div class="modal fade" id="balcktwoModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <!-- <h5 class="modal-title" id="exampleModalLabel">Black List 202 users</h5> -->
        <!-- <button class="btn btn-icon btn-3 btn-primary down202" data-id="{{client}}" type="button"> -->
          <a href="/download202/{{client}}" class="btn btn-icon btn-3 btn-primary">
          <span class="btn-inner--icon"><i class="ni ni-cloud-download-95"></i></span>
            <span class="btn-inner--text modal-title">Export Black List 201 Users</span>
          </a>
        
          <a class="close" id="black202more" aria-label="Close" style="cursor: pointer;">
            <span aria-hidden="true">&times;</span>
          </a>
      </div>
      <div class="blackTwo">
        ...
      </div>
      
    </div>
  </div>
</div>



<script type='text/javascript'>
    $(document).ready(function () {
        $('.black404').click(function () {
            var userid = $(this).data('id');
            $.ajax({
                url: '/blackfour',
                type: 'post',
                data: { userid: userid },
                success: function (data) {
                    $('.blackFour').html(data);
                    $('.blackFour').append(data.htmlresponse);
                    // $('#empModal').modal('hide');
                    $('#balckfourModal').modal('show');
                }
            });
        });
        $('#back404more').click(function () {
            console.log("line 83");
            $('#balckfourModal').modal('hide');
        });
    });
  </script>

<script type='text/javascript'>
    $(document).ready(function () {
        $('.storageBuckets').click(function () {
            var userid = $(this).data('id');
            $.ajax({
                url: '/StorageBuckets',
                type: 'post',
                data: { userid: userid },
                success: function (data) {
                    $('.usersBuckets').html(data);
                    $('.usersBuckets').append(data.htmlresponse);
                    // $('#empModal').modal('hide');
                    $('#storageBuckets').modal('show');
                }
            });
        });
        $('#usersNoBuckets').click(function () {
            console.log("line 83");
            $('#storageBuckets').modal('hide');
        });
    });
  </script>


<script type='text/javascript'>
  $(document).ready(function () {
      $('.oneDriveStorage').click(function () {
          var userid = $(this).data('id');
          $.ajax({
              url: '/onedriveStorage',
              type: 'post',
              data: { userid: userid },
              success: function (data) {
                  $('.oneDriveeeee').html(data);
                  $('.oneDriveeeee').append(data.htmlresponse);
                  // $('#empModal').modal('hide');
                  $('#onedriveStore').modal('show');
              }
          });
      });
      $('#onedriveNoStore').click(function () {
          console.log("line 83");
          $('#onedriveStore').modal('hide');
      });
  });
</script>


<script type='text/javascript'>
  $(document).ready(function () {
      $('.down202').click(function () {
          var userid = $(this).data('id');
          $.ajax({
              url: '/download202',
              type: 'post',
              data: { userid: userid },
              success: function (data) {
                alert("Downloaded" + data)
              }
          });
      });
  });
</script>



<script type='text/javascript'>
    $(document).ready(function () {
        $('.black202').click(function () {
            var userid = $(this).data('id');
            $.ajax({
                url: '/blacktwo',
                type: 'post',
                data: { userid: userid },
                success: function (data) {
                    $('.blackTwo').html(data);
                    $('.blackTwo').append(data.htmlresponse);
                    // $('#empModal').modal('hide');
                    $('#balcktwoModal').modal('show');
                }
            });
        });
        $('#black202more').click(function () {
            console.log("line 83");
            $('#balcktwoModal').modal('hide');
        });
    });
  </script>
