154 lines
7.5 KiB
HTML
154 lines
7.5 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>Contact Submissions</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">Form Data</li>
|
|
<li class="breadcrumb-item active">Contact Form</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 %}
|
|
{% if form.errors %}
|
|
<div class="alert alert-danger">
|
|
<strong>Error:</strong>
|
|
<ul>
|
|
{% for field, errors in form.errors.items %}
|
|
{% for error in errors %}
|
|
<li>{{ field }}: {{ error }}</li>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% 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 Contacts</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6 p-0">
|
|
</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>Name</th>
|
|
<th>Email</th>
|
|
<th>Phone</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for contact in contacts %}
|
|
<tr>
|
|
<td>{{ forloop.counter }}</td>
|
|
<td><a href="#" data-bs-toggle="modal" data-bs-target="#editcontactModal{{ contact.id }}">{{ contact.name }}</a></td>
|
|
<td>{{ contact.email }}</td>
|
|
<td>{{ contact.phone }}</td>
|
|
<td>
|
|
<ul class="action">
|
|
<li class="edit">
|
|
<!-- Link to open the modal -->
|
|
<a href="#" data-bs-toggle="modal" data-bs-target="#editcontactModal{{ contact.id }}"><i class="icon-eye"></i></a>
|
|
|
|
<!-- Bootstrap 4 Modal -->
|
|
<div class="modal fade" id="editcontactModal{{ contact.id }}" tabindex="-1" role="dialog" aria-labelledby="editcontactModalLabel" 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="editcontactModalLabel">{{contact.name}}'s Submission</h5>
|
|
</div>
|
|
<div class="modal-body">
|
|
<!-- Include your edit form here -->
|
|
<p><strong>Name:</strong> {{ contact.name }}</p>
|
|
<p><strong>Email:</strong> <a href="mailto:{{ contact.email }}">{{ contact.email }}</a></p>
|
|
<p><strong>Phone:</strong> {{ contact.phone }}</p>
|
|
<p><strong>Subject:</strong> {{ contact.subject }}</p>
|
|
<p><strong>Message:</strong> {{ contact.message }}</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-secondary" type="button" data-bs-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li class="delete"><a href="#" data-slug="{{ contact.id }}"><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 'AdminContactDelete' contact.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 %} |