<style>
    .ticket-container {
      display: flex;
      gap: 1rem;
      flex-wrap: wrap;
    }
  
    .ticket-card {
      background-color: #fff;
  
      padding: 10px;
      width: 23rem;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
  
    .ticket-card-header {
      display: flex;
      justify-content: space-between;
    }
  
    .ticket-card-heading {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 10px;
    }
  
    .ticket-card-description {
      font-size: 16px;
      margin-bottom: 15px;
    }
  
    .ticket-card-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 5px;
    }
    .ticket-footer-right {
      display: flex;
      gap: 3px;
    }
    .priority-label {
      font-weight: bold;
      padding: 3px 8px;
      border-radius: 3px;
      color: #fff;
    }
  
    .priority-low {
      background-color: green;
    }
  
    .priority-medium {
      background-color: orange;
    }
  
    .priority-high {
      background-color: red;
    }
  
    .chat-btn {
      padding: 5px 10px;
      background-color: #333;
      color: #fff;
      border: none;
      text-decoration: none;
      cursor: pointer;
    }
    .chat-btn:hover {
      background-color: #3c3b3b;
    }
    .chat-btn:active {
      background-color: #3c3b3b;
    }
    @media (max-width: 767px) {
      .dashboard-content {
        padding: 1rem;
      }
      .dashboard-container {
        display: flex;
        flex-direction: column;
      }
      .dashboard-nav {
        background-color: #333;
        padding: 20px;
        flex: 0 0 0;
      }
    }
  </style>
  
  <% tickets.forEach(ticket => { %>
  <div class="ticket-card">
    <div class="ticket-card-header">
      <h3 class="ticket-card-heading"><%= ticket.title %></h3>
      <% if (ticket.status==='pending') { %>
      <!-- Button trigger modal -->
      <button
        type="button"
        class="btn btn-danger btn-sm"
        data-bs-toggle="modal"
        data-bs-target="#exampleModal1"
      >
        Close
      </button>
  
      <!-- Modal -->
      <div
        class="modal fade"
        id="exampleModal1"
        tabindex="-1"
        aria-labelledby="exampleModal1Label"
        aria-hidden="true"
      >
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <h1 class="modal-title fs-5" id="exampleModal1Label">
                Confirmation
              </h1>
              <button
                type="button"
                class="btn-close"
                data-bs-dismiss="modal"
                aria-label="Close"
              ></button>
            </div>
            <div class="modal-body">
              Are you sure you want to close the ticket?
            </div>
            <div class="modal-footer">
              <button
                type="button"
                class="btn btn-secondary"
                data-bs-dismiss="modal"
              >
                Cancel
              </button>
              <a
                ticket-id="<%= ticket._id %>"
                id="close-ticket-button"
                class="btn btn-primary"
              >
                Confirm</a
              >
            </div>
          </div>
        </div>
      </div>
  
      <% }else { } %>
    </div>
    <p class="ticket-card-description"><%= ticket.description %></p>
    <span class="ticket-card-description"
      ><strong>Status:</strong> <%= ticket.status %></span
    >
    <div class="ticket-card-footer">
      <span class="assignee"
        ><strong>Assignee:</strong> <%= ticket.assignedTo %></span
      >
      <div class="ticket-footer-right">
        <span class="priority-label priority-<%= ticket.priorityLevel %>"
          ><%= ticket.priorityLevel %></span
        >
        <a
          href="/chat?ticketId=<%= ticket._id %>"
          ticket-id="<%= ticket._id %>"
          type="button"
          id="chat-button"
          class="chat-btn"
        >
          Chat
        </a>
      </div>
    </div>
  </div>
  <% }); %>