Files
djangocms/templates/dashboard/main/project/projects.html
2024-11-19 13:00:24 +07:00

122 lines
6.1 KiB
HTML

{% extends 'dashboard/base.html' %}
{% load static %}
{% block title %}{{ title }} - {{ seo_settings.meta_title }}{% endblock title %}
{% block content %}
<div class="page-body">
<div class="container-fluid">
<div class="page-title">
<div class="row">
<div class="col-6">
<h3>Project</h3>
</div>
<div class="col-6">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'adminHome' %}">
<svg class="stroke-icon">
<use href="{% static 'admin/assets/svg/icon-sprite.svg' %}#stroke-home"></use>
</svg></a></li>
<li class="breadcrumb-item">Project</li>
<li class="breadcrumb-item active">Project List</li>
</ol>
</div>
</div>
</div>
</div>
<!-- Container-fluid starts-->
<div class="container-fluid">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
<div class="col-md-12 project-list">
<div class="card">
<div class="row">
<div class="col-md-6 p-0 d-flex">
<ul class="nav nav-tabs border-tab" id="top-tab" role="tablist">
<li class="nav-item"><a class="nav-link active" id="top-home-tab" data-bs-toggle="tab" href="#top-home" role="tab" aria-controls="top-home" aria-selected="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-target"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="6"></circle><circle cx="12" cy="12" r="2"></circle></svg>All Projects</a></li>
</ul>
</div>
<div class="col-md-6 p-0">
<div class="form-group mb-0 me-0"></div><a class="btn btn-primary" href="{% url 'adminProjectCreate' %}"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-square"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>Create New Project</a>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Zero Configuration Starts-->
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="display" id="basic-1">
<thead>
<tr>
<th>#</th>
<th>Image</th>
<th>Title</th>
<th>Category</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr>
<td>{{ forloop.counter }}</td>
{% if project.image %}
<td><img src="{{ project.getProjectImage }}" width="50" alt="projectImage" style="border-radius:5px;" srcset=""></td>
{% else %}
<td>No image</td>
{% endif %}
<td><a href="{% url 'adminProjectEdit' project.slug %}">{{ project.title }}</a></td>
<td>{{ project.category }}</td>
<td>
<ul class="action">
<li class="edit"> <a href="{% url 'adminProjectEdit' project.slug %}"><i class="icon-pencil-alt"></i></a></li>
<li class="delete"><a href="#" data-slug="{{ project.slug }}"><i class="icon-trash"></i></a></li>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
var deleteButtons = document.querySelectorAll('.icon-trash');
deleteButtons.forEach(function(button) {
button.addEventListener('click', function (event) {
event.preventDefault();
var url = "{% url 'adminProjectDelete' id=project.id %}";
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = url;
}
})
});
});
});
</script>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Zero Configuration Ends-->
</div>
</div>
</div>
{% endblock %}