v1
This commit is contained in:
parent
699861b36f
commit
eca4cc9cba
Binary file not shown.
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from .models import Product, TankOrder
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Product)
|
||||
admin.site.register(TankOrder)
|
||||
7
core/forms.py
Normal file
7
core/forms.py
Normal file
@ -0,0 +1,7 @@
|
||||
from django import forms
|
||||
from .models import TankOrder
|
||||
|
||||
class TankOrderForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = TankOrder
|
||||
fields = ['name', 'address', 'phone', 'tank_size']
|
||||
24
core/migrations/0001_initial.py
Normal file
24
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.2.7 on 2026-01-18 08:30
|
||||
|
||||
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=255)),
|
||||
('description', models.TextField()),
|
||||
('capacity', models.IntegerField()),
|
||||
('price', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||
],
|
||||
),
|
||||
]
|
||||
24
core/migrations/0002_tankorder.py
Normal file
24
core/migrations/0002_tankorder.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.2.7 on 2026-01-18 08:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='TankOrder',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100)),
|
||||
('address', models.CharField(max_length=255)),
|
||||
('phone', models.CharField(max_length=20)),
|
||||
('tank_size', models.CharField(max_length=50)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
BIN
core/migrations/__pycache__/0002_tankorder.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0002_tankorder.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,21 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Product(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField()
|
||||
capacity = models.IntegerField() # In liters
|
||||
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
# image = models.ImageField(upload_to='products/', null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class TankOrder(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
address = models.CharField(max_length=255)
|
||||
phone = models.CharField(max_length=20)
|
||||
tank_size = models.CharField(max_length=50)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Order for {self.name} at {self.address}"
|
||||
@ -13,13 +13,51 @@
|
||||
<meta property="og:image" content="{{ project_image_url }}">
|
||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||
{% endif %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<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=Lato:wght@400;700&family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Toko Tangki Air</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'index' %}">Home</a>
|
||||
</li>
|
||||
{% if user.is_staff %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'order_list' %}">Daftar Pesanan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/">Admin</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="container my-4">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="text-center py-3 bg-light">
|
||||
<p>© 2026 Toko Tangki Air</p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,145 +1,49 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ project_name }}{% 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 title %}Pesan Air Tangki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your app…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
<div class="container my-5">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="display-4 fw-bold">Pesan Air Tangki Bersih, Cepat & Mudah</h1>
|
||||
<p class="lead my-4">Kami menyediakan layanan pengiriman air tangki berkualitas tinggi untuk kebutuhan rumah tangga dan bisnis Anda. Pesan sekarang dan nikmati air bersih tanpa repot.</p>
|
||||
|
||||
<form method="post" class="p-4 border rounded-3 bg-light">
|
||||
{% csrf_token %}
|
||||
<h3 class="mb-4">Formulir Pemesanan</h3>
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary btn-lg w-100">Kirim Pesanan</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-lg-6 text-center">
|
||||
<img src="https://via.placeholder.com/500x500.png?text=Air+Tangki" alt="Tangki Air" class="img-fluid rounded-3">
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
|
||||
<p class="runtime">
|
||||
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
|
||||
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||
</footer>
|
||||
{% endblock %}
|
||||
|
||||
<div class="row text-center mt-5 pt-5">
|
||||
<div class="col-md-4">
|
||||
<div class="feature-icon-small d-inline-flex align-items-center justify-content-center text-bg-primary bg-gradient fs-4 rounded-3">
|
||||
<i class="bi bi-droplet-fill"></i>
|
||||
</div>
|
||||
<h4 class="fw-semibold my-3">Kualitas Terjamin</h4>
|
||||
<p class="text-muted">Air bersih dan higienis langsung dari sumber terpercaya.</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="feature-icon-small d-inline-flex align-items-center justify-content-center text-bg-primary bg-gradient fs-4 rounded-3">
|
||||
<i class="bi bi-truck"></i>
|
||||
</div>
|
||||
<h4 class="fw-semibold my-3">Pengiriman Cepat</h4>
|
||||
<p class="text-muted">Armada kami siap mengantar pesanan Anda tepat waktu.</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="feature-icon-small d-inline-flex align-items-center justify-content-center text-bg-primary bg-gradient fs-4 rounded-3">
|
||||
<i class="bi bi-headset"></i>
|
||||
</div>
|
||||
<h4 class="fw-semibold my-3">Layanan Pelanggan</h4>
|
||||
<p class="text-muted">Tim kami siap membantu Anda dengan ramah dan responsif.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
41
core/templates/core/order_list.html
Normal file
41
core/templates/core/order_list.html
Normal file
@ -0,0 +1,41 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="container mt-5">
|
||||
<h1 class="mb-4">Daftar Pesanan Tangki Air</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Tanggal Pesan</th>
|
||||
<th scope="col">Nama Pelanggan</th>
|
||||
<th scope="col">No. Telepon</th>
|
||||
<th scope="col">Alamat</th>
|
||||
<th scope="col">Kapasitas Tangki (L)</th>
|
||||
<th scope="col">Jumlah</th>
|
||||
<th scope="col">Catatan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for order in orders %}
|
||||
<tr>
|
||||
<td>{{ order.order_date|date:"d M Y, H:i" }}</td>
|
||||
<td>{{ order.customer_name }}</td>
|
||||
<td>{{ order.phone_number }}</td>
|
||||
<td>{{ order.address }}</td>
|
||||
<td>{{ order.tank_capacity }}</td>
|
||||
<td>{{ order.quantity }}</td>
|
||||
<td>{{ order.notes|default:"-" }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="7" class="text-center">Belum ada pesanan.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a href="{% url 'index' %}" class="btn btn-secondary">Kembali ke Beranda</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
13
core/templates/core/order_success.html
Normal file
13
core/templates/core/order_success.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2 text-center">
|
||||
<h1 class="display-4">Pesanan Berhasil!</h1>
|
||||
<p class="lead">Terima kasih telah memesan. Kami akan segera menghubungi Anda untuk konfirmasi lebih lanjut.</p>
|
||||
<a href="{% url 'index' %}" class="btn btn-primary mt-3">Kembali ke Halaman Utama</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,7 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from .views import index, order_success, order_list
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
path("", index, name="index"),
|
||||
path("order-success/", order_success, name="order_success"),
|
||||
path("orders/", order_list, name="order_list"),
|
||||
]
|
||||
|
||||
@ -2,24 +2,60 @@ import os
|
||||
import platform
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, redirect
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
def home(request):
|
||||
"""Render the landing screen with loader and environment details."""
|
||||
host_name = request.get_host().lower()
|
||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
||||
now = timezone.now()
|
||||
from .models import Product, TankOrder
|
||||
from .forms import TankOrderForm
|
||||
|
||||
def index(request):
|
||||
if request.method == 'POST':
|
||||
form = TankOrderForm(request.POST)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
return redirect('order_success')
|
||||
else:
|
||||
form = TankOrderForm()
|
||||
|
||||
products = [
|
||||
{
|
||||
'name': 'Tangki Air 500L',
|
||||
'capacity': 500,
|
||||
'price': 150000,
|
||||
'description': 'Cocok untuk kebutuhan rumah tangga kecil.'
|
||||
},
|
||||
{
|
||||
'name': 'Tangki Air 1000L',
|
||||
'capacity': 1000,
|
||||
'price': 250000,
|
||||
'description': 'Ideal untuk keluarga sedang atau bisnis kecil.'
|
||||
},
|
||||
{
|
||||
'name': 'Tangki Air 2000L',
|
||||
'capacity': 2000,
|
||||
'price': 450000,
|
||||
'description': 'Pilihan tepat untuk kebutuhan air yang lebih besar.'
|
||||
},
|
||||
]
|
||||
|
||||
context = {
|
||||
"project_name": "New Style",
|
||||
"agent_brand": agent_brand,
|
||||
"django_version": django_version(),
|
||||
"python_version": platform.python_version(),
|
||||
"current_time": now,
|
||||
"host_name": host_name,
|
||||
"form": form,
|
||||
"products": products,
|
||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
|
||||
from django.contrib.admin.views.decorators import staff_member_required
|
||||
|
||||
def order_success(request):
|
||||
return render(request, 'core/order_success.html')
|
||||
|
||||
@staff_member_required
|
||||
def order_list(request):
|
||||
orders = TankOrder.objects.all().order_by('-order_date')
|
||||
context = {
|
||||
'orders': orders,
|
||||
}
|
||||
return render(request, 'core/order_list.html', context)
|
||||
|
||||
@ -1,4 +1,49 @@
|
||||
/* Custom styles for the application */
|
||||
body {
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
:root {
|
||||
--primary-color: #0D6EFD;
|
||||
--accent-color: #00BFFF;
|
||||
--base-color: #F8F9FA;
|
||||
--text-color: #343A40;
|
||||
--heading-font: 'Poppins', sans-serif;
|
||||
--body-font: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--body-font);
|
||||
color: var(--text-color);
|
||||
background-color: var(--base-color);
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: var(--heading-font);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.btn-accent {
|
||||
background-color: var(--accent-color);
|
||||
border-color: var(--accent-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.hero {
|
||||
padding: 4rem 0;
|
||||
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.product-card {
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: .25rem;
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.product-card h3 {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user