Prototype implementation
This commit is contained in:
parent
315143a6fc
commit
14b0bc6d01
160 changed files with 5731 additions and 42 deletions
46
vergabe_teilnahme/apps/feedback/views.py
Normal file
46
vergabe_teilnahme/apps/feedback/views.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.views.decorators.http import require_GET, require_POST
|
||||
|
||||
from .models import Feedbackeintrag
|
||||
|
||||
|
||||
@require_GET
|
||||
def modal(request):
|
||||
return render(request, 'partials/feedback_modal.html')
|
||||
|
||||
|
||||
@require_POST
|
||||
def submit(request):
|
||||
beschreibung = request.POST.get('beschreibung', '').strip()
|
||||
if not beschreibung:
|
||||
return render(request, 'partials/feedback_modal.html',
|
||||
{'error': 'Beschreibung ist erforderlich.'})
|
||||
|
||||
entry = Feedbackeintrag(
|
||||
titel=request.POST.get('titel', 'Ohne Titel') or 'Ohne Titel',
|
||||
beschreibung=beschreibung,
|
||||
seite_kontext=request.POST.get('seite_kontext', ''),
|
||||
kategorie=request.POST.get('kategorie', 'hinweis'),
|
||||
dringlichkeit=request.POST.get('dringlichkeit', 'mittel'),
|
||||
)
|
||||
ausschreibung_pk = request.POST.get('ausschreibung')
|
||||
if ausschreibung_pk:
|
||||
try:
|
||||
from vergabe_teilnahme.apps.ausschreibungen.models import Ausschreibung
|
||||
entry.ausschreibung = Ausschreibung.objects.get(pk=ausschreibung_pk)
|
||||
except (Ausschreibung.DoesNotExist, ValueError):
|
||||
pass
|
||||
if request.user.is_authenticated:
|
||||
entry.erfasst_von = request.user
|
||||
entry.save()
|
||||
|
||||
return HttpResponse(
|
||||
'<div x-data="{open:true}" x-show="open" x-cloak '
|
||||
'class="fixed inset-0 bg-black/30 z-50 flex items-center justify-center">'
|
||||
'<div class="bg-white rounded-xl shadow-xl p-8 text-center max-w-sm mx-4">'
|
||||
'<p class="text-2xl mb-2">✅</p>'
|
||||
'<p class="font-medium text-slate-900">Danke für dein Feedback!</p>'
|
||||
'<button @click="open=false" class="btn-secondary mt-4">Schließen</button>'
|
||||
'</div></div>'
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue