<div class="row">
  <div class="col-md-12 mt-2">
    <!-- <div class="row">
      <div class="col-md-3 offset-md-9">
        <div class="card w-50 float-right mb-2"><a href="/cms/add" class="btn btn-sm btn-info m-1"><i
              class="fas fa-plus"></i> Daten hinzufügen</a></div>
      </div>
    </div> -->
    <div class="card card-info">
      <div class="card-header">
        <h3 class="card-title">
          <%=sectionTitle%>
        </h3>
      </div>
      <div class="card-body table-responsive">
        <table class="table table-hover table-head-fixed datatable">
          <thead>
            <tr>
              <th style="width: 1%">
                #
              </th>
              <th style="width: 10%; text-align: left;">      
                Titel
              </th>
              <th style="width: 10%; " data-orderable="false">
                Bild
              </th>       
              <th style="width: 10%; ">
                Hergestellt in
              </th>     
              <th style="width: 10%" data-orderable="false">
                Aktion
              </th>
            </tr>
          </thead>
          <tbody>
            <% let index=1;%>
              <% for (data of dataList){ %>
                <tr>
                  <td>
                    <%=index++%>
                  </td>
                  <td style="text-align: left;">
                    <%= data.title ? (data.title.length> 50 ? data.title.slice(0,50) + '...' :
                      data.title) : 'N/A' %>
                  </td>
                  <!-- <td>
                    <%if(data.image !=null && data.image !="" ){%>
                      <img class="img-thumbnail " style="width: 50px" height="50px"
                        src="/<%=data.image %>" alt="Image">
                      <%}else{%>
                        <img class="img-thumbnail " style="width: 50px" src="/images/no-image.jpg%>" alt="Image">
                        <%}%>
                  </td> -->

                  <td>
                    <% if (data.has_image == 1) { %>
                      <!-- Show image if has_image is 1 -->
                      <img class="img-thumbnail" style="width: 50px" height="50px" src="/<%= data.image %>" alt="Image">
                    <% } else { %>
                      <!-- Show video if has_image is 0 and video is not empty -->
                      <% if (data.video && data.video != "") { %>
                        <video width="100" height="100" controls>
                          <source src="/<%= data.video %>" type="video/mp4">
                          Your browser does not support the video tag.
                        </video>
                      <% } else { %>
                        <!-- Show no-image if video is empty -->
                        <img class="img-thumbnail" style="width: 50px" height="50px" src="/images/no-image.jpg" alt="No Image">
                      <% } %>
                    <% } %>
                  </td>
                  
                  <td>
                    <%= new Date(data.created_at).toLocaleDateString('en-GB') %>
                  </td>
               
                  <td>

                    <a class="btn btn-info btn-sm mr-2" href="/static-block/details/<%=data.id%>" data-toggle="tooltip"
                      title="Edit">
                      <i class="fa fa-eye">
                      </i>
                    </a>

                    <a class="btn btn-info btn-sm mr-2" href="/static-block/edit/<%=data.id%>" data-toggle="tooltip"
                      title="Edit">
                      <i class="fas fa-pencil-alt">
                      </i>
                    </a>

                  </td>
                </tr>
                <% } %>
          </tbody>
        </table>
      </div>
    </div>
    <!-- /.card -->
  </div>
  <!-- /.col -->
</div>
<!-- /.row -->


<%- contentFor('pageModalSection')%>
  <%- contentFor('pageScriptsSection')%>