Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
610ac52454 first try 2026-01-19 21:16:21 +00:00
17 changed files with 424 additions and 169 deletions

View File

@ -180,3 +180,8 @@ if EMAIL_USE_SSL:
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Login/Logout URLs
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/login/'

Binary file not shown.

View File

@ -1,3 +1,8 @@
from django.contrib import admin from django.contrib import admin
from .models import Product
# Register your models here. @admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
list_display = ('name', 'price', 'category', 'has_deposit')
list_filter = ('category', 'has_deposit')
search_fields = ('name',)

View File

@ -0,0 +1,25 @@
# Generated by Django 5.2.7 on 2026-01-19 20:59
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('price', models.DecimalField(decimal_places=2, max_digits=6)),
('category', models.CharField(choices=[('food', 'Food'), ('drink', 'Drink')], default='drink', max_length=20)),
('has_deposit', models.BooleanField(default=False)),
('image_url', models.URLField(blank=True, help_text='Optional URL for product image.', null=True)),
],
),
]

View File

@ -1,3 +1,16 @@
from django.db import models from django.db import models
# Create your models here. class Product(models.Model):
CATEGORY_CHOICES = [
('food', 'Food'),
('drink', 'Drink'),
]
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=6, decimal_places=2)
category = models.CharField(max_length=20, choices=CATEGORY_CHOICES, default='drink')
has_deposit = models.BooleanField(default=False)
image_url = models.URLField(max_length=200, blank=True, null=True, help_text="Optional URL for product image.")
def __str__(self):
return self.name

View File

@ -15,6 +15,11 @@
{% endif %} {% endif %}
{% load static %} {% load static %}
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}"> <link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Poppins:wght@600;700&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% block head %}{% endblock %} {% block head %}{% endblock %}
</head> </head>

View File

@ -1,145 +1,70 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %}
{% block title %}{{ project_name }}{% endblock %} {% block title %}EventKasse POS{% endblock %}
{% block head %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% {
background-position: 0% 0%;
}
100% {
background-position: 100% 100%;
}
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2.5rem 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
h1 {
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
font-weight: 700;
margin: 0 0 1.2rem;
letter-spacing: -0.02em;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
opacity: 0.92;
}
.loader {
margin: 1.5rem auto;
width: 56px;
height: 56px;
border: 4px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.runtime code {
background: rgba(0, 0, 0, 0.25);
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
footer {
position: absolute;
bottom: 1rem;
width: 100%;
text-align: center;
font-size: 0.85rem;
opacity: 0.75;
}
</style>
{% endblock %}
{% block content %} {% block content %}
<main> <div class="pos-container">
<div class="card"> <main class="pos-main">
<h1>Analyzing your requirements and generating your app…</h1> <header class="pos-header">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <div class="d-flex justify-content-between align-items-center">
<span class="sr-only">Loading…</span> <h1 class="text-white">EventKasse</h1>
<div>
<span class="text-white me-3">Hallo, {{ request.user.username }}</span>
<a href="{% url 'logout' %}" class="btn btn-secondary">Abmelden</a>
<a href="/admin/" class="btn btn-secondary">Admin</a>
</div> </div>
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p> </div>
<p class="hint">This page will refresh automatically as the plan is implemented.</p> </header>
<p class="runtime">
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code> <div class="product-area">
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code> {% for category, products in grouped_products.items %}
</p> <h2 class="category-title">{{ category }}</h2>
<div class="product-grid">
{% for product in products %}
<div class="product-card">
<div class="product-card-body">
<h5 class="product-card-title">{{ product.name }}</h5>
<p class="product-card-price">€{{ product.price|stringformat:".2f" }}</p>
</div>
</div>
{% endfor %}
</div>
{% empty %}
<div class="col-12">
<div class="card bg-dark text-white">
<div class="card-body">
<h5 class="card-title">No Products Found</h5>
<p class="card-text">Please add some products in the <a href="/admin/core/product/add/">Django Admin</a> to get started.</p>
</div>
</div>
</div>
{% endfor %}
</div> </div>
</main> </main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC) <aside class="pos-sidebar">
</footer> <div class="cart">
<h2 class="cart-title">Cart</h2>
<div class="cart-items">
<p class="text-white-50">Your cart is empty.</p>
</div>
<div class="cart-summary">
<div class="summary-row">
<span>Subtotal</span>
<span>€0.00</span>
</div>
<div class="summary-row">
<span>Deposit</span>
<span>€0.00</span>
</div>
<div class="summary-row total">
<span>Total</span>
<span>€0.00</span>
</div>
</div>
<button class="btn btn-primary btn-lg w-100 mt-3">Charge</button>
</div>
</aside>
</div>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,99 @@
{% extends "base.html" %}
{% load static %}
{% block title %}Login - EventKasse{% endblock %}
{% block content %}
<style>
.login-container {
display: flex;
justify-content: center;
align-items: center;
height: 80vh;
}
.login-form {
background-color: var(--sidebar-bg);
padding: 3rem;
border-radius: 12px;
width: 100%;
max-width: 450px;
border: 1px solid #374151;
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
.login-title {
color: var(--primary-color);
font-size: 2rem;
font-weight: 700;
text-align: center;
margin-bottom: 2rem;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-label {
color: var(--text-muted);
display: block;
margin-bottom: 0.5rem;
}
.form-control {
background-color: var(--bg-color);
border: 1px solid #475569;
color: var(--text-color);
border-radius: 8px;
padding: 0.75rem 1rem;
width: 100%;
}
.form-control:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
}
.btn-login {
background-color: var(--primary-color);
color: var(--bg-color);
font-weight: 700;
padding: 0.75rem 1.5rem;
border-radius: 8px;
width: 100%;
border: none;
transition: background-color 0.2s ease;
}
.btn-login:hover {
background-color: var(--primary-hover);
}
.error-message {
color: #fca5a5;
background-color: #450a0a;
border: 1px solid #7f1d1d;
padding: 1rem;
border-radius: 8px;
margin-bottom: 1.5rem;
text-align: center;
}
</style>
<div class="login-container">
<div class="login-form">
<h2 class="login-title">Kassen-Login</h2>
{% if form.errors %}
<div class="error-message">
<p>Benutzername oder Passwort ist falsch. Bitte versuchen Sie es erneut.</p>
</div>
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<div class="form-group">
<label for="id_username" class="form-label">Benutzername</label>
<input type="text" name="username" id="id_username" class="form-control" required>
</div>
<div class="form-group">
<label for="id_password" class="form-label">Passwort</label>
<input type="password" name="password" id="id_password" class="form-control" required>
</div>
<button type="submit" class="btn-login">Anmelden</button>
</form>
</div>
</div>
{% endblock %}

View File

@ -1,7 +1,10 @@
from django.urls import path from django.urls import path
from django.contrib.auth.views import LoginView, LogoutView
from .views import home from .views import index, article_detail
urlpatterns = [ urlpatterns = [
path("", home, name="home"), path("", index, name="index"),
path("article_detail", article_detail, name="article_detail"),
path("login/", LoginView.as_view(template_name='core/login.html'), name="login"),
path("logout/", LogoutView.as_view(), name="logout"),
] ]

View File

@ -1,25 +1,20 @@
import os from django.contrib.auth.decorators import login_required
import platform
from django import get_version as django_version
from django.shortcuts import render from django.shortcuts import render
from django.utils import timezone from .models import Product
from collections import defaultdict
@login_required
def home(request): def index(request):
"""Render the landing screen with loader and environment details.""" products = Product.objects.all().order_by('category', 'name')
host_name = request.get_host().lower() grouped_products = defaultdict(list)
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" for product in products:
now = timezone.now() grouped_products[product.category].append(product)
context = { context = {
"project_name": "New Style", 'grouped_products': dict(grouped_products)
"agent_brand": agent_brand,
"django_version": django_version(),
"python_version": platform.python_version(),
"current_time": now,
"host_name": host_name,
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
} }
return render(request, "core/index.html", context) return render(request, 'core/index.html', context)
def article_detail(request):
# This is a placeholder view to prevent errors
return render(request, 'core/article_detail.html')

View File

@ -1,4 +1,184 @@
/* Custom styles for the application */ :root {
body { --bg-color: #1a1a1a;
font-family: system-ui, -apple-system, sans-serif; --sidebar-bg: #262626;
--card-bg: #262626;
--text-color: #e2e8f0;
--text-muted: #94a3b8;
--primary-color: #4ade80;
--primary-hover: #6ee7b7;
--font-heading: 'Poppins', sans-serif;
--font-body: 'Inter', sans-serif;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-body);
margin: 0;
font-size: 16px;
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-heading);
font-weight: 600;
}
.pos-container {
display: flex;
height: 100vh;
width: 100%;
}
.pos-main {
flex-grow: 1;
padding: 2rem;
display: flex;
flex-direction: column;
}
.pos-header {
margin-bottom: 2rem;
}
.product-area {
overflow-y: auto;
flex-grow: 1;
padding-right: 1rem; /* for scrollbar */
}
.category-title {
color: var(--primary-color);
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 1.5rem;
margin-top: 2rem;
border-bottom: 2px solid var(--primary-color);
padding-bottom: 0.5rem;
display: inline-block;
}
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1.75rem;
}
.product-card {
background-color: var(--card-bg);
border-radius: 12px;
border: 1px solid #374151;
color: var(--text-color);
cursor: pointer;
transition: transform 0.3s ease, box-shadow 0.3s ease;
padding: 1.5rem 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: center;
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}
.product-card:hover {
transform: translateY(-8px);
border-color: var(--primary-color);
box-shadow: 0 10px 15px -3px rgba(88, 204, 128, 0.4), 0 4px 6px -2px rgba(88, 204, 128, 0.1);
}
.product-card-title {
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 0.5rem;
}
.product-card-price {
font-size: 1.25rem;
font-weight: 700;
color: var(--primary-color);
margin: 0;
}
.pos-sidebar {
width: 380px;
min-width: 380px;
background-color: var(--sidebar-bg);
padding: 2rem;
display: flex;
flex-direction: column;
}
.cart {
display: flex;
flex-direction: column;
height: 100%;
}
.cart-title {
color: var(--text-color);
border-bottom: 1px solid #475569;
padding-bottom: 1rem;
margin-bottom: 1rem;
}
.cart-items {
flex-grow: 1;
overflow-y: auto;
}
.cart-summary {
border-top: 1px solid #475569;
padding-top: 1rem;
margin-top: 1rem;
}
.summary-row {
display: flex;
justify-content: space-between;
font-size: 1rem;
margin-bottom: 0.75rem;
}
.summary-row.total {
font-size: 1.25rem;
font-weight: 700;
color: var(--primary-color);
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: var(--bg-color);
font-weight: 700;
padding: 0.75rem 1rem;
transition: background-color 0.2s ease;
}
.btn-primary:hover {
background-color: var(--primary-hover);
border-color: var(--primary-hover);
color: var(--bg-color);
}
.btn-secondary {
background-color: var(--card-bg);
border-color: var(--text-muted);
color: var(--text-color);
}
/* Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
background: #475569;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
} }