Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/backoffice/templates/feedback_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% extends 'base.html' %}

{% block title %}
Feedback Detail | Orga | BackOffice | {{ block.super }}
{% endblock %}

{% block content %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Feedback detail</h3>
</div>
<div class="card-body">
<div class="mb-4">
<figure>
<blockquote class="blockquote">
<p>{{ feedback.feedback }}</p>
</blockquote>
<figcaption class="blockquote-footer">
<cite title="Source Title">{{ feedback.user.profile.public_credit_name }}</cite>
</figcaption>
</figure>
</div>
<div>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#orga"><i class="fas fa-undo"></i> Backoffice</a>
<a class="btn btn-primary" href="{% url 'backoffice:feedback_list' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Feedback list</a>
{% if not feedback.processed_by %}
<form method="post" action="{% url 'backoffice:feedback_process' camp_slug=camp.slug pk=feedback.pk %}">
{% csrf_token %}
<button type="submit" class="btn btn-success"><i class="fas fa-check"></i> Processed</a>
</form>
{% endif %}
</div>
</div>
</div>
{% endblock %}
53 changes: 53 additions & 0 deletions src/backoffice/templates/feedback_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static %}
{% load imageutils %}

{% block title %}
Feedback list | {{ block.super }}
{% endblock %}

{% block content %}
<div class="row">
<h2>Feedback list</h2>
<div>
<p class="lead">List of all feedbacks for this camp </p>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#orga"><i class="fas fa-undo"></i> Backoffice</a>
</div>
</div>
<br>
<div class="row">
<table class="table table-hover datatable">
<thead>
<tr>
<th>Username</th>
<th>Public Credit Name</th>
<th>Feedback</th>
<th>Processed at</th>
<th>Processed by</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for feedback in object_list %}
<tr>
<td>{{ feedback.user.username }}</td>
<td>{{ feedback.user.profile.public_credit_name }}</td>
<td>{{ feedback.feedback|truncatewords:12 }}</td>
<td>{{ feedback.processed_at|default_if_none:"" }}</td>
<td>{{ feedback.processed_by|default_if_none:"" }}</td>
<td>
<a href="{% url 'backoffice:feedback_detail' camp_slug=camp.slug pk=feedback.pk %}" class="btn btn-sm btn-primary">Detail</a>
{% if not feedback.processed_by %}
<form method="post" action="{% url 'backoffice:feedback_process' camp_slug=camp.slug pk=feedback.pk %}">
{% csrf_token %}
<button type="submit" class="btn btn-sm btn-success"><i class="fas fa-check"></i> Processed</a>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}
4 changes: 4 additions & 0 deletions src/backoffice/templates/includes/index_orga.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ <h3>Orga Team</h3>
<h4 class="list-group-item-heading">Approve Public Credit Names</h4>
<p class="list-group-item-text">Use this view to check and approve users Public Credit Names</p>
</a>
<a href="{% url 'backoffice:feedback_list' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">Feedback list</h4>
<p class="list-group-item-text">View all of the feedbacks for this camp</p>
</a>
<a href="{% url 'backoffice:merchandise_orders' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">Merchandise Orders</h4>
<p class="list-group-item-text">Use this view to look at Merchandise Orders</p>
Expand Down
7 changes: 7 additions & 0 deletions src/backoffice/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
from .views import FacilityTypeListView
from .views import FacilityTypeUpdateView
from .views import FacilityUpdateView
from .views import FeedbackDetailView
from .views import FeedbackListView
from .views import FeedbackProcessView
from .views import InvoiceDownloadMultipleView
from .views import InvoiceDownloadView
from .views import InvoiceListCSVView
Expand Down Expand Up @@ -418,6 +421,10 @@
],
),
),
# feedback
path("feedback_list/", FeedbackListView.as_view(), name="feedback_list"),
path("feedback_detail/<uuid:pk>", FeedbackDetailView.as_view(), name="feedback_detail"),
path("feedback_process/<uuid:pk>", FeedbackProcessView.as_view(), name="feedback_process"),
# infodesk
path(
"infodesk/",
Expand Down
39 changes: 39 additions & 0 deletions src/backoffice/views/orga.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@

from django.contrib import messages
from django.forms import modelformset_factory
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.shortcuts import render
from django.urls import reverse
from django.utils import timezone
from django.views.generic import DetailView
from django.views.generic import ListView
from django.views.generic import TemplateView
from django.views.generic import View
from django.views.generic.edit import FormView
from django.views.generic.edit import SingleObjectMixin

from backoffice.mixins import OrgaTeamPermissionMixin
from camps.mixins import CampViewMixin
from feedback.models import Feedback
from profiles.models import Profile
from shop.models import OrderProductRelation
from shop.models import Product
Expand Down Expand Up @@ -305,3 +309,38 @@ def get_context_data(self, *args, **kwargs):
2,
)
return context


##############
# FEEDBACK


class FeedbackListView(CampViewMixin, OrgaTeamPermissionMixin, ListView):
"""View for listing all feedbacks."""

model = Feedback
template_name = "feedback_list.html"


class FeedbackDetailView(CampViewMixin, OrgaTeamPermissionMixin, DetailView):
"""View for listing all feedbacks."""

model = Feedback
template_name = "feedback_detail.html"


class FeedbackProcessView(CampViewMixin, OrgaTeamPermissionMixin, SingleObjectMixin, View):
"""View for marking feedback as processed"""

model = Feedback
http_method_names = ["post"]

def post(self, request, *args, **kwargs):
"""Mark feedback as processed."""
self.object = self.get_object()
self.object.processed_by = self.request.user
self.object.processed_at = timezone.now()
self.object.save()
return HttpResponseRedirect(
reverse("backoffice:feedback_list", kwargs={"camp_slug": self.camp.slug}),
)
Loading