Skip to content

Commit

Permalink
Add/reject events by admin implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
MithishR committed Apr 6, 2024
1 parent 689b230 commit eae0232
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 16 deletions.
15 changes: 7 additions & 8 deletions Django/communicado/pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ class Events(models.Model):
capacity = models.IntegerField(null=True, blank=True)
category = models.CharField(max_length=50, null=True, blank=True)
artist = models.CharField(max_length=100, null=True, blank=True)
isVerified = models.BooleanField(default=False)
#isVerified=models.IntegerField(default=0)
# IS_VERIFIED_CHOICES = (
# (0, 'Not Checked'),
# (1, 'Approved'),
# (-1, 'Rejected'),
# )
# isVerified = models.IntegerField(choices=IS_VERIFIED_CHOICES, default=0)
#isVerified = models.BooleanField(default=False)
IS_VERIFIED_CHOICES = (
(0, 'Not Checked'),
(1, 'Approved'),
(-1, 'Rejected'),
)
isVerified = models.IntegerField(choices=IS_VERIFIED_CHOICES, default=0)

adminID = models.ForeignKey(Admin, on_delete=models.CASCADE, null=True, blank=True,db_column= "adminID")
eventOrganizerID = models.ForeignKey(EventOrganizer, on_delete=models.CASCADE, null=True, blank=True,db_column="eventOrganizerID")
Expand Down
221 changes: 221 additions & 0 deletions Django/communicado/pages/templates/pages/eventaction.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Event - {{ event.name }}</title>
<style>
/* CSS for screen view */
body {
font-family: Arial, sans-serif;
background-color: #0c0808;
margin: 0;
padding: 0;
}

h1, h2 {
color: #fff;
text-align: center;
margin-bottom: 20px;
font-size: 24px;
}

.container {
margin: 20px auto;
padding: 20px;
background-color: #0e0101;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
width: 80%;
}

.event-container {
margin-bottom: 20px;
padding: 10px;
border: 1px solid #ddd; /* Add border to separate events */
border-radius: 5px; /* Add rounded corners */
}

.event {
display: flex; /* Use flexbox */
align-items: center; /* Center align items vertically */
margin-bottom: 20px;
}

.event-details {
flex: 1; /* Take up remaining space */
padding: 20px;
color: #fff;
}

.event-details > * {
margin-bottom: 10px; /* Add spacing between elements */
color: #fff;
}

.event-image {
margin-left: 20px; /* Add margin to separate image from text */
width: 800px; /* Set a fixed width for the image */
margin-bottom: 10px;
margin-top: 20px;
height: 500px;
}

.event-image img {
width: 100%; /* Make the image fill its container */
border-radius: 5px; /* Add rounded corners */
}

.btn {
display: inline-block;
padding: 10px 20px;
font-size: 18px;
background-color: transparent;
color: #fff;
text-decoration: none;
border: 2px solid #fff;
border-radius: 5px;
margin-top: 20px;
transition: background-color 0.3s, border-color 0.3s, color 0.3s;
text-align: center;
}

.btn:hover {
background-color: #fff;
border-color: #fff;
color: #000;
}

h1 {
text-align: center; /* Center-align the title */
color: #fff;
}

.event-name {
text-align: left; /* Center-align the event name */
font-weight: bold;
font-size: medium;
color: #fff;
}

header {
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
padding: 10px;
text-align: right;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
}

header a {
color: #fff;
margin: 0 10px;
text-decoration: none;
}

header a:hover {
text-decoration: underline;
}

/* CSS for print view */
@media print {
body {
background-color: #fff; /* Change background color for print */
}

.container {
width: 100%; /* Ensure full width for print */
margin: 0; /* Remove margin for print */
padding: 0; /* Remove padding for print */
}

.btn {
display: none; /* Hide buttons for print */
}

header {
display: none; /* Hide header for print */
}
}
</style>
</head>
<body>
<header>
<a href="{% url 'login' %}">Login</a>
<a href="{% url 'signup' %}">Signup</a>
<a href="#">View Cart</a>
</header>
<div class="container">
<h1>Update Event</h1>

<div class="event-container">
<h2>{{ event.name }} Details</h2>
<div class="event-details">
{% if event.imageURL %}
<div class="event-image">
<img src="{% static event.imageURL %}" alt="Event Image">
</div>{% endif %}
<div class="event-info">
<span class="label">Name:</span>
<span class="value">{{ event.name }}</span>
</div>
<div class="event-info">
<span class="label">Date and Time:</span>
<span class="value">{{ event.eventDateTime }}</span>
</div>
<div class="event-info">
<span class="label">Location:</span>
<span class="value">{{ event.location }}</span>
</div>
<div class="event-info">
<span class="label">Capacity:</span>
<span class="value">{{ event.capacity }}</span>
</div>
<div class="event-info">
<span class="label">Category:</span>
<span class="value">{{ event.category }}</span>
</div>
<div class="event-info">
<span class="label">Artist:</span>
<span class="value">{{ event.artist }}</span>
</div>
<div class="event-info">
<span class="label">Price:</span>
<span class="value">{{ event.price }}</span>
</div>
<div class="event-id">
<span class="label">Event ID:</span>
<span class="value">{{ event.eventID }}</span>
</div>

<div>
<button class="btn" onclick="confirmApproval('{{ event.eventID }}')">Approve Event</button>
<button class="btn" onclick="confirmRejection('{{ event.eventID }}')">Reject Event</button>
</div>



</div>
</div>
</div>
<script>
function confirmApproval(eventId) {
var confirmation = confirm("Are you sure you want to approve this event?");
if (confirmation) {
window.location.href = "{% url 'approve_event' event_ID=event.eventID %}";
}
}

function confirmRejection(eventId) {
var confirmation = confirm("Are you sure you want to reject this event?");
if (confirmation) {
window.location.href = "{% url 'reject_event' event_ID=event.eventID%}";
}
}
</script>
</body>
</html>
Loading

0 comments on commit eae0232

Please sign in to comment.