</div>
</div>


<!-- jQuery -->
<script src="{{ asset('jquery/jquery.js') }}"></script>
<!-- Bootstrap Bundle JS -->
<script src="{{ asset('bootstrap') }}/js/bootstrap.bundle.min.js"></script>
<!-- Select2 JS -->
<script src="{{ asset('select2/js/select2.min.js') }}"></script>
<!-- Clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.8/clipboard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js"></script>
<!-- Your Custom JS -->
<script src="{{ asset('js/style.js') }}"></script>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    // Initialize Clipboard.js
    var clipboardTaskID = new ClipboardJS('#copyTaskID1', {
      text: function(trigger) {
        // Get the text from the corresponding <td>
        var row = trigger.closest('tr');
        return row.querySelector('td:nth-child(5)').innerText;
      }
    });

    var clipboardResourceID = new ClipboardJS('#copyResourceID1', {
      text: function(trigger) {
        // Get the text from the corresponding <td>
        var row = trigger.closest('tr');
        return row.querySelector('td:nth-child(6)').innerText;
      }
    });

    // Display success message when copying is successful
    clipboardTaskID.on('success', function(e) {
      alert('Task ID copied to clipboard!');
      e.clearSelection();
    });

    clipboardResourceID.on('success', function(e) {
      alert('Resource ID copied to clipboard!');
      e.clearSelection();
    });

  });
</script>
<script>
  $(document).ready(function() {
    // Initialize Select2
    $('#clr-form-control-3').select2();

    // Add close icon to selected options
    $('#clr-form-control-3').on('select2:select', function(e) {
      // If "All" is selected, unselect all other options
      if (e.params.data.id === 'clr-option-clr-id-6') {
        $('#clr-form-control-3').val(['clr-option-clr-id-6']).trigger('change');
      } else {
        // For other options, update badges
        updateBadge(e.params.data.id, e.params.data.text);
        // Unselect "All" when selecting other options
        $('#clr-form-control-3').val($('#clr-form-control-3').val().filter(val => val !== 'clr-option-clr-id-6')).trigger('change');
      }
    });

    // Remove badge when clicking the close icon
    $(document).on('click', '.select2-selection__choice__remove', function() {
      var value = $(this).parent().data('value');
      // Update badges for other options
      updateBadge(value, '');
      // If no options are selected, select "All"
      if ($('#clr-form-control-3').val() && $('#clr-form-control-3').val().length === 0) {
        $('#clr-form-control-3').val(['clr-option-clr-id-6']).trigger('change');
      }
    });

    // Function to update badges
    function updateBadge(value, text) {
      // Your implementation to update badges goes here
    }


  });
</script>


</body>

</html>