Client views

This commit is contained in:
Kumi 2021-04-12 15:32:15 +02:00
parent ae9b760cb8
commit d263417bed
6 changed files with 87 additions and 7 deletions

View file

@ -1,6 +1,6 @@
from django.urls import path
from .views import ClientRegistrationView, ClientProfileView, ClientDashboardView
from .views import ClientRegistrationView, ClientProfileView, ClientDashboardView, ClientBookingsView
app_name = "clients"
@ -8,4 +8,5 @@ urlpatterns = [
path('dashboard/', ClientDashboardView.as_view(), name="dashboard"),
path('register/', ClientRegistrationView.as_view(), name="register"),
path('profile/', ClientProfileView.as_view(), name="profile"),
path('bookings/', ClientBookingsView.as_view(), name="bookings"),
]

View file

@ -1,12 +1,14 @@
from django.views.generic import CreateView, UpdateView, TemplateView
from django.views.generic import CreateView, UpdateView, TemplateView, ListView
from django.urls import reverse_lazy
from django.shortcuts import redirect
from django.contrib import messages
from .models import ClientProfile
from .mixins import ClientProfileRequiredMixin
from localauth.mixins import LoginRequiredMixin
from public.mixins import InConstructionMixin
from auction.models import Inquiry
class ClientRegistrationView(InConstructionMixin, LoginRequiredMixin, CreateView):
model = ClientProfile
@ -59,4 +61,11 @@ class ClientProfileView(InConstructionMixin, LoginRequiredMixin, UpdateView):
return redirect("clients:register")
class ClientDashboardView(InConstructionMixin, LoginRequiredMixin, TemplateView):
template_name = "clients/dashboard.html"
template_name = "clients/dashboard.html"
class ClientBookingsView(InConstructionMixin, ClientProfileRequiredMixin, ListView):
model = Inquiry
template_name = "clients/bookings.html"
def get_queryset(self):
return Inquiry.objects.filter(client=self.request.user.clientprofile)

View file

@ -8,7 +8,7 @@
<div class="col-12 col-md-12 col-lg-12 col-xl-12">
<div class="dashboard-heading">
<h2>Dein <span>Profil</span></h2>
<p>Servus {{ request.user.get_full_name }}, willkommen in deinem JourneyJoker-Profil!</p>
<p>Servus {{ request.user.clientprofile.full_name }}, willkommen in deinem JourneyJoker-Profil!</p>
<p>Hier siehst du all deine gebuchten Reisen und kannst deine Daten verwalten!</p>
</div><!-- end dashboard-heading -->
@ -19,7 +19,7 @@
<ul class="nav nav-tabs">
<li class="nav-item active"><a class="nav-link" href="{% url "clients:dashboard" %}"><span><i class="fa fa-cogs"></i></span>Dashboard</a></li>
<li class="nav-item"><a class="nav-link" href="{% url "clients:profile" %}"><span><i class="fa fa-user"></i></span>Profil</a></li>
<li class="nav-item"><a class="nav-link" href="#"><span><i class="fa fa-briefcase"></i></span>Buchungen</a></li>
<li class="nav-item"><a class="nav-link" href="{% url "clients:bookings" %}"><span><i class="fa fa-briefcase"></i></span>Buchungen</a></li>
<li class="nav-item"><a class="nav-link" href="#"><span><i class="fa fa-heart"></i></span>Bewertungen</a></li>
</ul>
</div><!-- end columns -->

View file

@ -0,0 +1,50 @@
{% extends "clients/base.html" %}
{% block "dashboardcontent" %}
<div class="col-12 col-md-10 col-lg-10 dashboard-content booking-trips">
<h2 class="dash-content-title">Deine Buchungen</h2>
<div class="dashboard-listing booking-listing">
<div class="dash-listing-heading">
<div class="custom-radio">
<input type="radio" id="radio01" name="radio" checked/>
<label for="radio01"><span></span>Alle Anfragen</label>
</div><!-- end custom-radio -->
<div class="custom-radio">
<input type="radio" id="radio02" name="radio" />
<label for="radio02"><span></span>Fixiert</label>
</div><!-- end custom-radio -->
<div class="custom-radio">
<input type="radio" id="radio03" name="radio" />
<label for="radio03"><span></span>In Gebotsphase</label>
</div><!-- end custom-radio -->
<div class="custom-radio">
<input type="radio" id="radio04" name="radio" />
<label for="radio04"><span></span>Inaktiv</label>
</div><!-- end custom-radio -->
</div>
<div class="table-responsive">
<table class="table table-hover">
<tbody>
<tr>
<td class="dash-list-icon booking-list-date"><div class="b-date"><h3>12</h3><p>April 2021</p></div></td>
<td class="dash-list-text booking-list-detail">
<h3>Habbo Hotel</h3>
<ul class="list-unstyled booking-info">
<li><span>Ankunft:</span> 12. April 2021</li>
<li><span>Abreise:</span> 19. April 2021</li>
<li><span>Preis:</span> € 500,00</li>
</ul>
<button class="btn btn-orange">Details</button>
</td>
<td class="dash-list-btn"><button class="btn btn-orange">Stornieren</button><button class="btn">PDF-Bestätigung</button></td>
</tr>
</tbody>
</table>
</div><!-- end table-responsive -->
</div><!-- end booking-listings -->
</div><!-- end columns -->
{% endblock %}

View file

@ -31,4 +31,24 @@
</div><!-- end card-body -->
</div><!-- end panel-detault -->
</div><!-- end columns -->
{% endblock %}
{% block "modal" %}
<div id="edit-profile" class="modal custom-modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">{% trans "Profildaten" %}</h3>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div><!-- end modal-header -->
<div class="modal-body">
<form method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="btn btn-orange btn-block">{% trans "Anwenden" %}</button>
</form>
</div><!-- end modal-bpdy -->
</div><!-- end modal-content -->
</div><!-- end modal-dialog -->
</div><!-- end edit-profile -->
{% endblock %}

View file

@ -149,9 +149,9 @@
<a href="#" class="nav-link" data-toggle="dropdown">{% trans "Mein&nbsp;Urlaub" %}<span><i class="fa fa-angle-down"></i></span></a>
<ul class="dropdown-menu">
{% if request.user.is_authenticated %}
<li><a class="dropdown-item" href="{% url "clients:dashboard" %}">{% trans "Dashboard" %}</a></li>
<li><a class="dropdown-item" href="{% url "clients:profile" %}">{% trans "Mein Profil" %}</a></li>
<li><a class="dropdown-item" href="/">{% trans "Gestellte Anfragen" %}</a></li>
<li><a class="dropdown-item" href="/">{% trans "Gebuchte Reisen" %}</a></li>
<li><a class="dropdown-item" href="{% url "clients:bookings" %}">{% trans "Anfragen und Buchungen" %}</a></li>
{% else %}
<li><a class="dropdown-item" href="{% url "localauth:login" %}?next={{ request.path }}">{% trans "Login" %}</a></li>
<li><a class="dropdown-item" href="{% url "localauth:register" %}?next={{ request.path }}">{% trans "Registrieren" %}</a></li>