work done

This commit is contained in:
Angelo Rodriguez 2024-12-04 16:36:57 +01:00
parent 4b496a7d4f
commit 43fe9aea31
7 changed files with 125 additions and 30 deletions

View file

@ -1,11 +1,52 @@
from django import forms from django import forms
from core.styles import label_span
class WeeklyReport(forms.Form): class WeeklyReport(forms.Form):
department = forms.CharField(label="Abteilung", max_length=150) department = forms.CharField(
company_text = forms.CharField(label="Betriebliche Tätigkeiten", max_length=300) label=label_span("Abteilung"),
week_topic = forms.CharField(label="Thema der Woche", max_length=600) max_length=150,
school_text = forms.CharField(label="Berufsschule", max_length=300) widget=forms.TextInput(
attrs={
"placeholder": "Abteilung",
"class": "w-full p-2 border border-gray-300 rounded-lg focus:ring focus:ring-blue-400 mb-5",
}
),
)
company_text = forms.CharField(
label=label_span("Betriebliche Tätigkeiten"),
max_length=300,
widget=forms.Textarea(
attrs={
"class": "w-full p-2 border border-gray-300 rounded-lg focus:ring focus:ring-blue-400 mb-5",
"rows": 10,
"placeholder": "Betriebliche Tätigkeiten",
}
),
)
week_topic = forms.CharField(
label=label_span("Thema der Woche"),
max_length=600,
widget=forms.Textarea(
attrs={
"class": "w-full p-2 border border-gray-300 rounded-lg focus:ring focus:ring-blue-400 mb-5",
"rows": 8,
"placeholder": "Thema der Woche",
}
),
)
school_text = forms.CharField(
label=label_span("Berufsschule"),
max_length=300,
widget=forms.Textarea(
attrs={
"class": "w-full p-2 border border-gray-300 rounded-lg focus:ring focus:ring-blue-400 mb-5",
"rows": 5,
"placeholder": "Berufsschule",
}
),
)
def content_values(self) -> dict: def content_values(self) -> dict:
if self.is_valid(): if self.is_valid():

View file

@ -4,3 +4,7 @@ STYLE = {
"red_btn": "text-white bg-red-700 hover:bg-red-800 focus:outline-none focus:ring-4 focus:ring-red-300 font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900", "red_btn": "text-white bg-red-700 hover:bg-red-800 focus:outline-none focus:ring-4 focus:ring-red-300 font-medium rounded-full text-sm px-5 py-2.5 text-center me-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900",
"card": "bg-white drop-shadow-md p-4 mx-auto mt-5 aspect-[2/3] hover:drop-shadow-xl hover:scale-[0.85] scale-[0.8] lg:hover:scale-[0.95] lg:scale-[0.9] transition-all duration-50 transform ease-in-out w-60 sm:w-80", "card": "bg-white drop-shadow-md p-4 mx-auto mt-5 aspect-[2/3] hover:drop-shadow-xl hover:scale-[0.85] scale-[0.8] lg:hover:scale-[0.95] lg:scale-[0.9] transition-all duration-50 transform ease-in-out w-60 sm:w-80",
} }
def label_span(txt):
return f'<span class="block text-base font-medium font-bold text-gray-700 mr-1 mb-3">{txt}</span>'

5
core/templates/header.html Executable file
View file

@ -0,0 +1,5 @@
<header class="w-full bg-red-600 text-white py-4 shadow-md">
<div class="max-w-4xl {% if center is None or center %}mx-auto{% endif %} px-4">
<h1 class="text-2xl font-bold {% if center is None or center %}{% else %}ml-5{% endif %}">{{ title }}</h1>
</div>
</header>

View file

@ -3,7 +3,7 @@
{% include 'component/report.html' with report=report %} {% include 'component/report.html' with report=report %}
{% endfor %} {% endfor %}
<div hx-get="/reports?page={{ next }}" <div hx-get="/reports?page={{ next }}"
hx-trigger="revealed" hx-trigger="revealed"

View file

@ -3,11 +3,14 @@
<title>Azube</title> <title>Azube</title>
{% include 'head.html' %} {% include 'head.html' %}
</head> </head>
<body> <body class="bg-gray-100 min-h-screen">
{% include 'header.html' with title="Deine Berichtshefte" center=False %}
<div class="bg-gray-100 min-h-screen"> <div class="bg-gray-100 min-h-screen">
<h1 class="text-2xl justify-center flex pt-5">Deine Berichtshefte</h1>
{% if late_reports > 1 %} {% if late_reports > 1 %}
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 mr-10 ml-10 mt-6" role="alert"> <div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 mr-10 ml-10 mt-6" role="alert">
<p class="font-bold"> Du bist nicht aktuell! </p> <p class="font-bold"> Du bist nicht aktuell! </p>
<p> Du hast noch {{ late_reports }} Berichtshefte nachzuschreiben. </p> <p> Du hast noch {{ late_reports }} Berichtshefte nachzuschreiben. </p>

View file

@ -3,17 +3,36 @@
<title> Berichtsheft {{ report.num }} </title> <title> Berichtsheft {{ report.num }} </title>
{% include 'head.html' %} {% include 'head.html' %}
</head> </head>
<body> <body class="bg-gray-50 text-gray-800 font-sans min-h-screen flex flex-col items-center">
<h1> Berichtsheft {{ report.num }} </h1>
{% with title="Berichtsheft "|add:report.num %}
<p> Berichtsheft {{ report.year }} / {{ report.week }} </p> {% include 'header.html' with title="Berichtsheft" %}
{% endwith %}
<p> Is Approved ? {{ report.is_approved }} </p>
<main class="flex-grow w-full max-w-4xl mx-auto p-6 bg-white shadow-lg rounded-lg mt-6">
{% for key, value in report.content.items %} <div class="mb-4">
<p class="text-lg font-medium text-gray-700">
<p> {{ key }} : {{ value }} </p> Berichtsheft <span class="font-semibold">{{ report.year }}</span> / <span class="font-semibold">{{ report.week }}</span>
</p>
{% endfor %} <p class="text-gray-700">
</body> Is Approved?
<span class="{% if report.is_approved %}text-green-500 font-semibold{% else %}text-red-500 font-semibold{% endif %}">
{{ report.is_approved }}
</span>
</p>
</div>
<div class="border-t border-gray-200 mt-4 pt-4">
<h2 class="text-lg font-medium text-gray-800 mb-2">Content:</h2>
<dl class="space-y-2">
{% for key, value in report.content.items %}
<div class="flex justify-between items-start">
<dt class="text-sm font-medium text-gray-600">{{ key }}</dt>
<dd class="text-sm text-gray-800">{{ value }}</dd>
</div>
{% endfor %}
</dl>
</div>
</main>
</body>
</html> </html>

View file

@ -3,19 +3,42 @@
<title>Neues Berichtsheft</title> <title>Neues Berichtsheft</title>
{% include 'head.html' %} {% include 'head.html' %}
</head> </head>
<body> <body class="bg-gray-50 text-gray-800 font-sans min-h-screen flex flex-col items-center">
<h1>Neues Berichtsheft</h1>
<p>{{ user.display_name }}</p> {% include 'header.html' with title="Neues Berichtsheft" %}
<p>Berichtsheft {{ year }} / {{ week }}</p>
<p>Von: {{ start_date|date:"d.m.Y" }} bis: {{ end_date|date:"d.m.Y" }}</p>
<form method="post"> <main class="flex-grow w-full max-w-4xl mx-auto p-6 bg-white shadow-lg rounded-lg mt-6">
{{ form }} <div class="mb-6">
<p class="text-lg font-medium">{{ user.display_name }}</p>
<p class="text-gray-600">
Berichtsheft <span class="font-semibold">{{ year }}</span> / <span class="font-semibold">{{ week }}</span>
</p>
<p class="text-gray-600">
Von: <span class="font-semibold">{{ start_date|date:"d.m.Y" }}</span> bis: <span class="font-semibold">{{ end_date|date:"d.m.Y" }}</span>
</p>
</div>
<button>Submit</button> <form method="post" class="space-y-4">
{% for field in form %}
<div class="mb-4">
<label for="{{ field.id_for_label }}">
{{ field.label|safe }}
</label>
{{ field }}
{% if field.errors %}
<p class="text-red-500 text-sm">{{ field.errors|join:", " }}</p>
{% endif %}
</div>
{% endfor %}
{% csrf_token %} {% csrf_token %}
</form> <button
type="submit"
class="w-full bg-red-600 text-white py-2 px-4 rounded-lg shadow hover:bg-red-700 focus:ring focus:ring-red-400">
Submit
</button>
</form>
</main>
</body> </body>
</html> </html>